Work on ball audio

This commit is contained in:
James Lambert 2023-02-14 19:53:20 -07:00
parent 47cd6c3c5e
commit 06593f221b
9 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1 @@
-c 1

View file

@ -0,0 +1 @@
-c 1

View file

@ -0,0 +1 @@
-c 1

View file

@ -0,0 +1 @@
-c 1

View file

@ -25,4 +25,8 @@ unsigned short soundsPortalFizzle = SOUNDS_PORTAL_FIZZLE2;
unsigned short soundsElevatorDoor = SOUNDS_DOORMOVE1;
unsigned short soundsBallLoop = SOUNDS_ENERGY_SING_LOOP4;
unsigned short soundsBallLoop = SOUNDS_ENERGY_SING_LOOP4;
unsigned short soundsBallLaunch = SOUNDS_ENERGY_SING_FLYBY1;
unsigned short soundsBallBounce = SOUNDS_ENERGY_BOUNCE1;
unsigned short soundsBallKill = SOUNDS_ENERGY_DISINTEGRATE4;
unsigned short soundsBallExplode = SOUNDS_ENERGY_SING_EXPLOSION2;

View file

@ -13,5 +13,9 @@ extern unsigned short soundsPortalFizzle;
extern unsigned short soundsElevatorDoor;
extern unsigned short soundsBallLoop;
extern unsigned short soundsBallLaunch;
extern unsigned short soundsBallBounce;
extern unsigned short soundsBallKill;
extern unsigned short soundsBallExplode;
#endif

View file

@ -187,8 +187,9 @@ void playerHandleCollision(struct Player* player) {
vector3ProjectPlane(&player->body.velocity, &contact->normal, &player->body.velocity);
}
if (isColliderForBall(contact->shapeA) || isColliderForBall(contact->shapeB)) {
if (((isColliderForBall(contact->shapeA) || isColliderForBall(contact->shapeB)) && !playerIsDead(player))) {
playerKill(player, 0);
soundPlayerPlay(soundsBallKill, 1.0f, 1.0f, NULL, NULL);
}
}
}

View file

@ -152,6 +152,9 @@ void ballInitBurn(struct Ball* ball, struct ContactManifold* manifold) {
burnTransform.scale = gOneVec;
transformToMatrixL(&burnTransform, &burn->matrix, SCENE_SCALE);
soundPlayerPlay(soundsBallBounce, 1.0f, 1.0f, &burnTransform.position, &gZeroVec);
burn->at = burnTransform.position;
burn->normal = manifold->normal;
}
@ -183,6 +186,7 @@ void ballUpdate(struct Ball* ball) {
collisionSceneRemoveDynamicObject(&ball->collisionObject);
dynamicSceneRemove(ball->dynamicId);
soundPlayerStop(ball->soundLoopId);
soundPlayerPlay(soundsBallExplode, 1.0f, 1.0f, &ball->rigidBody.transform.position, &gZeroVec);
ball->soundLoopId = SOUND_ID_NONE;
}
}

View file

@ -6,10 +6,13 @@
#include "../physics/collision_scene.h"
#include "dynamic_scene.h"
#include "signals.h"
#include "../audio/clips.h"
#include "../audio/soundplayer.h"
#include "../build/assets/models/props/combine_ball_launcher.h"
#include "../build/assets/materials/static.h"
struct CollisionBox gBallLauncherBox = {
{0.5f, 0.5f, 0.5f},
};
@ -92,6 +95,7 @@ void ballLauncherUpdate(struct BallLauncher* launcher) {
ballInit(&launcher->currentBall, &launcher->rigidBody.transform.position, &initialVelocity, launcher->rigidBody.currentRoom, launcher->ballLifetime);
skAnimatorRunClip(&launcher->animator, &props_combine_ball_launcher_Armature_launch_clip, 0.0f, 0);
soundPlayerPlay(soundsBallLaunch, 1.0f, 1.0f, &launcher->rigidBody.transform.position, &gZeroVec);
}
if (ballIsActive(&launcher->currentBall) && !ballIsCollisionOn(&launcher->currentBall)) {