This commit is contained in:
Jack Andersen 2017-01-28 17:58:38 -10:00
commit 7586142991
5 changed files with 157 additions and 168 deletions

View File

@ -62,17 +62,18 @@ void CIOWinManager::Draw() const
bool CIOWinManager::DistributeOneMessage(const CArchitectureMessage& msg, bool CIOWinManager::DistributeOneMessage(const CArchitectureMessage& msg,
CArchitectureQueue& queue) CArchitectureQueue& queue)
{ {
CArchitectureMessage tmpMsg = msg;
for (IOWinPQNode* node = x4_pumpRoot ; node ; node = node->x8_next) for (IOWinPQNode* node = x4_pumpRoot ; node ; node = node->x8_next)
{ {
CIOWin* iow = node->GetIOWin(); CIOWin* iow = node->GetIOWin();
CIOWin::EMessageReturn mret = iow->OnMessage(msg, x8_localGatherQueue); CIOWin::EMessageReturn mret = iow->OnMessage(tmpMsg, x8_localGatherQueue);
while (x8_localGatherQueue) while (x8_localGatherQueue)
{ {
CArchitectureMessage msg = x8_localGatherQueue.Pop(); tmpMsg = x8_localGatherQueue.Pop();
if (msg.GetTarget() == EArchMsgTarget::IOWinManager) if (tmpMsg.GetTarget() == EArchMsgTarget::IOWinManager)
{ {
if (OnIOWinMessage(msg)) if (OnIOWinMessage(tmpMsg))
{ {
x8_localGatherQueue.Clear(); x8_localGatherQueue.Clear();
queue.Clear(); queue.Clear();
@ -80,7 +81,7 @@ bool CIOWinManager::DistributeOneMessage(const CArchitectureMessage& msg,
} }
} }
else else
queue.Push(std::move(msg)); queue.Push(std::move(tmpMsg));
} }
switch (mret) switch (mret)

View File

@ -16,7 +16,7 @@ class CIOWinManager
{ {
std::shared_ptr<CIOWin> x0_iowin; std::shared_ptr<CIOWin> x0_iowin;
int x4_prio; int x4_prio;
CIOWinManager::IOWinPQNode* x8_next; CIOWinManager::IOWinPQNode* x8_next = nullptr;
IOWinPQNode(std::weak_ptr<CIOWin> iowin, int prio, IOWinPQNode(std::weak_ptr<CIOWin> iowin, int prio,
CIOWinManager::IOWinPQNode* next) CIOWinManager::IOWinPQNode* next)
: x0_iowin(iowin), x4_prio(prio), x8_next(next) {} : x0_iowin(iowin), x4_prio(prio), x8_next(next) {}

View File

@ -5,96 +5,97 @@ namespace urde
{ {
CFinalInput::CFinalInput() CFinalInput::CFinalInput()
: x0_dt(0.0), : x0_dt(0.0)
x4_controllerIdx(0), , x4_controllerIdx(0)
x8_anaLeftX(0.0), , x8_anaLeftX(0.0)
xc_anaLeftY(0.0), , xc_anaLeftY(0.0)
x10_anaRightX(0.0), , x10_anaRightX(0.0)
x14_anaRightY(0.0), , x14_anaRightY(0.0)
x18_anaLeftTrigger(0.0), , x18_anaLeftTrigger(0.0)
x1c_anaRightTrigger(0.0), , x1c_anaRightTrigger(0.0)
x20_enableAnaLeftXP(false), , x20_enableAnaLeftXP(false)
x20_enableAnaLeftNegXP(false), , x20_enableAnaLeftNegXP(false)
x21_enableAnaLeftYP(false), , x21_enableAnaLeftYP(false)
x21_enableAnaLeftNegYP(false), , x21_enableAnaLeftNegYP(false)
x22_enableAnaRightXP(false), , x22_enableAnaRightXP(false)
x22_enableAnaRightNegXP(false), , x22_enableAnaRightNegXP(false)
x23_enableAnaRightYP(false), , x23_enableAnaRightYP(false)
x23_enableAnaRightNegYP(false), , x23_enableAnaRightNegYP(false)
x24_anaLeftTriggerP(false), , x24_anaLeftTriggerP(false)
x28_anaRightTriggerP(false), , x28_anaRightTriggerP(false)
x2c_b24_A(false), , x2c_b24_A(false)
x2c_b25_B(false), , x2c_b25_B(false)
x2c_b26_X(false), , x2c_b26_X(false)
x2c_b27_Y(false), , x2c_b27_Y(false)
x2c_b28_Z(false), , x2c_b28_Z(false)
x2c_b29_L(false), , x2c_b29_L(false)
x2c_b30_R(false), , x2c_b30_R(false)
x2c_b31_DPUp(false), , x2c_b31_DPUp(false)
x2d_b24_DPRight(false), , x2d_b24_DPRight(false)
x2d_b25_DPDown(false), , x2d_b25_DPDown(false)
x2d_b26_DPLeft(false), , x2d_b26_DPLeft(false)
x2d_b27_Start(false), , x2d_b27_Start(false)
x2d_b28_PA(false), , x2d_b28_PA(false)
x2d_b29_PB(false), , x2d_b29_PB(false)
x2d_b30_PX(false), , x2d_b30_PX(false)
x2d_b31_PY(false), , x2d_b31_PY(false)
x2e_b24_PZ(false), , x2e_b24_PZ(false)
x2e_b25_PL(false), , x2e_b25_PL(false)
x2e_b26_PR(false), , x2e_b26_PR(false)
x2e_b27_PDPUp(false), , x2e_b27_PDPUp(false)
x2e_b28_PDPRight(false), , x2e_b28_PDPRight(false)
x2e_b29_PDPDown(false), , x2e_b29_PDPDown(false)
x2e_b30_PDPLeft(false), , x2e_b30_PDPLeft(false)
x2e_b31_PStart(false) {} , x2e_b31_PStart(false)
{
}
CFinalInput::CFinalInput(int cIdx, float dt, const boo::DolphinControllerState& data, const CFinalInput& prevInput,
CFinalInput::CFinalInput(int cIdx, float dt,
const boo::DolphinControllerState& data,
const CFinalInput& prevInput,
float leftDiv, float rightDiv) float leftDiv, float rightDiv)
: x0_dt(dt), : x0_dt(dt)
x4_controllerIdx(cIdx), , x4_controllerIdx(cIdx)
x8_anaLeftX(zeus::clamp(-1.0f, data.m_leftStick[0] / 72.0f / leftDiv, 1.0f)), , x8_anaLeftX(zeus::clamp(-1.0f, data.m_leftStick[0] / 72.0f / leftDiv, 1.0f))
xc_anaLeftY(zeus::clamp(-1.0f, data.m_leftStick[1] / 72.0f / leftDiv, 1.0f)), , xc_anaLeftY(zeus::clamp(-1.0f, data.m_leftStick[1] / 72.0f / leftDiv, 1.0f))
x10_anaRightX(zeus::clamp(-1.0f, data.m_rightStick[0] / 59.0f / rightDiv, 1.0f)), , x10_anaRightX(zeus::clamp(-1.0f, data.m_rightStick[0] / 59.0f / rightDiv, 1.0f))
x14_anaRightY(zeus::clamp(-1.0f, data.m_rightStick[0] / 59.0f / rightDiv, 1.0f)), , x14_anaRightY(zeus::clamp(-1.0f, data.m_rightStick[1] / 59.0f / rightDiv, 1.0f))
x18_anaLeftTrigger(data.m_analogTriggers[0] * 0.0066666668), , x18_anaLeftTrigger(data.m_analogTriggers[0] * 0.007f)
x1c_anaRightTrigger(data.m_analogTriggers[1] * 0.0066666668), , x1c_anaRightTrigger(data.m_analogTriggers[1] * 0.007f)
x20_enableAnaLeftXP(DLARight() && !prevInput.DLARight()), , x20_enableAnaLeftXP(DLARight() && !prevInput.DLARight())
x20_enableAnaLeftNegXP(DLALeft() && !prevInput.DLALeft()), , x20_enableAnaLeftNegXP(DLALeft() && !prevInput.DLALeft())
x21_enableAnaLeftYP(DLAUp() && !prevInput.DLAUp()), , x21_enableAnaLeftYP(DLAUp() && !prevInput.DLAUp())
x21_enableAnaLeftNegYP(DLADown() && !prevInput.DLADown()), , x21_enableAnaLeftNegYP(DLADown() && !prevInput.DLADown())
x22_enableAnaRightXP(DRARight() && !prevInput.DRARight()), , x22_enableAnaRightXP(DRARight() && !prevInput.DRARight())
x22_enableAnaRightNegXP(DRALeft() && !prevInput.DRALeft()), , x22_enableAnaRightNegXP(DRALeft() && !prevInput.DRALeft())
x23_enableAnaRightYP(DRAUp() && !prevInput.DRAUp()), , x23_enableAnaRightYP(DRAUp() && !prevInput.DRAUp())
x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown()), , x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown())
x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger()), , x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger())
x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger()), , x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger())
x2c_b24_A(data.m_btns & uint16_t(boo::EDolphinControllerButtons::A)), , x2c_b24_A(data.m_btns & uint16_t(boo::EDolphinControllerButtons::A))
x2c_b25_B(data.m_btns & uint16_t(boo::EDolphinControllerButtons::B)), , x2c_b25_B(data.m_btns & uint16_t(boo::EDolphinControllerButtons::B))
x2c_b26_X(data.m_btns & uint16_t(boo::EDolphinControllerButtons::X)), , x2c_b26_X(data.m_btns & uint16_t(boo::EDolphinControllerButtons::X))
x2c_b27_Y(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Y)), , x2c_b27_Y(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Y))
x2c_b28_Z(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Z)), , x2c_b28_Z(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Z))
x2c_b29_L(data.m_btns & uint16_t(boo::EDolphinControllerButtons::L)), , x2c_b29_L(data.m_btns & uint16_t(boo::EDolphinControllerButtons::L))
x2c_b30_R(data.m_btns & uint16_t(boo::EDolphinControllerButtons::R)), , x2c_b30_R(data.m_btns & uint16_t(boo::EDolphinControllerButtons::R))
x2c_b31_DPUp(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Up)), , x2c_b31_DPUp(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Up))
x2d_b24_DPRight(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Right)), , x2d_b24_DPRight(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Right))
x2d_b25_DPDown(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Down)), , x2d_b25_DPDown(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Down))
x2d_b26_DPLeft(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Left)), , x2d_b26_DPLeft(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Left))
x2d_b27_Start(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Start)), , x2d_b27_Start(data.m_btns & uint16_t(boo::EDolphinControllerButtons::Start))
x2d_b28_PA(DA() && !prevInput.DA()), , x2d_b28_PA(DA() && !prevInput.DA())
x2d_b29_PB(DB() && !prevInput.DB()), , x2d_b29_PB(DB() && !prevInput.DB())
x2d_b30_PX(DX() && !prevInput.DX()), , x2d_b30_PX(DX() && !prevInput.DX())
x2d_b31_PY(DY() && !prevInput.DY()), , x2d_b31_PY(DY() && !prevInput.DY())
x2e_b24_PZ(DZ() && !prevInput.DZ()), , x2e_b24_PZ(DZ() && !prevInput.DZ())
x2e_b25_PL(DL() && !prevInput.DL()), , x2e_b25_PL(DL() && !prevInput.DL())
x2e_b26_PR(DR() && !prevInput.DR()), , x2e_b26_PR(DR() && !prevInput.DR())
x2e_b27_PDPUp(DDPUp() && !prevInput.DDPUp()), , x2e_b27_PDPUp(DDPUp() && !prevInput.DDPUp())
x2e_b28_PDPRight(DDPRight() && !prevInput.DDPRight()), , x2e_b28_PDPRight(DDPRight() && !prevInput.DDPRight())
x2e_b29_PDPDown(DDPDown() && !prevInput.DDPDown()), , x2e_b29_PDPDown(DDPDown() && !prevInput.DDPDown())
x2e_b30_PDPLeft(DDPLeft() && !prevInput.DDPLeft()), , x2e_b30_PDPLeft(DDPLeft() && !prevInput.DDPLeft())
x2e_b31_PStart(DStart() && !prevInput.DStart()) {} , x2e_b31_PStart(DStart() && !prevInput.DStart())
{
}
static float KBToAnaLeftX(const CKeyboardMouseControllerData& data) static float KBToAnaLeftX(const CKeyboardMouseControllerData& data)
{ {
@ -136,51 +137,49 @@ static float KBToAnaRightY(const CKeyboardMouseControllerData& data)
return retval; return retval;
} }
CFinalInput::CFinalInput(int cIdx, float dt, CFinalInput::CFinalInput(int cIdx, float dt, const CKeyboardMouseControllerData& data, const CFinalInput& prevInput)
const CKeyboardMouseControllerData& data, : x0_dt(dt)
const CFinalInput& prevInput) , x4_controllerIdx(cIdx)
: x0_dt(dt), , x8_anaLeftX(KBToAnaLeftX(data))
x4_controllerIdx(cIdx), , xc_anaLeftY(KBToAnaLeftY(data))
x8_anaLeftX(KBToAnaLeftX(data)), , x10_anaRightX(KBToAnaRightX(data))
xc_anaLeftY(KBToAnaLeftY(data)), , x14_anaRightY(KBToAnaRightY(data))
x10_anaRightX(KBToAnaRightX(data)), , x18_anaLeftTrigger(data.m_charKeys['q'] ? 1.0 : 0.0)
x14_anaRightY(KBToAnaRightY(data)), , x1c_anaRightTrigger(data.m_charKeys['e'] ? 1.0 : 0.0)
x18_anaLeftTrigger(data.m_charKeys['q'] ? 1.0 : 0.0), , x20_enableAnaLeftXP(DLARight() && !prevInput.DLARight())
x1c_anaRightTrigger(data.m_charKeys['e'] ? 1.0 : 0.0), , x20_enableAnaLeftNegXP(DLALeft() && !prevInput.DLALeft())
x20_enableAnaLeftXP(DLARight() && !prevInput.DLARight()), , x21_enableAnaLeftYP(DLAUp() && !prevInput.DLAUp())
x20_enableAnaLeftNegXP(DLALeft() && !prevInput.DLALeft()), , x21_enableAnaLeftNegYP(DLADown() && !prevInput.DLADown())
x21_enableAnaLeftYP(DLAUp() && !prevInput.DLAUp()), , x22_enableAnaRightXP(DRARight() && !prevInput.DRARight())
x21_enableAnaLeftNegYP(DLADown() && !prevInput.DLADown()), , x22_enableAnaRightNegXP(DRALeft() && !prevInput.DRALeft())
x22_enableAnaRightXP(DRARight() && !prevInput.DRARight()), , x23_enableAnaRightYP(DRAUp() && !prevInput.DRAUp())
x22_enableAnaRightNegXP(DRALeft() && !prevInput.DRALeft()), , x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown())
x23_enableAnaRightYP(DRAUp() && !prevInput.DRAUp()), , x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger())
x23_enableAnaRightNegYP(DRADown() && !prevInput.DRADown()), , x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger())
x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger()), , x2c_b24_A(data.m_mouseButtons[int(boo::EMouseButton::Primary)])
x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger()), , x2c_b25_B(data.m_charKeys[' '])
x2c_b24_A(data.m_mouseButtons[int(boo::EMouseButton::Primary)]), , x2c_b26_X(data.m_charKeys['c'])
x2c_b25_B(data.m_charKeys[' ']), , x2c_b27_Y(data.m_mouseButtons[int(boo::EMouseButton::Secondary)])
x2c_b26_X(data.m_charKeys['c']), , x2c_b28_Z(data.m_charKeys['\t'])
x2c_b27_Y(data.m_mouseButtons[int(boo::EMouseButton::Secondary)]), , x2c_b29_L(data.m_charKeys['q'])
x2c_b28_Z(data.m_charKeys['\t']), , x2c_b30_R(data.m_charKeys['e'])
x2c_b29_L(data.m_charKeys['q']), , x2c_b31_DPUp(data.m_specialKeys[int(boo::ESpecialKey::Up)])
x2c_b30_R(data.m_charKeys['e']), , x2d_b24_DPRight(data.m_specialKeys[int(boo::ESpecialKey::Right)])
x2c_b31_DPUp(data.m_specialKeys[int(boo::ESpecialKey::Up)]), , x2d_b25_DPDown(data.m_specialKeys[int(boo::ESpecialKey::Down)])
x2d_b24_DPRight(data.m_specialKeys[int(boo::ESpecialKey::Right)]), , x2d_b26_DPLeft(data.m_specialKeys[int(boo::ESpecialKey::Left)])
x2d_b25_DPDown(data.m_specialKeys[int(boo::ESpecialKey::Down)]), , x2d_b27_Start(data.m_specialKeys[int(boo::ESpecialKey::Esc)])
x2d_b26_DPLeft(data.m_specialKeys[int(boo::ESpecialKey::Left)]), , x2d_b28_PA(DA() && !prevInput.DA())
x2d_b27_Start(data.m_specialKeys[int(boo::ESpecialKey::Esc)]), , x2d_b29_PB(DB() && !prevInput.DB())
x2d_b28_PA(DA() && !prevInput.DA()), , x2d_b30_PX(DX() && !prevInput.DX())
x2d_b29_PB(DB() && !prevInput.DB()), , x2d_b31_PY(DY() && !prevInput.DY())
x2d_b30_PX(DX() && !prevInput.DX()), , x2e_b24_PZ(DZ() && !prevInput.DZ())
x2d_b31_PY(DY() && !prevInput.DY()), , x2e_b25_PL(DL() && !prevInput.DL())
x2e_b24_PZ(DZ() && !prevInput.DZ()), , x2e_b26_PR(DR() && !prevInput.DR())
x2e_b25_PL(DL() && !prevInput.DL()), , x2e_b27_PDPUp(DDPUp() && !prevInput.DDPUp())
x2e_b26_PR(DR() && !prevInput.DR()), , x2e_b28_PDPRight(DDPRight() && !prevInput.DDPRight())
x2e_b27_PDPUp(DDPUp() && !prevInput.DDPUp()), , x2e_b29_PDPDown(DDPDown() && !prevInput.DDPDown())
x2e_b28_PDPRight(DDPRight() && !prevInput.DDPRight()), , x2e_b30_PDPLeft(DDPLeft() && !prevInput.DDPLeft())
x2e_b29_PDPDown(DDPDown() && !prevInput.DDPDown()), , x2e_b31_PStart(DStart() && !prevInput.DStart())
x2e_b30_PDPLeft(DDPLeft() && !prevInput.DDPLeft()),
x2e_b31_PStart(DStart() && !prevInput.DStart())
{ {
if (x8_anaLeftX || xc_anaLeftY) if (x8_anaLeftX || xc_anaLeftY)
{ {
@ -246,5 +245,4 @@ CFinalInput& CFinalInput::operator|=(const CFinalInput& other)
x2e_b31_PStart |= other.x2e_b31_PStart; x2e_b31_PStart |= other.x2e_b31_PStart;
return *this; return *this;
} }
} }

