Add own-body spectator camera and player names; record Workshop 0.0.139
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-11-03 21:16:05 +01:00
parent 4f02ad64b4
commit 828bb0a1a7
17 changed files with 1048 additions and 35 deletions
+6 -3
View File
@@ -62,7 +62,7 @@ struct Math {
static float Cos(float v){return std::cos(v);}
};
struct Entity {
bool alive=true;Entity* vehicle=nullptr;
bool alive=true,conscious=true;Entity* vehicle=nullptr;
vector transform[4]={{1,0,0},{0,1,0},{0,0,1},{200,30,300}};
vector lower={190,28,290},upper={210,36,310};
void GetWorldTransform(vector* out){for(int i=0;i<4;i++)out[i]=transform[i];}
@@ -70,7 +70,7 @@ struct Entity {
};
using IEntity=Entity*;
struct CompartmentAccessComponent {static IEntity GetVehicleIn(IEntity e){return e->vehicle;}};
struct ERR_Actors {static bool Alive(IEntity e){return e&&e->alive;}};
struct ERR_Actors {static bool Alive(IEntity e){return e&&e->alive;}static bool CanFight(IEntity e){return Alive(e)&&e->conscious;}};
struct Controller {IEntity target=nullptr;vector anchor={100,20,300};vector ERR_ObserverAnchor(){return anchor;}} owner;
Controller* controller=&owner;
struct Inputs {
@@ -123,7 +123,10 @@ int main(){
Follow corpse;corpse.m_PlayerView=true;corpse.Frame(p);
assert(near(corpse.m_Yaw,189)&&near(world.last.Start,actor.transform[3]+vector(0,.4,0)));
assert(world.last.Exclude==&actor);
actor.alive=true;Follow living;living.Frame(p);
actor.alive=true;actor.conscious=false;Follow casualty;casualty.m_PlayerView=true;casualty.Frame(p);
assert(near(casualty.m_Yaw,189)&&near(world.last.Start,actor.transform[3]+vector(0,.4,0)));
inputs.zoom=.1;float previousDistance=casualty.m_Distance;casualty.Frame(p);assert(casualty.m_Distance>previousDistance);
actor.conscious=true;inputs={1,0,0};Follow living;living.Frame(p);
assert(near(living.m_Yaw,189)&&near(world.last.Start,actor.transform[3]+vector(0,1.5,0)));
// A living teammate's unavailable sampled player view keeps its existing
// stable fallback; this fix must not introduce mouse-driven shoulder drift.