mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 00:44:21 +00:00
Implement most of LegoCameraController (#419)
* Implement LegoCameraController subclasses * Update legopovcontroller.cpp * fixes * Update legocameracontroller.cpp * fix naming conventions * Update legopointofviewcontroller.h * Update legopointofviewcontroller.h * Fixes * Match LegoPointOfViewController::Create --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
@@ -238,7 +238,7 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
|
||||
mat.GetMatrix()[i][2] = mat2[i][2] * c + mat2[i][1] * s;
|
||||
}
|
||||
Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]);
|
||||
m_world->GetCamera()->LookAt(at, dir, up);
|
||||
m_world->GetCamera()->SetWorldTransform(at, dir, up);
|
||||
FUN_10010c30();
|
||||
break;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
|
||||
mat.SetIdentity();
|
||||
Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]);
|
||||
at[1] = 1.25;
|
||||
m_world->GetCamera()->LookAt(at, dir, up);
|
||||
m_world->GetCamera()->SetWorldTransform(at, dir, up);
|
||||
if (GameState()->GetUnknown10() == 0) {
|
||||
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
|
||||
VTable0xe8(0x29, TRUE, 7);
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#include "legocameracontroller.h"
|
||||
|
||||
// STUB: LEGO1 0x10011d50
|
||||
LegoCameraController::LegoCameraController()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10011f70
|
||||
LegoCameraController::~LegoCameraController()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10012260
|
||||
void LegoCameraController::LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up)
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100123e0
|
||||
void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32)
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10012740
|
||||
Vector3Data& LegoCameraController::FUN_10012740()
|
||||
{
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100127f0
|
||||
Vector3Data& LegoCameraController::FUN_100127f0()
|
||||
{
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100128a0
|
||||
Vector3Data& LegoCameraController::FUN_100128a0()
|
||||
{
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
107
LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp
Normal file
107
LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
#include "legocameracontroller.h"
|
||||
|
||||
#include "legoinputmanager.h"
|
||||
#include "legonotify.h"
|
||||
#include "legoomni.h"
|
||||
#include "legovideomanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoCameraController, 0xc8);
|
||||
|
||||
// FUNCTION: LEGO1 0x10011d50
|
||||
LegoCameraController::LegoCameraController()
|
||||
{
|
||||
SetWorldTransform(Vector3Data(0, 0, 0), Vector3Data(0, 0, 1), Vector3Data(0, 1, 0));
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10011f70
|
||||
LegoCameraController::~LegoCameraController()
|
||||
{
|
||||
if (InputManager()) {
|
||||
if (InputManager()->GetCamera() == this) {
|
||||
InputManager()->ClearCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10011ff0
|
||||
MxResult LegoCameraController::Create()
|
||||
{
|
||||
InputManager()->SetCamera(this);
|
||||
return LegoPointOfViewController::Create(VideoManager()->Get3DManager()->GetLego3DView());
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10012020
|
||||
MxLong LegoCameraController::Notify(MxParam& p_param)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100121b0
|
||||
void LegoCameraController::OnLButtonDown(MxPoint32 p_point)
|
||||
{
|
||||
LeftDown(p_point.GetX(), p_point.GetY());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100121d0
|
||||
void LegoCameraController::OnLButtonUp(MxPoint32 p_point)
|
||||
{
|
||||
LeftUp(p_point.GetX(), p_point.GetY());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100121f0
|
||||
void LegoCameraController::OnRButtonDown(MxPoint32 p_point)
|
||||
{
|
||||
RightDown(p_point.GetX(), p_point.GetY());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012210
|
||||
void LegoCameraController::OnRButtonUp(MxPoint32 p_point)
|
||||
{
|
||||
RightUp(p_point.GetX(), p_point.GetY());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012230
|
||||
void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point)
|
||||
{
|
||||
if (p_modifier & c_lButtonState)
|
||||
LeftDrag(p_point.GetX(), p_point.GetY());
|
||||
else if (p_modifier & c_rButtonState)
|
||||
RightDrag(p_point.GetX(), p_point.GetY());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012260
|
||||
void LegoCameraController::SetWorldTransform(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up)
|
||||
{
|
||||
CalcLocalTransform(p_at, p_dir, p_up, m_matrix1);
|
||||
m_matrix2 = m_matrix1;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100123e0
|
||||
void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32)
|
||||
{
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10012740
|
||||
Vector3Data& LegoCameraController::FUN_10012740()
|
||||
{
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100127f0
|
||||
Vector3Data& LegoCameraController::FUN_100127f0()
|
||||
{
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100128a0
|
||||
Vector3Data& LegoCameraController::FUN_100128a0()
|
||||
{
|
||||
// Actually returns reference to a member
|
||||
static Vector3Data g_v;
|
||||
return g_v;
|
||||
}
|
||||
134
LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp
Normal file
134
LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "legonavcontroller.h"
|
||||
#include "legoomni.h"
|
||||
#include "legopointofviewcontroller.h"
|
||||
#include "mxticklemanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoMouseController, 0x20);
|
||||
DECOMP_SIZE_ASSERT(LegoPointOfViewController, 0x38);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FUNCTION: LEGO1 0x10065550
|
||||
LegoMouseController::LegoMouseController()
|
||||
{
|
||||
m_isButtonDown = FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100655d0
|
||||
LegoMouseController::~LegoMouseController()
|
||||
{
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10065620
|
||||
void LegoMouseController::LeftDown(int p_x, int p_y)
|
||||
{
|
||||
m_isButtonDown = TRUE;
|
||||
m_buttonX = p_x;
|
||||
m_buttonY = p_y;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10065640
|
||||
void LegoMouseController::LeftUp(int p_x, int p_y)
|
||||
{
|
||||
m_isButtonDown = FALSE;
|
||||
m_buttonX = p_x;
|
||||
m_buttonY = p_y;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10065660
|
||||
void LegoMouseController::LeftDrag(int p_x, int p_y)
|
||||
{
|
||||
m_buttonX = p_x;
|
||||
m_buttonY = p_y;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10065680
|
||||
void LegoMouseController::RightDown(int p_x, int p_y)
|
||||
{
|
||||
m_isButtonDown = TRUE;
|
||||
m_buttonX = p_x;
|
||||
m_buttonY = p_y;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100656a0
|
||||
void LegoMouseController::RightUp(int p_x, int p_y)
|
||||
{
|
||||
m_isButtonDown = FALSE;
|
||||
m_buttonX = p_x;
|
||||
m_buttonY = p_y;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100656c0
|
||||
void LegoMouseController::RightDrag(int p_x, int p_y)
|
||||
{
|
||||
m_buttonX = p_x;
|
||||
m_buttonY = p_y;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FUNCTION: LEGO1 0x100656e0
|
||||
LegoPointOfViewController::LegoPointOfViewController()
|
||||
{
|
||||
m_lego3DView = NULL;
|
||||
m_entity = NULL;
|
||||
m_nav = NULL;
|
||||
// m_entityOffsetUp is a temporary kludge. It should be replaced
|
||||
// by 3D camera offset and position stored in the entity since each
|
||||
// entity may have a different best viewpoint.
|
||||
m_entityOffsetUp = 0.0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10065770
|
||||
LegoPointOfViewController::~LegoPointOfViewController()
|
||||
{
|
||||
TickleManager()->UnregisterClient(this);
|
||||
if (m_nav) {
|
||||
delete m_nav;
|
||||
m_nav = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100657f0
|
||||
MxResult LegoPointOfViewController::Create(Lego3DView* p_lego3DView)
|
||||
{
|
||||
m_lego3DView = p_lego3DView;
|
||||
m_nav = new LegoNavController();
|
||||
LegoOmni::GetInstance()->SetNavController(m_nav);
|
||||
m_nav->SetTrackDefaultParams(TRUE);
|
||||
TickleManager()->RegisterClient(this, 10);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100658c0
|
||||
void LegoPointOfViewController::LeftDown(int p_x, int p_y)
|
||||
{
|
||||
LegoMouseController::LeftDown(p_x, p_y);
|
||||
AffectPointOfView();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100658e0
|
||||
void LegoPointOfViewController::LeftDrag(int p_x, int p_y)
|
||||
{
|
||||
LegoMouseController::LeftDrag(p_x, p_y);
|
||||
AffectPointOfView();
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10065900
|
||||
void LegoPointOfViewController::AffectPointOfView()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10065930
|
||||
MxResult LegoPointOfViewController::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10065ae0
|
||||
void LegoPointOfViewController::SetEntity(LegoEntity* p_entity)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
Reference in New Issue
Block a user