View File

@ -111,16 +111,16 @@ public:
bool DDPLeft() const {return x2d_b26_DPLeft;} bool DDPLeft() const {return x2d_b26_DPLeft;}
bool DDPDown() const {return x2d_b25_DPDown;} bool DDPDown() const {return x2d_b25_DPDown;}
bool DDPUp() const {return x2c_b31_DPUp;} bool DDPUp() const {return x2c_b31_DPUp;}
bool DRTrigger() const {return x1c_anaRightTrigger > 0.050000001;} bool DRTrigger() const {return x1c_anaRightTrigger > 0.05f;}
bool DLTrigger() const {return x18_anaLeftTrigger > 0.050000001;} bool DLTrigger() const {return x18_anaLeftTrigger > 0.05f;}
bool DRARight() const {return x10_anaRightX > 0.69999999;} bool DRARight() const {return x10_anaRightX > 0.7f;}
bool DRALeft() const {return x10_anaRightX < -0.69999999;} bool DRALeft() const {return x10_anaRightX < -0.7f;}
bool DRADown() const {return x14_anaRightY < -0.69999999;} bool DRADown() const {return x14_anaRightY < -0.7f;}
bool DRAUp() const {return x14_anaRightY > 0.69999999;} bool DRAUp() const {return x14_anaRightY > 0.7f;}
bool DLARight() const {return x8_anaLeftX > 0.69999999;} bool DLARight() const {return x8_anaLeftX > 0.7f;}
bool DLALeft() const {return x8_anaLeftX < -0.69999999;} bool DLALeft() const {return x8_anaLeftX < -0.7f;}
bool DLADown() const {return xc_anaLeftY < -0.69999999;} bool DLADown() const {return xc_anaLeftY < -0.7f;}
bool DLAUp() const {return xc_anaLeftY > 0.69999999;} bool DLAUp() const {return xc_anaLeftY > 0.7f;}
float AStart() const {return x2d_b27_Start ? 1.0 : 0.0;} float AStart() const {return x2d_b27_Start ? 1.0 : 0.0;}
float AR() const {return x2c_b30_R ? 1.0 : 0.0;} float AR() const {return x2c_b30_R ? 1.0 : 0.0;}
float AL() const {return x2c_b29_L ? 1.0 : 0.0;} float AL() const {return x2c_b29_L ? 1.0 : 0.0;}

