- [CHG] Retocat el mòdul JAudio per a adaptar-se a les necesitats del joc.
- [NEW] audio::getCurrentMusic() - [NEW] audio::stopAllChannels() - [FIX] El JAudio i JInput han de inicialitzarse abans de entrar al Init del joc - Afegides músiques i alguns sons - Comence a fer que sone cada musica i so en el seu lloc - [TOFIX] LAG EN EL AUDIO!
This commit is contained in:
@@ -30,8 +30,8 @@ namespace actor
|
||||
int current_tag = 0;
|
||||
bool floating_editing = false;
|
||||
|
||||
audio::sound *walk = nullptr;
|
||||
int walk_channel = -1;
|
||||
int falling_sound = -1;
|
||||
|
||||
void resetTag()
|
||||
{
|
||||
@@ -811,6 +811,8 @@ namespace actor
|
||||
actor::actor_t *future_below = any_below_me(act);
|
||||
if ((input::keyDown(SDL_SCANCODE_SPACE) || input::keyDown(config::getKey(KEY_JUMP))) && (hero::getSkills() & SKILL_SHOES) && (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y && (act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x && act->react_mask == 0 && ((act->pos.z == 0 && room::getFloor() != 11) || (act->below || future_below)))
|
||||
{
|
||||
audio::pauseChannel(walk_channel);
|
||||
audio::playSound("snd_jump.wav", SOUND_ALL);
|
||||
// [RZC 01/10/2024] Hack per a que al aterrar sobre els que desapareixen puga botar sobre ells, i a més ells desapareguen
|
||||
if (!act->below && future_below && future_below->flags & FLAG_DISAPPEAR)
|
||||
actor::push(act, future_below, PUSH_ZN);
|
||||
@@ -852,6 +854,9 @@ namespace actor
|
||||
{
|
||||
act->react_mask = 0; // desactivem la guarda (react_mask=0)
|
||||
act->flags |= FLAG_GRAVITY; // i reactivem el flag de gravetat
|
||||
|
||||
if (falling_sound!=-1) { audio::stopChannel(falling_sound); falling_sound = -1; }
|
||||
falling_sound = audio::playSound("snd_fall.wav", SOUND_ALL, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,13 +864,12 @@ namespace actor
|
||||
if (moving)
|
||||
{
|
||||
act->flags |= FLAG_ANIMATED;
|
||||
//if (audio::getChannelState(walk_channel) == audio::CHANNEL_PAUSED) audio::resumeChannel(walk_channel);
|
||||
if ( (config::getSoundMode()==SOUND_ALL) && (act->anim_frame==0)) walk_channel = audio::playSound(walk, 0);
|
||||
if (act->react_mask==0 && !(act->flags&FLAG_GRAVITY)) audio::resumeChannel(walk_channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
act->flags &= uint8_t(~FLAG_ANIMATED);
|
||||
//if (audio::getChannelState(walk_channel) == audio::CHANNEL_PLAYING) audio::pauseChannel(walk_channel);
|
||||
audio::pauseChannel(walk_channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1252,6 +1256,8 @@ namespace actor
|
||||
// Si estic sobre el piso, no faig res
|
||||
if (act->pos.z == 0)
|
||||
{
|
||||
if (act->flags&FLAG_HERO && falling_sound!=-1) { audio::stopChannel(falling_sound); falling_sound = -1; }
|
||||
|
||||
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
|
||||
changeMoving(act);
|
||||
act->push &= ~PUSH_ZN;
|
||||
@@ -1292,6 +1298,7 @@ namespace actor
|
||||
// Si sí que hi ha...
|
||||
if (below)
|
||||
{
|
||||
if (act->flags&FLAG_HERO && falling_sound!=-1) { audio::stopChannel(falling_sound); falling_sound = -1; }
|
||||
// ...el asociem...
|
||||
act->below = below;
|
||||
below->above = act;
|
||||
@@ -1889,10 +1896,10 @@ namespace actor
|
||||
for (int i = 0; i < 100; ++i)
|
||||
boosters_collected[i] = false;
|
||||
brilli = draw::getSurface("objectes.gif");
|
||||
|
||||
if (config::getSoundMode()==SOUND_ALL) walk = audio::loadSound("walk.wav");
|
||||
//walk_channel = audio::playSound(walk, -1);
|
||||
//audio::pauseChannel(walk_channel);
|
||||
if ( (config::getSoundMode()==SOUND_ALL) ) {
|
||||
walk_channel = audio::playSound("snd_walk.wav", SOUND_ALL, -1);
|
||||
audio::pauseChannel(walk_channel);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user