Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MarathonRecomp/api/Marathon.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Sonicteam/AppMarathon.h"
#include "Sonicteam/AudioEngineXenon.h"
#include "Sonicteam/CObjBalloonIconDrawable.h"
#include "Sonicteam/Camera/CameraModeManager.h"
#include "Sonicteam/Camera/CameraMode.h"
#include "Sonicteam/Camera/Cameraman.h"
#include "Sonicteam/Camera/SonicCamera.h"
Expand Down Expand Up @@ -49,6 +50,7 @@
#include "Sonicteam/MainMenuTask.h"
#include "Sonicteam/MainMode.h"
#include "Sonicteam/Message/MsgSuckPlayer.h"
#include "Sonicteam/Message/MsgCameramanCameraMode.h"
#include "Sonicteam/MessageWindowTask.h"
#include "Sonicteam/MovieObject.h"
#include "Sonicteam/MovieObjectWmv.h"
Expand Down
24 changes: 24 additions & 0 deletions MarathonRecomp/api/Sonicteam/Camera/CameraModeManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include <Marathon.inl>
#include <boost/smart_ptr/shared_ptr.h>
#include <api/stdx/vector.h>

namespace Sonicteam::Camera
{
class Cameraman;
class CameraMode;
class CameraModeManager
{
// TODO: figure out all these, 8218C100
struct _vector_struct_
{
MARATHON_INSERT_PADDING(0x14);
};
public:
xpointer<Cameraman> m_pCameraman;
boost::shared_ptr<CameraMode> m_spCameraMode;
MARATHON_INSERT_PADDING(0x8);
stdx::vector<_vector_struct_> m_vVector;
};
}
9 changes: 6 additions & 3 deletions MarathonRecomp/api/Sonicteam/Camera/Cameraman.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

#include <Marathon.inl>
#include <boost/smart_ptr/shared_ptr.h>
#include <Sonicteam/Camera/CameraModeManager.h>

namespace Sonicteam::Camera
{
class Cameraman : Actor
class Cameraman : public Actor
{
public:
MARATHON_INSERT_PADDING(0x58);
be<float> m_FOV;
MARATHON_INSERT_PADDING(0x24);
boost::shared_ptr<CameraModeManager> m_spCameraModeManager;
MARATHON_INSERT_PADDING(0x2C);
be<float> m_FOV; // 0xB0
};
}
15 changes: 15 additions & 0 deletions MarathonRecomp/api/Sonicteam/Message/MsgCameramanCameraMode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <Marathon.inl>
#include <Sonicteam/SoX/Math/Vector.h>
#include <Sonicteam/SoX/Message.h>

namespace Sonicteam::Message
{
struct MsgCameramanCameraInitialize : SoX::Message<0x14007>
{
be<uint32_t> m_PadID;
be<uint32_t> m_TargetActorID;
bool IsDemoCam;
};
}
3 changes: 2 additions & 1 deletion MarathonRecomp/api/Sonicteam/Player/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ namespace Sonicteam::Player

stdx::string m_PlayerLua;
stdx::string m_PlayerPackage;
MARATHON_INSERT_PADDING(8);
be<uint32_t> m_TargetCameraActorID;
xpointer<MessageReceiver> m_pCameraman; // Here as MessageReceiver
be<uint32_t> m_PlayerIndex;
MARATHON_INSERT_PADDING(0x2C);
bool m_IsPlayer;
Expand Down
4 changes: 3 additions & 1 deletion MarathonRecomp/api/Sonicteam/SoX/Physics/Havok/WorldHavok.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

#include <Marathon.inl>
#include <Sonicteam/SoX/Physics/World.h>
#include <hk330/hkpWorld.h>

