Fix airborn momentum
This commit is contained in:
parent
affd0de279
commit
7db90f4276
|
@ -85,7 +85,6 @@ Where `/home/james/Blender/blender-2.93.1-linux-x64` is the folder where Blender
|
|||
## Current TODO list
|
||||
|
||||
- [ ] fix chell animation problem (fixed itself, investigate)
|
||||
- [ ] Skips audio sometimes
|
||||
- [ ] rotate auto uv
|
||||
- [ ] disable portal surfaces manually on some surfaces
|
||||
- [ ] Portal not rending recursively sometimes
|
||||
|
@ -95,6 +94,7 @@ Where `/home/james/Blender/blender-2.93.1-linux-x64` is the folder where Blender
|
|||
- [ ] Presort portal gun polygon order
|
||||
- [ ] Signage should not always be on
|
||||
- [ ] Camera shake
|
||||
- [?] Skips audio sometimes
|
||||
- [x] sound effects for ball (portal_pak_dir/scripts/npc_sounds_energy_ball.txt)
|
||||
- [x] first portal wall
|
||||
- [x] the cube bounces the player
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -90,16 +90,6 @@ void cutsceneRunnerCancel(struct CutsceneRunner* runner) {
|
|||
runner->currentCutscene = NULL;
|
||||
}
|
||||
|
||||
ALSndId cutsceneRunnerPlaySound(struct CutsceneStep* step) {
|
||||
return soundPlayerPlay(
|
||||
step->playSound.soundId,
|
||||
step->playSound.volume * (1.0f / 255.0f),
|
||||
step->playSound.pitch * (1.0f / 64.0f),
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
void cutsceneQueueSound(int soundId, float volume, int channel) {
|
||||
struct QueuedSound* next = gCutsceneNextFreeSound;
|
||||
|
||||
|
@ -135,7 +125,13 @@ void cutsceneRunnerStartStep(struct CutsceneRunner* runner) {
|
|||
switch (step->type) {
|
||||
case CutsceneStepTypePlaySound:
|
||||
case CutsceneStepTypeStartSound:
|
||||
runner->state.playSound.soundId = cutsceneRunnerPlaySound(step);
|
||||
runner->state.playSound.soundId = soundPlayerPlay(
|
||||
step->playSound.soundId,
|
||||
step->playSound.volume * (1.0f / 255.0f),
|
||||
step->playSound.pitch * (1.0f / 64.0f),
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
break;
|
||||
case CutsceneStepTypeQueueSound:
|
||||
cutsceneQueueSound(step->queueSound.soundId, step->queueSound.volume * (1.0f / 255.0f), step->queueSound.channel);
|
||||
|
@ -156,6 +152,11 @@ void cutsceneRunnerStartStep(struct CutsceneRunner* runner) {
|
|||
sceneFirePortal(&gScene, &firingRay, &transformUp, step->openPortal.portalIndex, location->roomIndex, 0);
|
||||
break;
|
||||
}
|
||||
case CutsceneStepTypeClosePortal:
|
||||
{
|
||||
sceneClosePortal(&gScene, step->closePortal.portalIndex);
|
||||
break;
|
||||
}
|
||||
case CutsceneStepTypeSetSignal:
|
||||
signalsSetDefault(step->setSignal.signalIndex, step->setSignal.signalValue);
|
||||
break;
|
||||
|
|
|
@ -47,6 +47,7 @@ enum CutsceneStepType {
|
|||
CutsceneStepWaitForAnimation,
|
||||
CutsceneStepSaveCheckpoint,
|
||||
CutsceneStepKillPlayer,
|
||||
CutsceneStepTypeClosePortal,
|
||||
};
|
||||
|
||||
#define CH_NONE 0xFF
|
||||
|
@ -75,6 +76,9 @@ struct CutsceneStep {
|
|||
u16 locationIndex;
|
||||
u16 portalIndex;
|
||||
} openPortal;
|
||||
struct {
|
||||
u16 portalIndex;
|
||||
} closePortal;
|
||||
float delay;
|
||||
struct {
|
||||
u16 signalIndex;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#define GRAB_RAYCAST_DISTANCE 2.5f
|
||||
#define DROWN_TIME 2.0f
|
||||
|
||||
#define STAND_SPEED 1.5f
|
||||
|
||||
#define DEAD_OFFSET -0.4f
|
||||
|
||||
#define PLAYER_COLLISION_LAYERS (COLLISION_LAYERS_TANGIBLE | COLLISION_LAYERS_FIZZLER | COLLISION_LAYERS_BLOCK_BALL)
|
||||
|
@ -149,6 +151,7 @@ void playerInit(struct Player* player, struct Location* startLocation, struct Ve
|
|||
|
||||
#define PLAYER_SPEED (150.0f / 64.0f)
|
||||
#define PLAYER_ACCEL (5.875f)
|
||||
#define PLAYER_AIR_ACCEL (5.875f)
|
||||
#define PLAYER_STOP_ACCEL (5.875f)
|
||||
|
||||
#define ROTATE_RATE (M_PI * 2.0f)
|
||||
|
@ -423,7 +426,6 @@ struct SKAnimationClip* playerDetermineNextClip(struct Player* player, float* bl
|
|||
return &player_chell_Armature_runw_clip;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void playerUpdate(struct Player* player, struct Transform* cameraTransform) {
|
||||
|
@ -456,13 +458,33 @@ void playerUpdate(struct Player* player, struct Transform* cameraTransform) {
|
|||
vector3AddScaled(&targetVelocity, &forward, PLAYER_SPEED, &targetVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
targetVelocity.y = player->body.velocity.y;
|
||||
|
||||
float velocityDot = vector3Dot(&player->body.velocity, &targetVelocity);
|
||||
int isAccelerating = velocityDot > 0.0f;
|
||||
float acceleration = 0.0f;
|
||||
|
||||
if (!(player->flags & PlayerFlagsGrounded)) {
|
||||
float velocitySqrd = vector3MagSqrd(&player->body.velocity);
|
||||
if (velocitySqrd >= PLAYER_SPEED * PLAYER_SPEED) {
|
||||
struct Vector3 movementCenter;
|
||||
vector3Scale(&player->body.velocity, &movementCenter, -PLAYER_SPEED / sqrtf(velocitySqrd));
|
||||
targetVelocity.x += player->body.velocity.x + movementCenter.x;
|
||||
targetVelocity.z += player->body.velocity.z + movementCenter.z;
|
||||
}
|
||||
|
||||
acceleration = PLAYER_AIR_ACCEL * FIXED_DELTA_TIME;
|
||||
} else if (isAccelerating) {
|
||||
acceleration = PLAYER_ACCEL * FIXED_DELTA_TIME;
|
||||
} else {
|
||||
acceleration = PLAYER_STOP_ACCEL * FIXED_DELTA_TIME;
|
||||
}
|
||||
|
||||
vector3MoveTowards(
|
||||
&player->body.velocity,
|
||||
&targetVelocity,
|
||||
vector3Dot(&player->body.velocity, &targetVelocity) > 0.0f ? PLAYER_ACCEL * FIXED_DELTA_TIME : PLAYER_STOP_ACCEL * FIXED_DELTA_TIME,
|
||||
acceleration,
|
||||
&player->body.velocity
|
||||
);
|
||||
player->body.angularVelocity = gZeroVec;
|
||||
|
@ -496,7 +518,7 @@ void playerUpdate(struct Player* player, struct Transform* cameraTransform) {
|
|||
float penetration = hit.distance - PLAYER_HEAD_HEIGHT;
|
||||
|
||||
if (penetration < 0.0f) {
|
||||
vector3AddScaled(&player->body.transform.position, &gUp, -penetration, &player->body.transform.position);
|
||||
vector3AddScaled(&player->body.transform.position, &gUp, MIN(-penetration, STAND_SPEED * FIXED_DELTA_TIME), &player->body.transform.position);
|
||||
if (player->body.velocity.y < 0.0f) {
|
||||
player->body.velocity.y = 0.0f;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ int elevatorUpdate(struct Elevator* elevator, struct Player* player) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((elevator->openAmount == 0.0f && shouldBeOpen) || (elevator->openAmount && !shouldBeOpen)) {
|
||||
if ((elevator->openAmount == 0.0f && shouldBeOpen) || (elevator->openAmount == 1.0f && !shouldBeOpen)) {
|
||||
soundPlayerPlay(soundsElevatorDoor, 1.0f, 0.5f, &elevator->rigidBody.transform.position, &gZeroVec);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,11 @@ local function generate_cutscene_step(step, step_index, label_locations, cutscen
|
|||
find_location_index(step.args[1]),
|
||||
step.args[2] == "1" and 1 or 0,
|
||||
}
|
||||
elseif step.command == "close_portal" and #step.args >= 1 then
|
||||
result.type = sk_definition_writer.raw('CutsceneStepTypeClosePortal')
|
||||
result.closePortal = {
|
||||
step.args[2] == "1" and 1 or 0,
|
||||
}
|
||||
elseif (step.command == "set_signal" or step.command == "clear_signal") and #step.args >= 1 then
|
||||
result.type = sk_definition_writer.raw('CutsceneStepTypeSetSignal')
|
||||
result.setSignal = {
|
||||
|
|
Loading…
Reference in a new issue