hedge-dev / HMMCodes

Hedge Mod Manager community codes repository
14 stars 16 forks source link

New HMM code update messes sound handle #110

Closed BatmanSonic758 closed 4 months ago

BatmanSonic758 commented 7 months ago

Working on an update of a mod of mine, everything worked fine, until the HMM library got updated and that messed up sound handles, thus makes the sounds repeat themselves after being played first. In other words, the sound doesn't stop like they used to before the library update.

A code like this for example:

static bool isStompingDownTails = false; static int TailsStompDownSoundHandle = -1;

{ if (Player.GetPlayerType() != Player.PlayerType.Tails) return;

Tails.StateID currentState = Player.State.GetCurrentStateID<Tails.StateID>();

if (currentState == Tails.StateID.TailsStateStompingDown)
{
    if (!isStompingDownTails)
    {
        TailsStompDownSoundHandle = Player.Sound.PlaySound("ta_fly_loop"); // Change to the appropriate sound file

        if (TailsStompDownSoundHandle != -1)
        {
            isStompingDownTails = true;
        }
        else
        {
            // Handle sound play error, e.g., print a message or log an error
        }
    }
}
else
{
    if (isStompingDownTails)
    {
        int soundHandle = TailsStompDownSoundHandle;
        Player.Sound.StopSound(&soundHandle);
        TailsStompDownSoundHandle = soundHandle;
        isStompingDownTails = false;
    }
}

}

hyperbx commented 6 months ago

I'm not sure what the issue could be here, as I don't recall changing any sound implementation when updating the APIs.

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity. Please comment on this issue if you don't want it to automatically close in 14 days.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.