feat: complete native client rendering parity updates
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -49,10 +49,12 @@
|
||||
#include "GameLib/FlyingData.h"
|
||||
#include "GameLib/FlyingObjectManager.h"
|
||||
#include "EffectLib/EffectManager.h"
|
||||
#include "EffectLib/EffectInstance.h"
|
||||
#include "EterLib/Camera.h"
|
||||
#include "GameLib/ItemManager.h"
|
||||
#include "UserInterface/PythonItem.h"
|
||||
#include "UserInterface/StdAfx.h"
|
||||
#include "UserInterface/PythonPlayer.h"
|
||||
#include "UserInterface/PythonExchange.h"
|
||||
#include "UserInterface/PythonTextTail.h"
|
||||
#include "UserInterface/PythonCharacterManager.h"
|
||||
@@ -674,11 +676,11 @@ int main(int argc, char** argv)
|
||||
const size_t moves_before = server ? server->Events().size() : 0;
|
||||
if (main_instance)
|
||||
main_instance->NEW_GetPixelPosition(&start);
|
||||
PythonBoot::UIMouseButton(1, true, 400, 520);
|
||||
PythonBoot::UIMouseButton(1, true, 400, 220);
|
||||
pump_until(0.1, [] { return false; });
|
||||
PythonBoot::UIMouseButton(1, false, 400, 520);
|
||||
PythonBoot::UIMouseButton(1, false, 400, 220);
|
||||
CHECK(main_instance && pump_until(3, [&] { return walked() > 100.0f; }));
|
||||
CHECK(main_instance && pump_until(5, [&] { return !main_instance->IsWalking(); }));
|
||||
CHECK(main_instance && pump_until(10, [&] { return !main_instance->IsWalking(); }));
|
||||
std::printf("port_login_flow_test: click walked %.0f cm\n", main_instance ? walked() : 0.0f);
|
||||
if (server)
|
||||
{
|
||||
@@ -746,6 +748,61 @@ int main(int argc, char** argv)
|
||||
++attacks;
|
||||
std::printf("port_login_flow_test: %zu attack(s) until the stray dog died\n", attacks);
|
||||
CHECK(attacks >= (size_t) FakeLoginServer::kMobHits);
|
||||
|
||||
// Camera mouse wheel zoom test:
|
||||
// Test zooming in (Wheel UP, positive delta) and zooming out (Wheel DOWN, negative delta).
|
||||
{
|
||||
CCamera* pkCmrCur = CCameraManager::Instance().GetCurrentCamera();
|
||||
CHECK(pkCmrCur != nullptr);
|
||||
if (pkCmrCur)
|
||||
{
|
||||
const float initial_dist = pkCmrCur->GetDistance();
|
||||
std::printf("port_login_flow_test: initial camera distance = %f\n", initial_dist);
|
||||
|
||||
// Zoom IN: positive wheel delta
|
||||
PythonBoot::UIMouseWheel(120);
|
||||
pump_until(0.1, [] { return false; });
|
||||
const float zoomed_in_dist = pkCmrCur->GetDistance();
|
||||
std::printf("port_login_flow_test: zoomed in camera distance = %f\n", zoomed_in_dist);
|
||||
CHECK(zoomed_in_dist < initial_dist);
|
||||
|
||||
// Zoom OUT: negative wheel delta
|
||||
PythonBoot::UIMouseWheel(-240);
|
||||
pump_until(0.1, [] { return false; });
|
||||
const float zoomed_out_dist = pkCmrCur->GetDistance();
|
||||
std::printf("port_login_flow_test: zoomed out camera distance = %f\n", zoomed_out_dist);
|
||||
CHECK(zoomed_out_dist > zoomed_in_dist);
|
||||
}
|
||||
}
|
||||
|
||||
// P-grade skill test: verify P-grade skill (geomgyeong / Aura of the Sword) uses Grade 3 motion (geomgyeong_4.msa),
|
||||
// spawns effect instances (geom_4_badak.mse, geom_4_sword_making.mse), and renders them.
|
||||
{
|
||||
CPythonPlayer& rkPlayer = CPythonPlayer::Instance();
|
||||
rkPlayer.SetStatus(POINT_SP, 1000);
|
||||
rkPlayer.SetStatus(POINT_MAX_SP, 1000);
|
||||
rkPlayer.SetStatus(POINT_HP, 1000);
|
||||
rkPlayer.SetStatus(POINT_MAX_HP, 1000);
|
||||
CInstanceBase* pkInstMain = rkPlayer.NEW_GetMainActorPtr();
|
||||
CHECK(pkInstMain != nullptr);
|
||||
if (pkInstMain)
|
||||
{
|
||||
pkInstMain->ChangeWeapon(19);
|
||||
rkPlayer.SetSkill(4, 4); // slot 4 = geomgyeong
|
||||
rkPlayer.SetSkillLevel_(4, 3, 40); // Grade 3 (P), Level 40
|
||||
CHECK(rkPlayer.GetSkillGrade(4) == 3);
|
||||
rkPlayer.ClickSkillSlot(4);
|
||||
CHECK(pkInstMain->IsUsingSkill());
|
||||
bool has_effects = false;
|
||||
for (int step = 0; step < 10; ++step)
|
||||
{
|
||||
pump_until(0.1, [] { return false; });
|
||||
if (CEffectInstance::GetRenderingEffectCount() > 0)
|
||||
has_effects = true;
|
||||
}
|
||||
CHECK(has_effects);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 10. (批次 4-c) NPC shop: a click on the general store walks up to it (__OnClickActor) and sends CG_ON_CLICK;
|
||||
|
||||
Reference in New Issue
Block a user