mirror of
https://github.com/Retropex/dolphin.git
synced 2025-05-12 19:30:44 +02:00
Player Index / Handle Each Controller
This commit is contained in:
parent
35cf0def0b
commit
dc832a5c85
@ -212,50 +212,50 @@ void ChangeUIPrimeHack(int number, bool useMetroidUI)
|
||||
wiimote->GetNunchuk()->ChangeUIPrimeHack(useMetroidUI);
|
||||
}
|
||||
|
||||
bool CheckVisor(int visorcount)
|
||||
bool CheckVisor(int visorcount, int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->CheckVisorCtrl(visorcount);
|
||||
}
|
||||
|
||||
bool CheckBeam(int beamcount)
|
||||
bool CheckBeam(int beamcount, int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->CheckBeamCtrl(beamcount);
|
||||
}
|
||||
|
||||
bool CheckForward() {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
bool CheckForward(int player_index) {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetNunchukGroup(WiimoteEmu::NunchukGroup::Stick)->
|
||||
controls[0].get()->control_ref->State() > 0.5;
|
||||
}
|
||||
|
||||
bool CheckBack() {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
bool CheckBack(int player_index) {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetNunchukGroup(WiimoteEmu::NunchukGroup::Stick)->
|
||||
controls[1].get()->control_ref->State() > 0.5;
|
||||
}
|
||||
|
||||
bool CheckLeft() {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
bool CheckLeft(int player_index) {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetNunchukGroup(WiimoteEmu::NunchukGroup::Stick)->
|
||||
controls[2].get()->control_ref->State() > 0.5;
|
||||
}
|
||||
|
||||
bool CheckRight() {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
bool CheckRight(int player_index) {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetNunchukGroup(WiimoteEmu::NunchukGroup::Stick)->
|
||||
controls[3].get()->control_ref->State() > 0.5;
|
||||
}
|
||||
|
||||
bool CheckJump() {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
bool CheckJump(int player_index) {
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->groups[0].get()->controls[1]->control_ref->State() > 0.5;
|
||||
}
|
||||
@ -278,16 +278,16 @@ bool GrappleCtlBound() {
|
||||
return wiimote->IsGrappleBinded();
|
||||
}
|
||||
|
||||
bool CheckSpringBall()
|
||||
bool CheckSpringBall(int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->CheckSpringBallCtrl();
|
||||
}
|
||||
|
||||
std::tuple<bool, bool> GetBVMenuOptions()
|
||||
std::tuple<bool, bool> GetBVMenuOptions(int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetBVMenuOptions();
|
||||
}
|
||||
@ -299,44 +299,44 @@ bool CheckImprovedMotions()
|
||||
return wiimote->CheckImprovedMotions();
|
||||
}
|
||||
|
||||
bool CheckVisorScroll(bool direction)
|
||||
bool CheckVisorScroll(bool direction, int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
|
||||
return wiimote->CheckVisorScrollCtrl(direction);
|
||||
}
|
||||
|
||||
bool CheckBeamScroll(bool direction)
|
||||
bool CheckBeamScroll(bool direction, int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
|
||||
return wiimote->CheckBeamScrollCtrl(direction);
|
||||
}
|
||||
|
||||
bool PrimeUseController()
|
||||
bool PrimeUseController(int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->PrimeControllerMode();
|
||||
}
|
||||
|
||||
std::tuple<double, double> GetPrimeStickXY()
|
||||
std::tuple<double, double> GetPrimeStickXY(int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetPrimeStickXY();
|
||||
}
|
||||
|
||||
std::tuple<double, double, bool, bool, bool, bool> PrimeSettings()
|
||||
std::tuple<double, double, bool, bool, bool, bool> PrimeSettings(int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->GetPrimeSettings();
|
||||
}
|
||||
|
||||
bool CheckPitchRecentre()
|
||||
bool CheckPitchRecentre(int player_index)
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(player_index));
|
||||
|
||||
return wiimote->CheckPitchRecentre();
|
||||
}
|
||||
|
@ -102,30 +102,29 @@ ControllerEmu::ControlGroup* GetTaTaConGroup(int number, WiimoteEmu::TaTaConGrou
|
||||
|
||||
void ChangeUIPrimeHack(int number, bool useMetroidUI);
|
||||
|
||||
bool CheckVisor(int visor_count);
|
||||
bool CheckBeam(int beam_count);
|
||||
bool CheckBeamScroll(bool direction);
|
||||
bool CheckVisorScroll(bool direction);
|
||||
bool CheckSpringBall();
|
||||
bool CheckVisor(int visor_count, int player_index = 0);
|
||||
bool CheckBeam(int beam_count, int player_index = 0);
|
||||
bool CheckBeamScroll(bool direction, int player_index = 0);
|
||||
bool CheckVisorScroll(bool direction, int player_index = 0);
|
||||
bool CheckSpringBall(int player_index = 0);
|
||||
bool CheckImprovedMotions();
|
||||
bool CheckForward();
|
||||
bool CheckBack();
|
||||
bool CheckLeft();
|
||||
bool CheckRight();
|
||||
bool CheckJump();
|
||||
bool CheckForward(int player_index = 0);
|
||||
bool CheckBack(int player_index = 0);
|
||||
bool CheckLeft(int player_index = 0);
|
||||
bool CheckRight(int player_index = 0);
|
||||
bool CheckJump(int player_index = 0);
|
||||
|
||||
bool CheckGrapple();
|
||||
bool UseGrappleTapping();
|
||||
bool GrappleCtlBound();
|
||||
bool PrimeUseController();
|
||||
bool PrimeUseController(int player_index = 0);
|
||||
|
||||
bool PrimeUseController();
|
||||
bool CheckPitchRecentre();
|
||||
bool CheckPitchRecentre(int player_index = 0);
|
||||
|
||||
std::tuple<double, double> GetPrimeStickXY();
|
||||
std::tuple<bool, bool> GetBVMenuOptions();
|
||||
std::tuple<double, double> GetPrimeStickXY(int player_index = 0);
|
||||
std::tuple<bool, bool> GetBVMenuOptions(int player_index = 0);
|
||||
|
||||
std::tuple<double, double, bool, bool, bool, bool> PrimeSettings();
|
||||
std::tuple<double, double, bool, bool, bool, bool> PrimeSettings(int player_index = 0);
|
||||
|
||||
|
||||
bool NetPlay_GetButtonPress(int wiimote, bool pressed);
|
||||
|
@ -31,24 +31,26 @@
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "Core\HW\GCPadEmu.h"
|
||||
|
||||
namespace prime {
|
||||
namespace {
|
||||
float sensitivity;
|
||||
float cursor_sensitivity;
|
||||
float camera_fov;
|
||||
std::array<float, 4> sensitivity;
|
||||
std::array<float, 4> cursor_sensitivity;
|
||||
std::array<float, 4> camera_fov;
|
||||
|
||||
bool inverted_x = false;
|
||||
bool inverted_y = false;
|
||||
bool scale_cursor_sens = false;
|
||||
std::array<bool, 4> inverted_x = {false, false, false, false};
|
||||
std::array<bool, 4> inverted_y = {false, false, false, false};
|
||||
std::array<bool, 4> scale_cursor_sens = {false, false, false, false};
|
||||
HackManager hack_mgr;
|
||||
AddressDB addr_db;
|
||||
EmuVariableManager var_mgr;
|
||||
bool is_running = false;
|
||||
CameraLock lock_camera = CameraLock::Unlocked;
|
||||
bool reticle_lock = false;
|
||||
std::array<bool, 4> reticle_lock = {false, false, false, false};
|
||||
|
||||
std::string pending_modfile = "";
|
||||
bool mod_suspended = false;
|
||||
@ -91,47 +93,47 @@ void InitializeHack() {
|
||||
hack_mgr.enable_mod("elf_mod_loader");
|
||||
}
|
||||
|
||||
bool CheckBeamCtl(int beam_num) {
|
||||
bool CheckBeamCtl(int beam_num, int player_index) {
|
||||
return Wiimote::CheckBeam(beam_num);
|
||||
}
|
||||
|
||||
bool CheckVisorCtl(int visor_num) {
|
||||
bool CheckVisorCtl(int visor_num, int player_index) {
|
||||
return Wiimote::CheckVisor(visor_num);
|
||||
}
|
||||
|
||||
bool CheckVisorScrollCtl(bool direction) {
|
||||
bool CheckVisorScrollCtl(bool direction, int player_index) {
|
||||
return Wiimote::CheckVisorScroll(direction);
|
||||
}
|
||||
|
||||
bool CheckBeamScrollCtl(bool direction) {
|
||||
bool CheckBeamScrollCtl(bool direction, int player_index) {
|
||||
return Wiimote::CheckBeamScroll(direction);
|
||||
}
|
||||
|
||||
bool CheckSpringBallCtl() {
|
||||
return Wiimote::CheckSpringBall();
|
||||
bool CheckSpringBallCtl(int player_index) {
|
||||
return Wiimote::CheckSpringBall(player_index);
|
||||
}
|
||||
|
||||
bool ImprovedMotionControls() {
|
||||
return Wiimote::CheckImprovedMotions();
|
||||
}
|
||||
|
||||
bool CheckForward() {
|
||||
bool CheckForward(int player_index) {
|
||||
return Wiimote::CheckForward();
|
||||
}
|
||||
|
||||
bool CheckBack() {
|
||||
bool CheckBack(int player_index) {
|
||||
return Wiimote::CheckBack();
|
||||
}
|
||||
|
||||
bool CheckLeft() {
|
||||
bool CheckLeft(int player_index) {
|
||||
return Wiimote::CheckLeft();
|
||||
}
|
||||
|
||||
bool CheckRight() {
|
||||
bool CheckRight(int player_index) {
|
||||
return Wiimote::CheckRight();
|
||||
}
|
||||
|
||||
bool CheckJump() {
|
||||
bool CheckJump(int player_index) {
|
||||
return Wiimote::CheckJump();
|
||||
}
|
||||
|
||||
@ -211,113 +213,114 @@ std::tuple<float, float, float> GetArmXYZ() {
|
||||
return std::make_tuple(x, y, z);
|
||||
}
|
||||
|
||||
void UpdateHackSettings() {
|
||||
void UpdateHackSettings(int player_index) {
|
||||
double camera, cursor;
|
||||
bool invertx, inverty, scale_sens = false, lock = false;
|
||||
|
||||
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN)
|
||||
std::tie<double, double, bool, bool>(camera, cursor, invertx, inverty) =
|
||||
Pad::PrimeSettings();
|
||||
else
|
||||
std::tie<double, double, bool, bool, bool>(camera, cursor, invertx, inverty, scale_sens, lock) =
|
||||
Wiimote::PrimeSettings();
|
||||
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
|
||||
std::tie(camera, cursor, invertx, inverty) =
|
||||
static_cast<GCPad*>(Pad::GetConfig()->GetController(player_index))->GetPrimeSettings();
|
||||
} else {
|
||||
std::tie(camera, cursor, invertx, inverty, scale_sens, lock) =
|
||||
static_cast<WiimoteEmu::Wiimote*>(Wiimote::GetConfig()->GetController(player_index))->GetPrimeSettings();
|
||||
}
|
||||
|
||||
SetSensitivity((float)camera);
|
||||
SetCursorSensitivity((float)cursor);
|
||||
SetInvertedX(invertx);
|
||||
SetInvertedY(inverty);
|
||||
SetScaleCursorSensitivity(scale_sens);
|
||||
SetReticleLock(lock);
|
||||
SetSensitivity((float)camera, player_index);
|
||||
SetCursorSensitivity((float)cursor, player_index);
|
||||
SetInvertedX(invertx, player_index);
|
||||
SetInvertedY(inverty, player_index);
|
||||
SetScaleCursorSensitivity(scale_sens, player_index);
|
||||
SetReticleLock(lock, player_index);
|
||||
}
|
||||
|
||||
float GetSensitivity() {
|
||||
return sensitivity;
|
||||
float GetSensitivity(int player_index) {
|
||||
return sensitivity[player_index];
|
||||
}
|
||||
|
||||
void SetSensitivity(float sens) {
|
||||
sensitivity = sens;
|
||||
void SetSensitivity(float sens, int player_index) {
|
||||
sensitivity[player_index] = sens;
|
||||
}
|
||||
|
||||
bool HandleReticleLockOn()
|
||||
bool HandleReticleLockOn(int player_index)
|
||||
{
|
||||
return reticle_lock;
|
||||
return reticle_lock[player_index];
|
||||
}
|
||||
|
||||
void SetReticleLock(bool lock)
|
||||
void SetReticleLock(bool lock, int player_index)
|
||||
{
|
||||
reticle_lock = lock;
|
||||
reticle_lock[player_index] = lock;
|
||||
}
|
||||
|
||||
float GetCursorSensitivity() {
|
||||
return cursor_sensitivity;
|
||||
float GetCursorSensitivity(int player_index) {
|
||||
return cursor_sensitivity[player_index];
|
||||
}
|
||||
|
||||
void SetCursorSensitivity(float sens) {
|
||||
cursor_sensitivity = sens;
|
||||
void SetCursorSensitivity(float sens, int player_index) {
|
||||
cursor_sensitivity[player_index] = sens;
|
||||
}
|
||||
|
||||
float GetFov() {
|
||||
return Config::Get(Config::FOV);
|
||||
}
|
||||
|
||||
bool InvertedY() {
|
||||
return inverted_y;
|
||||
bool InvertedY(int player_index) {
|
||||
return inverted_y[player_index];
|
||||
}
|
||||
|
||||
void SetInvertedY(bool inverted) {
|
||||
inverted_y = inverted;
|
||||
void SetInvertedY(bool inverted, int player_index) {
|
||||
inverted_y[player_index] = inverted;
|
||||
}
|
||||
|
||||
bool InvertedX() {
|
||||
return inverted_x;
|
||||
bool InvertedX(int player_index) {
|
||||
return inverted_x[player_index];
|
||||
}
|
||||
|
||||
void SetInvertedX(bool inverted) {
|
||||
inverted_x = inverted;
|
||||
void SetInvertedX(bool inverted, int player_index) {
|
||||
inverted_x[player_index] = inverted;
|
||||
}
|
||||
|
||||
bool ScaleCursorSensitivity() {
|
||||
return scale_cursor_sens;
|
||||
bool ScaleCursorSensitivity(int player_index) {
|
||||
return scale_cursor_sens[player_index];
|
||||
}
|
||||
|
||||
void SetScaleCursorSensitivity(bool scale) {
|
||||
scale_cursor_sens = scale;
|
||||
void SetScaleCursorSensitivity(bool scale, int player_index) {
|
||||
scale_cursor_sens[player_index] = scale;
|
||||
}
|
||||
|
||||
bool CheckPitchRecentre() {
|
||||
bool CheckPitchRecentre(int player_index) {
|
||||
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
|
||||
if (Pad::PrimeUseController()) {
|
||||
return Pad::CheckPitchRecentre();
|
||||
}
|
||||
}
|
||||
else if (Wiimote::PrimeUseController()) {
|
||||
return Wiimote::CheckPitchRecentre();
|
||||
return Wiimote::CheckPitchRecentre(player_index);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
double GetHorizontalAxis() {
|
||||
double GetHorizontalAxis(int player_index) {
|
||||
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
|
||||
if (Pad::PrimeUseController()) {
|
||||
return std::get<0>(Pad::GetPrimeStickXY());
|
||||
}
|
||||
}
|
||||
else if (Wiimote::PrimeUseController()) {
|
||||
return std::get<0>(Wiimote::GetPrimeStickXY());
|
||||
return std::get<0>(Wiimote::GetPrimeStickXY(player_index));
|
||||
}
|
||||
|
||||
return static_cast<double>(g_mouse_input->GetDeltaHorizontalAxis());
|
||||
}
|
||||
|
||||
double GetVerticalAxis() {
|
||||
double GetVerticalAxis(int player_index) {
|
||||
if (hack_mgr.get_active_game() >= Game::PRIME_1_GCN) {
|
||||
if (Pad::PrimeUseController()) {
|
||||
return std::get<1>(Pad::GetPrimeStickXY());
|
||||
}
|
||||
}
|
||||
else if (Wiimote::PrimeUseController()) {
|
||||
return std::get<1>(Wiimote::GetPrimeStickXY());
|
||||
return std::get<1>(Wiimote::GetPrimeStickXY(player_index));
|
||||
}
|
||||
|
||||
return static_cast<double>(g_mouse_input->GetDeltaVerticalAxis());
|
||||
|
@ -13,17 +13,17 @@
|
||||
namespace prime {
|
||||
void InitializeHack();
|
||||
|
||||
bool CheckBeamCtl(int beam_num);
|
||||
bool CheckVisorCtl(int visor_num);
|
||||
bool CheckBeamScrollCtl(bool direction);
|
||||
bool CheckVisorScrollCtl(bool direction);
|
||||
bool CheckSpringBallCtl();
|
||||
bool CheckBeamCtl(int beam_num, int player_index = 0);
|
||||
bool CheckVisorCtl(int visor_num, int player_index = 0);
|
||||
bool CheckBeamScrollCtl(bool direction, int player_index = 0);
|
||||
bool CheckVisorScrollCtl(bool direction, int player_index = 0);
|
||||
bool CheckSpringBallCtl(int player_index = 0);
|
||||
bool ImprovedMotionControls();
|
||||
bool CheckForward();
|
||||
bool CheckBack();
|
||||
bool CheckLeft();
|
||||
bool CheckRight();
|
||||
bool CheckJump();
|
||||
bool CheckForward(int player_index = 0);
|
||||
bool CheckBack(int player_index = 0);
|
||||
bool CheckLeft(int player_index = 0);
|
||||
bool CheckRight(int player_index = 0);
|
||||
bool CheckJump(int player_index = 0);
|
||||
|
||||
bool CheckGrappleCtl();
|
||||
bool GrappleTappingMode();
|
||||
@ -48,33 +48,33 @@ bool GetAutoArmAdjust();
|
||||
bool GetToggleArmAdjust();
|
||||
std::tuple<float, float, float> GetArmXYZ();
|
||||
|
||||
void UpdateHackSettings();
|
||||
void UpdateHackSettings(int player_index = 0);
|
||||
|
||||
float GetSensitivity();
|
||||
void SetSensitivity(float sensitivity);
|
||||
float GetCursorSensitivity();
|
||||
void SetCursorSensitivity(float sensitivity);
|
||||
bool ScaleCursorSensitivity();
|
||||
void SetScaleCursorSensitivity(bool scale);
|
||||
float GetSensitivity(int player_index = 0);
|
||||
void SetSensitivity(float sensitivity, int player_index = 0);
|
||||
float GetCursorSensitivity(int player_index = 0);
|
||||
void SetCursorSensitivity(float sensitivity, int player_index = 0);
|
||||
bool ScaleCursorSensitivity(int player_index = 0);
|
||||
void SetScaleCursorSensitivity(bool scale, int player_index = 0);
|
||||
float GetFov();
|
||||
bool InvertedY();
|
||||
void SetInvertedY(bool inverted);
|
||||
bool InvertedX();
|
||||
void SetInvertedX(bool inverted);
|
||||
bool InvertedY(int player_index = 0);
|
||||
void SetInvertedY(bool inverted, int player_index = 0);
|
||||
bool InvertedX(int player_index = 0);
|
||||
void SetInvertedX(bool inverted, int player_index = 0);
|
||||
bool GetCulling();
|
||||
|
||||
bool HandleReticleLockOn();
|
||||
void SetReticleLock(bool lock);
|
||||
bool HandleReticleLockOn(int player_index = 0);
|
||||
void SetReticleLock(bool lock, int player_index = 0);
|
||||
|
||||
enum CameraLock { Centre, Angle45, Unlocked };
|
||||
|
||||
void SetLockCamera(CameraLock lock);
|
||||
CameraLock GetLockCamera();
|
||||
|
||||
bool CheckPitchRecentre();
|
||||
bool CheckPitchRecentre(int player_index = 0);
|
||||
|
||||
double GetHorizontalAxis();
|
||||
double GetVerticalAxis();
|
||||
double GetHorizontalAxis(int player_index = 0);
|
||||
double GetVerticalAxis(int player_index = 0);
|
||||
|
||||
std::tuple<bool, bool> GetMenuOptions();
|
||||
|
||||
|
@ -169,7 +169,7 @@ float FpsControls::calculate_yaw_vel() {
|
||||
}
|
||||
|
||||
void FpsControls::handle_beam_visor_switch(std::array<int, 4> const &beams,
|
||||
std::array<std::tuple<int, int>, 4> const &visors) {
|
||||
std::array<std::tuple<int, int>, 4> const &visors, int player_index) {
|
||||
// Global array of all powerups (measured in "ammunition"
|
||||
// even for things like visors/beams)
|
||||
LOOKUP_DYN(powerups_array);
|
||||
@ -192,7 +192,7 @@ void FpsControls::handle_beam_visor_switch(std::array<int, 4> const &beams,
|
||||
}
|
||||
|
||||
if (has_beams) {
|
||||
const int beam_id = get_beam_switch(beams);
|
||||
const int beam_id = get_beam_switch(beams, player_index);
|
||||
if (beam_id != -1) {
|
||||
prime::GetVariableManager()->set_variable("new_beam", static_cast<u32>(beam_id));
|
||||
prime::GetVariableManager()->set_variable("beamchange_flag", u32{1});
|
||||
@ -202,7 +202,7 @@ void FpsControls::handle_beam_visor_switch(std::array<int, 4> const &beams,
|
||||
LOOKUP_DYN(active_visor);
|
||||
int visor_id, visor_off;
|
||||
std::tie(visor_id, visor_off) = get_visor_switch(visors,
|
||||
read32(active_visor) == 0);
|
||||
read32(active_visor) == 0, player_index);
|
||||
|
||||
if (visor_id != -1) {
|
||||
if (read32(powerups_array + (visor_off * powerups_size) + powerups_offset)) {
|
||||
@ -367,6 +367,8 @@ void FpsControls::run_mod_mp2(Region region) {
|
||||
|
||||
// VERY similar to mp1, this time CPlayer isn't TOneStatic (presumably because
|
||||
// of multiplayer mode in the GCN version?)
|
||||
int player_index = 0;
|
||||
|
||||
LOOKUP_DYN(player);
|
||||
if (player == 0) {
|
||||
return;
|
||||
@ -378,7 +380,7 @@ void FpsControls::run_mod_mp2(Region region) {
|
||||
return;
|
||||
}
|
||||
|
||||
handle_beam_visor_switch(prime_two_beams, prime_two_visors);
|
||||
handle_beam_visor_switch(prime_two_beams, prime_two_visors, player_index);
|
||||
|
||||
// Is beam/visor menu showing on screen
|
||||
LOOKUP_DYN(beamvisor_menu_state);
|
||||
|
@ -28,7 +28,7 @@ private:
|
||||
void calculate_pitch_to_target(float target_pitch);
|
||||
float calculate_yaw_vel();
|
||||
void handle_beam_visor_switch(std::array<int, 4> const &beams,
|
||||
std::array<std::tuple<int, int>, 4> const& visors);
|
||||
std::array<std::tuple<int, int>, 4> const& visors, int player_index = 0);
|
||||
void mp3_handle_lasso(u32 grapple_state_addr);
|
||||
|
||||
void run_mod_menu(Game game, Region region);
|
||||
|
@ -25,8 +25,8 @@ namespace prime
|
||||
*/
|
||||
|
||||
static float cursor_x = 0, cursor_y = 0;
|
||||
static int current_beam = 0;
|
||||
static int current_visor = 0;
|
||||
static std::array<int, 4> current_beam = {0, 0, 0, 0};
|
||||
static std::array<int, 4> current_visor = {0, 0, 0, 0};
|
||||
static std::array<bool, 4> beam_owned = {false, false, false, false};
|
||||
static std::array<bool, 4> visor_owned = {false, false, false, false};
|
||||
static bool noclip_enabled = false;
|
||||
@ -103,9 +103,9 @@ void write_invalidate(u32 address, u32 value) {
|
||||
PowerPC::ScheduleInvalidateCacheThreadSafe(address);
|
||||
}
|
||||
|
||||
std::tuple<int, int> get_visor_switch(std::array<std::tuple<int, int>, 4> const& visors, bool combat_visor) {
|
||||
std::tuple<int, int> get_visor_switch(std::array<std::tuple<int, int>, 4> const& visors, bool combat_visor, int player_index) {
|
||||
static bool pressing_button = false;
|
||||
if (CheckVisorCtl(0)) {
|
||||
if (CheckVisorCtl(0, player_index)) {
|
||||
if (!combat_visor) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
@ -116,40 +116,40 @@ std::tuple<int, int> get_visor_switch(std::array<std::tuple<int, int>, 4> const&
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CheckVisorCtl(1)) {
|
||||
if (CheckVisorCtl(1, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return visors[1];
|
||||
}
|
||||
}
|
||||
else if (CheckVisorCtl(2)) {
|
||||
else if (CheckVisorCtl(2, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return visors[2];
|
||||
}
|
||||
}
|
||||
else if (CheckVisorCtl(3)) {
|
||||
else if (CheckVisorCtl(3, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return visors[3];
|
||||
}
|
||||
}
|
||||
else if (CheckVisorScrollCtl(true)) {
|
||||
else if (CheckVisorScrollCtl(true, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (visor_owned[current_visor = (current_visor + 1) % 4]) break;
|
||||
if (visor_owned[current_visor[player_index] = (current_visor[player_index] + 1) % 4]) break;
|
||||
}
|
||||
return visors[current_visor];
|
||||
return visors[current_visor[player_index]];
|
||||
}
|
||||
}
|
||||
else if (CheckVisorScrollCtl(false)) {
|
||||
else if (CheckVisorScrollCtl(false, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (visor_owned[current_visor = (current_visor + 3) % 4]) break;
|
||||
if (visor_owned[current_visor[player_index] = (current_visor[player_index] + 3) % 4]) break;
|
||||
}
|
||||
return visors[current_visor];
|
||||
return visors[current_visor[player_index]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -158,48 +158,48 @@ std::tuple<int, int> get_visor_switch(std::array<std::tuple<int, int>, 4> const&
|
||||
return std::make_tuple(-1, 0);
|
||||
}
|
||||
|
||||
int get_beam_switch(std::array<int, 4> const& beams) {
|
||||
int get_beam_switch(std::array<int, 4> const& beams, int player_index) {
|
||||
static bool pressing_button = false;
|
||||
if (CheckBeamCtl(0)) {
|
||||
if (CheckBeamCtl(0, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return current_beam = beams[0];
|
||||
return current_beam[player_index] = beams[0];
|
||||
}
|
||||
}
|
||||
else if (CheckBeamCtl(1)) {
|
||||
else if (CheckBeamCtl(1, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return current_beam = beams[1];
|
||||
return current_beam[player_index] = beams[1];
|
||||
}
|
||||
}
|
||||
else if (CheckBeamCtl(2)) {
|
||||
else if (CheckBeamCtl(2, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return current_beam = beams[2];
|
||||
return current_beam[player_index] = beams[2];
|
||||
}
|
||||
}
|
||||
else if (CheckBeamCtl(3)) {
|
||||
else if (CheckBeamCtl(3, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
return current_beam = beams[3];
|
||||
return current_beam[player_index] = beams[3];
|
||||
}
|
||||
}
|
||||
else if (CheckBeamScrollCtl(true)) {
|
||||
else if (CheckBeamScrollCtl(true, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (beam_owned[current_beam = (current_beam + 1) % 4]) break;
|
||||
if (beam_owned[current_beam[player_index] = (current_beam[player_index] + 1) % 4]) break;
|
||||
}
|
||||
return beams[current_beam];
|
||||
return beams[current_beam[player_index]];
|
||||
}
|
||||
}
|
||||
else if (CheckBeamScrollCtl(false)) {
|
||||
else if (CheckBeamScrollCtl(false, player_index)) {
|
||||
if (!pressing_button) {
|
||||
pressing_button = true;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (beam_owned[current_beam = (current_beam + 3) % 4]) break;
|
||||
if (beam_owned[current_beam[player_index] = (current_beam[player_index] + 3) % 4]) break;
|
||||
}
|
||||
return beams[current_beam];
|
||||
return beams[current_beam[player_index]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -49,8 +49,8 @@ constexpr u32 gen_vmcall(const u32 call_idx, const u32 param) {
|
||||
|
||||
constexpr float kTurnrateRatio = 0.00498665500569808449206349206349f;
|
||||
|
||||
int get_beam_switch(std::array<int, 4> const& beams);
|
||||
std::tuple<int, int> get_visor_switch(std::array<std::tuple<int, int>, 4> const& visors, bool combat_visor);
|
||||
int get_beam_switch(std::array<int, 4> const& beams, int player_index = 0);
|
||||
std::tuple<int, int> get_visor_switch(std::array<std::tuple<int, int>, 4> const& visors, bool combat_visor, int player_index = 0);
|
||||
|
||||
void handle_cursor(u32 x_address, u32 y_address, Region region);
|
||||
void handle_reticle(u32 x_address, u32 y_address, Region region, float fov);
|
||||
|
Loading…
Reference in New Issue
Block a user