Skip to content

Commit

Permalink
update Player footerPos
Browse files Browse the repository at this point in the history
  • Loading branch information
tyanmahou committed Dec 26, 2024
1 parent ef3ec65 commit 2933269
Show file tree
Hide file tree
Showing 29 changed files with 96 additions and 69 deletions.
8 changes: 4 additions & 4 deletions Re-Abyss/app/components/Actor/Common/AudioSource.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Common/AudioSource.hpp>
#include <abyss/components/Actor/Common/AudioSource.hpp>
#include <abyss/commons/Resource/Assets/Assets.hpp>
#include <abyss/modules/Actor/base/ActorObj.hpp>

Expand Down Expand Up @@ -55,7 +55,7 @@ namespace
m_pActor->destroy();
}
const auto& pos = m_locator->getPos();
const auto& listener = ActorUtils::PlayerPos(*m_pActor);
const auto& listener = ActorUtils::PlayerCenterPos(*m_pActor);

auto [volume, pan] = ::CalcVolume(pos, listener);
m_audio.setVolume(volume);
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace abyss::Actor
return !audio.isPlaying();
});
const auto pos = m_locator->getCenterPos();
const auto& listener = ActorUtils::PlayerPos(*m_pActor);
const auto& listener = ActorUtils::PlayerCenterPos(*m_pActor);

for (auto&& audio : m_audios) {
auto [volume, pan] = ::CalcVolume(pos, listener);
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace abyss::Actor
void AudioSource::playDirect(const s3d::Audio& audio)
{
const auto pos = m_locator->getCenterPos();
const auto& listener = ActorUtils::PlayerPos(*m_pActor);
const auto& listener = ActorUtils::PlayerCenterPos(*m_pActor);

auto [volume, pan] = ::CalcVolume(pos, listener);
audio.setVolume(volume);
Expand Down
5 changes: 5 additions & 0 deletions Re-Abyss/app/components/Actor/Common/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ namespace abyss::Actor
return this->getOffsetedPos();
}
}
Body& Body::setCenterPos(const s3d::Vec2& pos)
{
s3d::Vec2 diff = pos - this->getCenterPos();
return this->setPos(m_pos + diff);
}
s3d::Vec2 Body::moveDiff() const
{
return m_pos - m_prevPos;
Expand Down
1 change: 1 addition & 0 deletions Re-Abyss/app/components/Actor/Common/Body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ namespace abyss::Actor
ColDirection fixPos(const Room::RoomData& room, const s3d::Optional<ColDirection>& strict = s3d::none);

s3d::Vec2 getCenterPos()const override;
Body& setCenterPos(const s3d::Vec2& pos);

s3d::Vec2 moveDiff() const;
private:
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Actor/Enemy/BabyDux/EyeCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Enemy/BabyDux/EyeCtrl.hpp>
#include <abyss/components/Actor/Enemy/BabyDux/EyeCtrl.hpp>

#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/components/Actor/Enemy/BabyDux/ForwardCtrl.hpp>
Expand All @@ -24,7 +24,7 @@ namespace abyss::Actor::Enemy::BabyDux
void EyeCtrl::onLastUpdate()
{
const auto& pos = m_body->getPos();
const auto& playerPos = ActorUtils::PlayerPos(*m_pActor);
const auto& playerPos = ActorUtils::PlayerCenterPos(*m_pActor);

auto erpRate = InterpUtil::DampRatio(Param::Eye::ErpRate, m_pActor->deltaTime());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace abyss::Actor::Enemy::BazookaKun
// 基準点の計算
auto pivot = pos + Vec2{ m_isMirrored ? 3 : -3, m_isFlipped ? -15 : 15 };
pivot = pivot.rotateAt(pos, s3d::ToRadians(m_rotate));
const Vec2 playerPos = ActorUtils::PlayerPos(*m_pActor);
const Vec2 playerPos = ActorUtils::PlayerCenterPos(*m_pActor);

auto eyeVec = this->eyeVec();

Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Actor/Enemy/CodeZero/HeadCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Enemy/CodeZero/HeadCtrl.hpp>
#include <abyss/components/Actor/Enemy/CodeZero/HeadCtrl.hpp>

#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/components/Actor/Common/Body.hpp>
Expand Down Expand Up @@ -41,7 +41,7 @@ namespace abyss::Actor::Enemy::CodeZero
if (!m_isActive) {
return;
}
const auto& playerPos = ActorUtils::PlayerPos(*m_pActor);
const auto& playerPos = ActorUtils::PlayerCenterPos(*m_pActor);
auto pos = this->getCenterPos();

Vec2 look{0 , 0};
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Actor/Enemy/KingDux/EyeCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Enemy/KingDux/EyeCtrl.hpp>
#include <abyss/components/Actor/Enemy/KingDux/EyeCtrl.hpp>

#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/components/Actor/Common/Body.hpp>
Expand Down Expand Up @@ -47,7 +47,7 @@ namespace abyss::Actor::Enemy::KingDux
void EyeCtrl::updateDefault()
{
const auto& pos = m_body->getPos();
const auto& playerPos = ActorUtils::PlayerPos(*m_pActor);
const auto& playerPos = ActorUtils::PlayerCenterPos(*m_pActor);

auto erpRate = InterpUtil::DampRatio(Param::Eye::ErpRate, m_pActor->deltaTime());

Expand Down
6 changes: 3 additions & 3 deletions Re-Abyss/app/components/Actor/Gimmick/Door/GimmickReactor.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Gimmick/Door/GimmickReactor.hpp>
#include <abyss/components/Actor/Gimmick/Door/GimmickReactor.hpp>

#include <abyss/commons/InputManager/InputManager.hpp>
#include <abyss/modules/Actor/base/ActorObj.hpp>
Expand Down Expand Up @@ -50,11 +50,11 @@ namespace abyss::Actor::Gimmick::Door
Player::DoorInMapMoveState::Change(player, door, *link);
return;
} else if (auto startPos = pStage->findStartPos(m_door->getStartId())) {
if (auto room = pStage->findRoom(startPos->getPos())) {
if (auto room = pStage->findRoom(startPos->getCenterPos())) {
Door::DoorData door{
startPos->getStartId(),
m_door->getPos(),
startPos->getPos(),
startPos->getCenterPos(),
startPos->getForward(),
m_door->getSize(),
m_door->getKind(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Gimmick/ShutterWall/ShutterCtrl.hpp>
#include <abyss/components/Actor/Gimmick/ShutterWall/ShutterCtrl.hpp>
#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/modules/Camera/Camera.hpp>
#include <abyss/components/Actor/Gimmick/ShutterWall/ShutterUtil.hpp>
Expand Down Expand Up @@ -48,7 +48,7 @@ namespace abyss::Actor::Gimmick::ShutterWall
const Vec2& pos = m_terrain->tl();

if (m_isWait) {
const Vec2& playerPos = ActorUtils::PlayerPos(*m_pActor);
const Vec2& playerPos = ActorUtils::PlayerCenterPos(*m_pActor);
const Vec2 centerPos = ShutterUtil::CenterPosFromTl(pos);

auto toPlayer = playerPos - centerPos;
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Actor/Ooparts/CommonBuilder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Ooparts/CommonBuilder.hpp>
#include <abyss/components/Actor/Ooparts/CommonBuilder.hpp>
#include <abyss/components/Actor/Common/Body.hpp>
#include <abyss/components/Actor/Common/VModel.hpp>
#include <abyss/components/Actor/Common/BossFadeMask.hpp>
Expand All @@ -16,7 +16,7 @@ namespace abyss::Actor::Ooparts
auto parentBody = parent->find<Body>();
auto forward = parentBody->getForward();
pActor->attach<Body>(pActor)
->initPos(parentBody->getPos() + s3d::Vec2{ forward.signH() * -20, -40 })
->initPos(parentBody->getCenterPos() + s3d::Vec2{ forward.signH() * -20, -40 })
.setForward(forward);

pActor->attach<PursuitCtrl>(pActor, parentBody);
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Actor/Ooparts/PursuitCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Ooparts/PursuitCtrl.hpp>
#include <abyss/components/Actor/Ooparts/PursuitCtrl.hpp>
#include <Siv3D.hpp>

#include <abyss/modules/Actor/base/ActorObj.hpp>
Expand Down Expand Up @@ -38,7 +38,7 @@ namespace abyss::Actor::Ooparts
}
}
m_body->setForward(m_pParent->getForward());
m_body->setPos(m_pParent->getPos() + m_localPos);
m_body->setPos(m_pParent->getCenterPos() + m_localPos);
}

}
7 changes: 4 additions & 3 deletions Re-Abyss/app/components/Actor/Player/Builder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Player/Builder.hpp>
#include <abyss/components/Actor/Player/Builder.hpp>

#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/modules/Manager/Manager.hpp>
Expand Down Expand Up @@ -72,6 +72,7 @@ namespace abyss::Actor::Player
pActor->attach<Body>(pActor)
->initSize(Param::Base::Size)
.initPos(initPos)
.setAnchor(BodyAnchor::BottomCenter)
.setForward(forward)
;
pActor->attach<BodyUpdater>(pActor);
Expand Down Expand Up @@ -267,14 +268,14 @@ namespace
return &m_oopartsView
->setTime(m_pActor->getTimeSec())
.setForward(m_body->getForward())
.setPos(m_body->getPos() + handOffset)
.setPos(m_body->getCenterPos() + handOffset)
;
}
ChargeEffectVM* bindChargeEft()const
{
return &m_chargeView
->setTime(m_pActor->getTimeSec())
.setPos(m_body->getPos())
.setPos(m_body->getCenterPos())
.setCharge(m_charge->getCharge())
;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Player/State/DoorInMapMoveState.hpp>
#include <abyss/components/Actor/Player/State/DoorInMapMoveState.hpp>
#include <abyss/components/Actor/Player/SeDef.hpp>
#include <abyss/modules/Event/Events.hpp>
#include <abyss/components/Event/MapMove/DoorIn/Builder.hpp>
Expand Down Expand Up @@ -36,7 +36,7 @@ namespace abyss::Actor::Player
m_pActor->getModule<Events>()->create<Event::MapMove::DoorIn::Builder>(
m_door,
m_link,
m_body->getPos()
m_body->getCenterPos()
);
}
void DoorInMapMoveState::end()
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Actor/Player/State/DoorInState.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/Player/State/DoorInState.hpp>
#include <abyss/components/Actor/Player/State/DoorInState.hpp>
#include <abyss/components/Actor/Player/State/SwimState.hpp>
#include <abyss/components/Actor/Player/SeDef.hpp>
#include <abyss/modules/Temporary/Temporary.hpp>
Expand Down Expand Up @@ -32,7 +32,7 @@ namespace abyss::Actor::Player
m_pActor->getModule<Events>()->create<Event::RoomMove::DoorMove::Builder>(
m_room,
m_door,
m_body->getPos(),
m_body->getCenterPos(),
[this]() {
// ステートを更新する
auto stateCtrl = m_pActor->find<StateCtrl>();
Expand Down
6 changes: 5 additions & 1 deletion Re-Abyss/app/components/Actor/utils/ActorUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Actor/utils/ActorUtils.hpp>
#include <abyss/components/Actor/utils/ActorUtils.hpp>
#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/modules/Actor/Actors.hpp>
#include <abyss/modules/Actor/Player/PlayerManager.hpp>
Expand All @@ -10,6 +10,10 @@ namespace abyss::Actor::ActorUtils
{
return actor.getModule<Actor::Player::PlayerManager>()->getPos();
}
const s3d::Vec2& PlayerCenterPos(const ActorObj& actor)
{
return actor.getModule<Actor::Player::PlayerManager>()->getCenterPos();
}
const s3d::Vec2& PlayerVelocity(const ActorObj& actor)
{
return actor.getModule<Actor::Player::PlayerManager>()->getVelocity();
Expand Down
3 changes: 2 additions & 1 deletion Re-Abyss/app/components/Actor/utils/ActorUtils.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once
#pragma once
#include <abyss/commons/Fwd.hpp>
#include <Siv3D/Fwd.hpp>

namespace abyss::Actor::ActorUtils
{
const s3d::Vec2& PlayerPos(const ActorObj& actor);
const s3d::Vec2& PlayerCenterPos(const ActorObj& actor);
const s3d::Vec2& PlayerVelocity(const ActorObj& actor);

s3d::Vec2 ToPlayer(const ActorObj& actor, const Body& body);
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Event/MapMove/MapMoveCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Event/MapMove/MapMoveCtrl.hpp>
#include <abyss/components/Event/MapMove/MapMoveCtrl.hpp>
#include <abyss/modules/Event/base/EventObj.hpp>
#include <abyss/modules/Stage/Stage.hpp>
#include <abyss/modules/Camera/Camera.hpp>
Expand Down Expand Up @@ -73,7 +73,7 @@ namespace abyss::Event::MapMove
// カメラの座標更新
cameraFix->setPos(m_callback->calcCameraPos());
// プレイヤーの座標更新
m_pEvent->getModule<Actor::Player::PlayerManager>()->setPos(m_callback->calcPlayerPos());
m_pEvent->getModule<Actor::Player::PlayerManager>()->setCenterPos(m_callback->calcPlayerPos());

if (sw.ms() >= m_animeMilliSec) {
break;
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Event/RoomMove/BasicMove/Builder.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Event/RoomMove/BasicMove/Builder.hpp>
#include <abyss/components/Event/RoomMove/BasicMove/Builder.hpp>

#include <abyss/modules/Camera/Camera.hpp>
#include <abyss/modules/Room/RoomManager.hpp>
Expand All @@ -16,7 +16,7 @@ namespace abyss::Event::RoomMove::BasicMove
{
{
auto* player = pEvent->getModule<Actor::Player::PlayerManager>();
const auto& pos = player->getPos();
const auto& pos = player->getCenterPos();
const auto& current = pEvent->getModule<RoomManager>()->currentRoom();
auto camera = pEvent->getModule<Camera>();
Vec2 cameraPos = camera->getPos();
Expand Down
3 changes: 1 addition & 2 deletions Re-Abyss/app/components/Event/RoomMove/DoorMove/Builder.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <abyss/components/Event/RoomMove/DoorMove/Builder.hpp>
#include <abyss/components/Event/RoomMove/DoorMove/Builder.hpp>

#include <abyss/modules/Room/RoomManager.hpp>
#include <abyss/modules/Actor/Player/PlayerManager.hpp>
#include <abyss/modules/Event/Events.hpp>
#include <abyss/modules/Event/base/EventObj.hpp>

Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Event/RoomMove/RoomMoveCtrl.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Event/RoomMove/RoomMoveCtrl.hpp>
#include <abyss/components/Event/RoomMove/RoomMoveCtrl.hpp>
#include <abyss/modules/Manager/Manager.hpp>
#include <abyss/modules/Camera/Camera.hpp>
#include <abyss/modules/Camera/CameraFix/base/ICameraFix.hpp>
Expand Down Expand Up @@ -80,7 +80,7 @@ namespace abyss::Event::RoomMove
// カメラの座標更新
cameraFix->setPos(m_callback->calcCameraPos());
// プレイヤーの座標更新
m_pEvent->getModule<Actor::Player::PlayerManager>()->setPos(m_callback->calcPlayerPos());
m_pEvent->getModule<Actor::Player::PlayerManager>()->setCenterPos(m_callback->calcPlayerPos());

if (sw.ms() >= m_animeMilliSec) {
break;
Expand Down
4 changes: 2 additions & 2 deletions Re-Abyss/app/components/Fade/FadeUtil.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/components/Fade/FadeUtil.hpp>
#include <abyss/components/Fade/FadeUtil.hpp>

#include <abyss/modules/Actor/Player/PlayerManager.hpp>
#include <abyss/modules/Camera/Camera.hpp>
Expand Down Expand Up @@ -55,7 +55,7 @@ namespace abyss::Fade
{
auto* playerManager = pGameObject->getModule<Actor::Player::PlayerManager>();
return WaitIrisOut(pGameObject, [playerManager] {
return playerManager->getPos();
return playerManager->getCenterPos();
}, timeSec);
}
template<FadeOperation Operation>
Expand Down
6 changes: 4 additions & 2 deletions Re-Abyss/app/entities/Actor/Gimmick/GimmickEntity.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <Siv3D/Vector2D.hpp>
#include <abyss/values/Forward.hpp>

Expand All @@ -21,5 +21,7 @@ namespace abyss::Actor::Gimmick
s3d::uint32 id;
GimmickType type;
s3d::Vec2 pos;
};
s3d::Vec2 footPos;
s3d::Vec2 size;
};
}
11 changes: 10 additions & 1 deletion Re-Abyss/app/modules/Actor/Player/PlayerManager.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <abyss/modules/Actor/Player/PlayerManager.hpp>
#include <abyss/modules/Actor/Player/PlayerManager.hpp>
#include <abyss/modules/Actor/base/ActorObj.hpp>
#include <abyss/components/Actor/Common/Body.hpp>
#include <abyss/components/Actor/Common/HP.hpp>
Expand All @@ -16,10 +16,19 @@ namespace abyss::Actor::Player
m_body->setPos(pos);
return *this;
}
PlayerManager& PlayerManager::setCenterPos(const s3d::Vec2& pos)
{
m_body->setCenterPos(pos);
return *this;
}
const s3d::Vec2& PlayerManager::getPos() const
{
return m_body->getPos();
}
s3d::Vec2 PlayerManager::getCenterPos() const
{
return m_body->getCenterPos();
}
const s3d::Vec2& PlayerManager::getVelocity() const
{
return m_body->getVelocity();
Expand Down
4 changes: 3 additions & 1 deletion Re-Abyss/app/modules/Actor/Player/PlayerManager.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <abyss/commons/Fwd.hpp>
#include <abyss/components/Actor/Player/PlayerDesc.hpp>
#include <abyss/utils/Ref/Ref.hpp>
Expand All @@ -14,7 +14,9 @@ namespace abyss::Actor::Player
void regist(const Ref<ActorObj>& player);

PlayerManager& setPos(const s3d::Vec2& pos);
PlayerManager& setCenterPos(const s3d::Vec2& pos);
const s3d::Vec2& getPos() const;
s3d::Vec2 getCenterPos() const;
const s3d::Vec2& getVelocity() const;

const Ref<ActorObj>& getActor() const;
Expand Down
Loading

0 comments on commit 2933269

Please sign in to comment.