Skip to content

Commit f2ad20d

Browse files
authored
Merge pull request #2962 from 2dos/final-changes-for-ballaam
Breaks older cosmetics packs
2 parents 3f97397 + db9c6ef commit f2ad20d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1618
-1134
lines changed

archipelago.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"minimum_ap_version": "0.6.5",
3-
"world_version": "1.4.20",
3+
"world_version": "1.4.21",
44
"authors": ["2dos", "AlmostSeagull", "Ballaam", "Green Bean", "Killklli", "Lrauq", "PoryGone", "Umed"],
55
"version": 7,
66
"compatible_version": 7,

archipelago/FillSettings.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
)
5151
from randomizer.Enums.Items import Items as DK64RItems
5252
from randomizer.Enums.Types import Types
53+
from randomizer.Enums.Maps import Maps
5354
from randomizer.Enums.Enemies import Enemies
5455
from randomizer.Enums.Kongs import Kongs
5556
from randomizer.Enums.Levels import Levels
@@ -79,6 +80,20 @@ def get_default_settings() -> dict:
7980
"blocker_7": 8,
8081
"blocker_selection_behavior": BLockerSetting.normal_random,
8182
"blocker_text": 60,
83+
"bosses_selected": [
84+
Maps.JapesBoss,
85+
Maps.AztecBoss,
86+
Maps.FactoryBoss,
87+
Maps.GalleonBoss,
88+
Maps.FungiBoss,
89+
Maps.CavesBoss,
90+
Maps.CastleBoss,
91+
Maps.KroolDonkeyPhase,
92+
Maps.KroolDiddyPhase,
93+
Maps.KroolLankyPhase,
94+
Maps.KroolTinyPhase,
95+
Maps.KroolChunkyPhase,
96+
],
8297
"bonus_barrel_auto_complete": False,
8398
"boss_location_rando": True,
8499
"cannons_require_blast": True,

archipelago/Logic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,15 +1236,21 @@ def hasMoveSwitchsanity(
12361236
return kong_data and misc_abilities[data.kong]
12371237
elif data.switch_type == SwitchType.GunSwitch:
12381238
gun_abilities = [self.coconut, self.peanut, self.grape, self.feather, self.pineapple]
1239+
if data.kong == Kongs.any:
1240+
return self.HasGun(Kongs.any)
12391241
return kong_data and gun_abilities[data.kong]
12401242
elif data.switch_type == SwitchType.InstrumentPad:
12411243
instrument_abilities = [self.bongos, self.guitar, self.trombone, self.saxophone, self.triangle]
1244+
if data.kong == Kongs.any:
1245+
return self.HasInstrument(Kongs.any)
12421246
return kong_data and instrument_abilities[data.kong]
12431247
elif data.switch_type == SwitchType.SlamSwitch:
12441248
return kong_data and self.CanSlamSwitch(level, default_slam_level)
12451249
elif data.switch_type == SwitchType.GunInstrumentCombo:
12461250
gun_abilities = [self.coconut, self.peanut, self.grape, self.feather, self.pineapple]
12471251
instrument_abilities = [self.bongos, self.guitar, self.trombone, self.saxophone, self.triangle]
1252+
if data.kong == Kongs.any:
1253+
return self.HasGun(Kongs.any) and self.HasInstrument(Kongs.any)
12481254
return kong_data and gun_abilities[data.kong] and instrument_abilities[data.kong]
12491255
elif data.switch_type == SwitchType.PushableButton:
12501256
if data.kong == Kongs.diddy:

base-hack/Build/BuildEnums.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,17 @@ class ExtraTextures(IntEnum):
922922
SpecialAPPearlSilver = auto()
923923
FoolsAPPearlBlack = auto()
924924
FoolsAPPearlSilver = auto()
925+
DonkeyPadLeft = auto()
926+
DonkeyPadRight = auto()
927+
DiddyPadLeft = auto()
928+
DiddyPadRight = auto()
929+
LankyPadLeft = auto()
930+
LankyPadRight = auto()
931+
ChunkyPadLeft = auto()
932+
ChunkyPadRight = auto()
933+
AnyGunFront = auto()
934+
AnyInsLeft = auto()
935+
AnyInsRight = auto()
925936

926937

927938
class MoveTypes(IntEnum):

base-hack/Build/build.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from convertSetup import convertSetup
2929
from cutscene_builder import buildScripts
3030
from end_seq_writer import createSquishFile, createTextFile
31-
from generate_yellow_wrinkly import generateYellowWrinkly, generateSprintSwitch, fixFactoryDoor, modifyOtherWrinklyDoors
31+
from generate_yellow_wrinkly import generateYellowWrinkly, generateSprintSwitch, fixFactoryDoor, modifyOtherWrinklyDoors, buildAnyKongSwitches
3232
from helm_doors import getHelmDoorModel
3333
from instance_script_maker import BuildInstanceScripts
3434
from model_shrink import shrinkModel
@@ -67,6 +67,7 @@
6767
modifyOtherWrinklyDoors()
6868
generateSprintSwitch()
6969
fixFactoryDoor()
70+
buildAnyKongSwitches()
7071
generateIceMaze()
7172

7273
getHelmDoorModel(6022, 6023, "crown_door.bin")
@@ -315,6 +316,8 @@
315316
File(name="Melon Model", pointer_table_index=TableNames.ModelTwoGeometry, file_index=606, source_file="melon_3d_om2.bin", do_not_extract=True, do_not_delete_source=True),
316317
File(name="Sprint Switch", pointer_table_index=TableNames.ModelTwoGeometry, file_index=611, source_file="assets/Gong/sprint_switch.bin", do_not_extract=True, do_not_delete_source=True),
317318
File(name="Factory Door", pointer_table_index=TableNames.ModelTwoGeometry, file_index=664, source_file="assets/Gong/factory_door.bin", do_not_extract=True, do_not_delete_source=True),
319+
File(name="Any Gun Switch", pointer_table_index=TableNames.ModelTwoGeometry, file_index=0x296, source_file="assets/Gong/any_gun.bin", do_not_extract=True, do_not_delete_source=True),
320+
File(name="Any Instrument Pad", pointer_table_index=TableNames.ModelTwoGeometry, file_index=0x297, source_file="assets/Gong/any_ins.bin", do_not_extract=True, do_not_delete_source=True),
318321
File(name="21132 Sign", pointer_table_index=TableNames.TexturesGeometry, file_index=0x7CA, source_file="21132_tex.bin", target_size=2 * 64 * 32),
319322
File(name="Crypt Lever Sign 1", pointer_table_index=TableNames.TexturesGeometry, file_index=0x999, source_file="cryptlev1_tex.bin", target_size=2 * 64 * 32),
320323
File(name="Crypt Lever Sign 2", pointer_table_index=TableNames.TexturesGeometry, file_index=0x99A, source_file="cryptlev2_tex.bin", target_size=2 * 64 * 32),
@@ -1916,6 +1919,33 @@
19161919
)
19171920
)
19181921