View File

@ -19,27 +19,17 @@ CAi::CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo&
const CDamageVulnerability& dmgVuln, const CMaterialList& list, ResId, const CActorParameters& actorParams, const CDamageVulnerability& dmgVuln, const CMaterialList& list, ResId, const CActorParameters& actorParams,
float stepUp, float stepDown) float stepUp, float stepDown)
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass), : CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass),
actorParams, stepUp, stepDown), actorParams, stepUp, stepDown)
x258_healthInfo(hInfo), , x258_healthInfo(hInfo)
x260_damageVulnerability(dmgVuln) , x260_damageVulnerability(dmgVuln)
{ {
} }
CAiStateFunc CAi::GetStateFunc(const char* func) CAiStateFunc CAi::GetStateFunc(const char* func) { return m_FuncMap->GetStateFunc(func); }
{
return m_FuncMap->GetStateFunc(func);
}
CAiTriggerFunc CAi::GetTrigerFunc(const char* func) CAiTriggerFunc CAi::GetTrigerFunc(const char* func) { return m_FuncMap->GetTriggerFunc(func); }
{
return m_FuncMap->GetTriggerFunc(func);
}
const CStateMachine* CAi::GetStateMachine() const { return x2c8_stateMachine.GetObj(); } const CStateMachine* CAi::GetStateMachine() const { return x2c8_stateMachine.GetObj(); }
void CAi::CreateFuncLookup(CAiFuncMap* funcMap) void CAi::CreateFuncLookup(CAiFuncMap* funcMap) { m_FuncMap = funcMap; }
{
m_FuncMap = funcMap;
}
CAiFuncMap* CAi::m_FuncMap = nullptr; CAiFuncMap* CAi::m_FuncMap = nullptr;
} }