Wire attack and combo execution (mobile step 3b)
Port the ActorInstanceBattle combo state machine, CRaceMotionData attack data, player motion/combo tables, NEW_Attack + OnAttack/OnHit packets and remote FUNC_ATTACK/FUNC_COMBO playback so keyboard and touch attacks swing and hit on the real-server path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5597842d90
commit
260d421bde
+4
-1
@@ -238,6 +238,9 @@ if(BUILD_TESTING AND NOT ANDROID)
|
||||
add_executable(ava2_render_3d_test tests/ava2_render_3d_test.cpp)
|
||||
target_link_libraries(ava2_render_3d_test PRIVATE ava2_render)
|
||||
add_test(NAME ava2.render_3d COMMAND ava2_render_3d_test "ymir work/pc/warrior/warrior_assasin1.gr2")
|
||||
add_executable(attack_combo_test tests/attack_combo_test.cpp)
|
||||
target_link_libraries(attack_combo_test PRIVATE ava2_render)
|
||||
add_test(NAME ava2.attack_combo COMMAND attack_combo_test "ymir work/pc/warrior/warrior_assasin1.gr2")
|
||||
if(AVA2_EMBED_PYTHON)
|
||||
add_executable(hardware_scene_test tests/hardware_scene_test.cpp)
|
||||
target_link_libraries(hardware_scene_test PRIVATE ava2_python)
|
||||
@@ -328,7 +331,7 @@ if(BUILD_TESTING AND NOT ANDROID)
|
||||
target_include_directories(login_oracle_test PRIVATE "${CMAKE_BINARY_DIR}/generated")
|
||||
target_link_libraries(login_oracle_test PRIVATE ava2_protocol)
|
||||
add_test(NAME ava2.login_oracle COMMAND login_oracle_test)
|
||||
foreach(asset_test ava2.python ava2.window_tree ava2.render_3d ava2.mark_manager)
|
||||
foreach(asset_test ava2.python ava2.window_tree ava2.render_3d ava2.attack_combo ava2.mark_manager)
|
||||
if(TEST ${asset_test})
|
||||
set_tests_properties(${asset_test} PROPERTIES SKIP_RETURN_CODE 77
|
||||
ENVIRONMENT "AVA2_PACK_MAKER=${AVA2_PACK_MAKER_DIR};AVA2_TEST_RUNDIR=${AVA2_TEST_RUNDIR}")
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- 游戏资源为 2.8 GB、约 5 万个散文件(`assets/loose`),17 个源文件中 120 多处通过 `std::filesystem` / `ifstream` 直接读文件,无法读取 APK 内置资源。
|
||||
- 没有处理前后台切换(`SDL_EVENT_WILL_ENTER_BACKGROUND` / `DID_ENTER_FOREGROUND`)和低内存事件。
|
||||
- 触摸分流已实现(`src/app/input/touch_router.*`,见下文 `input/`):移动端或 `--touch` / `AVA2_TOUCH=1` 时关闭 SDL 触摸转鼠标,每个手指分到界面、攻击键、左下浮动摇杆或镜头(单指拖动转向、双指缩放、轻点=点地移动)。Python 模块 `touch` 供 HUD 设置攻击键位置并读取摇杆状态;`ui_mobile_joystick` / `ui_mobile_combat` 改为只做显示(`not_pick`)。多指同时操作尚未在真机验证。
|
||||
- 实际出招尚未接通:触摸攻击键和键盘一样只设置 `player` 的攻击键状态,真服路径里 `player_ComboAttack` 仍是空实现。
|
||||
- 出招已接通(PORT-PLAN「Mobile step 3b」):触摸攻击键和键盘共用 `ProcessPlayerAttack`,按原版连招时序出招,发送 FUNC_COMBO 移动包,命中检测后发 `CG_ATTACK`;尚未在真服验证,弓箭飞行、技能、PvP 规则等仍缺。
|
||||
- 原型 HUD 用到的 `taskbar/attack_button_0x.sub`、`quickslot_0x.sub` 不在资源包里:攻击键暂用色块,技能圈槽位不可见。
|
||||
- 软键盘已改为仅在输入框获得焦点(`ime.EnableCaptureInput`)或聊天打开时弹出。
|
||||
- `src/app/main.cpp` 共 2418 行,启动、主循环、登录和调试参数都在其中。
|
||||
|
||||
@@ -1178,3 +1178,47 @@ key state is still not consumed on the real-server path (`player_ComboAttack`
|
||||
stub), so touch attack does not swing yet; the prototype's attack/quickslot
|
||||
`.sub` art is missing from the packs (attack drawn as a coloured block, skill
|
||||
slots invisible).
|
||||
|
||||
### 2026-10-12 Mobile step 3b — attack and combo wiring
|
||||
|
||||
The attack key (keyboard or touch) now swings on the real-server path, ported
|
||||
from GameLib ActorInstanceBattle / ActorInstanceCollisionDetection,
|
||||
CPythonPlayerInput `NEW_Attack`, CPythonPlayerEventHandler `OnAttack` /
|
||||
`OnHit` and CInstanceBase `RefreshState` / `RunNormalAttack` / `RunComboAttack`.
|
||||
|
||||
- `RaceData`: `RaceMotionData` (`ParseRaceMotionData`, cached
|
||||
`GetRaceMotionData`) reads ComboInputData and AttackingData in both the old
|
||||
single-hit layout (`AttackingType`) and the `MotionType` + `HitDataCount`
|
||||
layout; `.msm` DEFENDING radius. `LoadPlayerRaces` registers every player
|
||||
motion and combo table (`LoadPlayerMotions`, a port of
|
||||
PythonPlayerSettingsModule intro/general/weapon/combo/horse/fishing).
|
||||
- `chr.MOTION_MODE_BOW_SPECIAL` is 17 and there is no `MOTION_MODE_CLAW`
|
||||
(AVA2 builds without `ENABLE_WOLFMAN_CHARACTER`, Locale_inc.h:131).
|
||||
- `ActorInstance`: combo state machine (`InputComboAttackCommand`, pre-input
|
||||
and direct input windows, `ComboProcess`, `__RunNextCombo`, mounted wrap),
|
||||
normal attack, attack speed (`m_dwAtkSpd / 100`) applied to attack motions,
|
||||
per-hit-data victim maps with invisible time and the 16 / HitLimitCount
|
||||
limits, `TestAttackHit` (hit-position segments against the victim).
|
||||
- `ProcessPlayerAttack` (called from the main loop): `NEW_Attack` checks
|
||||
(bow needs a target and an arrow), stop packet when the attack interrupts a
|
||||
walk, `CG_MOVE` FUNC_COMBO per started motion, hit test against live
|
||||
monsters/stones, `SetTarget` + `CG_ATTACK` on a hit. Walking and click-move
|
||||
are suspended while attacking. `player.ComboAttack` uses the same path.
|
||||
- Remote actors: `RefreshState` picks the motion mode from weapon / mount /
|
||||
polymorph / wedding dress / pickaxe / rod; `CG_MOVE` FUNC_ATTACK / FUNC_COMBO
|
||||
from the server play the attack motion facing the packet rotation.
|
||||
|
||||
Verified: `ava2.attack_combo` (both .msa layouts, warrior combo tables, real
|
||||
combo timings: pre-input fires at DirectInputTime, direct input chains, input
|
||||
after InputLimitTime is dropped, attack speed, remote motions not reported,
|
||||
hit detection at yaw 0 / 90 incl. once-per-combo, range and far side);
|
||||
`ava2.touch_game`; 52/52 desktop tests.
|
||||
Outstanding gaps: not verified against the real server; attack speed is a
|
||||
motion-clock ratio (no blend / speed-ratio curves); accumulation root motion is
|
||||
not applied during attacks; victims are an upright cylinder of the race
|
||||
DEFENDING radius (50 default) instead of the bone spheres; bow attacks have no
|
||||
arrow flight / clickable-distance reserve; horse attack details, emotions and
|
||||
skills are not wired; PvP `IsAttackableInstance` rules and the `__CanAttack`
|
||||
checks (emotion, private shop, observer, new mount) are missing; remote
|
||||
FUNC_ATTACK / FUNC_COMBO snap to the packet position instead of walking there
|
||||
when 50+ away.
|
||||
|
||||
+6
-2
@@ -2054,14 +2054,18 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
|
||||
static bool wasMoving = false;
|
||||
static uint32_t lastMoveSent = 0;
|
||||
float moveYaw = 0.0f;
|
||||
const bool keyboardMoving = actor.CanAct() && ava2::GetPlayerMovementYaw(orbit_camera.GetYaw(), moveYaw);
|
||||
// Attack input first (NEW_Attack ends walking); no movement while an attack plays.
|
||||
if (ava2::ProcessPlayerAttack(orbit_camera.GetYaw(), dt, wasMoving)) wasMoving = false;
|
||||
const bool attacking = ava2::IsPlayerAttacking();
|
||||
if (attacking) actor.ClearMoveTarget();
|
||||
const bool keyboardMoving = actor.CanAct() && !attacking && ava2::GetPlayerMovementYaw(orbit_camera.GetYaw(), moveYaw);
|
||||
actor.SetSpeed(340.0f * float(main->m_dwMovSpd) / 100.0f);
|
||||
if (keyboardMoving) {
|
||||
actor.ClearMoveTarget();
|
||||
actor.MoveInDirection(moveYaw, dt, active_terrain, active_map_objects);
|
||||
} else {
|
||||
if (wasKeyboardMoving) actor.StopMoving();
|
||||
if (actor.CanAct() && ava2::IsPlayerMouseMoving() && renderer3d && active_terrain) {
|
||||
if (actor.CanAct() && !attacking && ava2::IsPlayerMouseMoving() && renderer3d && active_terrain) {
|
||||
long mouseX=0, mouseY=0;
|
||||
UI::CWindowManager::Instance().GetMousePosition(mouseX,mouseY);
|
||||
float pickX=0,pickY=0,pickZ=0;
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace ava2 {
|
||||
|
||||
namespace {
|
||||
|
||||
void RefreshState(SNetworkActorData& actor, uint32_t motion, bool loop);
|
||||
|
||||
// AVA2 InstanceBase.cpp SHORSE::Create / __AttachHorseSaddle: mounts are
|
||||
// separate actors, and the rider's main model follows their "saddle" bone.
|
||||
void ConfigureMount(SNetworkActorData& data) {
|
||||
@@ -32,9 +34,8 @@ void ConfigureMount(SNetworkActorData& data) {
|
||||
data.m_pMountInstance=std::move(mount);
|
||||
}
|
||||
}
|
||||
const uint16_t mode=data.m_pMountInstance ? 9 : 1;
|
||||
rider.SetMotionMode(mode);
|
||||
rider.PlayMotion(MotionType::Wait,true);
|
||||
// MountHorse / DismountHorse end in RefreshState(NAME_WAIT): the weapon picks the horse mode.
|
||||
RefreshState(data, RaceData::NAME_WAIT, true);
|
||||
}
|
||||
|
||||
// InstanceBaseEffect.cpp g_akD3DXClrName / g_akD3DXClrTitle / g_TitleNameMap: zero (transparent
|
||||
@@ -74,6 +75,69 @@ bool ArmorVnumToShape(uint32_t vnum, uint32_t* shape) {
|
||||
constexpr uint8_t kTypePC = 6; // CActorInstance::TYPE_PC
|
||||
bool IsPC(const SNetworkActorData& actor) { return actor.m_bType == kTypePC; }
|
||||
|
||||
// CRaceMotionData::EMode (ENABLE_WOLFMAN_CHARACTER off) and CItemData weapon / item types.
|
||||
enum {
|
||||
MODE_GENERAL = 1, MODE_ONEHAND_SWORD, MODE_TWOHAND_SWORD, MODE_DUALHAND_SWORD, MODE_BOW, MODE_FAN,
|
||||
MODE_BELL, MODE_FISHING, MODE_HORSE, MODE_HORSE_ONEHAND_SWORD, MODE_HORSE_TWOHAND_SWORD,
|
||||
MODE_HORSE_DUALHAND_SWORD, MODE_HORSE_BOW, MODE_HORSE_FAN, MODE_HORSE_BELL, MODE_WEDDING_DRESS,
|
||||
MODE_BOW_SPECIAL,
|
||||
};
|
||||
enum { WEAPON_SWORD, WEAPON_DAGGER, WEAPON_BOW, WEAPON_TWO_HANDED, WEAPON_BELL, WEAPON_FAN, WEAPON_ARROW,
|
||||
WEAPON_MOUNT_SPEAR, WEAPON_CLAW, WEAPON_QUIVER };
|
||||
enum { ITEM_TYPE_ROD = 13, ITEM_TYPE_COSTUME = 28 };
|
||||
|
||||
// CInstanceBase::RefreshState: picks the motion mode from the polymorph / dress / weapon / horse
|
||||
// state, then intercepts the motion. The actor's attack speed follows m_dwAtkSpd (SetAttackSpeed).
|
||||
void RefreshState(SNetworkActorData& actor, uint32_t motion, bool loop) {
|
||||
if (!actor.m_pActorInstance) return;
|
||||
auto& inst = *actor.m_pActorInstance;
|
||||
const bool mounting = actor.m_pMountInstance != nullptr;
|
||||
const uint32_t weapon = inst.GetPartItemID(RaceData::PART_WEAPON);
|
||||
int itemType = 0xff, subType = 0xff;
|
||||
SItemModelData item;
|
||||
if (GetItemData(weapon, &item)) {
|
||||
itemType = item.type;
|
||||
subType = int(GetWeaponType(item));
|
||||
}
|
||||
int mode = MODE_GENERAL;
|
||||
const bool pickAxe = actor.m_awPart[RaceData::PART_WEAPON] >= 29101 && actor.m_awPart[RaceData::PART_WEAPON] <= 29110;
|
||||
if (actor.m_bType == 7) { // IsPoly
|
||||
mode = MODE_GENERAL;
|
||||
} else if (actor.m_awPart[RaceData::PART_MAIN] == 201 || inst.GetShape() == 201) { // IsWearingDress
|
||||
mode = MODE_WEDDING_DRESS;
|
||||
} else if (pickAxe) {
|
||||
mode = mounting ? MODE_HORSE : MODE_GENERAL;
|
||||
} else if (itemType == ITEM_TYPE_ROD) {
|
||||
mode = mounting ? MODE_HORSE : MODE_FISHING;
|
||||
} else if (mounting) {
|
||||
switch (subType) {
|
||||
case WEAPON_SWORD: mode = MODE_HORSE_ONEHAND_SWORD; break;
|
||||
case WEAPON_TWO_HANDED: mode = MODE_HORSE_TWOHAND_SWORD; break;
|
||||
case WEAPON_DAGGER: mode = MODE_HORSE_DUALHAND_SWORD; break;
|
||||
case WEAPON_FAN: mode = MODE_HORSE_FAN; break;
|
||||
case WEAPON_BELL: mode = MODE_HORSE_BELL; break;
|
||||
case WEAPON_BOW: mode = MODE_HORSE_BOW; break;
|
||||
default: mode = MODE_HORSE; break;
|
||||
}
|
||||
} else {
|
||||
switch (subType) {
|
||||
case WEAPON_SWORD: mode = MODE_ONEHAND_SWORD; break;
|
||||
case WEAPON_TWO_HANDED: mode = MODE_TWOHAND_SWORD; break;
|
||||
case WEAPON_DAGGER: mode = MODE_DUALHAND_SWORD; break;
|
||||
case WEAPON_BOW:
|
||||
mode = actor.m_awPart[RaceData::PART_ARROW_TYPE] == WEAPON_QUIVER ? MODE_BOW_SPECIAL : MODE_BOW;
|
||||
break;
|
||||
case WEAPON_FAN: mode = MODE_FAN; break;
|
||||
case WEAPON_BELL: mode = MODE_BELL; break;
|
||||
default: mode = MODE_GENERAL; break;
|
||||
}
|
||||
}
|
||||
inst.SetMotionMode(mode);
|
||||
inst.SetMountingHorse(mounting);
|
||||
inst.SetAttackSpeed(float(actor.m_dwAtkSpd > 0 ? actor.m_dwAtkSpd : 100) / 100.0f);
|
||||
if (!inst.InterceptMotionIndex(motion, loop)) inst.PlayMotion(static_cast<MotionType>(motion), loop);
|
||||
}
|
||||
|
||||
// InstanceBase.h RaceToJob / RaceToSex (ENABLE_WOLFMAN_CHARACTER off).
|
||||
int RaceToJob(int race) { return race % 4; }
|
||||
int RaceToSex(int race) {
|
||||
@@ -330,12 +394,16 @@ bool NetworkActorManager::ChangeArmor(SNetworkActorData& actor, uint32_t armor)
|
||||
return true;
|
||||
}
|
||||
|
||||
// CInstanceBase::ChangeWeapon(eWeapon, eArrow). The bow motion-mode switch is not ported.
|
||||
// CInstanceBase::ChangeWeapon(eWeapon, eArrow).
|
||||
void NetworkActorManager::ChangeWeapon(SNetworkActorData& actor, uint32_t weapon, uint32_t arrow) {
|
||||
actor.m_awPart[RaceData::PART_ARROW_TYPE] = arrow;
|
||||
if (!actor.m_pActorInstance) return;
|
||||
SItemModelData item;
|
||||
if (!actor.m_pMountInstance && GetItemData(weapon, &item) &&
|
||||
(item.subType == WEAPON_BOW || (item.type == ITEM_TYPE_COSTUME && item.values[3] == WEAPON_BOW)))
|
||||
actor.m_pActorInstance->SetMotionMode(arrow == WEAPON_QUIVER ? MODE_BOW_SPECIAL : MODE_BOW);
|
||||
if (weapon == actor.m_pActorInstance->GetPartItemID(RaceData::PART_WEAPON)) return;
|
||||
if (SetWeapon(actor, weapon, arrow)) actor.m_pActorInstance->PlayMotion(MotionType::Wait, true);
|
||||
if (SetWeapon(actor, weapon, arrow)) RefreshState(actor, RaceData::NAME_WAIT, true);
|
||||
}
|
||||
|
||||
// CInstanceBase::ChangeHair.
|
||||
@@ -503,6 +571,8 @@ void NetworkActorManager::AppendActor(const SNetworkActorData& data) {
|
||||
}
|
||||
actor->PlayMotion(MotionType::Wait, true);
|
||||
ConfigureMount(actorData);
|
||||
// CInstanceBase::Create ends in Refresh(NAME_WAIT, true).
|
||||
RefreshState(actorData, RaceData::NAME_WAIT, true);
|
||||
|
||||
// AVA2 InstanceBase::SetAffect(AFFECT_STUN=5) controls the sleep action flag.
|
||||
actor->SetSleep((data.m_affectFlags[0] & (1u<<5))!=0);
|
||||
@@ -584,6 +654,8 @@ void NetworkActorManager::UpdateActor(const SNetworkUpdateActorData& data) {
|
||||
actorData.m_dwMountVnum = data.m_dwMountVnum;
|
||||
actorData.m_dwMovSpd = data.m_dwMovSpd;
|
||||
actorData.m_dwAtkSpd = data.m_dwAtkSpd;
|
||||
if (actorData.m_pActorInstance)
|
||||
actorData.m_pActorInstance->SetAttackSpeed(float(data.m_dwAtkSpd > 0 ? data.m_dwAtkSpd : 100) / 100.0f);
|
||||
ConfigureMount(actorData);
|
||||
|
||||
// CNetworkActorManager::UpdateActor: ChangeArmor, ChangeWeapon(weapon, arrow), ChangeHair, ChangeSash.
|
||||
@@ -636,6 +708,17 @@ void NetworkActorManager::MoveActor(const SNetworkMoveActorData& data) {
|
||||
if (data.m_dwFunc == 0) { // Stop
|
||||
actorData.m_isMoving = false;
|
||||
actorData.m_pActorInstance->PlayMotion(MotionType::Wait);
|
||||
} else if (data.m_dwFunc == 2 || data.m_dwFunc == 3) {
|
||||
// FUNC_ATTACK / FUNC_COMBO (CInstanceBase::PushTCPState): RunNormalAttack /
|
||||
// RunComboAttack(rot, arg) at the packet position. The original walks there first when
|
||||
// it is 50 or more away; the port snaps.
|
||||
actorData.m_isMoving = false;
|
||||
actorData.m_lCurX = data.m_lPosX;
|
||||
actorData.m_lCurY = data.m_lPosY;
|
||||
auto& inst = *actorData.m_pActorInstance;
|
||||
inst.SetPosition(float(data.m_lPosX), inst.GetY(), float(data.m_lPosY));
|
||||
if (data.m_dwFunc == 2) inst.RunNormalAttack(data.m_fRot);
|
||||
else inst.RunComboAttack(data.m_fRot, uint16_t(data.m_dwArg));
|
||||
} else { // Move
|
||||
actorData.m_isMoving = true;
|
||||
actorData.m_pActorInstance->PlayMotion(MotionType::Run);
|
||||
|
||||
@@ -413,19 +413,210 @@ bool ActorInstance::PlayMotion(MotionType type, bool loop) {
|
||||
m_model->SetAnimationLoop(loop, loop);
|
||||
SyncLodMotion();
|
||||
|
||||
if (type == MotionType::Attack || type == MotionType::ComboAttack1 ||
|
||||
type == MotionType::ComboAttack2 || type == MotionType::ComboAttack3 ||
|
||||
type == MotionType::Skill1 || type == MotionType::Skill2 ||
|
||||
type == MotionType::Skill3 || type == MotionType::Skill4 ||
|
||||
type == MotionType::Skill5) {
|
||||
m_isAttacking = true;
|
||||
} else {
|
||||
m_isAttacking = false;
|
||||
}
|
||||
|
||||
const uint32_t index = uint32_t(type);
|
||||
m_isAttacking = (index >= RaceData::NAME_NORMAL_ATTACK && index <= RaceData::NAME_COMBO_ATTACK_8) ||
|
||||
(index >= RaceData::NAME_SKILL && index < RaceData::NAME_SKILL_END);
|
||||
OnMotionBound(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ActorInstance::OnMotionBound(uint32_t type) {
|
||||
// ActorInstanceMotion.cpp __BindMotionData: the race motion data of the new motion.
|
||||
m_curRaceMotion = nullptr;
|
||||
uint16_t keyMode;
|
||||
if (m_raceData && m_raceData->GetMotionKey(uint16_t(m_motionMode), uint16_t(type), &keyMode)) {
|
||||
const auto* entries = m_raceData->GetMotions(keyMode, type);
|
||||
if (entries && !entries->empty()) m_curRaceMotion = GetRaceMotionData(entries->front().fileName);
|
||||
}
|
||||
if (!m_curRaceMotion) {
|
||||
m_comboIndex = 0;
|
||||
m_motionSpeed = 1.0f;
|
||||
return;
|
||||
}
|
||||
if (m_curRaceMotion->isAttackingMotion) m_hitDataMap.clear();
|
||||
if (m_comboIndex != 0 && !m_curRaceMotion->isComboMotion) m_comboIndex = 0;
|
||||
// InterceptOnceMotion(..., __GetAttackSpeed()) for normal and combo attacks.
|
||||
const bool attackMotion = m_curRaceMotion->isAttackingMotion &&
|
||||
(m_curRaceMotion->motionType == RaceMotionData::MOTION_TYPE_NORMAL ||
|
||||
m_curRaceMotion->motionType == RaceMotionData::MOTION_TYPE_COMBO);
|
||||
m_motionSpeed = attackMotion ? m_atkSpd : 1.0f;
|
||||
}
|
||||
|
||||
bool ActorInstance::IsWaiting() const {
|
||||
const uint32_t index = uint32_t(m_currentMotion);
|
||||
return index == RaceData::NAME_WAIT || index == RaceData::NAME_INTRO_WAIT || index == RaceData::NAME_STOP;
|
||||
}
|
||||
|
||||
bool ActorInstance::IsUsingSkill() const {
|
||||
const uint32_t index = uint32_t(m_currentMotion);
|
||||
return (index >= RaceData::NAME_SKILL && index < RaceData::NAME_SKILL_END) ||
|
||||
(index >= RaceData::NAME_SPECIAL_1 && index <= RaceData::NAME_SPECIAL_6);
|
||||
}
|
||||
|
||||
float ActorInstance::GetDefendingRadius() const {
|
||||
return m_raceData ? m_raceData->GetDefendingRadius() * m_scale : 0.0f;
|
||||
}
|
||||
|
||||
bool ActorInstance::CanCheckAttacking() const {
|
||||
if (!m_curRaceMotion || !m_curRaceMotion->isAttackingMotion || IsMotionFinished()) return false;
|
||||
return m_curRaceMotion->motionType == RaceMotionData::MOTION_TYPE_NORMAL ||
|
||||
m_curRaceMotion->motionType == RaceMotionData::MOTION_TYPE_COMBO;
|
||||
}
|
||||
|
||||
uint16_t ActorInstance::GetCurrentComboType() const {
|
||||
// __GetCurrentComboType
|
||||
if (IsBowMode() || IsHandMode() || m_isMountingHorse) return 0;
|
||||
return m_wcurComboType;
|
||||
}
|
||||
|
||||
void ActorInstance::RunNextCombo() {
|
||||
++m_comboIndex;
|
||||
if (!m_raceData) return;
|
||||
const auto* combo = m_raceData->GetComboData(uint16_t(m_motionMode), GetCurrentComboType());
|
||||
// The original TraceErrors these two cases on every input; the port stays quiet.
|
||||
if (!combo) return;
|
||||
const uint32_t arrayIndex = m_comboIndex - 1;
|
||||
if (arrayIndex >= combo->size()) return;
|
||||
const uint32_t comboSize = uint32_t(combo->size());
|
||||
const uint16_t motion = uint16_t((*combo)[arrayIndex]);
|
||||
RunComboAttack(m_atkDirYaw, motion);
|
||||
if (m_comboIndex == comboSize) {
|
||||
// __OnEndCombo: mounted combos wrap; on foot the index resets when Wait binds.
|
||||
if (m_isMountingHorse) m_comboIndex = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool ActorInstance::InputComboAttackCommand(float dirYaw) {
|
||||
m_atkDirYaw = dirYaw;
|
||||
if (m_isPreInput) return false;
|
||||
if (m_comboIndex == 0) {
|
||||
RunNextCombo();
|
||||
return true;
|
||||
}
|
||||
if (!m_curRaceMotion) return false;
|
||||
const float elapsed = GetAttackingElapsedTime();
|
||||
if (m_curRaceMotion->isComboMotion) {
|
||||
if (elapsed > m_curRaceMotion->inputEndTime) {
|
||||
if (IsBowMode()) m_isNextPreInput = true;
|
||||
return false;
|
||||
}
|
||||
if (elapsed > m_curRaceMotion->nextComboTime) {
|
||||
RunNextCombo();
|
||||
return true;
|
||||
}
|
||||
if (elapsed > m_curRaceMotion->inputStartTime) m_isPreInput = true;
|
||||
} else if (elapsed > m_curRaceMotion->motionDuration * 0.9f) {
|
||||
RunNextCombo();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ActorInstance::InputNormalAttackCommand(float dirYaw) {
|
||||
// __CanInputNormalAttackCommand + NormalAttack
|
||||
bool canInput = IsWaiting();
|
||||
if (!canInput && m_curRaceMotion && m_curRaceMotion->isAttackingMotion &&
|
||||
m_curRaceMotion->motionType == RaceMotionData::MOTION_TYPE_NORMAL)
|
||||
canInput = GetAttackingElapsedTime() > m_curRaceMotion->motionDuration * 0.9f;
|
||||
if (!canInput) return false;
|
||||
return RunNormalAttack(dirYaw);
|
||||
}
|
||||
|
||||
bool ActorInstance::RunNormalAttack(float dirYaw) {
|
||||
uint16_t motion;
|
||||
if (!m_raceData || !m_raceData->GetNormalAttackIndex(uint16_t(m_motionMode), &motion)) return false;
|
||||
m_yaw = dirYaw;
|
||||
if (!InterceptMotionIndex(motion, false)) return false;
|
||||
if (m_reportAttacks) m_attackMotions.push_back(motion); // __OnAttack
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ActorInstance::RunComboAttack(float dirYaw, uint16_t motion) {
|
||||
// ComboAttack: rotate, InterceptOnceMotion at the attack speed, __OnAttack. The combo index is
|
||||
// kept across the bind (the original binds before it compares the new motion's combo data).
|
||||
m_yaw = dirYaw;
|
||||
if (!InterceptMotionIndex(motion, false)) return false;
|
||||
if (m_reportAttacks) m_attackMotions.push_back(motion);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ActorInstance::ComboProcess() {
|
||||
if (m_comboIndex != 0) {
|
||||
if (!m_curRaceMotion) {
|
||||
m_comboIndex = 0; // __ClearCombo
|
||||
m_isPreInput = false;
|
||||
return;
|
||||
}
|
||||
if (m_isPreInput && GetAttackingElapsedTime() > m_curRaceMotion->nextComboTime) {
|
||||
RunNextCombo();
|
||||
m_isPreInput = false;
|
||||
}
|
||||
} else {
|
||||
m_isPreInput = false;
|
||||
if (!IsUsingSkill() && m_isNextPreInput) {
|
||||
RunNextCombo();
|
||||
m_isNextPreInput = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ActorInstance::PopAttackMotion(uint16_t* motion) {
|
||||
if (m_attackMotions.empty()) return false;
|
||||
*motion = m_attackMotions.front();
|
||||
m_attackMotions.pop_front();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ActorInstance::TestAttackHit(uint32_t victimVID, float x, float z, float radius, float frameDt, bool huge) {
|
||||
// __NormalAttackProcess. The original's distance vector is (dx, dz, dz); horizontal distance here.
|
||||
const float distX = x - m_posX, distZ = z - m_posZ;
|
||||
const float range = huge ? 500.0f : 300.0f;
|
||||
if (distX * distX + distZ * distZ >= range * range) return false;
|
||||
if (!CanCheckAttacking()) return false;
|
||||
const float attackRadius = 20.0f;
|
||||
const float victimRadius = radius > 0.0f ? radius : 50.0f;
|
||||
const float limit = attackRadius + victimRadius;
|
||||
const auto& pad = *m_curRaceMotion;
|
||||
const float motionTime = GetAttackingElapsedTime();
|
||||
const float c = std::cos(m_yaw * DEG_TO_RAD), s = std::sin(m_yaw * DEG_TO_RAD);
|
||||
// Graphic space (x, y) -> port (X, Z = -y); the port yaw is the graphic rotation.
|
||||
auto toWorld = [&](const float* local, float& outX, float& outZ) {
|
||||
outX = m_posX + local[0] * c - local[1] * s;
|
||||
outZ = m_posZ - (local[0] * s + local[1] * c);
|
||||
};
|
||||
for (size_t hitIndex = 0; hitIndex < pad.hitData.size(); ++hitIndex) {
|
||||
const auto& hit = pad.hitData[hitIndex];
|
||||
auto& hitted = m_hitDataMap[hitIndex];
|
||||
const auto already = hitted.find(victimVID);
|
||||
if (already != hitted.end() &&
|
||||
(pad.motionType == RaceMotionData::MOTION_TYPE_COMBO || already->second > m_localTime))
|
||||
continue;
|
||||
auto it = hit.hitPositions.lower_bound(motionTime - frameDt);
|
||||
const auto end = hit.hitPositions.upper_bound(motionTime);
|
||||
for (; it != end; ++it) {
|
||||
// __GetReachScale() is 1: v3Position itself.
|
||||
float ax, az, bx, bz;
|
||||
toWorld(it->second.last, ax, az);
|
||||
toWorld(it->second.pos, bx, bz);
|
||||
// Segment (a, b) against the static victim point.
|
||||
const float sx = bx - ax, sz = bz - az;
|
||||
const float lenSq = sx * sx + sz * sz;
|
||||
float t = lenSq > 1e-6f ? ((x - ax) * sx + (z - az) * sz) / lenSq : 0.0f;
|
||||
t = std::clamp(t, 0.0f, 1.0f);
|
||||
const float px = ax + sx * t - x, pz = az + sz * t - z;
|
||||
if (px * px + pz * pz > limit * limit) continue;
|
||||
// insert keeps an existing entry, like std::map::insert in the original.
|
||||
hitted.insert({victimVID, m_localTime + pad.invisibleTime});
|
||||
const size_t count = hitted.size();
|
||||
const bool normal = pad.motionType == RaceMotionData::MOTION_TYPE_COMBO ||
|
||||
pad.motionType == RaceMotionData::MOTION_TYPE_NORMAL;
|
||||
if (normal ? count > 16 : int(count) > pad.hitLimitCount) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ActorInstance::PlayMotionIndex(uint32_t index, bool loop) {
|
||||
uint16_t keyMode;
|
||||
if (!m_raceData || !m_raceData->GetMotionKey(uint16_t(m_motionMode), uint16_t(index), &keyMode)) return false;
|
||||
@@ -586,8 +777,9 @@ void ActorInstance::Update(float dt, const TerrainHeightSource* terrain, const M
|
||||
}
|
||||
}
|
||||
|
||||
// Advance animation time
|
||||
m_animTime += dt;
|
||||
// Advance animation time (attack motions run at the attack speed ratio).
|
||||
m_animTime += dt * m_motionSpeed;
|
||||
m_localTime += dt;
|
||||
m_lodLocalTime += dt; // CGrannyModelInstance::UpdateLocalTime
|
||||
if (!m_motionQueue.empty() && m_animTime >= m_motionDuration) {
|
||||
// ReservingMotionProcess: the next pushed motion takes over when the current one ends.
|
||||
@@ -616,17 +808,17 @@ bool ActorInstance::Attack() {
|
||||
if (m_curHP <= 0) return false;
|
||||
|
||||
if (!m_isAttacking) {
|
||||
m_comboIndex = 1;
|
||||
m_previewComboIndex = 1;
|
||||
if (!PlayMotion(MotionType::ComboAttack1, false)) {
|
||||
PlayMotion(MotionType::Attack, false);
|
||||
}
|
||||
return true;
|
||||
} else if (m_animTime > m_motionDuration * 0.35f) {
|
||||
// Advance combo chain
|
||||
m_comboIndex = (m_comboIndex % 3) + 1;
|
||||
m_previewComboIndex = (m_previewComboIndex % 3) + 1;
|
||||
MotionType next = MotionType::ComboAttack1;
|
||||
if (m_comboIndex == 2) next = MotionType::ComboAttack2;
|
||||
else if (m_comboIndex == 3) next = MotionType::ComboAttack3;
|
||||
if (m_previewComboIndex == 2) next = MotionType::ComboAttack2;
|
||||
else if (m_previewComboIndex == 3) next = MotionType::ComboAttack3;
|
||||
|
||||
if (!PlayMotion(next, false)) {
|
||||
PlayMotion(MotionType::Attack, false);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
namespace ava2 {
|
||||
|
||||
class RaceData;
|
||||
struct RaceMotionData;
|
||||
|
||||
// Metin2 standard motion types (aligned with 40250 CRaceMotionData::EName)
|
||||
enum class MotionType {
|
||||
@@ -25,6 +26,11 @@ enum class MotionType {
|
||||
ComboAttack1 = 14,
|
||||
ComboAttack2 = 15,
|
||||
ComboAttack3 = 16,
|
||||
ComboAttack4 = 17,
|
||||
ComboAttack5 = 18,
|
||||
ComboAttack6 = 19,
|
||||
ComboAttack7 = 20,
|
||||
ComboAttack8 = 21,
|
||||
Skill1 = 101, // Samyeon (三连击)
|
||||
Skill2 = 102, // Palbang (八方风雨)
|
||||
Skill3 = 103, // Jeongwi (狂战士)
|
||||
@@ -185,6 +191,45 @@ public:
|
||||
void SetComboType(uint16_t comboType) { m_wcurComboType = comboType; }
|
||||
uint16_t GetComboType() const { return m_wcurComboType; }
|
||||
|
||||
// GameLib ActorInstanceBattle.cpp combo state machine. Direction is a port yaw (degrees).
|
||||
// InputComboAttackCommand / ComboProcess / __RunNextCombo / __OnEndCombo follow the original;
|
||||
// each started attack motion is queued for the caller (CPythonPlayerEventHandler::OnAttack sends
|
||||
// it as a FUNC_COMBO state packet) and read with PopAttackMotion.
|
||||
bool InputComboAttackCommand(float dirYaw);
|
||||
bool InputNormalAttackCommand(float dirYaw);
|
||||
// NormalAttack (CInstanceBase::RunNormalAttack for remote FUNC_ATTACK) and ComboAttack
|
||||
// (RunComboAttack for FUNC_COMBO): play the motion facing dirYaw without the input checks.
|
||||
bool RunNormalAttack(float dirYaw);
|
||||
bool RunComboAttack(float dirYaw, uint16_t motion);
|
||||
// Only the main actor reports its attacks (CPythonPlayerEventHandler is the main actor's handler).
|
||||
void SetReportAttacks(bool report) { m_reportAttacks = report; if (!report) m_attackMotions.clear(); }
|
||||
void ComboProcess();
|
||||
bool PopAttackMotion(uint16_t* motion);
|
||||
uint32_t GetComboIndex() const { return m_comboIndex; }
|
||||
// m_fAtkSpd (atkspd / 100): attack motions advance this much faster, like the original motion
|
||||
// speed ratio passed to InterceptOnceMotion.
|
||||
void SetAttackSpeed(float ratio) { m_atkSpd = ratio > 0.0f ? ratio : 1.0f; }
|
||||
float GetAttackSpeed() const { return m_atkSpd; }
|
||||
// GetAttackingElapsedTime: motion local time scaled by the attack speed.
|
||||
float GetAttackingElapsedTime() const { return m_animTime; }
|
||||
const RaceMotionData* GetCurrentRaceMotionData() const { return m_curRaceMotion; }
|
||||
bool IsWaiting() const; // __IsWaitMotion: WAIT / INTRO_WAIT / STOP
|
||||
bool IsUsingSkill() const; // NAME_SKILL..NAME_SKILL_END or SPECIAL_1..6
|
||||
bool IsBowMode() const { return m_motionMode == 5 || m_motionMode == 13 || m_motionMode == 17; }
|
||||
bool IsHandMode() const { return m_motionMode == 1 || m_motionMode == 9; }
|
||||
bool IsMountingHorse() const { return m_isMountingHorse; }
|
||||
void SetMountingHorse(bool mounted) { m_isMountingHorse = mounted; }
|
||||
// CanCheckAttacking: the current motion is a NORMAL or COMBO attacking motion.
|
||||
bool CanCheckAttacking() const;
|
||||
// ActorInstanceCollisionDetection.cpp __NormalAttackProcess against one victim. The victim's
|
||||
// defending spheres are approximated by an upright cylinder of `radius` around (x, z) (0 radius:
|
||||
// 50); DetectCollisionDynamicZCylinderVSDynamicZCylinder ignores height anyway. frameDt is the
|
||||
// real frame time (hit positions in [t - dt, t]). Returns true for a new hit; a victim is hit
|
||||
// once per hit data in a combo motion, else again after the invisible time.
|
||||
// The race's DEFENDING sphere radius (.msm AttachingData), 0 when unknown.
|
||||
float GetDefendingRadius() const;
|
||||
bool TestAttackHit(uint32_t victimVID, float x, float z, float radius, float frameDt, bool huge = false);
|
||||
|
||||
// Cast specific skill motion (stops movement, sets attack state, plays one-shot)
|
||||
bool CastSkill(MotionType skillMotion);
|
||||
|
||||
@@ -292,7 +337,19 @@ private:
|
||||
std::deque<std::pair<uint32_t, bool>> m_motionQueue; // m_MotionDeque (index, loop)
|
||||
bool PlayMotionIndex(uint32_t index, bool loop);
|
||||
bool m_isAttacking = false;
|
||||
int m_comboIndex = 0;
|
||||
uint32_t m_comboIndex = 0;
|
||||
// Combo state (CActorInstance m_isPreInput / m_isNextPreInput / m_fAtkDirRot / m_HitDataMap).
|
||||
const RaceMotionData* m_curRaceMotion = nullptr;
|
||||
bool m_isPreInput = false, m_isNextPreInput = false, m_isMountingHorse = false, m_reportAttacks = false;
|
||||
float m_atkDirYaw = 0.0f, m_atkSpd = 1.0f, m_motionSpeed = 1.0f;
|
||||
std::deque<uint16_t> m_attackMotions;
|
||||
// m_HitDataMap: hit data index -> (vid -> local time the victim may be hit again).
|
||||
std::unordered_map<size_t, std::unordered_map<uint32_t, float>> m_hitDataMap;
|
||||
float m_localTime = 0.0f;
|
||||
int m_previewComboIndex = 0; // Attack() (offline preview) cycle, separate from the real combo
|
||||
uint16_t GetCurrentComboType() const;
|
||||
void RunNextCombo();
|
||||
void OnMotionBound(uint32_t type);
|
||||
uint16_t m_wcurComboType = 0;
|
||||
std::unordered_map<std::string, float> m_buffs;
|
||||
|
||||
|
||||
+347
-16
@@ -2,6 +2,7 @@
|
||||
#include "ava2_text_file.h"
|
||||
#include "ava2_text_file_loader.h"
|
||||
#include "src/eter_resource/ResourceManager.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@@ -124,10 +125,132 @@ bool RaceData::LoadRaceData(const std::string& fileName) {
|
||||
}
|
||||
loader.setParent();
|
||||
}
|
||||
// AttachingData (collision spheres, attached effects) is not ported.
|
||||
// AttachingData: only COLLISION_TYPE_DEFENDING sphere radii are kept (CActorInstance defending
|
||||
// spheres, approximated by one cylinder for the attack hit test). Attached effects are not ported.
|
||||
if (loader.setChildNode("attachingdata")) {
|
||||
for (size_t i = 0; i < loader.childCount(); ++i) {
|
||||
if (!loader.setChild(i)) continue;
|
||||
int collisionType = 0;
|
||||
if (loader.tokenInteger("collisiontype", &collisionType) && collisionType == 3) {
|
||||
for (size_t j = 0; j < loader.childCount(); ++j) {
|
||||
if (!loader.setChild(j)) continue;
|
||||
std::string radius;
|
||||
if (loader.tokenString("radius", &radius))
|
||||
m_defendingRadius = std::max(m_defendingRadius, float(std::atof(radius.c_str())));
|
||||
loader.setParent();
|
||||
}
|
||||
}
|
||||
loader.setParent();
|
||||
}
|
||||
loader.setParent();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool TokenFloat(const TextFileLoader& loader, const char* key, float* value) {
|
||||
std::string token;
|
||||
if (!loader.tokenString(key, &token)) return false;
|
||||
*value = float(std::atof(token.c_str()));
|
||||
return true;
|
||||
}
|
||||
|
||||
// NRaceData::THitData::Load.
|
||||
bool LoadHitData(const TextFileLoader& loader, RaceMotionData::HitData* hit) {
|
||||
if (!TokenFloat(loader, "attackingstarttime", &hit->attackStartTime)) return false;
|
||||
if (!TokenFloat(loader, "attackingendtime", &hit->attackEndTime)) return false;
|
||||
if (!loader.tokenString("attackingbone", &hit->boneName)) hit->boneName.clear();
|
||||
if (!TokenFloat(loader, "weaponlength", &hit->weaponLength)) hit->weaponLength = 0.0f;
|
||||
hit->hitPositions.clear();
|
||||
if (const auto* tv = loader.tokenVector("hitposition")) {
|
||||
// The original walks the list 7 tokens at a time without a bounds check; a short tail is dropped.
|
||||
for (size_t i = 0; i + 7 <= tv->size(); i += 7) {
|
||||
RaceMotionData::HitTimePosition hp;
|
||||
const float time = float(std::atof((*tv)[i].c_str()));
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
hp.last[k] = float(std::atof((*tv)[i + 1 + k].c_str()));
|
||||
hp.pos[k] = float(std::atof((*tv)[i + 4 + k].c_str()));
|
||||
}
|
||||
hit->hitPositions[time] = hp;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// NRaceData::LoadAttackData + LoadMotionAttackData.
|
||||
bool LoadMotionAttackData(TextFileLoader& loader, RaceMotionData* data) {
|
||||
if (!loader.tokenInteger("attacktype", &data->attackType)) data->attackType = 2; // ATTACK_TYPE_SPLASH
|
||||
if (!loader.tokenInteger("hittingtype", &data->hittingType)) return false;
|
||||
if (!TokenFloat(loader, "stiffentime", &data->stiffenTime)) return false;
|
||||
if (!TokenFloat(loader, "invisibletime", &data->invisibleTime)) return false;
|
||||
if (!TokenFloat(loader, "externalforce", &data->externalForce)) return false;
|
||||
if (!loader.tokenInteger("hitlimitcount", &data->hitLimitCount)) data->hitLimitCount = 0;
|
||||
// AttackingType was renamed MotionType; old files still carry the former key.
|
||||
if (!loader.tokenInteger("motiontype", &data->motionType) &&
|
||||
!loader.tokenInteger("attackingtype", &data->motionType))
|
||||
return false;
|
||||
data->hitData.clear();
|
||||
int count = 0;
|
||||
if (!loader.tokenInteger("hitdatacount", &count)) {
|
||||
data->hitData.emplace_back();
|
||||
return LoadHitData(loader, &data->hitData.back());
|
||||
}
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (!loader.setChild(size_t(i))) return false;
|
||||
data->hitData.emplace_back();
|
||||
if (!LoadHitData(loader, &data->hitData.back())) return false;
|
||||
loader.setParent();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool ParseRaceMotionData(const std::string& text, RaceMotionData* data) {
|
||||
TextFileLoader loader;
|
||||
if (!loader.load(text)) return false;
|
||||
loader.setTop();
|
||||
if (!loader.tokenString("motionfilename", &data->motionFileName)) return false;
|
||||
if (!TokenFloat(loader, "motionduration", &data->motionDuration)) return false;
|
||||
if (const auto* acc = loader.tokenVector("accumulation")) {
|
||||
if (acc->size() != 3) {
|
||||
TraceError("CRaceMotioNData::LoadMotionData : syntax error on accumulation, vector size " + std::to_string(acc->size()));
|
||||
return false;
|
||||
}
|
||||
for (int k = 0; k < 3; ++k) data->accumulation[k] = float(std::atof((*acc)[k].c_str()));
|
||||
}
|
||||
for (size_t i = 0; i < loader.childCount(); ++i) {
|
||||
loader.setChild(i); // CGotoChild
|
||||
const std::string name = loader.nodeName();
|
||||
bool ok = true;
|
||||
if (name == "comboinputdata") {
|
||||
data->isComboMotion = true;
|
||||
ok = TokenFloat(loader, "preinputtime", &data->inputStartTime) &&
|
||||
TokenFloat(loader, "directinputtime", &data->nextComboTime) &&
|
||||
TokenFloat(loader, "inputlimittime", &data->inputEndTime);
|
||||
} else if (name == "attackingdata") {
|
||||
data->isAttackingMotion = true;
|
||||
ok = LoadMotionAttackData(loader, data);
|
||||
}
|
||||
loader.setTop();
|
||||
if (!ok) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const RaceMotionData* GetRaceMotionData(const std::string& msaFileName) {
|
||||
static std::map<std::string, std::unique_ptr<RaceMotionData>> cache;
|
||||
const std::string key = CResourceManager::NormalizePath(msaFileName.c_str());
|
||||
auto it = cache.find(key);
|
||||
if (it != cache.end()) return it->second.get();
|
||||
std::unique_ptr<RaceMotionData> data;
|
||||
std::string text;
|
||||
if (ReadRaceResourceFile(msaFileName, &text)) {
|
||||
data = std::make_unique<RaceMotionData>();
|
||||
if (!ParseRaceMotionData(text, data.get())) data.reset();
|
||||
}
|
||||
return cache.emplace(key, std::move(data)).first->second.get();
|
||||
}
|
||||
|
||||
void RaceData::SetShapeModel(uint32_t index, const std::string& model) { m_shapes[index].model = model; }
|
||||
|
||||
void RaceData::AppendShapeSkin(uint32_t index, uint32_t, const std::string& src, const std::string& dst) {
|
||||
@@ -425,6 +548,228 @@ bool RaceManager::LoadGameNPC(const std::string& fileName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
// CPythonPlayerSettingsModule (UserInterface/PythonPlayerSettingsModule.cpp) motion tables.
|
||||
enum {
|
||||
MODE_GENERAL = 1, MODE_ONEHAND_SWORD, MODE_TWOHAND_SWORD, MODE_DUALHAND_SWORD, MODE_BOW, MODE_FAN, MODE_BELL,
|
||||
MODE_FISHING, MODE_HORSE, MODE_HORSE_ONEHAND_SWORD, MODE_HORSE_TWOHAND_SWORD, MODE_HORSE_DUALHAND_SWORD,
|
||||
MODE_HORSE_BOW, MODE_HORSE_FAN, MODE_HORSE_BELL, MODE_WEDDING_DRESS, MODE_BOW_SPECIAL,
|
||||
};
|
||||
enum { JOB_WARRIOR, JOB_ASSASSIN, JOB_SURA, JOB_SHAMAN };
|
||||
enum {
|
||||
HORSE_SKILL_WILDATTACK = RaceData::NAME_SKILL + 121,
|
||||
HORSE_SKILL_CHARGE = RaceData::NAME_SKILL + 122,
|
||||
HORSE_SKILL_SPLASH = RaceData::NAME_SKILL + 123,
|
||||
};
|
||||
enum { COMBO_TYPE_1, COMBO_TYPE_2, COMBO_TYPE_3 };
|
||||
|
||||
struct PlayerMotionLoader {
|
||||
RaceData& race;
|
||||
std::string path; // CRaceManager::SetPathName
|
||||
int job;
|
||||
|
||||
// __RegisterCacheMotionData: CRaceData::RegisterMotionData drops a motion whose .msa fails to load.
|
||||
void Register(uint16_t mode, uint16_t name, const char* file, int percent = 100) const {
|
||||
const std::string fileName = path + file;
|
||||
if (!GetRaceMotionData(fileName)) {
|
||||
TraceError("CRaceData::RegisterMotionData - LoadMotionData(c_szFileName=" + fileName + ") ERROR");
|
||||
return;
|
||||
}
|
||||
race.RegisterMotion(mode, name, fileName, percent);
|
||||
}
|
||||
void Combo(uint16_t mode, uint16_t type, std::initializer_list<uint16_t> motions) const {
|
||||
race.ReserveComboAttack(mode, type, uint32_t(motions.size()));
|
||||
uint32_t index = 0;
|
||||
for (uint16_t motion : motions) race.RegisterComboAttack(mode, type, index++, motion);
|
||||
}
|
||||
|
||||
// __SetGeneralMotions.
|
||||
void GeneralMotions(uint16_t mode) const {
|
||||
race.RegisterMotionMode(mode);
|
||||
Register(mode, RaceData::NAME_WAIT, "wait.msa");
|
||||
Register(mode, RaceData::NAME_WALK, "walk.msa");
|
||||
Register(mode, RaceData::NAME_RUN, "run.msa");
|
||||
Register(mode, RaceData::NAME_DAMAGE, "damage.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE, "damage_1.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE_BACK, "damage_2.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE_BACK, "damage_3.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE_FLYING, "damage_flying.msa");
|
||||
Register(mode, RaceData::NAME_STAND_UP, "falling_stand.msa");
|
||||
Register(mode, RaceData::NAME_DAMAGE_FLYING_BACK, "back_damage_flying.msa");
|
||||
Register(mode, RaceData::NAME_STAND_UP_BACK, "back_falling_stand.msa");
|
||||
Register(mode, RaceData::NAME_DEAD, "dead.msa");
|
||||
Register(mode, RaceData::NAME_DIG, "dig.msa");
|
||||
}
|
||||
|
||||
// __LoadCombo. MODE_BOW_SPECIAL takes the sword branch like the original.
|
||||
void LoadCombo(uint16_t mode) const {
|
||||
using R = RaceData;
|
||||
if (mode == MODE_BOW) {
|
||||
Combo(MODE_BOW, COMBO_TYPE_1, {R::NAME_COMBO_ATTACK_1});
|
||||
return;
|
||||
}
|
||||
Combo(mode, COMBO_TYPE_1, {R::NAME_COMBO_ATTACK_1, R::NAME_COMBO_ATTACK_2, R::NAME_COMBO_ATTACK_3, R::NAME_COMBO_ATTACK_4});
|
||||
Combo(mode, COMBO_TYPE_2, {R::NAME_COMBO_ATTACK_1, R::NAME_COMBO_ATTACK_2, R::NAME_COMBO_ATTACK_3, R::NAME_COMBO_ATTACK_5,
|
||||
R::NAME_COMBO_ATTACK_7});
|
||||
Combo(mode, COMBO_TYPE_3, {R::NAME_COMBO_ATTACK_1, R::NAME_COMBO_ATTACK_2, R::NAME_COMBO_ATTACK_3, R::NAME_COMBO_ATTACK_5,
|
||||
R::NAME_COMBO_ATTACK_6,
|
||||
uint16_t(mode == MODE_DUALHAND_SWORD ? R::NAME_COMBO_ATTACK_8 : R::NAME_COMBO_ATTACK_4)});
|
||||
}
|
||||
|
||||
// __LoadWeaponMotion.
|
||||
void WeaponMotion(uint16_t mode, const std::string& folder) {
|
||||
path = folder;
|
||||
race.RegisterMotionMode(mode);
|
||||
switch (job) {
|
||||
case JOB_WARRIOR: {
|
||||
const bool oneHand = mode == MODE_ONEHAND_SWORD;
|
||||
Register(mode, RaceData::NAME_WAIT, "wait.msa", oneHand ? 50 : 70);
|
||||
Register(mode, RaceData::NAME_WAIT, "wait_1.msa", oneHand ? 50 : 30);
|
||||
break;
|
||||
}
|
||||
case JOB_ASSASSIN:
|
||||
Register(mode, RaceData::NAME_WAIT, "wait.msa", 70);
|
||||
Register(mode, RaceData::NAME_WAIT, "wait_1.msa", 30);
|
||||
break;
|
||||
case JOB_SURA:
|
||||
Register(mode, RaceData::NAME_WAIT, "wait.msa");
|
||||
Register(mode, RaceData::NAME_DAMAGE, "damage.msa");
|
||||
break;
|
||||
case JOB_SHAMAN:
|
||||
Register(mode, RaceData::NAME_WAIT, "wait.msa");
|
||||
break;
|
||||
}
|
||||
Register(mode, RaceData::NAME_WALK, "walk.msa");
|
||||
Register(mode, RaceData::NAME_RUN, "run.msa");
|
||||
Register(mode, RaceData::NAME_DAMAGE, "damage.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE, "damage_1.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE_BACK, "damage_2.msa", 50);
|
||||
Register(mode, RaceData::NAME_DAMAGE_BACK, "damage_3.msa", 50);
|
||||
if (mode == MODE_BOW) {
|
||||
Register(mode, RaceData::NAME_COMBO_ATTACK_1, "attack.msa");
|
||||
} else if (mode == MODE_BOW_SPECIAL) {
|
||||
Register(mode, RaceData::NAME_COMBO_ATTACK_1, "attack_special.msa");
|
||||
} else {
|
||||
static const char* kCombo[] = {"combo_01.msa", "combo_02.msa", "combo_03.msa", "combo_04.msa",
|
||||
"combo_05.msa", "combo_06.msa", "combo_07.msa"};
|
||||
for (uint16_t k = 0; k < 7; ++k) Register(mode, uint16_t(RaceData::NAME_COMBO_ATTACK_1 + k), kCombo[k]);
|
||||
if (job == JOB_ASSASSIN && mode == MODE_DUALHAND_SWORD)
|
||||
Register(mode, RaceData::NAME_COMBO_ATTACK_8, "combo_08.msa");
|
||||
}
|
||||
LoadCombo(mode);
|
||||
}
|
||||
};
|
||||
|
||||
// GetHorsePathNameByMode is not in the reference sources; the folders are the pack's horse_* names.
|
||||
const char* HorsePathName(uint16_t mode) {
|
||||
switch (mode) {
|
||||
case MODE_HORSE_ONEHAND_SWORD: return "horse_onehand_sword/";
|
||||
case MODE_HORSE_TWOHAND_SWORD: return "horse_twohand_sword/";
|
||||
case MODE_HORSE_DUALHAND_SWORD: return "horse_dualhand_sword/";
|
||||
case MODE_HORSE_FAN: return "horse_fan/";
|
||||
case MODE_HORSE_BELL: return "horse_bell/";
|
||||
default: return "horse/";
|
||||
}
|
||||
}
|
||||
|
||||
void LoadPlayerMotions(RaceData& race, const std::string& folder) {
|
||||
using R = RaceData;
|
||||
PlayerMotionLoader l{race, folder + "intro/", int(race.GetRace() % 4)};
|
||||
// __SetIntroMotions
|
||||
race.RegisterMotionMode(MODE_GENERAL);
|
||||
l.Register(MODE_GENERAL, R::NAME_INTRO_WAIT, "wait.msa");
|
||||
l.Register(MODE_GENERAL, R::NAME_INTRO_SELECTED, "selected.msa");
|
||||
l.Register(MODE_GENERAL, R::NAME_INTRO_NOT_SELECTED, "not_selected.msa");
|
||||
|
||||
// __LoadGameRace (emotions, guild skills and skills are not ported)
|
||||
l.path = folder + "general/";
|
||||
l.GeneralMotions(MODE_GENERAL);
|
||||
if (l.job == JOB_WARRIOR || l.job == JOB_ASSASSIN) {
|
||||
race.SetMotionRandomWeight(MODE_GENERAL, R::NAME_WAIT, 0, 70);
|
||||
l.Register(MODE_GENERAL, R::NAME_WAIT, "wait_1.msa", 30);
|
||||
}
|
||||
l.Register(MODE_GENERAL, R::NAME_COMBO_ATTACK_1, "attack.msa", 50);
|
||||
l.Register(MODE_GENERAL, R::NAME_COMBO_ATTACK_1, "attack_1.msa", 50);
|
||||
l.Combo(MODE_GENERAL, COMBO_TYPE_1, {R::NAME_COMBO_ATTACK_1});
|
||||
switch (l.job) {
|
||||
case JOB_WARRIOR:
|
||||
l.WeaponMotion(MODE_ONEHAND_SWORD, folder + "onehand_sword/");
|
||||
l.WeaponMotion(MODE_TWOHAND_SWORD, folder + "twohand_sword/");
|
||||
break;
|
||||
case JOB_ASSASSIN:
|
||||
l.WeaponMotion(MODE_ONEHAND_SWORD, folder + "onehand_sword/");
|
||||
l.WeaponMotion(MODE_DUALHAND_SWORD, folder + "dualhand_sword/");
|
||||
l.WeaponMotion(MODE_BOW, folder + "bow/");
|
||||
l.WeaponMotion(MODE_BOW_SPECIAL, folder + "bow/");
|
||||
break;
|
||||
case JOB_SURA:
|
||||
l.WeaponMotion(MODE_ONEHAND_SWORD, folder + "onehand_sword/");
|
||||
break;
|
||||
case JOB_SHAMAN:
|
||||
l.WeaponMotion(MODE_FAN, folder + "fan/");
|
||||
l.WeaponMotion(MODE_BELL, folder + "Bell/");
|
||||
break;
|
||||
}
|
||||
|
||||
// __LoadHorse
|
||||
l.path = folder + "horse/";
|
||||
race.RegisterMotionMode(MODE_HORSE);
|
||||
l.Register(MODE_HORSE, R::NAME_WAIT, "wait.msa", 90);
|
||||
l.Register(MODE_HORSE, R::NAME_WALK, "walk.msa");
|
||||
l.Register(MODE_HORSE, R::NAME_RUN, "run.msa");
|
||||
l.Register(MODE_HORSE, R::NAME_DEAD, "dead.msa");
|
||||
l.Register(MODE_HORSE, HORSE_SKILL_CHARGE, "skill_charge.msa");
|
||||
l.Register(MODE_HORSE, R::NAME_WAIT, "wait_1.msa", 9);
|
||||
l.Register(MODE_HORSE, R::NAME_WAIT, "wait_2.msa", 1);
|
||||
l.Register(MODE_HORSE, R::NAME_DAMAGE, "damage.msa");
|
||||
l.Register(MODE_HORSE, R::NAME_DAMAGE_BACK, "damage.msa");
|
||||
if (l.job == JOB_SHAMAN || l.job == JOB_SURA) l.Register(MODE_HORSE, HORSE_SKILL_SPLASH, "skill_splash.msa");
|
||||
static const std::vector<uint16_t> kHorseModes[] = {
|
||||
{MODE_HORSE_ONEHAND_SWORD, MODE_HORSE_TWOHAND_SWORD}, // m_vecHorse JOB_WARRIOR
|
||||
{MODE_HORSE_ONEHAND_SWORD, MODE_HORSE_DUALHAND_SWORD}, // JOB_ASSASSIN
|
||||
{MODE_HORSE_ONEHAND_SWORD}, // JOB_SURA
|
||||
{MODE_HORSE_FAN, MODE_HORSE_BELL}, // JOB_SHAMAN
|
||||
};
|
||||
for (uint16_t mode : kHorseModes[l.job]) {
|
||||
l.path = folder + HorsePathName(mode);
|
||||
race.RegisterMotionMode(mode);
|
||||
l.Register(mode, R::NAME_COMBO_ATTACK_1, "combo_01.msa");
|
||||
l.Register(mode, R::NAME_COMBO_ATTACK_2, "combo_02.msa");
|
||||
l.Register(mode, R::NAME_COMBO_ATTACK_3, "combo_03.msa");
|
||||
l.Combo(mode, COMBO_TYPE_1, {R::NAME_COMBO_ATTACK_1, R::NAME_COMBO_ATTACK_2, R::NAME_COMBO_ATTACK_3});
|
||||
l.Register(mode, HORSE_SKILL_WILDATTACK, "skill_wildattack.msa");
|
||||
if (l.job == JOB_WARRIOR || l.job == JOB_ASSASSIN) l.Register(mode, HORSE_SKILL_SPLASH, "skill_splash.msa");
|
||||
}
|
||||
if (l.job == JOB_ASSASSIN) {
|
||||
l.path = folder + "horse_bow/";
|
||||
race.RegisterMotionMode(MODE_HORSE_BOW);
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_WAIT, "wait.msa", 90);
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_WAIT, "wait_1.msa", 9);
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_WAIT, "wait_2.msa", 1);
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_RUN, "run.msa");
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_DAMAGE, "damage.msa");
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_DEAD, "dead.msa");
|
||||
l.Register(MODE_HORSE_BOW, R::NAME_COMBO_ATTACK_1, "attack.msa");
|
||||
l.Register(MODE_HORSE_BOW, HORSE_SKILL_WILDATTACK, "skill_wildattack.msa");
|
||||
l.Register(MODE_HORSE_BOW, HORSE_SKILL_SPLASH, "skill_splash.msa");
|
||||
l.Combo(MODE_HORSE_BOW, COMBO_TYPE_1, {R::NAME_COMBO_ATTACK_1});
|
||||
}
|
||||
|
||||
// __LoadFishing
|
||||
l.path = folder + "fishing/";
|
||||
race.RegisterMotionMode(MODE_FISHING);
|
||||
l.Register(MODE_FISHING, R::NAME_WAIT, "wait.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_WALK, "walk.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_RUN, "run.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_FISHING_THROW, "throw.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_FISHING_WAIT, "fishing_wait.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_FISHING_STOP, "fishing_cancel.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_FISHING_REACT, "fishing_react.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_FISHING_CATCH, "fishing_catch.msa");
|
||||
l.Register(MODE_FISHING, R::NAME_FISHING_FAIL, "fishing_fail.msa");
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void RaceManager::LoadPlayerRaces() {
|
||||
// CPythonPlayerSettingsModule m_vecRaceData.
|
||||
static const struct { const char* msm; const char* path; } kRaces[] = {
|
||||
@@ -449,21 +794,7 @@ void RaceManager::LoadPlayerRaces() {
|
||||
case 2: race->RegisterAttachingBoneName(RaceData::PART_WEAPON, "equip_right"); break;
|
||||
}
|
||||
race->RegisterAttachingBoneName(RaceData::PART_SASH, "Bip01 Spine2"); // ENABLE_SASH_SYSTEM
|
||||
race->RegisterMotionData(RaceData::NAME_INTRO_WAIT, kRaces[i].path + std::string("intro/wait.msa"), 100);
|
||||
race->RegisterMotionData(RaceData::NAME_INTRO_SELECTED, kRaces[i].path + std::string("intro/selected.msa"), 100);
|
||||
race->RegisterMotionData(RaceData::NAME_INTRO_NOT_SELECTED, kRaces[i].path + std::string("intro/not_selected.msa"), 100);
|
||||
race->RegisterMotionData(RaceData::NAME_WAIT, kRaces[i].path + std::string("general/wait.msa"), 100);
|
||||
race->RegisterMotionData(RaceData::NAME_WALK, kRaces[i].path + std::string("general/walk.msa"), 100);
|
||||
race->RegisterMotionData(RaceData::NAME_RUN, kRaces[i].path + std::string("general/run.msa"), 100);
|
||||
race->RegisterMotionData(RaceData::NAME_DEAD, kRaces[i].path + std::string("general/dead.msa"), 100);
|
||||
// CPythonPlayerSettingsModule::__LoadHorse: mounted riders use a distinct pose.
|
||||
race->RegisterMotionMode(9);
|
||||
for (const auto& motion : {std::pair{RaceData::NAME_WAIT, "wait.msa"},
|
||||
std::pair{RaceData::NAME_WALK, "walk.msa"},
|
||||
std::pair{RaceData::NAME_RUN, "run.msa"},
|
||||
std::pair{RaceData::NAME_DEAD, "dead.msa"}})
|
||||
race->RegisterMotion(9, motion.first, kRaces[i].path + std::string("horse/") + motion.second, 100);
|
||||
|
||||
LoadPlayerMotions(*race, kRaces[i].path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
// Port of AVA2 GameLib CRaceData (RaceData.h/.cpp, RaceDataFile.cpp LoadRaceData) and CRaceManager
|
||||
// (RaceManager.cpp): .msm shape/hair tables, attaching bone names, the npclist race-name registry,
|
||||
// the per-race resource path search and the motlist.txt GENERAL motion list.
|
||||
// Not ported: smoke effects, AttachingData (collision spheres / attached effects), the CRaceMotionData
|
||||
// .msa event payload (only MotionFileName is read), motion modes other than GENERAL.
|
||||
// Player weapon / horse / fishing motion modes and combo tables follow UserInterface
|
||||
// PythonPlayerSettingsModule.cpp. Not ported: smoke effects, attached effects, the .msa motion
|
||||
// events / loop data, emotion and skill motions. Of AttachingData only the DEFENDING sphere radius
|
||||
// is kept (hit test approximation).
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -119,7 +121,11 @@ public:
|
||||
void RegisterComboAttack(uint16_t mode, uint16_t comboType, uint32_t comboIndex, uint16_t motion);
|
||||
const std::vector<uint32_t>* GetComboData(uint16_t mode, uint16_t comboType) const;
|
||||
|
||||
// Largest COLLISION_TYPE_DEFENDING sphere radius of the .msm AttachingData (0 when none).
|
||||
float GetDefendingRadius() const { return m_defendingRadius; }
|
||||
|
||||
private:
|
||||
float m_defendingRadius = 0.0f;
|
||||
uint32_t m_race = 0;
|
||||
std::string m_baseModelFileName, m_treeFileName, m_attributeFileName, m_smokeBoneName;
|
||||
std::string m_motionListFileName = "motlist.txt";
|
||||
@@ -175,6 +181,31 @@ bool ReadRaceResourceFile(const std::string& fileName, std::string* text);
|
||||
// .msa "MotionFileName" (CRaceMotionData::LoadMotionData); returns the gr2 path or "" on failure.
|
||||
std::string ReadMotionFileName(const std::string& msaFileName);
|
||||
|
||||
// CRaceMotionData::LoadMotionData combat payload (GameLib RaceMotionData.cpp, GameType.cpp
|
||||
// NRaceData::LoadMotionAttackData / THitData::Load). Loop data, motion events and sound are not read.
|
||||
struct RaceMotionData {
|
||||
enum { MOTION_TYPE_NONE, MOTION_TYPE_NORMAL, MOTION_TYPE_COMBO, MOTION_TYPE_SKILL };
|
||||
struct HitTimePosition { float last[3] = {}; float pos[3] = {}; }; // v3LastPosition / v3Position (local)
|
||||
struct HitData {
|
||||
float attackStartTime = 0.0f, attackEndTime = 0.0f, weaponLength = 0.0f;
|
||||
std::string boneName;
|
||||
std::map<float, HitTimePosition> hitPositions; // mapHitPosition, keyed by motion time
|
||||
};
|
||||
std::string motionFileName;
|
||||
float motionDuration = 0.0f;
|
||||
float accumulation[3] = {};
|
||||
bool isComboMotion = false;
|
||||
float inputStartTime = 0.0f, nextComboTime = 0.0f, inputEndTime = 0.0f; // pre / direct / limit
|
||||
bool isAttackingMotion = false;
|
||||
int attackType = 0, hittingType = 0, motionType = MOTION_TYPE_NONE, hitLimitCount = 0;
|
||||
float stiffenTime = 0.0f, invisibleTime = 0.0f, externalForce = 0.0f;
|
||||
std::vector<HitData> hitData;
|
||||
};
|
||||
// Parses an .msa text; false where CRaceMotionData::LoadMotionData fails.
|
||||
bool ParseRaceMotionData(const std::string& text, RaceMotionData* data);
|
||||
// Cached by .msa path (CResourceManager static cache); nullptr when the file is missing or invalid.
|
||||
const RaceMotionData* GetRaceMotionData(const std::string& msaFileName);
|
||||
|
||||
struct CRaceMotionData {
|
||||
using EName = RaceData::EMotion;
|
||||
enum {
|
||||
|
||||
@@ -1450,8 +1450,8 @@ void initchr() {
|
||||
PyModule_AddIntConstant(module, "MOTION_MODE_HORSE_FAN", 14);
|
||||
PyModule_AddIntConstant(module, "MOTION_MODE_HORSE_BELL", 15);
|
||||
PyModule_AddIntConstant(module, "MOTION_MODE_WEDDING_DRESS", 16);
|
||||
PyModule_AddIntConstant(module, "MOTION_MODE_CLAW", 17);
|
||||
PyModule_AddIntConstant(module, "MOTION_MODE_BOW_SPECIAL", 18);
|
||||
// AVA2 builds without ENABLE_WOLFMAN_CHARACTER: no MODE_CLAW, MODE_BOW_SPECIAL follows WEDDING_DRESS.
|
||||
PyModule_AddIntConstant(module, "MOTION_MODE_BOW_SPECIAL", 17);
|
||||
PyModule_AddIntConstant(module, "DIR_NORTH", 0);
|
||||
PyModule_AddIntConstant(module, "DIR_NORTHEAST", 1);
|
||||
PyModule_AddIntConstant(module, "DIR_EAST", 2);
|
||||
|
||||
@@ -984,6 +984,102 @@ bool GetPlayerMovementYaw(float cameraYaw, float& movementYaw) {
|
||||
movementYaw = std::fmod(movementYaw + 720.0f, 360.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
// CPythonPlayer::SetTarget(dwVID, FALSE) as CPythonPlayerEventHandler::OnHit calls it: a different
|
||||
// victim replaces the target only once the 1 s target hold has run out. CanChangeTarget and
|
||||
// IsTargetableInstance are not checked.
|
||||
static uint32_t s_targetEndTime = 0;
|
||||
static void SetPlayerHitTarget(uint32_t vid) {
|
||||
const uint32_t now = GetServerMSec();
|
||||
if (s_targetVID == vid) {
|
||||
s_targetEndTime = now + 1000;
|
||||
return;
|
||||
}
|
||||
if (s_targetEndTime > now) return;
|
||||
s_targetEndTime = now + 1000;
|
||||
s_targetVID = vid;
|
||||
PythonNetworkStream::Instance().SendTargetPacket(vid);
|
||||
}
|
||||
|
||||
static float s_attackCameraYaw = 0.0f;
|
||||
// CPythonPlayer::NEW_Attack + CInstanceBase::NEW_Attack(fDirRot). Not ported from __CanAttack:
|
||||
// emotion / private shop / observer / new-mount skill checks. Bow mode needs a live target (the
|
||||
// clickable-distance reserve and arrow flight are not ported).
|
||||
static bool PlayerNewAttack() {
|
||||
auto& manager = NetworkActorManager::Instance();
|
||||
auto* main = manager.GetMainInstance();
|
||||
if (!main || !main->m_pActorInstance) return false;
|
||||
auto& inst = *main->m_pActorInstance;
|
||||
if (!inst.CanAct() || inst.IsUsingSkill()) return false;
|
||||
float dirYaw = inst.GetYaw();
|
||||
if (inst.IsBowMode()) {
|
||||
const auto* target = s_targetVID ? manager.GetActorData(s_targetVID) : nullptr;
|
||||
if (!target || !target->m_pActorInstance || target->m_pActorInstance->IsDead()) {
|
||||
player_window_call("OnCannotUseSkill", Py_BuildValue("(is)", PythonNetworkStream::Instance().GetMainActorVID(), "NEED_TARGET"));
|
||||
return false;
|
||||
}
|
||||
if (!HasEnoughArrow()) return false;
|
||||
const float dx = target->m_pActorInstance->GetX() - inst.GetX();
|
||||
const float dz = target->m_pActorInstance->GetZ() - inst.GetZ();
|
||||
dirYaw = std::fmod(std::atan2(dx, dz) * 180.0f / 3.14159265f + 360.0f, 360.0f);
|
||||
} else if (!GetPlayerMovementYaw(s_attackCameraYaw, dirYaw)) {
|
||||
// No hand attacks while mounted without a direction.
|
||||
if (inst.IsMountingHorse() && inst.IsHandMode()) return false;
|
||||
dirYaw = inst.GetYaw();
|
||||
}
|
||||
// EndWalking / m_isGoing = FALSE.
|
||||
inst.ClearMoveTarget();
|
||||
inst.StopMoving();
|
||||
if (inst.IsPolymorph() || main->m_bType == 7) return inst.InputNormalAttackCommand(dirYaw);
|
||||
return inst.InputComboAttackCommand(dirYaw);
|
||||
}
|
||||
|
||||
bool IsPlayerAttacking() {
|
||||
auto* main = NetworkActorManager::Instance().GetMainInstance();
|
||||
return main && main->m_pActorInstance && main->m_pActorInstance->IsAttacking();
|
||||
}
|
||||
|
||||
bool ProcessPlayerAttack(float cameraYaw, float frameDt, bool wasMoving) {
|
||||
s_attackCameraYaw = cameraYaw;
|
||||
auto& manager = NetworkActorManager::Instance();
|
||||
auto* main = manager.GetMainInstance();
|
||||
if (!main || !main->m_pActorInstance) return false;
|
||||
auto& inst = *main->m_pActorInstance;
|
||||
inst.SetReportAttacks(true);
|
||||
// CInstanceBase::Update: ComboProcess, then CPythonPlayer input (m_isAtkKey -> NEW_Attack).
|
||||
inst.ComboProcess();
|
||||
if (s_isAtkKey) PlayerNewAttack();
|
||||
// CPythonPlayerEventHandler::OnAttack: SendCharacterStatePacket(pos, rot, FUNC_COMBO, motion).
|
||||
uint16_t motion;
|
||||
bool stopSent = false;
|
||||
while (inst.PopAttackMotion(&motion)) {
|
||||
// EndWalking reports the stop (FUNC_WAIT) before the attack state.
|
||||
if (wasMoving && !stopSent) {
|
||||
PythonNetworkStream::Instance().SendCharacterMovePacket(0, 0,
|
||||
uint8_t(std::fmod(inst.GetYaw() + 360.0f, 360.0f) / 5.0f),
|
||||
int32_t(inst.GetX()), int32_t(inst.GetZ()), GetServerMSec());
|
||||
stopSent = true;
|
||||
}
|
||||
PythonNetworkStream::Instance().SendCharacterMovePacket(3, uint8_t(motion),
|
||||
uint8_t(std::fmod(inst.GetYaw() + 360.0f, 360.0f) / 5.0f),
|
||||
int32_t(inst.GetX()), int32_t(inst.GetZ()), GetServerMSec());
|
||||
}
|
||||
// CInstanceBase::AttackProcess: hit-test every attackable instance (enemies and stones; PvP
|
||||
// rules are not ported). Each hit is OnHit: SetTarget + SendAttackPacket(0, vid).
|
||||
if (!inst.CanCheckAttacking()) return stopSent;
|
||||
for (const auto& [vid, victim] : manager.GetActorDict()) {
|
||||
if (vid == main->m_dwVID || !victim.m_pActorInstance) continue;
|
||||
if (victim.m_bType != 0 && victim.m_bType != 2) continue; // TYPE_ENEMY / TYPE_STONE
|
||||
const auto& v = *victim.m_pActorInstance;
|
||||
if (v.IsDead()) continue;
|
||||
if (inst.TestAttackHit(vid, v.GetX(), v.GetZ(), v.GetDefendingRadius(), frameDt, IsBossRace(victim.m_dwRace))) {
|
||||
SetPlayerHitTarget(vid);
|
||||
PythonNetworkStream::Instance().SendAttackPacket(0, vid);
|
||||
}
|
||||
}
|
||||
return stopSent;
|
||||
}
|
||||
|
||||
static float s_fCmrRotSpd = 0.0f;
|
||||
static uint32_t s_inGuildAreaID = 0xffffffff;
|
||||
|
||||
@@ -2594,6 +2690,7 @@ static PyObject* player_ClearTarget(PyObject*, PyObject*) {
|
||||
}
|
||||
|
||||
static PyObject* player_ComboAttack(PyObject*, PyObject*) {
|
||||
PlayerNewAttack();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,12 @@ void CancelPlayerMovement();
|
||||
void SetPlayerJoystick(bool active, float x, float y);
|
||||
// player.SetAttackKeyState for native input (touch attack button).
|
||||
void SetPlayerAttackKey(bool pressed);
|
||||
// Per frame, before movement: combo pre-input, held attack key (CPythonPlayer::NEW_Attack), FUNC_COMBO
|
||||
// state packets for started attack motions, and the attack hit test (SendAttackPacket). wasMoving:
|
||||
// a walk is in progress on the server; its stop packet is sent first. Returns true when it sent it.
|
||||
bool ProcessPlayerAttack(float cameraYaw, float frameDt, bool wasMoving);
|
||||
// The main actor is playing an attack motion (movement input is ignored meanwhile).
|
||||
bool IsPlayerAttacking();
|
||||
// True when handler is the window passed to player.SetGameWindow (game.GameWindow).
|
||||
bool IsPlayerGameWindow(const void* handler);
|
||||
void SetWeaponPower(uint32_t dwMinPower, uint32_t dwMaxPower, uint32_t dwMinMagicPower, uint32_t dwMaxMagicPower, uint32_t dwAddPower);
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
// Attack wiring (mobile step 3b): CRaceMotionData .msa parsing, the PythonPlayerSettingsModule combo
|
||||
// tables, the ActorInstanceBattle combo state machine and __NormalAttackProcess hit detection.
|
||||
#include "src/eter_render/ActorInstance.h"
|
||||
#include "src/eter_render/RaceData.h"
|
||||
#include "test_rundir.h"
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
using ava2::RaceData;
|
||||
using ava2::RaceMotionData;
|
||||
|
||||
bool Near(float a, float b, float eps = 1e-4f) { return std::fabs(a - b) < eps; }
|
||||
|
||||
void TestParse() {
|
||||
// Old single-hit layout (AttackingType key, no HitDataCount).
|
||||
const char* oldMsa =
|
||||
"ScriptType MotionData\n"
|
||||
"MotionFileName \"d:/ymir work/pc/warrior/general/attack.gr2\"\n"
|
||||
"MotionDuration 1.000000\n"
|
||||
"Group ComboInputData\n{\n"
|
||||
" PreInputTime 1.0\n DirectInputTime 1.0\n InputLimitTime 0.602564\n LinkTime 0.0\n}\n"
|
||||
"Group AttackingData\n{\n"
|
||||
" AttackingType 1\n HittingType 2\n StiffenTime 0.0\n InvisibleTime 0.5\n ExternalForce 0.0\n"
|
||||
" AttackingStartTime 0.456410\n AttackingEndTime 0.597436\n"
|
||||
" AttackingBone \"equip_right_hand\"\n WeaponLength 0.0\n"
|
||||
" List HitPosition\n {\n"
|
||||
" 0.456410 1.0 45.0 104.0 1.5 45.5 104.5\n"
|
||||
" 0.464744 -3.0 41.0 102.0 -3.5 41.5 102.5\n"
|
||||
" }\n}\n";
|
||||
RaceMotionData a;
|
||||
assert(ava2::ParseRaceMotionData(oldMsa, &a));
|
||||
assert(Near(a.motionDuration, 1.0f));
|
||||
assert(a.isComboMotion && Near(a.inputStartTime, 1.0f) && Near(a.nextComboTime, 1.0f) && Near(a.inputEndTime, 0.602564f));
|
||||
assert(a.isAttackingMotion && a.motionType == RaceMotionData::MOTION_TYPE_NORMAL);
|
||||
assert(a.attackType == 2 && a.hitLimitCount == 0); // AttackType missing: ATTACK_TYPE_SPLASH
|
||||
assert(Near(a.invisibleTime, 0.5f));
|
||||
assert(a.hitData.size() == 1 && a.hitData[0].boneName == "equip_right_hand");
|
||||
assert(Near(a.hitData[0].attackStartTime, 0.456410f) && a.hitData[0].hitPositions.size() == 2);
|
||||
const auto& first = a.hitData[0].hitPositions.begin()->second;
|
||||
assert(Near(first.last[0], 1.0f) && Near(first.last[1], 45.0f) && Near(first.pos[2], 104.5f));
|
||||
|
||||
// Grouped layout (MotionType + HitDataCount + HitDataNN), accumulation and hit limit.
|
||||
const char* groupMsa =
|
||||
"ScriptType MotionData\n"
|
||||
"MotionFileName \"d:/ymir work/pc2/warrior/onehand_sword/combo_03.gr2\"\n"
|
||||
"MotionDuration 1.066667\n"
|
||||
"Accumulation 0.00 -143.01 0.00\n"
|
||||
"Group ComboInputData\n{\n"
|
||||
" PreInputTime 0.084786\n DirectInputTime 0.418462\n InputLimitTime 0.664615\n LinkTime 0.06\n}\n"
|
||||
"Group AttackingData\n{\n"
|
||||
" AttackType 0\n HittingType 2\n StiffenTime 0.0\n InvisibleTime 0.2\n ExternalForce 5.0\n"
|
||||
" HitLimitCount 3\n MotionType 2\n HitDataCount 2\n"
|
||||
" Group HitData00\n {\n"
|
||||
" AttackingStartTime 0.18\n AttackingEndTime 0.52\n"
|
||||
" AttackingBone \"equip_right_hand\"\n WeaponLength 130.0\n"
|
||||
" List HitPosition\n {\n 0.180513 -31.0 -37.0 78.0 -88.0 77.0 55.0\n }\n }\n"
|
||||
" Group HitData01\n {\n"
|
||||
" AttackingStartTime 0.6\n AttackingEndTime 0.7\n"
|
||||
" AttackingBone \"equip_left_hand\"\n WeaponLength 0.0\n"
|
||||
" List HitPosition\n {\n 0.6 1 2 3 4 5 6\n 0.7 7 8 9 10 11 12\n }\n }\n"
|
||||
"}\n";
|
||||
RaceMotionData b;
|
||||
assert(ava2::ParseRaceMotionData(groupMsa, &b));
|
||||
assert(Near(b.accumulation[1], -143.01f));
|
||||
assert(Near(b.inputStartTime, 0.084786f) && Near(b.nextComboTime, 0.418462f) && Near(b.inputEndTime, 0.664615f));
|
||||
assert(b.motionType == RaceMotionData::MOTION_TYPE_COMBO && b.attackType == 0 && b.hitLimitCount == 3);
|
||||
assert(b.hitData.size() == 2);
|
||||
assert(b.hitData[1].boneName == "equip_left_hand" && b.hitData[1].hitPositions.size() == 2);
|
||||
assert(Near(b.hitData[1].hitPositions.rbegin()->second.pos[0], 10.0f));
|
||||
|
||||
// CRaceMotionData::LoadMotionData fails without MotionDuration.
|
||||
RaceMotionData c;
|
||||
assert(!ava2::ParseRaceMotionData("ScriptType MotionData\nMotionFileName \"x.gr2\"\n", &c));
|
||||
}
|
||||
|
||||
void TestComboTables() {
|
||||
const RaceData* warrior = ava2::RaceManager::Instance().GetRaceDataPointer(0);
|
||||
assert(warrior);
|
||||
const auto* type1 = warrior->GetComboData(2, 0); // MODE_ONEHAND_SWORD, COMBO_TYPE_1
|
||||
assert(type1 && type1->size() == 4);
|
||||
for (uint32_t k = 0; k < 4; ++k) assert((*type1)[k] == RaceData::NAME_COMBO_ATTACK_1 + k);
|
||||
const auto* type2 = warrior->GetComboData(2, 1);
|
||||
assert(type2 && type2->size() == 5 && type2->back() == RaceData::NAME_COMBO_ATTACK_7);
|
||||
const auto* type3 = warrior->GetComboData(2, 2);
|
||||
assert(type3 && type3->size() == 6 && type3->back() == RaceData::NAME_COMBO_ATTACK_4);
|
||||
// Horse weapon combos are three swings.
|
||||
const auto* horse = warrior->GetComboData(10, 0);
|
||||
assert(horse && horse->size() == 3);
|
||||
|
||||
const auto* motions = warrior->GetMotions(2, RaceData::NAME_COMBO_ATTACK_2);
|
||||
assert(motions && !motions->empty());
|
||||
const RaceMotionData* combo2 = ava2::GetRaceMotionData(motions->front().fileName);
|
||||
assert(combo2 && combo2->isComboMotion && combo2->isAttackingMotion);
|
||||
assert(combo2->motionType == RaceMotionData::MOTION_TYPE_COMBO);
|
||||
assert(!combo2->hitData.empty() && !combo2->hitData[0].hitPositions.empty());
|
||||
// Cached by path.
|
||||
assert(ava2::GetRaceMotionData(motions->front().fileName) == combo2);
|
||||
}
|
||||
|
||||
// Advances the current motion to motion time t (attack speed 1).
|
||||
void AdvanceTo(ava2::ActorInstance& actor, float t) {
|
||||
const float dt = t - actor.GetAttackingElapsedTime();
|
||||
assert(dt > 0.0f);
|
||||
actor.Update(dt);
|
||||
assert(Near(actor.GetAttackingElapsedTime(), t, 1e-3f));
|
||||
}
|
||||
|
||||
void TestComboStateMachine(const char* model) {
|
||||
ava2::ActorInstance actor;
|
||||
assert(actor.SetRace(0));
|
||||
assert(actor.SetModel(model));
|
||||
actor.SetMotionMode(2);
|
||||
assert(actor.PlayMotion(ava2::MotionType::Wait, true));
|
||||
actor.SetReportAttacks(true);
|
||||
actor.SetAttackSpeed(1.0f);
|
||||
|
||||
uint16_t motion = 0;
|
||||
assert(actor.GetComboIndex() == 0 && !actor.PopAttackMotion(&motion));
|
||||
// First input starts combo 1 facing the input direction and reports it.
|
||||
assert(actor.InputComboAttackCommand(90.0f));
|
||||
assert(actor.GetComboIndex() == 1);
|
||||
assert(actor.PopAttackMotion(&motion) && motion == RaceData::NAME_COMBO_ATTACK_1);
|
||||
assert(!actor.PopAttackMotion(&motion));
|
||||
assert(actor.IsAttacking() && actor.CanCheckAttacking());
|
||||
const RaceMotionData* m1 = actor.GetCurrentRaceMotionData();
|
||||
assert(m1 && m1->isComboMotion);
|
||||
assert(m1->inputStartTime < m1->nextComboTime && m1->nextComboTime < m1->inputEndTime);
|
||||
|
||||
// Before PreInputTime the input is ignored.
|
||||
AdvanceTo(actor, m1->inputStartTime * 0.5f);
|
||||
assert(!actor.InputComboAttackCommand(90.0f) && actor.GetComboIndex() == 1);
|
||||
// Between PreInputTime and DirectInputTime it is buffered; ComboProcess fires it at DirectInputTime.
|
||||
AdvanceTo(actor, (m1->inputStartTime + m1->nextComboTime) * 0.5f);
|
||||
assert(!actor.InputComboAttackCommand(90.0f));
|
||||
actor.ComboProcess();
|
||||
assert(actor.GetComboIndex() == 1 && !actor.PopAttackMotion(&motion));
|
||||
AdvanceTo(actor, (m1->nextComboTime + m1->inputEndTime) * 0.5f);
|
||||
actor.ComboProcess();
|
||||
assert(actor.GetComboIndex() == 2);
|
||||
assert(actor.PopAttackMotion(&motion) && motion == RaceData::NAME_COMBO_ATTACK_2);
|
||||
assert(Near(actor.GetAttackingElapsedTime(), 0.0f));
|
||||
|
||||
// After DirectInputTime a direct input chains immediately.
|
||||
const RaceMotionData* m2 = actor.GetCurrentRaceMotionData();
|
||||
assert(m2 && m2 != m1);
|
||||
AdvanceTo(actor, (m2->nextComboTime + m2->inputEndTime) * 0.5f);
|
||||
assert(actor.InputComboAttackCommand(90.0f));
|
||||
assert(actor.GetComboIndex() == 3);
|
||||
assert(actor.PopAttackMotion(&motion) && motion == RaceData::NAME_COMBO_ATTACK_3);
|
||||
|
||||
// Past InputLimitTime the combo can no longer continue.
|
||||
const RaceMotionData* m3 = actor.GetCurrentRaceMotionData();
|
||||
AdvanceTo(actor, std::min(m3->motionDuration * 0.99f, m3->inputEndTime + 0.02f));
|
||||
assert(!actor.InputComboAttackCommand(90.0f) && actor.GetComboIndex() == 3);
|
||||
assert(!actor.PopAttackMotion(&motion));
|
||||
|
||||
// Attack speed scales the motion clock of attack motions.
|
||||
ava2::ActorInstance fast;
|
||||
assert(fast.SetRace(0) && fast.SetModel(model));
|
||||
fast.SetMotionMode(2);
|
||||
assert(fast.PlayMotion(ava2::MotionType::Wait, true));
|
||||
fast.SetAttackSpeed(1.5f);
|
||||
assert(fast.InputComboAttackCommand(0.0f));
|
||||
fast.Update(0.1f);
|
||||
assert(Near(fast.GetAttackingElapsedTime(), 0.15f, 1e-3f));
|
||||
|
||||
// Without SetReportAttacks nothing is queued (remote actors).
|
||||
ava2::ActorInstance remote;
|
||||
assert(remote.SetRace(0) && remote.SetModel(model));
|
||||
remote.SetMotionMode(2);
|
||||
assert(remote.PlayMotion(ava2::MotionType::Wait, true));
|
||||
assert(remote.RunComboAttack(45.0f, RaceData::NAME_COMBO_ATTACK_2));
|
||||
assert(remote.GetCurrentMotion() == ava2::MotionType(RaceData::NAME_COMBO_ATTACK_2));
|
||||
assert(!remote.PopAttackMotion(&motion));
|
||||
}
|
||||
|
||||
void TestHitDetection(const char* model) {
|
||||
for (float yaw : {0.0f, 90.0f}) {
|
||||
ava2::ActorInstance actor;
|
||||
assert(actor.SetRace(0) && actor.SetModel(model));
|
||||
actor.SetMotionMode(2);
|
||||
assert(actor.PlayMotion(ava2::MotionType::Wait, true));
|
||||
const float px = 1000.0f, pz = 2000.0f;
|
||||
actor.SetPosition(px, 0.0f, pz);
|
||||
assert(!actor.CanCheckAttacking());
|
||||
assert(!actor.TestAttackHit(7, px, pz, 50.0f, 0.05f)); // waiting: no attacking motion
|
||||
assert(actor.InputComboAttackCommand(yaw));
|
||||
const RaceMotionData* m = actor.GetCurrentRaceMotionData();
|
||||
assert(m && !m->hitData.empty());
|
||||
const auto key = *m->hitData[0].hitPositions.begin();
|
||||
AdvanceTo(actor, key.first + 0.01f);
|
||||
// Graphic local (x, y) rotated by the yaw, port Z = -graphic y.
|
||||
const float* p = key.second.pos;
|
||||
float vx, vz;
|
||||
if (yaw == 0.0f) { vx = px + p[0]; vz = pz - p[1]; }
|
||||
else { vx = px - p[1]; vz = pz - p[0]; }
|
||||
// A victim at the blade position is hit once per combo motion.
|
||||
assert(actor.TestAttackHit(7, vx, vz, 50.0f, 0.05f));
|
||||
assert(!actor.TestAttackHit(7, vx, vz, 50.0f, 0.05f));
|
||||
// Another victim at the same spot is still hit.
|
||||
assert(actor.TestAttackHit(8, vx, vz, 50.0f, 0.05f));
|
||||
// On the far side of the actor the swing does not reach.
|
||||
const float ox = px - (vx - px) / std::hypot(vx - px, vz - pz) * 250.0f;
|
||||
const float oz = pz - (vz - pz) / std::hypot(vx - px, vz - pz) * 250.0f;
|
||||
assert(!actor.TestAttackHit(9, ox, oz, 50.0f, 0.05f));
|
||||
// Out of the 300 range (500 for huge victims) nothing is tested.
|
||||
assert(!actor.TestAttackHit(10, px + 400.0f, pz, 500.0f, 0.05f));
|
||||
// The next combo motion clears the hit map: victim 7 can be hit again by its swing.
|
||||
actor.SetReportAttacks(true);
|
||||
AdvanceTo(actor, (m->nextComboTime + m->inputEndTime) * 0.5f);
|
||||
assert(actor.InputComboAttackCommand(yaw) && actor.GetComboIndex() == 2);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
TestParse();
|
||||
std::cout << "msa parsing ok\n";
|
||||
if (argc < 2) return 0;
|
||||
if (!ava2_test::EnterTestRunDir()) return ava2_test::kSkip;
|
||||
ava2::RaceManager::Instance().LoadPlayerRaces();
|
||||
if (!ava2::RaceManager::Instance().GetRaceDataPointer(0)) {
|
||||
std::cerr << "SKIP: player races missing from the run directory\n";
|
||||
return ava2_test::kSkip;
|
||||
}
|
||||
TestComboTables();
|
||||
TestComboStateMachine(argv[1]);
|
||||
TestHitDetection(argv[1]);
|
||||
std::cout << "Attack combos, timings and hit detection follow the original\n";
|
||||
return 0;
|
||||
}
|
||||
@@ -444,7 +444,7 @@ int main(int argc,char** argv) {
|
||||
"assert player.GetStatus(player.LEVEL) == 99\n"
|
||||
"assert player.GetMainCharacterPosition() == (0.0, 0.0, 0.0)\n"
|
||||
"assert chr.AFFECT_BLEEDING == 42\n"
|
||||
"assert chr.MOTION_MODE_CLAW == 17\n"
|
||||
"assert chr.MOTION_MODE_BOW_SPECIAL == 17 and not hasattr(chr, 'MOTION_MODE_CLAW')\n"
|
||||
"assert chrmgr.NAMECOLOR_TOURNAMENT_TEAM_A == 32\n"
|
||||
"assert chrmgr.EFFECT_ELEMENTS_WEAPON == 280\n"
|
||||
"import privateShopSearch\n"
|
||||
|
||||
Reference in New Issue
Block a user