Some WIP rect

This commit is contained in:
Christian Semmler 2023-12-29 20:03:42 -05:00
parent b4b73465d0
commit 3b3f47aa0d
3 changed files with 67 additions and 0 deletions

View File

@ -695,6 +695,52 @@ MxResult Start(MxDSAction* p_dsAction)
return MxOmni::GetInstance()->Start(p_dsAction); return MxOmni::GetInstance()->Start(p_dsAction);
} }
// Probably should be somewhere else
// FUNCTION: LEGO1 0x100b6e10
MxBool FUN_100b6e10(
MxS32 p_bitmapWidth,
MxS32 p_bitmapHeight,
MxS32 p_videoParamWidth,
MxS32 p_videoParamHeight,
MxS32* p_left,
MxS32* p_top,
MxS32* p_right,
MxS32* p_bottom,
MxS32* p_width,
MxS32* p_height
)
{
MxPoint32 topLeft(*p_left, *p_top);
MxRect32 bitmapRect(MxPoint32(0, 0), MxSize32(p_bitmapWidth, p_bitmapHeight));
MxPoint32 bottomRight(*p_right, *p_bottom);
MxRect32 videoParamRect(MxPoint32(0, 0), MxSize32(p_videoParamWidth, p_videoParamHeight));
MxRect32 rect(0, 0, *p_width, *p_height);
rect.AddPoint(topLeft);
if (!rect.IntersectsWith(bitmapRect))
return FALSE;
rect.Intersect(bitmapRect);
rect.SubtractPoint(topLeft);
rect.AddPoint(bottomRight);
if (!rect.IntersectsWith(videoParamRect))
return FALSE;
rect.Intersect(videoParamRect);
rect.SubtractPoint(bottomRight);
*p_left += rect.GetLeft();
*p_top += rect.GetTop();
*p_right += rect.GetLeft();
*p_bottom += rect.GetTop();
*p_width = rect.GetWidth();
*p_height = rect.GetHeight();
return TRUE;
}
// FUNCTION: LEGO1 0x100b6ff0 // FUNCTION: LEGO1 0x100b6ff0
void MakeSourceName(char* p_output, const char* p_input) void MakeSourceName(char* p_output, const char* p_input)
{ {

View File

@ -166,6 +166,19 @@ void FUN_10015820(MxU32, MxU32);
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid); LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
MxDSAction& GetCurrentAction(); MxDSAction& GetCurrentAction();
MxBool FUN_100b6e10(
MxS32 p_bitmapWidth,
MxS32 p_bitmapHeight,
MxS32 p_videoParamWidth,
MxS32 p_videoParamHeight,
MxS32* p_left,
MxS32* p_top,
MxS32* p_right,
MxS32* p_bottom,
MxS32* p_width,
MxS32* p_height
);
void PlayMusic(MxU32 p_index); void PlayMusic(MxU32 p_index);
void SetIsWorldActive(MxBool p_isWorldActive); void SetIsWorldActive(MxBool p_isWorldActive);
void RegisterScripts(); void RegisterScripts();

View File

@ -56,6 +56,14 @@ class MxRect32 {
this->m_bottom += p_point.GetY(); this->m_bottom += p_point.GetY();
} }
inline void SubtractPoint(const MxPoint32& p_point)
{
this->m_left -= p_point.GetX();
this->m_top -= p_point.GetY();
this->m_right -= p_point.GetX();
this->m_bottom -= p_point.GetY();
}
inline void SetSize(const MxSize32& p_size) inline void SetSize(const MxSize32& p_size)
{ {
this->m_right = p_size.GetWidth(); this->m_right = p_size.GetWidth();