From: otta8634 Date: Sat, 18 Jan 2025 08:02:42 +0000 (+0800) Subject: Some ecs physics cleanups and small optimizations X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F1438%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Some ecs physics cleanups and small optimizations --- diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index d678038a0..cfa927b8e 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -76,7 +76,7 @@ void sys_phys_update(entity this, float dt) PM_check_slick(this); - if (IS_SVQC && !PHYS_FIXANGLE(this)) { this.angles = '0 1 0' * this.v_angle.y; } + if (IS_SVQC && !PHYS_FIXANGLE(this)) { this.angles = eY * this.v_angle.y; } if (IS_PLAYER(this)) { if (IS_ONGROUND(this)) { PM_check_hitground(this); @@ -194,7 +194,7 @@ void sys_phys_simulate(entity this, float dt) // water jump only in certain situations // this mimics quakeworld code if (this.com_in_jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc && !PHYS_FROZEN(this)) { - vector yawangles = '0 1 0' * this.v_angle.y; + vector yawangles = eY * this.v_angle.y; vector forward, right, up; MAKE_VECTORS(yawangles, forward, right, up); vector spot = this.origin + 24 * forward; @@ -219,7 +219,7 @@ void sys_phys_simulate(entity this, float dt) // wishvel = forward * PHYS_CS(this).movement.x + right * PHYS_CS(this).movement.y + up * PHYS_CS(this).movement.z; vector wishvel = forward * PHYS_CS(this).movement.x + right * PHYS_CS(this).movement.y - + '0 0 1' * (this.com_phys_vel_2d ? 0 : PHYS_CS(this).movement.z); + + eZ * (this.com_phys_vel_2d ? 0 : PHYS_CS(this).movement.z); if (this.com_phys_water) { if (PHYS_FROZEN(this)) { @@ -236,7 +236,7 @@ void sys_phys_simulate(entity this, float dt) if (this.viewloc) { wishvel.z = -160; // drift anyway } else if (wishvel == '0 0 0') { - wishvel = '0 0 -60'; // drift towards bottom + wishvel.z = -60; // drift towards bottom } } } @@ -350,9 +350,10 @@ void sys_phys_simulate(entity this, float dt) // slime: 80 // water: 100 // idea: double those - this.velocity_z = 200; if (this.waterlevel >= WATERLEVEL_SUBMERGED) { this.velocity_z = PHYS_MAXSPEED(this) * 0.7; + } else { + this.velocity_z = 200; } } }