1922+
# Pads
1923+
pad_data = {
1924+
"donkey_pad_left": ExtraTextures.DonkeyPadLeft,
1925+
"donkey_pad_right": ExtraTextures.DonkeyPadRight,
1926+
"diddy_pad_left": ExtraTextures.DiddyPadLeft,
1927+
"diddy_pad_right": ExtraTextures.DiddyPadRight,
1928+
"lanky_pad_left": ExtraTextures.LankyPadLeft,
1929+
"lanky_pad_right": ExtraTextures.LankyPadRight,
1930+
"chunky_pad_left": ExtraTextures.ChunkyPadLeft,
1931+
"chunky_pad_right": ExtraTextures.ChunkyPadRight,
1932+
"any_gun": ExtraTextures.AnyGunFront,
1933+
"any_ins_left": ExtraTextures.AnyInsLeft,
1934+
"any_ins_right": ExtraTextures.AnyInsRight,
1935+
}
1936+
1937+
for tex, index in pad_data.items():
1938+
file_dict.append(
1939+
File(
1940+
name=f"Pad ({int(index)})",
1941+
pointer_table_index=TableNames.TexturesGeometry,
1942+
file_index=getBonusSkinOffset(index),
1943+
source_file=f"assets/displays/{tex}.png",
1944+
texture_format=TextureFormat.RGBA5551,
1945+
do_not_extract=True,
1946+
)
1947+
)
1948+
19191949
# Force all geo files to not be compressed
19201950
expanded_tables = {
19211951
TableNames.MapGeometry: list(range(216)),
@@ -2484,6 +2514,17 @@
24842514
"white_special_chars",
24852515
"blank",
24862516
"fakefairy",
2517+
"donkey_pad_left",
2518+
"donkey_pad_right",
2519+
"diddy_pad_left",
2520+
"diddy_pad_right",
2521+
"lanky_pad_left",
2522+
"lanky_pad_right",
2523+
"chunky_pad_left",
2524+
"chunky_pad_right",
2525+
"any_gun",
2526+
"any_ins_left",
2527+
"any_ins_right",
24872528
]
24882529
for b in barrel_skins:
24892530
displays.extend([f"barrel_{b}_0", f"barrel_{b}_1", f"dirt_reward_{b}", f"shop_{b}"])

