Merge pull request #335 from westonCoder/standing-object-grab-fix

Standing Object Grab FIx and Slider Fix
This commit is contained in:
lambertjamesd 2023-10-18 16:48:53 -06:00 committed by GitHub
commit 38114d3ff1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View file

@ -269,7 +269,7 @@ float soundClipDuration(int soundClipId, float pitch) {
return soundPlayerEstimateLength(alSound, pitch); return soundPlayerEstimateLength(alSound, pitch);
} }
void soundPlayerGameVolumeUpdate(enum SoundType type) { void soundPlayerGameVolumeUpdate() {
int index = 0; int index = 0;
while (index < gActiveSoundCount) { while (index < gActiveSoundCount) {
struct ActiveSound* sound = &gActiveSounds[index]; struct ActiveSound* sound = &gActiveSounds[index];
@ -279,7 +279,7 @@ void soundPlayerGameVolumeUpdate(enum SoundType type) {
} }
float newVolume = sound->originalVolume * gSaveData.audio.soundVolume/0xFFFF; float newVolume = sound->originalVolume * gSaveData.audio.soundVolume/0xFFFF;
if (type == SoundTypeMusic){ if (sound->soundType == SoundTypeMusic){
newVolume = newVolume* gSaveData.audio.musicVolume/0xFFFF; newVolume = newVolume* gSaveData.audio.musicVolume/0xFFFF;
} }

View file

@ -149,6 +149,10 @@ enum FizzleCheckResult decorObjectUpdateFizzler(struct CollisionObject* collisio
} }
int decorObjectUpdate(struct DecorObject* decorObject) { int decorObjectUpdate(struct DecorObject* decorObject) {
if (decorObject->collisionObject.flags & COLLISION_OBJECT_PLAYER_STANDING) {
decorObject->collisionObject.flags &= ~COLLISION_OBJECT_PLAYER_STANDING;
}
if (decorObject->playingSound != SOUND_ID_NONE) { if (decorObject->playingSound != SOUND_ID_NONE) {
soundPlayerUpdatePosition( soundPlayerUpdatePosition(
decorObject->playingSound, decorObject->playingSound,

View file

@ -143,11 +143,11 @@ enum MenuDirection audioOptionsUpdate(struct AudioOptions* audioOptions) {
switch (audioOptions->selectedItem) { switch (audioOptions->selectedItem) {
case AudioOptionGameVolume: case AudioOptionGameVolume:
audioOptionsHandleSlider(audioOptions->selectedItem, &gSaveData.audio.soundVolume, &audioOptions->gameVolume.value); audioOptionsHandleSlider(audioOptions->selectedItem, &gSaveData.audio.soundVolume, &audioOptions->gameVolume.value);
soundPlayerGameVolumeUpdate(SoundTypeAll); soundPlayerGameVolumeUpdate();
break; break;
case AudioOptionMusicVolume: case AudioOptionMusicVolume:
audioOptionsHandleSlider(audioOptions->selectedItem, &gSaveData.audio.musicVolume, &audioOptions->musicVolume.value); audioOptionsHandleSlider(audioOptions->selectedItem, &gSaveData.audio.musicVolume, &audioOptions->musicVolume.value);
soundPlayerGameVolumeUpdate(SoundTypeMusic); soundPlayerGameVolumeUpdate();
break; break;
case AudioOptionSubtitlesEnabled: case AudioOptionSubtitlesEnabled:
if (controllerGetButtonDown(0, A_BUTTON)) { if (controllerGetButtonDown(0, A_BUTTON)) {

View file

@ -241,7 +241,10 @@ void playerApplyPortalGrab(struct Player* player, int portalIndex) {
} }
void playerSetGrabbing(struct Player* player, struct CollisionObject* grabbing) { void playerSetGrabbing(struct Player* player, struct CollisionObject* grabbing) {
if (grabbing && !player->grabConstraint.object) { if (grabbing && grabbing->flags & COLLISION_OBJECT_PLAYER_STANDING){
player->grabConstraint.object = NULL;
}
else if (grabbing && !player->grabConstraint.object) {
pointConstraintInit(&player->grabConstraint, grabbing, 8.0f, 5.0f, 1.0f); pointConstraintInit(&player->grabConstraint, grabbing, 8.0f, 5.0f, 1.0f);
contactSolverAddPointConstraint(&gContactSolver, &player->grabConstraint); contactSolverAddPointConstraint(&gContactSolver, &player->grabConstraint);
hudResolvePrompt(&gScene.hud, CutscenePromptTypePickup); hudResolvePrompt(&gScene.hud, CutscenePromptTypePickup);