.meta name="Rare alerts" .meta description="Shows rare items on\nthe map and plays a\nsound when a rare\nitem drops" # Original code by Ralf @ GC-Forever and Aleron Ives # https://www.gc-forever.com/forums/viewtopic.php?t=2050 # https://www.gc-forever.com/forums/viewtopic.php?t=2049 .versions 3OJ2 3OJ3 3OJ4 3OJ5 3OE0 3OE1 3OE2 3OP0 entry_ptr: reloc0: .offsetof start start: .include WriteCodeBlocksGC .label hook_code, 0x8000C660 # Called from TItem::update in the case when the item is on the ground .label minimap_hook_call, .label minimap_hook_ret, .label minimap_render_dot, .data hook_code .deltaof hooks_start, hooks_end .address hook_code hooks_start: minimap_hook: lbz r0, [r31 + 0x00EF] cmplwi r0, 4 bne minimap_hook_skip_render # if (item->box_type != ItemBoxType::RARE) return; addi r3, r31, 0x0038 lis r4, 0xFFFF li r5, 0x0001 li r6, 0x0000 bl minimap_render_dot # minimap_render_dot(&item->location, RED_COLOR, 1, 0); minimap_hook_skip_render: mr r3, r31 b minimap_hook_ret # Called from handle_6x5F immediately after the item is constructed .label sound_hook_call, .label sound_hook_ret, .label play_sound_at_location, sound_hook: cmplwi r3, 0 beq sound_hook_skip_play # if (item == nullptr) return; lbz r0, [r3 + 0x00EF] cmplwi r0, 4 bne sound_hook_skip_play # if (item->box_type != ItemBoxType::RARE) return; lis r3, 0x0005 ori r3, r3, 0x2813 li r4, 0x0000 bl play_sound_at_location # play_sound_at_location(RARE_JINGLE, nullptr); sound_hook_skip_play: lwz r0, [r1 + 0x0024] b sound_hook_ret hooks_end: .data minimap_hook_call .data 4 .address minimap_hook_call b minimap_hook .data sound_hook_call .data 4 .address sound_hook_call b sound_hook .data 0x00000000 .data 0x00000000