Skip to content

Commit 254bebc

Browse files
authored
Merge pull request #2946 from 2dos/misc-fixes-dec
Misc fixes dec
2 parents 1aa629a + a57fa03 commit 254bebc

File tree

13 files changed

+342
-326
lines changed

13 files changed

+342
-326
lines changed

base-hack/asm/symbols.asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148

149149
.definelabel ExitPointer, 0x807FC900
150150
.definelabel ExitCount, 0x807FC904
151+
.definelabel CheatBitfield, 0x80744544
151152

152153
.definelabel screenCenterX, 0x80744490
153154
.definelabel screenCenterY, 0x80744494

base-hack/include/dk64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ extern unsigned short PositionFacingAngle;
562562
extern char ChimpyCam;
563563
extern char ScreenRatio;
564564
extern char SoundType;
565+
extern unsigned short CheatBitfield;
565566
extern actorData* LastSpawnedActor;
566567
extern char LoadedActorCount;
567568
extern loadedActorArr LoadedActorArray[64];

base-hack/include/global.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,4 +540,5 @@ extern unsigned char pregiven_status[56];
540540
extern StartingItemsStruct starting_item_data;
541541
extern coinHUDStruct CoinHUDElements[8];
542542
extern unsigned short guard_tag_timer;
543-
extern spoiler_struct spoiler_items[SPOILER_COUNT];
543+
extern spoiler_struct spoiler_items[SPOILER_COUNT];
544+
extern char k_rool_text[9];

base-hack/src/misc/file_screen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
static char balanced_igt[20] = "";
1414
static char perc_str[7] = "";
1515
static char gb_str[5] = "";
16+
char k_rool_text[9] = "& K.ROOL";
1617

1718
#define LINE_GAP 0x8C
1819
static char updated_tracker = 0;

base-hack/src/misc/hud.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ void initHUDDirection(placementData* hud_data, int item) {
330330
}
331331

