883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
51 lines
4.7 KiB
C++
51 lines
4.7 KiB
C++
// Real self/target spline bodies are private fixture inputs. The caller supplies
|
|
// an explicitly modelled already-bound actor generation, not a new server actor.
|
|
#include "entity_translation.hpp"
|
|
#include <algorithm>
|
|
#include <bit>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <iterator>
|
|
using namespace gateway;
|
|
static void expect(bool v){if(!v)throw Error("self trajectory/facing boundary assertion");}
|
|
static Bytes read(const char* p){std::ifstream f(p,std::ios::binary);if(!f)throw Error("private path input absent");return Bytes(std::istreambuf_iterator<char>(f),{});}
|
|
static bool self_output(const LegacyPacket& p,uint64_t self){if(p.opcode!=0x600002)return false;Reader r(p.body);auto raw=unpack_guid(r,16);Reader g(raw);return g.le(8)==self && (g.le(8)>>58)==2;}
|
|
static Bytes synthetic_path(const MonsterSpline& p,uint64_t mover,uint64_t target,bool flight){
|
|
Bytes guid;le(guid,mover,8);Bytes b=pack_guid(guid);for(float v:p.start)le(b,std::bit_cast<uint32_t>(v),4);
|
|
le(b,p.id+1,4);le(b,3,1);le(b,target,8);le(b,flight?0x300:0x100,4);le(b,p.duration,4);
|
|
le(b,flight?p.points.size():1,4);if(flight){for(const auto& point:p.points)for(float v:point)le(b,std::bit_cast<uint32_t>(v),4);}
|
|
else for(float v:p.points.back())le(b,std::bit_cast<uint32_t>(v),4);return b;
|
|
}
|
|
int main(int argc,char** argv){try{
|
|
if(argc!=5)throw Error("self/target actual path, source owner and snapshot paths required");
|
|
const auto body=read(argv[1]),target_body=read(argv[2]);auto path=turtle_monster_spline(body);auto target_path=turtle_monster_spline(target_body);
|
|
std::ifstream own(argv[3]);uint64_t self=0;own>>self;expect(self && path.guid==self && path.face==3 && !path.flying && target_path.guid==path.facing_target && !target_path.stop);
|
|
Character player{};player.guid=self;player.name="SyntheticFixtureContext";player.race=6;player.cls=1;
|
|
constexpr uint16_t realm=70;constexpr uint32_t map=1;
|
|
NativeEntityTranslation state;state.self_presentation_ready=true;state.self_position_generation=1;state.position_realm=realm;state.position_map=map;
|
|
auto& actor=state.actors[path.facing_target];actor.kind=3;actor.generation=9;actor.sent=true;actor.presentation_realm=realm;actor.presentation_map=map;
|
|
actor.modern=forever_creature_guid(path.facing_target,uint32_t(path.facing_target>>24)&0xffffff,realm,map);
|
|
auto run=[&](NativeEntityTranslation& s,const Bytes& b){return s.translate({0xdd,b},player,realm,1,map,{});};
|
|
expect(run(state,body).empty()); // Missing pose without a parsed motion witness stays held.
|
|
(void)run(state,target_body);expect(state.actors.at(path.facing_target).source_pose_moving && !state.source_positions.contains(path.facing_target));
|
|
const auto prior_rejections=state.motion_rejected;
|
|
auto out=run(state,body);auto it=std::find_if(out.begin(),out.end(),[&](const auto& p){return self_output(p,self);});expect(it!=out.end());expect(state.motion_rejected==prior_rejections);
|
|
const auto own_guid=forever_player_guid(self,realm);Reader r(it->body);expect(unpack_guid(r,16)==Bytes(own_guid.begin(),own_guid.end()));
|
|
expect(r.le(4)==path.id && r.le(4)==0x400000 && r.le(1)==0); // Existing ground primitive, no facing payload.
|
|
expect(r.le(4)==0 && r.le(4)==path.duration && r.le(4)==0 && r.le(1)==0);
|
|
expect(unpack_guid(r,16)==Bytes(16) && r.le(1)==255);
|
|
expect(((r.le(1)<<8)|r.le(1))==path.points.size());expect(r.le(3)==0);
|
|
for(const auto& p:path.points)for(float expected:p)expect(r.f32()==expected);
|
|
expect(r.le(1)==0);for(float expected:path.start)expect(r.f32()==expected);r.end();
|
|
expect(!state.action_journal.empty());const auto& note=state.action_journal.back();expect(note.kind==4 && note.reason==1002 && note.facing==3 && note.target==path.facing_target);
|
|
auto snapshot=state.motion_snapshot();std::ofstream f(argv[4],std::ios::binary);f.write((const char*)snapshot.data(),snapshot.size());f.close();
|
|
auto wrong=state;wrong.actors.at(path.facing_target).presentation_map=2;expect(run(wrong,body).empty());
|
|
wrong=state;wrong.actors.at(path.facing_target).presentation_realm=71;expect(run(wrong,body).empty());
|
|
wrong=state;wrong.actors.at(path.facing_target).sent=false;expect(run(wrong,body).empty());
|
|
wrong=state;wrong.source_positions[path.facing_target]={8,realm,map,{1,1,1}};expect(run(wrong,body).empty());
|
|
wrong=state;wrong.self_position_generation=0;expect(run(wrong,body).empty());
|
|
wrong=state;expect(run(wrong,synthetic_path(path,self,path.facing_target,true)).empty());
|
|
wrong=state;expect(run(wrong,synthetic_path(path,path.facing_target,self,false)).empty());
|
|
std::cout<<"PASS real ground trajectory preserved, final facing held, source diagnostic retained and stale/unbound counterpart holds\n";return 0;
|
|
}catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}}
|