base-hack/Build/createComplexImages.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,70 @@ def bump_saturation(image: Image, factor: float) -> Image:
656656
px[x, y] = (0, 0, 0, 0) # fully transparent
657657
font_im.save(f"{disp_dir}white_special_chars.png")
658658

659+
pad_warp_eq = {
660+
"donkey": 5,
661+
"diddy": 4,
662+
"lanky": 1,
663+
"chunky": 2,
664+
}
665+
666+
667+
def pointInPolygon(x, y, polygon):
668+
"""Define whether an xy point is within a concave or concave polygon."""
669+
inside = False
670+
n = len(polygon)
671+
672+
j = n - 1
673+
for i in range(n):
674+
xi, yi = polygon[i]
675+
xj, yj = polygon[j]
676+
677+
intersect = ((yi > y) != (yj > y)) and (x < (xj - xi) * (y - yi) / (yj - yi) + xi)
678+
679+
if intersect:
680+
inside = not inside
681+
682+
j = i
683+
684+
return inside
685+
686+
687+
for kong, eq_warp in pad_warp_eq.items():
688+
for seg in ("left", "right"):
689+
pad_im = Image.open(f"{hash_dir}ins_pad_{seg}.png")
690+
color_im = Image.open(f"{hash_dir}w{eq_warp}_pad_{seg}.png")
691+
apexes = [
692+
[32, 6],
693+
[12, 14],
694+
[6, 32],
695+
[13, 50],
696+
[32, 58],
697+
]
698+
if seg == "right":
699+
for i, a in enumerate(apexes):
700+
apexes[i][0] = 32 - apexes[i][0]
701+
px = pad_im.load()
702+
c_px = color_im.load()
703+
for y in range(64):
704+
for x in range(32):
705+
if pointInPolygon(x, y, apexes):
706+
px[x, y] = c_px[x, y]
707+
pad_im.save(f"{disp_dir}{kong}_pad_{seg}.png")
708+
709+
# Any kong activators
710+
gun_base = Image.open(f"{hash_dir}gun_face_base.png")
711+
crate_left = Image.open(f"{hash_dir}standard_crate_0.png").transpose(Image.Transpose.FLIP_TOP_BOTTOM)
712+
crate_right = Image.open(f"{hash_dir}standard_crate_1.png").transpose(Image.Transpose.FLIP_TOP_BOTTOM)
713+
crate_im = Image.new(mode="RGBA", size=(64, 64))
714+
crate_im.paste(crate_left, (0, 0), crate_left)
715+
crate_im.paste(crate_right, (32, 0), crate_right)
716+
crate_im = crate_im.resize((32, 32))
717+
gun_base.paste(crate_im, (0, -6), crate_im)
718+
gun_base.crop((0, 0, 32, 32)).save(f"{disp_dir}any_gun.png")
719+
headphones_im = Image.open(f"{hash_dir}headphones.png").transpose(Image.Transpose.FLIP_TOP_BOTTOM)
720+
headphones_im.crop((0, 0, 20, 40)).resize((32, 64)).save(f"{disp_dir}any_ins_left.png")
721+
headphones_im.crop((20, 0, 40, 40)).resize((32, 64)).save(f"{disp_dir}any_ins_right.png")
722+
659723
# AP Pearls
660724
ap_colors = [
661725
"#FB9152", # ORANGE
@@ -932,6 +996,17 @@ def alterWood(image):
932996
"funky_face_3.png",
933997
"snide_face.png",
934998
"white_special_chars.png",
999+
"ins_pad_left.png",
1000+
"ins_pad_right.png",
1001+
"w5_pad_left.png",
1002+
"w5_pad_right.png",
1003+
"w4_pad_left.png",
1004+
"w4_pad_right.png",
1005+
"w1_pad_left.png",
1006+
"w1_pad_right.png",
1007+
"w2_pad_left.png",
1008+
"w2_pad_right.png",
1009+
"gun_face_base.png",
9351010
]
9361011
for kong in kongs:
9371012
for x in range(2):

base-hack/Build/generate_yellow_wrinkly.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
hint_file = "assets/Gong/hint_door.bin"
1212
switch_file = "assets/Gong/sprint_switch.bin"
1313
door_file = "assets/Gong/factory_door.bin"
14+
any_gun_file = "assets/Gong/any_gun.bin"
15+
any_ins_file = "assets/Gong/any_ins.bin"
1416

