@@ -329,6 +329,10 @@ public override void SceneEnd(Scene scene) {
329329 [ MonoModIgnore ]
330330 [ PatchPlayerApproachMaxMove ]
331331 private extern int NormalUpdate ( ) ;
332+
333+ [ MonoModIgnore ]
334+ [ ForceNoInlining ]
335+ private extern ParticleType DustParticleFromSurfaceIndex ( int index ) ;
332336 }
333337
334338 public static class PlayerExt {
@@ -475,6 +479,7 @@ public static void PatchPlayerStarFlyReturnToNormalHitbox(ILContext context, Cus
475479
476480 public static void PatchPlayerOnCollideV ( ILContext context , CustomAttribute attrib ) {
477481 MethodDefinition m_SurfaceIndex_GetPathFromIndex = context . Module . GetType ( "Celeste.SurfaceIndex" ) . FindMethod ( "System.String GetPathFromIndex(System.Int32)" ) ;
482+ MethodDefinition m_SurfaceIndex_GetSoundParamFromIndex = context . Module . GetType ( "Celeste.SurfaceIndex" ) . FindMethod ( "System.Int32 GetSoundParamFromIndex(System.Int32)" ) ;
478483 MethodReference m_String_Concat = MonoModRule . Modder . Module . ImportReference (
479484 MonoModRule . Modder . FindType ( "System.String" ) . Resolve ( )
480485 . FindMethod ( "System.String Concat(System.String,System.String)" )
@@ -498,7 +503,7 @@ and get the variable index of num2
498503 /* Change
499504 Play((playFootstepOnLand > 0f) ? "event:/char/madeline/footstep" : "event:/char/madeline/landing", "surface_index", num2);
500505 to
501- Play(SurfaceIndex.GetPathFromIndex(num2) + ((playFootstepOnLand > 0f) ? "/footstep" : "/landing"), "surface_index", num2);
506+ Play(SurfaceIndex.GetPathFromIndex(num2) + ((playFootstepOnLand > 0f) ? "/footstep" : "/landing"), "surface_index", SurfaceIndex.GetSoundParamFromIndex( num2) );
502507 */
503508 cursor . GotoNext ( MoveType . AfterLabel , instr => instr . MatchLdarg ( 0 ) , instr => instr . MatchLdfld ( "Celeste.Player" , "playFootstepOnLand" ) ) ;
504509 cursor . Emit ( OpCodes . Ldloc , loc_landSoundIdx ) ;
@@ -509,6 +514,9 @@ and get the variable index of num2
509514 . Next . Operand = "/footstep" ;
510515 cursor . GotoNext ( MoveType . AfterLabel , instr => instr . MatchLdstr ( "surface_index" ) ) ;
511516 cursor . Emit ( OpCodes . Call , m_String_Concat ) ;
517+
518+ cursor . GotoNext ( MoveType . After , instr => instr . MatchLdloc ( loc_landSoundIdx ) ) ;
519+ cursor . Emit ( OpCodes . Call , m_SurfaceIndex_GetSoundParamFromIndex ) ;
512520 }
513521
514522 public static void PatchPlayerClimbBegin ( ILContext context , CustomAttribute attrib ) {
@@ -519,6 +527,7 @@ public static void PatchPlayerOrigWallJump(ILContext context, CustomAttribute at
519527 // Doesn't use PatchPlaySurfaceIndex because index, not platform, is stored in the local variable
520528
521529 MethodDefinition m_SurfaceIndex_GetPathFromIndex = context . Module . GetType ( "Celeste.SurfaceIndex" ) . FindMethod ( "System.String GetPathFromIndex(System.Int32)" ) ;
530+ MethodDefinition m_SurfaceIndex_GetSoundParamFromIndex = context . Module . GetType ( "Celeste.SurfaceIndex" ) . FindMethod ( "System.Int32 GetSoundParamFromIndex(System.Int32)" ) ;
522531 MethodReference m_String_Concat = MonoModRule . Modder . Module . ImportReference (
523532 MonoModRule . Modder . FindType ( "System.String" ) . Resolve ( )
524533 . FindMethod ( "System.String Concat(System.String,System.String)" )
@@ -529,14 +538,17 @@ public static void PatchPlayerOrigWallJump(ILContext context, CustomAttribute at
529538 /* Change:
530539 Play("event:/char/madeline/landing", "surface_index", num);
531540 to:
532- Play(SurfaceIndex.GetPathFromIndex(num) + "/landing", "surface_index", num);
541+ Play(SurfaceIndex.GetPathFromIndex(num) + "/landing", "surface_index", SurfaceIndex.GetSoundParamFromIndex( num) );
533542 */
534543 cursor . GotoNext ( MoveType . AfterLabel , instr => instr . MatchLdstr ( "event:/char/madeline/landing" ) ) ;
535544 cursor . Emit ( OpCodes . Ldloc_0 ) ;
536545 cursor . Emit ( OpCodes . Call , m_SurfaceIndex_GetPathFromIndex ) ;
537546 cursor . Emit ( OpCodes . Ldstr , "/landing" ) ;
538547 cursor . Emit ( OpCodes . Call , m_String_Concat ) ;
539548 cursor . Remove ( ) ;
549+
550+ cursor . GotoNext ( MoveType . After , instr => instr . MatchLdloc0 ( ) ) ;
551+ cursor . Emit ( OpCodes . Call , m_SurfaceIndex_GetSoundParamFromIndex ) ;
540552 }
541553
542554 public static void PatchPlayerCtor ( MethodDefinition method , CustomAttribute attrib ) {
0 commit comments