Skip to content

Instantly share code, notes, and snippets.

@Lusamine
Created June 19, 2025 18:05
Show Gist options
  • Select an option

  • Save Lusamine/122c8b7e2b7e9d6b90069356e57fbff7 to your computer and use it in GitHub Desktop.

Select an option

Save Lusamine/122c8b7e2b7e9d6b90069356e57fbff7 to your computer and use it in GitHub Desktop.
unsigned __int32 __fastcall camp_check_run_up_to_player(__int64 a1)
{
if ( (int)get_friendship_tier(a1) >= 5 && get_rand_float(global_struct->main_rng, 1.0) < 0.1 )// Makes Pokemon run up to you if passed
return 4;
if ( Pml_PokePara_CoreParam__GetCampFullness(*(Pml_PokePara_CoreParam_o **)(a1 + 88)) < 200u
|| get_rand_float(global_struct->main_rng, 1.0) >= 0.5 )
{
return 0;
}
return 4;
}
----
.text:00000071011B7630 ; =============== S U B R O U T I N E =======================================
.text:00000071011B7630
.text:00000071011B7630 ; Attributes: bp-based frame
.text:00000071011B7630
.text:00000071011B7630 ; unsigned __int32 __fastcall camp_check_run_up_to_player(__int64)
.text:00000071011B7630 camp_check_run_up_to_player ; CODE XREF: sub_7101258AF0+1E4↓p
.text:00000071011B7630
.text:00000071011B7630 var_10 = -0x10
.text:00000071011B7630 var_s0 = 0
.text:00000071011B7630
.text:00000071011B7630 STR X19, [SP,#-0x10+var_10]!
.text:00000071011B7634 STP X29, X30, [SP,#0x10+var_s0]
.text:00000071011B7638 ADD X29, SP, #0x10
.text:00000071011B763C MOV X19, X0
.text:00000071011B7640 BL get_friendship_tier
.text:00000071011B7644 CMP W0, #5
.text:00000071011B7648 B.LT loc_71011B7684
.text:00000071011B764C ADRP X8, #off_7102610848@PAGE
.text:00000071011B7650 LDR X8, [X8,#off_7102610848@PAGEOFF]
.text:00000071011B7654 LDR X8, [X8]
.text:00000071011B7658 LDR X0, [X8,#0x98]
.text:00000071011B765C FMOV S0, #1.0
.text:00000071011B7660 BL get_rand_float
.text:00000071011B7664 ADRP X8, #dword_7101C4BEC4@PAGE
.text:00000071011B7668 LDR S1, [X8,#dword_7101C4BEC4@PAGEOFF]
.text:00000071011B766C FCMP S0, S1
.text:00000071011B7670 B.PL loc_71011B7684
.text:00000071011B7674 MOV W0, #4
.text:00000071011B7678 LDP X29, X30, [SP,#0x10+var_s0]
.text:00000071011B767C LDR X19, [SP+0x10+var_10],#0x20
.text:00000071011B7680 RET
.text:00000071011B7684 ; ---------------------------------------------------------------------------
.text:00000071011B7684
.text:00000071011B7684 loc_71011B7684 ; CODE XREF: camp_check_run_up_to_player+18↑j
.text:00000071011B7684 ; camp_check_run_up_to_player+40↑j
.text:00000071011B7684 LDR X0, [X19,#0x58]
.text:00000071011B7688 BL Pml.PokePara.CoreParam$$GetCampFullness
.text:00000071011B768C AND W8, W0, #0xFF
.text:00000071011B7690 CMP W8, #0xC8
.text:00000071011B7694 B.CC loc_71011B76CC
.text:00000071011B7698 ADRP X8, #off_7102610848@PAGE
.text:00000071011B769C LDR X8, [X8,#off_7102610848@PAGEOFF]
.text:00000071011B76A0 LDR X8, [X8]
.text:00000071011B76A4 LDR X0, [X8,#0x98]
.text:00000071011B76A8 FMOV S0, #1.0
.text:00000071011B76AC BL get_rand_float
.text:00000071011B76B0 FMOV S1, #0.5
.text:00000071011B76B4 FCMP S0, S1
.text:00000071011B76B8 B.PL loc_71011B76CC
.text:00000071011B76BC MOV W0, #4
.text:00000071011B76C0 LDP X29, X30, [SP,#0x10+var_s0]
.text:00000071011B76C4 LDR X19, [SP+0x10+var_10],#0x20
.text:00000071011B76C8 RET
.text:00000071011B76CC ; ---------------------------------------------------------------------------
.text:00000071011B76CC
.text:00000071011B76CC loc_71011B76CC ; CODE XREF: camp_check_run_up_to_player+64↑j
.text:00000071011B76CC ; camp_check_run_up_to_player+88↑j
.text:00000071011B76CC MOV W0, WZR
.text:00000071011B76D0 LDP X29, X30, [SP,#0x10+var_s0]
.text:00000071011B76D4 LDR X19, [SP+0x10+var_10],#0x20
.text:00000071011B76D8 RET
.text:00000071011B76D8 ; End of function camp_check_run_up_to_player
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment