Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ICameraInput.h
- #pragma once
- #include "sead/math/seadVector.h"
- namespace al
- {
- class ICameraInput
- {
- public:
- virtual void calcInputStick(sead::Vector2f* out) const
- {
- out->x = 0.0f;
- out->y = 0.0f;
- }
- virtual bool isTriggerReset() const { return false; }
- virtual bool isHoldZoom() const { return false; }
- virtual bool tryCalcSnapShotMoveStick(sead::Vector2f*) const { return false; }
- virtual bool isHoldSnapShotZoomIn() const { return false; }
- virtual bool isHoldSnapShotZoomOut() const { return false; }
- virtual bool isHoldSnapShotRollLeft() const { return false; }
- virtual bool isHoldSnapShotRollRight() const { return false; }
- virtual void calcGyroPose(sead::Vector3f* one, sead::Vector3f* two, sead::Vector3f* three) const
- {
- // Better way to do this?
- one->x = 0.0f;
- one->y = 0.0f;
- one->z = 0.0f;
- two->x = 0.0f;
- two->y = 0.0f;
- two->z = 0.0f;
- three->x = 0.0f;
- three->y = 0.0f;
- three->z = 0.0f;
- }
- };
- }
- // MultiMarioCameraInput.h
- #pragma once
- #include "al/camera/ICameraInput.h"
- namespace rsm
- {
- namespace mechanic
- {
- namespace camera
- {
- class MultiMarioCameraInput : public al::ICameraInput
- {
- public:
- MultiMarioCameraInput();
- virtual void calcInputStick(sead::Vector2f*) const;
- virtual bool isTriggerReset() const;
- virtual bool isHoldZoom() const;
- virtual bool tryCalcSnapShotMoveStick(sead::Vector2f*) const;
- virtual bool isHoldSnapShotZoomIn() const;
- virtual bool isHoldSnapShotZoomOut() const;
- virtual bool isHoldSnapShotRollLeft() const;
- virtual bool isHoldSnapShotRollRight() const;
- virtual void calcGyroPose(sead::Vector3f*, sead::Vector3f*, sead::Vector3f*) const;
- void setPassthroughInput(al::ICameraInput*);
- protected:
- al::ICameraInput* passthroughInput;
- };
- }
- }
- }
- // MultiMarioCamera.cpp
- #include "rsm/mechanic/camera/MultiMarioCameraInput.hpp"
- #include "al/util.hpp"
- #include "game/Player/PlayerFunction.h"
- #include "rsm/manager/PlayerManager.hpp"
- rsm::mechanic::camera::MultiMarioCameraInput::MultiMarioCameraInput()
- {
- passthroughInput = nullptr;
- }
- void rsm::mechanic::camera::MultiMarioCameraInput::calcInputStick(sead::Vector2f* out) const
- {
- sead::Vector2f sticks;
- int stickCount = 0;
- sticks.x = 0.0f;
- sticks.y = 0.0f;
- rsm::manager::PlayerManager* manager = rsm::manager::PlayerManager::instance();
- for (int i = 0; i < manager->getPlayerNum(); i++)
- {
- PlayerActorBase* player = manager->getPlayer(i);
- int port = PlayerFunction::getPlayerInputPort(player);
- sead::Vector2f* playerStick = al::getRightStick(port);
- if (!al::isNearZero(*playerStick, 0.001f))
- {
- sticks += *playerStick;
- stickCount++;
- }
- }
- if (stickCount > 0)
- {
- out->x = sticks.x / (float)stickCount;
- out->y = sticks.y / (float)stickCount;
- }
- else
- {
- out->x = 0.0f;
- out->y = 0.0f;
- }
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::isTriggerReset() const
- {
- // This might interfere with the bubble.
- // TODO: Implementation that doesn't.
- return false;
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::isHoldZoom() const
- {
- return passthroughInput->isHoldZoom();
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::tryCalcSnapShotMoveStick(sead::Vector2f* out) const
- {
- return passthroughInput->tryCalcSnapShotMoveStick(out);
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::isHoldSnapShotZoomIn() const
- {
- return passthroughInput->isHoldSnapShotZoomIn();
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::isHoldSnapShotZoomOut() const
- {
- return passthroughInput->isHoldSnapShotZoomOut();
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::isHoldSnapShotRollLeft() const
- {
- return passthroughInput->isHoldSnapShotRollLeft();
- }
- bool rsm::mechanic::camera::MultiMarioCameraInput::isHoldSnapShotRollRight() const
- {
- return passthroughInput->isHoldSnapShotRollRight();
- }
- void rsm::mechanic::camera::MultiMarioCameraInput::calcGyroPose(sead::Vector3f* one, sead::Vector3f* two, sead::Vector3f* three) const
- {
- passthroughInput->calcGyroPose(one, two, three);
- }
- void rsm::mechanic::camera::MultiMarioCameraInput::setPassthroughInput(ICameraInput* input)
- {
- passthroughInput = input;
- }
Advertisement
Add Comment
Please, Sign In to add comment