Skip to content

Commit bd36807

Browse files
committed
Merge branch 'main' into FixShadowBikeBulletCollision
2 parents 14ae866 + 60b6ecc commit bd36807

9 files changed

Lines changed: 75 additions & 19 deletions

File tree

MarathonRecomp/api/Marathon.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "Sonicteam/AppMarathon.h"
2121
#include "Sonicteam/AudioEngineXenon.h"
2222
#include "Sonicteam/CObjBalloonIconDrawable.h"
23+
#include "Sonicteam/Camera/CameraModeManager.h"
2324
#include "Sonicteam/Camera/CameraMode.h"
2425
#include "Sonicteam/Camera/Cameraman.h"
2526
#include "Sonicteam/Camera/SonicCamera.h"
@@ -52,6 +53,7 @@
5253
#include "Sonicteam/MainMenuTask.h"
5354
#include "Sonicteam/MainMode.h"
5455
#include "Sonicteam/Message/MsgSuckPlayer.h"
56+
#include "Sonicteam/Message/MsgCameramanCameraMode.h"
5557
#include "Sonicteam/MessageWindowTask.h"
5658
#include "Sonicteam/MovieObject.h"
5759
#include "Sonicteam/MovieObjectWmv.h"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
#include <boost/smart_ptr/shared_ptr.h>
5+
#include <api/stdx/vector.h>
6+
7+
namespace Sonicteam::Camera
8+
{
9+
class Cameraman;
10+
class CameraMode;
11+
class CameraModeManager
12+
{
13+
// TODO: figure out all these, 8218C100
14+
struct _vector_struct_
15+
{
16+
MARATHON_INSERT_PADDING(0x14);
17+
};
18+
public:
19+
xpointer<Cameraman> m_pCameraman;
20+
boost::shared_ptr<CameraMode> m_spCameraMode;
21+
MARATHON_INSERT_PADDING(0x8);
22+
stdx::vector<_vector_struct_> m_vVector;
23+
};
24+
}

MarathonRecomp/api/Sonicteam/Camera/Cameraman.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
#include <Marathon.inl>
44
#include <boost/smart_ptr/shared_ptr.h>
5+
#include <Sonicteam/Camera/CameraModeManager.h>
56