namespace Sonicteam::SoX::Physics::Havok
{
class WorldHavok : public World
{
public:
MARATHON_INSERT_PADDING(0x18);
xpointer<hk330::hkpWorld> m_pWorld;
MARATHON_INSERT_PADDING(0x14);
bool m_IsDynamicUpdateRate;
};
}
5 changes: 5 additions & 0 deletions MarathonRecomp/api/hk330/hkpWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ namespace hk330
{
public:
MARATHON_INSERT_PADDING(0x308);

void UpdateCollisionFilterOnWorld(uint32_t updateMode, uint32_t updateShapeCollectionFilter)
{
GuestToHostFunction<void>(sub_82832910, this, updateMode, updateShapeCollectionFilter);
}
};
}
34 changes: 20 additions & 14 deletions MarathonRecomp/patches/player_patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bool MidairSnowboardControl()
// Add missing SetupModuleDebug to table.
void PlayerDebugMode_RegisterLuaSetup(PPCRegister& str, PPCRegister& index)
{
if (!Config::PlayerDebugMode)
if (!Config::EnableDebugMode)
return;

auto pString = (stdx::string*)g_memory.Translate(str.u32);
Expand Down Expand Up @@ -116,7 +116,7 @@ bool PlayerDebugMode_RemapDebugExitButton(PPCRegister& r_PadState, PPCRegister&
PPC_FUNC_IMPL(__imp__sub_82195500);
PPC_FUNC(sub_82195500)
{
if (!Config::PlayerDebugMode)
if (!(Config::EnableDebugMode || Config::RestoreDemoCameraMode))
{
__imp__sub_82195500(ctx, base);
return;
Expand All @@ -131,26 +131,32 @@ PPC_FUNC(sub_82195500)
if (pPlayer->m_IsPlayer)
{
auto playerIndex = pGameMode->m_pGameImp->PlayerActorIDToIndex(pPlayer->m_ActorID);
auto& spManager = pDoc->m_vspInputManager[pDoc->m_PlayerControllerID[playerIndex]];
auto padID = pDoc->m_PlayerControllerID[playerIndex];
auto& spManager = pDoc->m_vspInputManager[padID];
auto pGameImp = App::s_pApp->m_pDoc->GetDocMode<Sonicteam::GameMode>()->m_pGameImp.get();

// Disable camera volume collision on B press.
if (pPlayer->m_SetupModuleIndexPostfix == 2 && spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_B))
// Disable collision on B press.
if (pPlayer->m_SetupModuleIndexPostfix == 2 && spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_B) && Config::EnableDebugMode)
{
auto value = pZock->m_spPhantomA->m_pRigidBody->m_collidable.m_broadPhaseHandle.m_collisionFilterInfo == 6 ? 0x383 : 6;
pZock->m_spPhantomA->m_pRigidBody->m_collidable.m_broadPhaseHandle.m_collisionFilterInfo = value;
pGameImp->GetPhysicsWorld<Sonicteam::SoX::Physics::Havok::WorldHavok>()->m_pWorld.get()->UpdateCollisionFilterOnWorld(1,1);
}

pZock->m_spPhantomA.reset();
pZock->m_spPhantomB.reset();

GuestToHostFunction<void>(sub_821E3628, &pZock->m_spPhantomA, &pPlayer->m_spRootFrame, static_cast<Sonicteam::SoX::MessageReceiver*>(pPlayer), value, 50.0);

pZock->m_spPhantomB = pZock->m_spPhantomA;
pZock->m_spPhantomA->InitializeToWorld(pGameMode->m_pGameImp->m_spPhysicsWorld);
pZock->m_spPhantomA->SetPhantomListener(pZock->m_spPhantomListener);
// Switch to Camera <-> DemoGMCamera
if ((pPlayer->m_SetupModuleIndexPostfix == 2 || Config::RestoreDemoCameraMode) && spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_DpadUp))
{
auto pCamera = static_cast<Sonicteam::Camera::Cameraman*>(pPlayer->m_pCameraman.get());
guest_stack_var<Sonicteam::Message::MsgCameramanCameraInitialize> m_initMessage;
m_initMessage->IsDemoCam = pCamera->m_spCameraModeManager->m_spCameraMode->m_pVftable.ptr.get() != 0x82002004;
m_initMessage->m_TargetActorID = pPlayer->m_ActorID;
m_initMessage->m_PadID = spManager->m_ControllerID;
pCamera->OnMessageReceived(m_initMessage.get());
}

// Enter debug posture on Select press.
if (pPlayer->m_SetupModuleIndexPostfix != 2 &&
!(pPlayer->m_SetupModuleIndexPrefix == 2 && pPlayer->m_SetupModuleIndexPostfix == 1) &&
!(pPlayer->m_SetupModuleIndexPrefix == 2 && pPlayer->m_SetupModuleIndexPostfix == 1) && Config::EnableDebugMode &&
spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_Select))
{
pPlayer->m_SetupModuleIndexPostfix = 2;
Expand Down
3 changes: 2 additions & 1 deletion MarathonRecomp/user/config_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreChaosBoostJump, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreChainJumpFlips, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableEdgeGrabLeftover, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, TailsGauge, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, PlayerDebugMode, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableDebugMode, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreDemoCameraMode, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, MidairControlForMachSpeed, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, MidairControlForSnowboards, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, ControllableTeleportDash, false);
Expand Down
Loading