diff --git a/assets/sound/vo/aperture_ai/04_part1_entry-1.sox b/assets/sound/vo/aperture_ai/04_part1_entry-1.sox new file mode 100644 index 0000000..5ad82e6 --- /dev/null +++ b/assets/sound/vo/aperture_ai/04_part1_entry-1.sox @@ -0,0 +1 @@ +-c 1 -r 22050 diff --git a/assets/sound/vo/aperture_ai/04_part1_success-1.sox b/assets/sound/vo/aperture_ai/04_part1_success-1.sox new file mode 100644 index 0000000..5ad82e6 --- /dev/null +++ b/assets/sound/vo/aperture_ai/04_part1_success-1.sox @@ -0,0 +1 @@ +-c 1 -r 22050 diff --git a/assets/test_chambers/test_chamber_04/test_chamber_04.blend b/assets/test_chambers/test_chamber_04/test_chamber_04.blend index 30f145b..faf1a4d 100644 Binary files a/assets/test_chambers/test_chamber_04/test_chamber_04.blend and b/assets/test_chambers/test_chamber_04/test_chamber_04.blend differ diff --git a/src/levels/level_definition.h b/src/levels/level_definition.h index 3db9e0b..1c5af1a 100644 --- a/src/levels/level_definition.h +++ b/src/levels/level_definition.h @@ -212,6 +212,7 @@ struct BallLauncherDefinition { struct Quaternion rotation; short roomIndex; short signalIndex; + float ballLifetime; }; struct BallCatcherDefinition { diff --git a/src/scene/ball.c b/src/scene/ball.c index 5956cc2..b41a5bd 100644 --- a/src/scene/ball.c +++ b/src/scene/ball.c @@ -45,7 +45,7 @@ void ballInitInactive(struct Ball* ball) { ball->flags = 0; } -void ballInit(struct Ball* ball, struct Vector3* position, struct Vector3* velocity, short startingRoom) { +void ballInit(struct Ball* ball, struct Vector3* position, struct Vector3* velocity, short startingRoom, float ballLifetime) { collisionObjectInit(&ball->collisionObject, &gBallCollider, &ball->rigidBody, 1.0f, 0); collisionSceneAddDynamicObject(&ball->collisionObject); @@ -58,7 +58,6 @@ void ballInit(struct Ball* ball, struct Vector3* position, struct Vector3* veloc ball->rigidBody.transform.scale = gOneVec; ball->rigidBody.currentRoom = startingRoom; ball->flags = 0; - ball->lifetime = BALL_LIFETIME; ball->targetSpeed = sqrtf(vector3MagSqrd(&ball->rigidBody.velocity)); diff --git a/src/scene/ball.h b/src/scene/ball.h index d744d34..4169c24 100644 --- a/src/scene/ball.h +++ b/src/scene/ball.h @@ -4,7 +4,6 @@ #include "../physics/collision_object.h" #define BALL_VELOCITY 2.0f -#define BALL_LIFETIME 10.0f #define BALL_FADE_TIME 3.0f enum BallFlags { @@ -22,7 +21,7 @@ struct Ball { }; void ballInitInactive(struct Ball* ball); -void ballInit(struct Ball* ball, struct Vector3* position, struct Vector3* velocity, short startingRoom); +void ballInit(struct Ball* ball, struct Vector3* position, struct Vector3* velocity, short startingRoom, float ballLifetime); void ballTurnOnCollision(struct Ball* ball); void ballUpdate(struct Ball* ball); diff --git a/src/scene/ball_launcher.c b/src/scene/ball_launcher.c index 18727d0..cd548da 100644 --- a/src/scene/ball_launcher.c +++ b/src/scene/ball_launcher.c @@ -62,6 +62,7 @@ void ballLauncherInit(struct BallLauncher* launcher, struct BallLauncherDefiniti launcher->rigidBody.currentRoom = definition->roomIndex; launcher->signalIndex = definition->signalIndex; + launcher->ballLifetime = definition->ballLifetime; collisionObjectUpdateBB(&launcher->collisionObject); @@ -89,7 +90,7 @@ void ballLauncherUpdate(struct BallLauncher* launcher) { quatMultVector(&launcher->rigidBody.transform.rotation, &gForward, &initialVelocity); vector3Scale(&initialVelocity, &initialVelocity, BALL_VELOCITY); - ballInit(&launcher->currentBall, &launcher->rigidBody.transform.position, &initialVelocity, launcher->rigidBody.currentRoom); + 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); } diff --git a/src/scene/ball_launcher.h b/src/scene/ball_launcher.h index 5c3bf53..8c9e925 100644 --- a/src/scene/ball_launcher.h +++ b/src/scene/ball_launcher.h @@ -16,6 +16,7 @@ struct BallLauncher { struct SKAnimator animator; short dynamicId; short signalIndex; + float ballLifetime; struct Ball currentBall; }; diff --git a/tools/level_scripts/collision_export.lua b/tools/level_scripts/collision_export.lua index 8142cac..95e9057 100644 --- a/tools/level_scripts/collision_export.lua +++ b/tools/level_scripts/collision_export.lua @@ -269,6 +269,24 @@ local room_grids = {} for index, node in pairs(collider_nodes) do local is_transparent = sk_scene.find_flag_argument(node.arguments, "transparent") + + local collision_layers = {} + + for _, arg in pairs(node.arguments) do + if string.sub(arg, 1, #"CL_") == "CL_" then + table.insert(collision_layers, 'COLLISION_LAYERS_' .. string.sub(arg, #"CL_" + 1)) + end + end + + if #collision_layers == 0 then + table.insert(collision_layers, 'COLLISION_LAYERS_STATIC') + table.insert(collision_layers, 'COLLISION_LAYERS_BLOCK_BALL') + table.insert(collision_layers, 'COLLISION_LAYERS_TANGIBLE') + + if is_transparent then + table.insert(collision_layers, 'COLLISION_LAYERS_TRANSPARENT') + end + end for _, mesh in pairs(node.node.meshes) do local global_mesh = mesh:transform(node.node.full_transformation) @@ -306,9 +324,7 @@ for index, node in pairs(collider_nodes) do sk_definition_writer.reference_to(collider_type), sk_definition_writer.null_value, bb, - is_transparent and - sk_definition_writer.raw('COLLISION_LAYERS_STATIC | COLLISION_LAYERS_BLOCK_BALL | COLLISION_LAYERS_TRANSPARENT | COLLISION_LAYERS_TANGIBLE') or - sk_definition_writer.raw('COLLISION_LAYERS_STATIC | COLLISION_LAYERS_BLOCK_BALL | COLLISION_LAYERS_TANGIBLE') + sk_definition_writer.raw(table.concat(collision_layers, ' | ')) }) end end diff --git a/tools/level_scripts/entities.lua b/tools/level_scripts/entities.lua index 202083b..0c345a3 100644 --- a/tools/level_scripts/entities.lua +++ b/tools/level_scripts/entities.lua @@ -186,6 +186,7 @@ for _, switch_element in pairs(sk_scene.nodes_for_type('@ball_launcher')) do rotation * sk_math.axis_angle(sk_math.vector3(1, 0, 0), math.pi * 0.5), room_index, signals.signal_index_for_name(switch_element.arguments[1]), + switch_element.arguments[2] and tonumber(switch_element.arguments[2]) or 10 }) end