Align AVA2 Windows behavior and improve mobile touch interactions
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
// Port of AVA2 UserInterface/PythonNetworkStreamCommand.cpp (ServerCommand / SplitToken)
|
||||
// and the emoticon helpers from PythonNetworkStreamPhaseGame.cpp / PythonNetworkStream.cpp.
|
||||
// Commands that only forward to the game window are 1:1; commands that need actor/effect
|
||||
// state the port does not have yet (emotions, StoneDetect, stamina) are TraceError'd and
|
||||
// listed in docs/WINDOWS-PARITY.md.
|
||||
// Commands forward to the game window or actor/effect systems. Dual-emotion
|
||||
// blend/collision and complete TCP scheduling limits are tracked in the parity docs.
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "ava2_text_file.h"
|
||||
#include "shared/common/PythonUtils.h"
|
||||
#include "NetworkActorManager.h"
|
||||
#include "eter_render/RaceData.h"
|
||||
#include "python_gameplay_modules.h"
|
||||
#include "eter_effect/EffectManager.h"
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
@@ -169,17 +170,30 @@ void PythonNetworkStream::ServerCommand(const std::string& command) {
|
||||
} else if (!strcasecmp(szCmd, "StoneDetect")) {
|
||||
if (4 != TokenVector.size()) { strangeCount(); return; }
|
||||
// Needs CInstanceBase pixel position + CEffectManager compass effects.
|
||||
TraceError("ServerCommand StoneDetect not ported (effect): " + command);
|
||||
const auto* actor=NetworkActorManager::Instance().GetActorData(uint32_t(atoi(arg(1))));
|
||||
if(!actor || !actor->m_pActorInstance) {TraceError("StoneDetect: missing actor");return;}
|
||||
const uint8_t distance=uint8_t(atoi(arg(2)));
|
||||
const float angle=std::fmod(540.0f-float(atof(arg(3))),360.0f);
|
||||
if(distance>3 || !std::isfinite(angle)) {TraceError("StoneDetect: invalid distance/angle");return;}
|
||||
static const char* filenames[]={
|
||||
"d:/ymir work/effect/etc/firecracker/find_out.mse",
|
||||
"d:/ymir work/effect/etc/compass/appear_small.mse",
|
||||
"d:/ymir work/effect/etc/compass/appear_middle.mse",
|
||||
"d:/ymir work/effect/etc/compass/appear_large.mse"};
|
||||
const auto& instance=*actor->m_pActorInstance;
|
||||
EffectManager::Instance().CreateEffect(filenames[distance],instance.GetX(),instance.GetY(),instance.GetZ(),angle);
|
||||
} else if (!strcasecmp(szCmd, "StartStaminaConsume")) {
|
||||
if (3 != TokenVector.size()) { strangeCount(); return; }
|
||||
TraceError("ServerCommand StartStaminaConsume not ported (player stamina): " + command);
|
||||
StartPlayerStaminaConsume(uint32_t(atoi(arg(1))),uint32_t(atoi(arg(2))));
|
||||
} else if (!strcasecmp(szCmd, "StopStaminaConsume")) {
|
||||
if (2 != TokenVector.size()) { strangeCount(); return; }
|
||||
TraceError("ServerCommand StopStaminaConsume not ported (player stamina): " + command);
|
||||
StopPlayerStaminaConsume(uint32_t(atoi(arg(1))));
|
||||
} else if (!strcasecmp(szCmd, "sms")) {
|
||||
m_bMobileFlag = true;
|
||||
RefreshPlayerMobile();
|
||||
} else if (!strcasecmp(szCmd, "nosms")) {
|
||||
m_bMobileFlag = false;
|
||||
RefreshPlayerMobile();
|
||||
} else if (!strcasecmp(szCmd, "mobile_auth")) {
|
||||
call("OnMobileAuthority", Py_BuildValue("()"));
|
||||
} else if (!strcasecmp(szCmd, "messenger_auth")) {
|
||||
@@ -198,7 +212,7 @@ void PythonNetworkStream::ServerCommand(const std::string& command) {
|
||||
auto pInstance1 = NetworkActorManager::Instance().GetActorInstance(iVID1);
|
||||
auto pInstance2 = NetworkActorManager::Instance().GetActorInstance(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_FRENCH_KISS_START, CRaceMotionData::NAME_FRENCH_KISS_START);
|
||||
NetworkActorManager::Instance().BeginDualEmotion(uint32_t(iVID1),uint32_t(iVID2),CRaceMotionData::NAME_FRENCH_KISS_START,CRaceMotionData::NAME_FRENCH_KISS_START);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "kiss")) {
|
||||
if (TokenVector.size() >= 3) {
|
||||
@@ -207,7 +221,7 @@ void PythonNetworkStream::ServerCommand(const std::string& command) {
|
||||
auto pInstance1 = NetworkActorManager::Instance().GetActorInstance(iVID1);
|
||||
auto pInstance2 = NetworkActorManager::Instance().GetActorInstance(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_KISS_START, CRaceMotionData::NAME_KISS_START);
|
||||
NetworkActorManager::Instance().BeginDualEmotion(uint32_t(iVID1),uint32_t(iVID2),CRaceMotionData::NAME_KISS_START,CRaceMotionData::NAME_KISS_START);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "slap")) {
|
||||
if (TokenVector.size() >= 3) {
|
||||
@@ -216,7 +230,7 @@ void PythonNetworkStream::ServerCommand(const std::string& command) {
|
||||
auto pInstance1 = NetworkActorManager::Instance().GetActorInstance(iVID1);
|
||||
auto pInstance2 = NetworkActorManager::Instance().GetActorInstance(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_SLAP_HURT_START, CRaceMotionData::NAME_SLAP_HIT_START);
|
||||
NetworkActorManager::Instance().BeginDualEmotion(uint32_t(iVID1),uint32_t(iVID2),CRaceMotionData::NAME_SLAP_HURT_START,CRaceMotionData::NAME_SLAP_HIT_START);
|
||||
}
|
||||
} else if (!strcasecmp(szCmd, "clap")) {
|
||||
if (TokenVector.size() >= 2) {
|
||||
|
||||
Reference in New Issue
Block a user