67
namespace Sonicteam::Camera
78
{
8-
class Cameraman : Actor
9+
class Cameraman : public Actor
910
{
1011
public:
11-
MARATHON_INSERT_PADDING(0x58);
12-
be<float> m_FOV;
12+
MARATHON_INSERT_PADDING(0x24);
13+
boost::shared_ptr<CameraModeManager> m_spCameraModeManager;
14+
MARATHON_INSERT_PADDING(0x2C);
15+
be<float> m_FOV; // 0xB0
1316
};
1417
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include <Marathon.inl>
4+
#include <Sonicteam/SoX/Math/Vector.h>
5+
#include <Sonicteam/SoX/Message.h>
6+
7+
namespace Sonicteam::Message
8+
{
9+
struct MsgCameramanCameraInitialize : SoX::Message<0x14007>
10+
{
11+
be<uint32_t> m_PadID;
12+
be<uint32_t> m_TargetActorID;
13+
bool IsDemoCam;
14+
};
15+
}

MarathonRecomp/api/Sonicteam/Player/Object.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ namespace Sonicteam::Player
2424

2525
stdx::string m_PlayerLua;
2626
stdx::string m_PlayerPackage;
27-
MARATHON_INSERT_PADDING(8);
27+
be<uint32_t> m_TargetCameraActorID;
28+
xpointer<MessageReceiver> m_pCameraman; // Here as MessageReceiver
2829
be<uint32_t> m_PlayerIndex;
2930
MARATHON_INSERT_PADDING(0x2C);
3031
bool m_IsPlayer;

MarathonRecomp/api/Sonicteam/SoX/Physics/Havok/WorldHavok.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Marathon.inl>
44
#include <hk330/hkpWorld.h>
55
#include <Sonicteam/SoX/Physics/World.h>
6+
#include <hk330/hkpWorld.h>
67

78
namespace Sonicteam::SoX::Physics::Havok
89
{

MarathonRecomp/gpu/video.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,9 @@ static void DrawProfiler()
26962696
if (sdlVideoDriver != nullptr)
26972697
ImGui::Text("SDL Video Driver: %s", sdlVideoDriver);
26982698

2699+
ImGui::NewLine();
2700+
ImGui::Text("Output Resolution: %d x %d", Video::s_viewportWidth, Video::s_viewportHeight);
2701+
26992702
ImGui::NewLine();
27002703
ImGui::Checkbox("Show FPS", &Config::ShowFPS.Value);
27012704
ImGui::NewLine();

MarathonRecomp/patches/player_patches.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool MidairSnowboardControl()
8484
// Add missing SetupModuleDebug to table.
8585
void PlayerDebugMode_RegisterLuaSetup(PPCRegister& str, PPCRegister& index)
8686
{
87-
if (!Config::PlayerDebugMode)
87+
if (!Config::EnableDebugMode)
8888
return;
8989

9090
auto pString = (stdx::string*)g_memory.Translate(str.u32);
@@ -116,7 +116,7 @@ bool PlayerDebugMode_RemapDebugExitButton(PPCRegister& r_PadState, PPCRegister&
116116
PPC_FUNC_IMPL(__imp__sub_82195500);
117117
PPC_FUNC(sub_82195500)
118118
{
119-
if (!Config::PlayerDebugMode)
119+
if (!(Config::EnableDebugMode || Config::RestoreDemoCameraMode))
120120
{
121121
__imp__sub_82195500(ctx, base);
122122
return;
@@ -131,26 +131,32 @@ PPC_FUNC(sub_82195500)
131131
if (pPlayer->m_IsPlayer)
132132
{
133133
auto playerIndex = pGameMode->m_pGameImp->PlayerActorIDToIndex(pPlayer->m_ActorID);
134-
auto& spManager = pDoc->m_vspInputManager[pDoc->m_PlayerControllerID[playerIndex]];
134+
auto padID = pDoc->m_PlayerControllerID[playerIndex];
135+
auto& spManager = pDoc->m_vspInputManager[padID];
136+
auto pGameImp = App::s_pApp->m_pDoc->GetDocMode<Sonicteam::GameMode>()->m_pGameImp.get();
135137

136-
// Disable camera volume collision on B press.
137-
if (pPlayer->m_SetupModuleIndexPostfix == 2 && spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_B))
138+
// Disable collision on B press.
139+
if (pPlayer->m_SetupModuleIndexPostfix == 2 && spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_B) && Config::EnableDebugMode)
138140
{
139141
auto value = pZock->m_spPhantomA->m_pRigidBody->m_collidable.m_broadPhaseHandle.m_collisionFilterInfo == 6 ? 0x383 : 6;
142+
pZock->m_spPhantomA->m_pRigidBody->m_collidable.m_broadPhaseHandle.m_collisionFilterInfo = value;
143+
pGameImp->GetPhysicsWorld<Sonicteam::SoX::Physics::Havok::WorldHavok>()->m_pWorld->updateCollisionFilterOnWorld(1,1);
144+
}
140145

141-
pZock->m_spPhantomA.reset();
142-
pZock->m_spPhantomB.reset();
143-
144-
GuestToHostFunction<void>(sub_821E3628, &pZock->m_spPhantomA, &pPlayer->m_spRootFrame, static_cast<Sonicteam::SoX::MessageReceiver*>(pPlayer), value, 50.0);
145-
146-
pZock->m_spPhantomB = pZock->m_spPhantomA;
147-
pZock->m_spPhantomA->InitializeToWorld(pGameMode->m_pGameImp->m_spPhysicsWorld);
148-
pZock->m_spPhantomA->SetPhantomListener(pZock->m_spPhantomListener);
146+
// Switch to Camera <-> DemoGMCamera
147+
if ((pPlayer->m_SetupModuleIndexPostfix == 2 || Config::RestoreDemoCameraMode) && spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_DpadUp))
148+
{
149+
auto pCamera = static_cast<Sonicteam::Camera::Cameraman*>(pPlayer->m_pCameraman.get());
150+
guest_stack_var<Sonicteam::Message::MsgCameramanCameraInitialize> m_initMessage;
151+
m_initMessage->IsDemoCam = pCamera->m_spCameraModeManager->m_spCameraMode->m_pVftable.ptr.get() != 0x82002004;
152+
m_initMessage->m_TargetActorID = pPlayer->m_ActorID;
153+
m_initMessage->m_PadID = spManager->m_ControllerID;
154+
pCamera->OnMessageReceived(m_initMessage.get());
149155
}
150156

151157
// Enter debug posture on Select press.
152158
if (pPlayer->m_SetupModuleIndexPostfix != 2 &&
153-
!(pPlayer->m_SetupModuleIndexPrefix == 2 && pPlayer->m_SetupModuleIndexPostfix == 1) &&
159+
!(pPlayer->m_SetupModuleIndexPrefix == 2 && pPlayer->m_SetupModuleIndexPostfix == 1) && Config::EnableDebugMode &&
154160
spManager->m_PadState.IsPressed(Sonicteam::SoX::Input::KeyState_Select))
155161
{
156162
pPlayer->m_SetupModuleIndexPostfix = 2;

MarathonRecomp/user/config_def.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreChaosBoostJump, false);
8989
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreChainJumpFlips, false);
9090
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableEdgeGrabLeftover, false);
9191
CONFIG_DEFINE_HIDDEN("Codes", bool, TailsGauge, false);
92-
CONFIG_DEFINE_HIDDEN("Codes", bool, PlayerDebugMode, false);
92+
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableDebugMode, false);
93+
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreDemoCameraMode, false);
9394
CONFIG_DEFINE_HIDDEN("Codes", bool, MidairControlForMachSpeed, false);
9495
CONFIG_DEFINE_HIDDEN("Codes", bool, MidairControlForSnowboards, false);
9596
CONFIG_DEFINE_HIDDEN("Codes", bool, ControllableTeleportDash, false);

0 commit comments

Comments
 (0)