Skip to content

Commit e79b58f

Browse files
committed
Any Kong activators
1 parent b493209 commit e79b58f

File tree

23 files changed

+1166
-1038
lines changed

23 files changed

+1166
-1038
lines changed

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ class ExtraTextures(IntEnum):
931931
ChunkyPadLeft = auto()
932932
ChunkyPadRight = auto()
933933

934+
934935
class MoveTypes(IntEnum):
935936
"""Move Types Enum."""
936937

base-hack/Build/build.py

Lines changed: 4 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),

base-hack/Build/createComplexImages.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ def bump_saturation(image: Image, factor: float) -> Image:
662662
"lanky": 1,
663663
"chunky": 2,
664664
}
665+
666+
665667
def pointInPolygon(x, y, polygon):
666668
"""Define whether an xy point is within a concave or concave polygon."""
667669
inside = False
@@ -672,8 +674,7 @@ def pointInPolygon(x, y, polygon):
672674
xi, yi = polygon[i]
673675
xj, yj = polygon[j]
674676

675-
intersect = ((yi > y) != (yj > y)) and \
676-
(x < (xj - xi) * (y - yi) / (yj - yi) + xi)
677+
intersect = ((yi > y) != (yj > y)) and (x < (xj - xi) * (y - yi) / (yj - yi) + xi)
677678

678679
if intersect:
679680
inside = not inside
@@ -682,6 +683,7 @@ def pointInPolygon(x, y, polygon):
682683

683684
return inside
684685

686+
685687
for kong, eq_warp in pad_warp_eq.items():
686688
for seg in ("left", "right"):
687689
pad_im = Image.open(f"{hash_dir}ins_pad_{seg}.png")

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((0xC20).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+
for instruction in (0x368, 0x370, 0x3B8, 0x3C0):
195+
pad_f.seek(instruction)
196+
pad_f.write((0).to_bytes(4, "big"))
197+
pad_f.write((0).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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def getSkeleton(model_index: int, model_file: str = None):
101101
file_name = f"./skeleton/model_{model_file.replace('.bin','').replace('../','')}.png"
102102
image.save(file_name)
103103

104+
104105
for x in range(0xEC):
105-
if x in (68,132,151,213):
106+
if x in (68, 132, 151, 213):
106107
continue
107108
getSkeleton(x)

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

base-hack/src/instances/instances.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,9 @@ int change_object_scripts(behaviour_data* behaviour_pointer, int id, int index,
527527
behaviour_pointer->next_state = 20;
528528
}
529529
} else if (param2 == LLAMA_BONGOPAD) {
530+
if (Rando.free_source_llama == 5) {
531+
return 1;
532+
}
530533
return Character == Rando.free_source_llama;
531534
} else if (param2 == LLAMA_LAVAGATE) {
532535
if (Rando.cutscene_skip_setting != CSSKIP_AUTO) {
@@ -547,6 +550,13 @@ int change_object_scripts(behaviour_data* behaviour_pointer, int id, int index,
547550
} else if (index == 2) {
548551
giveItemFromKongData(&kong_check_data[KONGCHECK_LLAMA], FLAG_KONG_LANKY);
549552
} else if ((index >= 3) && (index <= 6)) {
553+
if (Rando.free_source_llama == 5) {
554+
int valid = 0;
555+
for (int i = 0; i < 5; i++) {
556+
valid |= getPressedSwitch(behaviour_pointer, kong_pellets[i], id);
557+
}
558+
return valid;
559+
}
550560
return getPressedSwitch(behaviour_pointer,kong_pellets[(int)Rando.free_source_llama],id);
551561
}
552562
} else if (param2 == LLAMA_GRAPE_SWITCH) {
@@ -750,6 +760,13 @@ int change_object_scripts(behaviour_data* behaviour_pointer, int id, int index,
750760
} else if (index == 1) {
751761
return !checkFlag(FLAG_KONG_DIDDY, FLAGTYPE_PERMANENT);
752762
} else if ((index == 2) || (index == 3)) {
763+
if (Rando.free_source_japes == 5) {
764+
int valid = 0;
765+
for (int i = 0; i < 5; i++) {
766+
valid |= getPressedSwitch(behaviour_pointer, kong_pellets[i], id);
767+
}
768+
return valid;
769+
}
753770
return getPressedSwitch(behaviour_pointer, kong_pellets[(int)Rando.free_source_japes], id);
754771
} else if (index == 4) {
755772
return !Rando.quality_of_life.remove_cutscenes; // TODO(theballaam96): Retry this

base-hack/src/instances/switches.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
int getPressedRandoSwitch(behaviour_data* behaviour_pointer, int setting, int vanilla_bullet_type, int ID) {
1515
int bullet = vanilla_bullet_type;
1616
if (setting != 0) {
17+
if (setting == 6) {
18+
// Any kong switch
19+
int valid = 0;
20+
for (int i = 0; i < 5; i++) {
21+
valid |= getPressedSwitch(behaviour_pointer, kong_pellets[i], ID);
22+
}
23+
return valid;
24+
}
1725
bullet = kong_pellets[setting - 1];
1826
}
1927
return getPressedSwitch(behaviour_pointer, bullet, ID);
@@ -65,6 +73,9 @@ int randomInstrumentGenericCode(behaviour_data* behaviour_pointer, int index, in
6573
setting = *pad_data[pad_index].setting_address;
6674
}
6775
if (setting != 0) {
76+
if (setting == 6) {
77+
return 1;
78+
}
6879
referenced_kong = setting - 1;
6980
}
7081
return Player->characterID == referenced_kong + 2;

randomizer/Enums/Settings.jsonc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,8 @@
10201020
"lanky": 2,
10211021
"tiny": 3,
10221022
"chunky": 4,
1023-
"random": 5
1023+
"random": 5,
1024+
"any": 6
10241025
},
10251026

10261027
/*

0 commit comments

Comments
 (0)