43 lines
2.5 KiB
C++
43 lines
2.5 KiB
C++
// Riding a 70334 elevator adds MovementInfo::TransportInfo; Turtle gets plain world movement (2026-11-24).
|
|
#include "gateway/world.hpp"
|
|
#include "gateway/roster_translation.hpp"
|
|
#include <bit>
|
|
#include <iostream>
|
|
#include <stdexcept>
|
|
using namespace gateway;
|
|
namespace {
|
|
void check(bool ok,const char* text){if(!ok)throw std::runtime_error(text);}
|
|
void number(Bytes& b,float f){le(b,std::bit_cast<uint32_t>(f),4);}
|
|
Bytes packet(uint8_t transport_bits,bool fall,bool ship=false){
|
|
auto b=pack_guid(forever_player_guid(4509,70));le(b,0,8);le(b,1234,4);
|
|
for(float f:{1600.f,240.f,-40.f,.5f,0.f,0.f})number(b,f);
|
|
le(b,0,4);le(b,17,4);number(b,1);le(b,0x40|(fall?0x20:0),1);le(b,0,1);
|
|
Guid128 lift{};lift[0]=7;lift[15]=0x2c;
|
|
if(ship){lift={};const uint64_t high=(uint64_t(6)<<58)|(uint64_t((1u<<19)|7)<<38);for(int i=0;i<8;++i)lift[8+i]=uint8_t(high>>(8*i));}
|
|
append(b,pack_guid(lift));
|
|
for(float f:{1.5f,-2.f,0.25f,0.f})number(b,f);le(b,0,1);le(b,1200,4);le(b,transport_bits,1);
|
|
if(transport_bits&0x80)le(b,1100,4);
|
|
if(fall){le(b,50,4);number(b,-4);le(b,0,1);}
|
|
return b;
|
|
}
|
|
}
|
|
int main(){
|
|
std::vector<Character> owned{{4509,"Praxis"}};
|
|
auto plain=forever_basic_movement(packet(0,false),70,owned);
|
|
check(plain.state.position[0]==1600.f && plain.state.position[2]==-40.f,"world position not kept");
|
|
check(!(plain.state.flags&0x02000000),"Turtle ONTRANSPORT invented");
|
|
auto source=turtle_basic_movement(plain);
|
|
check(forever_basic_movement(packet(0x80,false),70,owned).state.position[1]==240.f,"PrevMoveTime not consumed");
|
|
bool rejected=false;try{forever_basic_movement(packet(0x01,false),70,owned);}catch(const Error&){rejected=true;}
|
|
check(rejected,"reserved transport bits accepted");
|
|
check(!plain.transport && source.size()==28,"lift ride forwarded as a Source passenger");
|
|
// Ship/zeppelin (MO transport): Turtle gets ONTRANSPORT, the 0x1FC0 GUID, local offsets and time.
|
|
auto ride=forever_basic_movement(packet(0,false,true),70,owned);
|
|
check(ride.transport && ride.transport->source_guid==0x1FC0000000000007ull && ride.transport->time==1200,"ship passenger not bound");
|
|
auto legacy=turtle_basic_movement(ride);
|
|
check(legacy.size()==28+28 && (legacy[3]&0x02),"Source ONTRANSPORT block missing");
|
|
uint64_t g=0;for(int i=0;i<8;++i)g|=uint64_t(legacy[24+i])<<(8*i);
|
|
check(g==0x1FC0000000000007ull && std::bit_cast<float>(uint32_t(legacy[32]|legacy[33]<<8|legacy[34]<<16|uint32_t(legacy[35])<<24))==1.5f,"ship offsets misplaced");
|
|
std::cout<<"native elevator-ride movement PASS\n";
|
|
}
|