feat: complete native client rendering parity updates

This commit is contained in:
shen
2026-09-27 19:44:41 -07:00
parent 9a9dc6d224
commit 25dd65f2ce
99 changed files with 21121 additions and 921 deletions
@@ -13,6 +13,7 @@
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace mtnet::classic;
@@ -23,6 +24,16 @@ constexpr std::uint32_t kHandshake = 0x2468ace0;
constexpr int kHandshakeRetryLimit = 32; // game/src/desc.h HANDSHAKE_RETRY_LIMIT
constexpr int kIdleMs = 20000;
int fake_mob_count()
{
const char* value = std::getenv("MT_FAKE_MOB_COUNT");
if (!value || !*value)
return 1;
char* end = nullptr;
const long count = std::strtol(value, &end, 10);
return *end == '\0' && count >= 1 && count <= 64 ? static_cast<int>(count) : 1;
}
// get_dword_time(): milliseconds on the server's clock.
std::uint32_t now_ms()
{
@@ -582,6 +593,20 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
mob_update.attack_speed = 100;
if (!c.Send(mob) || !c.Send(mob_update))
return Fail(name + ": send monster");
// Optional crowd for render profiling. Keep the primary dog and its click path clear so the
// existing combat test still attacks kMobVID; additional dogs are passive scenery.
const int mob_count = fake_mob_count();
for (int i = 1; i < mob_count; ++i)
{
GCCharacterAdd extra = mob;
extra.vid = kMobVID + static_cast<std::uint32_t>(i);
extra.x = kMobX - 350 - ((i - 1) % 8) * 170;
extra.y = kMobY + 250 + ((i - 1) / 8) * 190;
GCCharacterUpdate extra_update = mob_update;
extra_update.vid = extra.vid;
if (!c.Send(extra) || !c.Send(extra_update))
return Fail(name + ": send extra monster");
}
// An NPC is ADD + ADDITIONAL_INFO + UPDATE like a PC (the name is the mob_proto locale name).
GCCharacterAdd keeper = zeroed<GCCharacterAdd>();
keeper.header = HDR_GC_CHARACTER_ADD;