1517
image_offsets = {
1618
Kong.DK: 0xF0,
@@ -166,3 +168,38 @@ def fixFactoryDoor():
166168
new = old + inc
167169
fg.seek(offset)
168170
fg.write(new.to_bytes(4, "big"))
171+
172+
173+
def buildAnyKongSwitches():
174+
"""Build the prop models for the any kong switches."""
175+
with open(ROMName, "rb") as fh:
176+
gun_f = ROMPointerFile(fh, TableNames.ModelTwoGeometry, 0x125)
177+
fh.seek(gun_f.start)
178+
dec = zlib.decompress(fh.read(gun_f.size), 15 + 32)
179+
with open(any_gun_file, "wb") as fg:
180+
fg.write(dec)
181+
182+
with open(any_gun_file, "r+b") as switch_f:
183+
switch_f.seek(0x22C)
184+
switch_f.write((getBonusSkinOffset(ExtraTextures.AnyGunFront)).to_bytes(4, "big"))
185+
186+
with open(ROMName, "rb") as fh:
187+
ins_f = ROMPointerFile(fh, TableNames.ModelTwoGeometry, 0xAB)
188+
fh.seek(ins_f.start)
189+
dec = zlib.decompress(fh.read(ins_f.size), 15 + 32)
190+
with open(any_ins_file, "wb") as fg:
191+
fg.write(dec)
192+
193+
with open(any_ins_file, "r+b") as pad_f:
194+
pad_f.seek(0x324)
195+
pad_f.write((getBonusSkinOffset(ExtraTextures.AnyInsLeft)).to_bytes(4, "big"))
196+
pad_f.seek(0x384)
197+
pad_f.write((getBonusSkinOffset(ExtraTextures.AnyInsRight)).to_bytes(4, "big"))
198+
pad_f.seek(0x50)
199+
floor_start = int.from_bytes(pad_f.read(4), "big")
200+
pad_f.seek(floor_start)
201+
floor_count = int.from_bytes(pad_f.read(4), "big")
202+
for x in range(floor_count):
203+
tri_start = floor_start + 0x10 + (0x18 * x)
204+
pad_f.seek(tri_start + 0x15)
205+
pad_f.write((2).to_bytes(1, "big"))

base-hack/Build/getModelSkeleton.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ def getSkeleton(model_index: int, model_file: str = None):
102102
image.save(file_name)
103103

104104

105-
getSkeleton(3)
106-
getSkeleton(0x10)
107-
getSkeleton(0x48)
108-
getSkeleton(0x67)
109-
getSkeleton(0xDA)
110-
getSkeleton(8)
111-
getSkeleton(0x12)
112-
getSkeleton(0x11)
105+
for x in range(0xEC):
106+
if x in (68, 132, 151, 213):
107+
continue
108+
getSkeleton(x)

base-hack/Build/pull_images_from_rom.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,17 @@ def __init__(self, name: str, format: str, table: int, index: int, width: int, h
120120
ImageData("bandit_coconut", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0x12E3, 40, 51, False, False),
121121
ImageData("bandit_melon", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0x12E4, 48, 42, False, False),
122122
ImageData("bandit_pineapple", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0x12E5, 32, 48, False, False),
123+
ImageData("ins_pad_left", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xBC5, 32, 64, False, False),
124+
ImageData("ins_pad_right", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xBC4, 32, 64, False, False),
125+
ImageData("w5_pad_left", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDEE, 32, 64, False, False),
126+
ImageData("w5_pad_right", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDEF, 32, 64, False, False),
127+
ImageData("w4_pad_left", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDF4, 32, 64, False, False),
128+
ImageData("w4_pad_right", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDF5, 32, 64, False, False),
129+
ImageData("w1_pad_left", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDF9, 32, 64, False, False),
130+
ImageData("w1_pad_right", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDFA, 32, 64, False, False),
131+
ImageData("w2_pad_left", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDF6, 32, 64, False, False),
132+
ImageData("w2_pad_right", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xDF7, 32, 64, False, False),
133+
ImageData("gun_face_base", TextureFormat.RGBA5551, TableNames.TexturesGeometry, 0xC20, 32, 32, False, False),
123134
]
124135

125136
shop_owners = {

base-hack/asm/hookcode/modeltwo.asm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,14 @@ ModelTwoToSetupState:
9898
sb $t9, 0x11 ($v1)
9999
lbu $t9, 0x8F ($t8)
100100
j 0x8063BA0C
101-
sb $t9, 0x12 ($v1)
101+
sb $t9, 0x12 ($v1)
102+
103+
AnyInsPadCheck:
104+
addiu $a1, $zero, 0x297 ; Any instrument pad
105+
beq $a1, $v0, AnyInsPadCheck_finish
106+
addiu $v1, $zero, 1
107+
or $v1, $zero, $zero
108+
109+
AnyInsPadCheck_finish:
110+
j 0x806E5644
111+
sltiu $at, $t7, 5

0 commit comments

Comments
 (0)