Skip to content
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

Start cosmetic refactor #2263 #2265

Merged
merged 14 commits into from
Dec 28, 2024
39 changes: 21 additions & 18 deletions base-hack/src/misc/krusha.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,29 @@ typedef struct projectile_extra {
/* 0x014 */ float unk14;
} projectile_extra;

typedef struct KrushaProjectileColorStruct {
unsigned char pellet;
unsigned char red;
unsigned char green;
unsigned char blue;
} KrushaProjectileColorStruct;

static KrushaProjectileColorStruct krusha_projectile_colors[] = {
{.pellet = 48, .red = 0xC0, .green = 0xFF, .blue = 0x00},
{.pellet = 36, .red = 0xFF, .green = 0x40, .blue = 0x00},
{.pellet = 42, .red = 0x18, .green = 0x18, .blue = 0x00},
{.pellet = 43, .red = 0x80, .green = 0x00, .blue = 0x00},
{.pellet = 38, .red = 0x00, .green = 0xFF, .blue = 0x00},
};

void setKrushaAmmoColor(void) {
int currentPellet = CurrentActorPointer_0->actorType;
switch (currentPellet) {
case 48:
changeActorColor(0xC0, 0xFF, 0, 0xFF);
break;
case 36:
changeActorColor(0xFF, 0x40, 0x40, 0xFF);
break;
case 42:
changeActorColor(0x18, 0x18, 0xFF, 0xFF);
break;
case 43:
changeActorColor(0x80, 0, 0xFF, 0xFF);
break;
case 38:
changeActorColor(0, 0xFF, 0, 0xFF);
break;
default:
changeActorColor(0, 0xFF, 0, 0xFF);
for (int i = 0; i < 5; i++) {
KrushaProjectileColorStruct *data = &krusha_projectile_colors[i];
if ((currentPellet == data->pellet) || (i == 4)) {
changeActorColor(data->red, data->green, data->blue, 0xFF);
return;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions randomizer/Lists/DoorLocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2852,6 +2852,7 @@ def isBarrierRemoved(spoiler, barrier_id: RemovedBarriersSelected):
kong_lst=[Kongs.tiny, Kongs.chunky],
group=11,
moveless=False,
door_type=[DoorType.boss, DoorType.wrinkly],
), # might be accessible by all kongs post-punch?
DoorData(
name="Winch Room - on the Winch",
Expand Down Expand Up @@ -2954,6 +2955,7 @@ def isBarrierRemoved(spoiler, barrier_id: RemovedBarriersSelected):
logicregion=Regions.MushroomLankyMushroomsRoom,
location=[447, 0, 368, 239.50],
group=20,
door_type=[DoorType.dk_portal, DoorType.wrinkly],
),
DoorData(
name="DK's Barn - Second floor",
Expand Down
20 changes: 17 additions & 3 deletions randomizer/Patching/ASMPatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ def getROMAddress(address: int, overlay: Overlay, offset_dict: dict) -> int:
raise Exception(f"Seeking out of bounds for this overlay. Attempted to seek to {hex(address)} in overlay {overlay.name}")
if address < rdram_start:
raise Exception(f"Seeking out of bounds for this overlay. Attempted to seek to {hex(address)} in overlay {overlay.name}")
if overlay == Overlay.Boot:
print(hex(rdram_start), hex(overlay_start), hex(overlay_start + (address - rdram_start)))
return overlay_start + (address - rdram_start)


Expand Down Expand Up @@ -664,7 +662,23 @@ def patchAssemblyCosmetic(ROM_COPY: ROM, settings: Settings, has_dom: bool = Tru
elif holiday == Holidays.Anniv25:
# Change barrel base sprite
writeValue(ROM_COPY, 0x80721458, Overlay.Static, getBonusSkinOffset(ExtraTextures.Anniv25Barrel), offset_dict)

# Smoother Camera
if settings.smoother_camera:
camera_change_cooldown = 5
writeValue(ROM_COPY, 0x806EA238, Overlay.Static, 0, offset_dict, 4) # Disable it requiring a new input
writeValue(ROM_COPY, 0x806EA2A4, Overlay.Static, 0, offset_dict, 4) # Disable it requiring a new input
camera_change_amount = 5 * (camera_change_cooldown - 2)
addr = getROMAddress(0x806EA25E, Overlay.Static, offset_dict)
ROM_COPY.seek(addr)
val = int.from_bytes(ROM_COPY.readBytes(2), "big")
if (val & 0x8000) == 0: # Is Mirror Mode
camera_change_amount = -camera_change_amount
writeValue(ROM_COPY, 0x806EA256, Overlay.Static, camera_change_cooldown, offset_dict)
writeValue(ROM_COPY, 0x806EA25E, Overlay.Static, -camera_change_amount, offset_dict, 2, True)
writeValue(ROM_COPY, 0x806EA2C2, Overlay.Static, camera_change_cooldown, offset_dict)
writeValue(ROM_COPY, 0x806EA2CA, Overlay.Static, camera_change_amount, offset_dict, 2, True)

# Crosshair
if settings.colorblind_mode != ColorblindMode.off:
writeValue(ROM_COPY, 0x8069E974, Overlay.Static, 0x1000, offset_dict) # Force first option
writeValue(ROM_COPY, 0x8069E9B0, Overlay.Static, 0, offset_dict, 4) # Prevent write
Expand Down
6 changes: 3 additions & 3 deletions randomizer/Patching/ApplyLocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from randomizer.Enums.Models import Model, ModelNames, HeadResizeImmune
from randomizer.Enums.Settings import RandomModels, BigHeadMode
from randomizer.Lists.Songs import ExcludedSongsSelector
from randomizer.Patching.Cosmetics.TextRando import writeCrownNames
from randomizer.Patching.Cosmetics.Holiday import applyHolidayMode
from randomizer.Patching.Cosmetics.EnemyColors import writeMiscCosmeticChanges
from randomizer.Patching.CosmeticColors import (
apply_cosmetic_colors,
applyHolidayMode,
overwrite_object_colors,
writeMiscCosmeticChanges,
writeCrownNames,
darkenDPad,
darkenPauseBubble,
)
Expand Down
6 changes: 2 additions & 4 deletions randomizer/Patching/ApplyRandomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@
from randomizer.Patching.BananaPortRando import randomize_bananaport, move_bananaports
from randomizer.Patching.BarrelRando import randomize_barrels
from randomizer.Patching.CoinPlacer import randomize_coins
from randomizer.Patching.Cosmetics.TextRando import writeBootMessages
from randomizer.Patching.Cosmetics.Puzzles import updateMillLeverTexture, updateCryptLeverTexture, updateDiddyDoors
from randomizer.Patching.CosmeticColors import (
applyHelmDoorCosmetics,
applyKongModelSwaps,
updateCryptLeverTexture,
updateMillLeverTexture,
writeBootMessages,
updateDiddyDoors,
showWinCondition,
)
from randomizer.Patching.CratePlacer import randomize_melon_crate
Expand Down
Loading
Loading