332332
void allocateHUD(int reallocate) {
333-
int cheat_bitfield = 0; // TODO: Hook this up
334333
int world = getWorld(CurrentMap, 1);
335334
if (reallocate) {
336335
HUD = dk_malloc(ITEMID_TERMINATOR * 0x30);
@@ -356,8 +355,8 @@ void allocateHUD(int reallocate) {
356355
int written_cheat = 0;
357356
// Write Stuff, normally in switch case
358357
if (element_def->cheat) {
359-
if (cheat_bitfield & element_def->cheat) {
360-
*(element->item_count_pointer) = correctRefillCap(i, 0);
358+
if (CheatBitfield & element_def->cheat) {
359+
*(element_def->counter) = correctRefillCap(i, 0);
361360
written_cheat = 1;
362361
}
363362
}

base-hack/src/pause/lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Gfx* printLevelIGT(Gfx* dl, int x, int y, float scale, char* str) {
4444
level_index = i;
4545
}
4646
}
47-
if (Rando.spoiler_hints) {
47+
if (Rando.spoiler_hints == 2) {
4848
unsigned short left = 0;
4949
unsigned short total = 0;
5050
getLevelPoints(level_index, &left, &total);

morpher.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h5>String Transposer</h5>
4444
<div class="modal-dialog modal-dialog-centered">
4545
<div class="modal-content">
4646
<div class="modal-header">
47-
<h5 class="modal-title">Modal title</h5>
47+
<h5 class="modal-title"></h5>
4848
<button id="close_button" type="button" class="btn-close d-none" data-bs-dismiss="modal" aria-label="Close"></button>
4949
</div>
5050
<div class="modal-body">

randomizer/Patching/ASMPatcher.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,18 @@ def patchAssembly(ROM_COPY, spoiler):
17061706
# Fix Null Lag Boost
17071707
writeHook(ROM_COPY, 0x806CCA90, Overlay.Static, "fixNullLagBoost", offset_dict)
17081708

1709+
if settings.win_condition_spawns_ship:
1710+
writeValue(ROM_COPY, 0x80029706, Overlay.Menu, getHiSym("k_rool_text"), offset_dict)
1711+
writeValue(ROM_COPY, 0x8002970A, Overlay.Menu, getLoSym("k_rool_text"), offset_dict)
1712+
writeFloatUpper(ROM_COPY, 0x800296D2, Overlay.Menu, 280, offset_dict)
1713+
writeFloatUpper(ROM_COPY, 0x800296D6, Overlay.Menu, 192, offset_dict)
1714+
writeValue(ROM_COPY, 0x8002974E, Overlay.Menu, 0x3ECC, offset_dict)
1715+
writeValue(ROM_COPY, 0x80029752, Overlay.Menu, 0xCCCD, offset_dict)
1716+
writeFloat(ROM_COPY, 0x80033CA4, Overlay.Menu, 1, offset_dict)
1717+
else:
1718+
writeValue(ROM_COPY, 0x8002975C, Overlay.Menu, 0x02401025, offset_dict, 4)
1719+
writeValue(ROM_COPY, 0x80029760, Overlay.Menu, 0, offset_dict, 4)
1720+
17091721
if settings.less_fragile_boulders:
17101722
# Thrown boulders/vases/etc require getting thrown at a wall to destroy
17111723
writeValue(ROM_COPY, 0x8069C1C2, Overlay.Static, 4, offset_dict) # Contact with wall: Destroy

randomizer/Patching/CosmeticColors.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,23 @@ def __init__(self, table: int, image: int, tex_format: TextureFormat, width: int
685685
self.default_count = default_count
686686

687687

688+
def writeWinConImage(settings: Settings, image: Image, ROM_COPY: LocalROM):
689+
"""Wrap function for writing a win con image, detecting K Rool win con."""
690+
# if settings.win_condition_spawns_ship:
691+
# base_im = Image.new(mode="RGBA", size=(64, 64))
692+
# left_im = getImageFile(ROM_COPY, TableNames.TexturesGeometry, 0x383, True, 32, 64, TextureFormat.RGBA5551)
693+
# right_im = getImageFile(ROM_COPY, TableNames.TexturesGeometry, 0x384, True, 32, 64, TextureFormat.RGBA5551)
694+
# base_im.paste(left_im, (0, 0), left_im)
695+
# base_im.paste(right_im, (32, 0), right_im)
696+
# base_im = base_im.transpose(Image.FLIP_TOP_BOTTOM)
697+
# base_im = base_im.resize((32, 32))
698+
# base_im.paste(image, (0, 0), image)
699+
# else:
700+
# base_im = image
701+
base_im = image
702+
writeColorImageToROM(base_im, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
703+
704+
688705
def showWinCondition(settings: Settings, ROM_COPY: LocalROM):
689706
"""Alter the image that's shown on the main menu to display the win condition."""
690707
win_con = settings.win_condition_item
@@ -710,25 +727,25 @@ def showWinCondition(settings: Settings, ROM_COPY: LocalROM):
710727
pos_y = 32 * img[2]
711728
output_image.paste(local_img, (pos_x, pos_y), local_img)
712729
output_image = output_image.resize((32, 32)).transpose(Image.FLIP_TOP_BOTTOM)
713-
writeColorImageToROM(output_image, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
730+
writeWinConImage(settings, output_image, LocalROM)
714731
if win_con == WinConditionComplex.get_key8:
715732
output_image = Image.open(BytesIO(js.getFile("base-hack/assets/displays/key8.png")))
716733
output_image = output_image.resize((32, 32))
717-
writeColorImageToROM(output_image, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
734+
writeWinConImage(settings, output_image, LocalROM)
718735
return
719736
if win_con == WinConditionComplex.req_bean:
720737
output_image = Image.open(BytesIO(js.getFile("base-hack/assets/arcade_jetpac/arcade/bean.png")))
721738
output_image = output_image.resize((32, 32))
722-
writeColorImageToROM(output_image, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
739+
writeWinConImage(settings, output_image, LocalROM)
723740
return
724741
if win_con == WinConditionComplex.krem_kapture:
725742
item_im = getImageFile(ROM_COPY, 14, 0x90, True, 32, 32, TextureFormat.RGBA5551)
726-
writeColorImageToROM(item_im, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
743+
writeWinConImage(settings, item_im, ROM_COPY)
727744
return
728745
if win_con == WinConditionComplex.dk_rap_items:
729746
item_im = getImageFile(ROM_COPY, 7, 0x3D3, False, 40, 40, TextureFormat.RGBA5551)
730747
item_im = item_im.resize((32, 32)).transpose(Image.FLIP_TOP_BOTTOM)
731-
writeColorImageToROM(item_im, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
748+
writeWinConImage(settings, item_im, ROM_COPY)
732749
return
733750
if win_con == WinConditionComplex.kill_the_rabbit:
734751
output_image = Image.open(BytesIO(js.getFile("base-hack/assets/displays/kill_the_rabbit.png")))
@@ -771,4 +788,4 @@ def showWinCondition(settings: Settings, ROM_COPY: LocalROM):
771788
base_im = base_im.resize((32, 32))
772789
num_im = numberToImage(settings.win_condition_count, (20, 20), ROM_COPY)
773790
base_im.paste(num_im, (6, 6), num_im)
774-
writeColorImageToROM(base_im, 14, 195, 32, 32, False, TextureFormat.RGBA5551, ROM_COPY)
791+
writeWinConImage(settings, base_im, ROM_COPY)

randomizer/Settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ def resolve_settings(self):
24372437

24382438
def isBadIceTrapLocation(self, location: Locations):
24392439
"""Determine whether an ice trap is safe to house an ice trap outside of individual cases."""
2440-
bad_fake_types = [Types.TrainingBarrel, Types.PreGivenMove]
2440+
bad_fake_types = [Types.TrainingBarrel, Types.PreGivenMove, Types.Hint]
24412441
is_bad = location.type in bad_fake_types
24422442
if self.ice_traps_damage:
24432443
if self.damage_amount in (DamageAmount.quad, DamageAmount.ohko) or self.perma_death or self.wipe_file_on_death:

0 commit comments

Comments
 (0)