mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-12 22:56:13 +00:00
Implemented functionality for editing, creating, and deleting script object links
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "CSplinePathExtra.h"
|
||||
#include "CWaypointExtra.h"
|
||||
#include "Core/Resource/Script/CLink.h"
|
||||
#include "Core/Scene/CScene.h"
|
||||
|
||||
CSplinePathExtra::CSplinePathExtra(CScriptObject *pInstance, CScene *pScene, CSceneNode *pParent)
|
||||
@@ -45,14 +46,14 @@ void CSplinePathExtra::AddWaypoints()
|
||||
|
||||
std::set<CWaypointExtra*> CheckedWaypoints;
|
||||
|
||||
for (u32 iLink = 0; iLink < mpInstance->NumOutLinks(); iLink++)
|
||||
for (u32 iLink = 0; iLink < mpInstance->NumLinks(eOutgoing); iLink++)
|
||||
{
|
||||
const SLink& rkLink = mpInstance->OutLink(iLink);
|
||||
CLink *pLink = mpInstance->Link(eOutgoing, iLink);
|
||||
|
||||
if ( (rkLink.State == 0x49533030 && rkLink.Message == 0x41544348) || // InternalState00/Attach
|
||||
(rkLink.State == 0x4D4F5450 && rkLink.Message == 0x41544348) ) // MotionPath/Attach
|
||||
if ( (pLink->State() == 0x49533030 && pLink->Message() == 0x41544348) || // InternalState00/Attach
|
||||
(pLink->State() == 0x4D4F5450 && pLink->Message() == 0x41544348) ) // MotionPath/Attach
|
||||
{
|
||||
CScriptNode *pNode = mpScene->ScriptNodeByID(rkLink.ObjectID);
|
||||
CScriptNode *pNode = mpScene->ScriptNodeByID(pLink->ReceiverID());
|
||||
|
||||
if (pNode && pNode->Object()->ObjectTypeID() == 0x57415950) // Waypoint
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "CWaypointExtra.h"
|
||||
#include "Core/Resource/Script/CLink.h"
|
||||
#include "Core/Render/CDrawUtil.h"
|
||||
#include "Core/Render/CRenderer.h"
|
||||
#include "Core/Scene/CScene.h"
|
||||
@@ -78,13 +79,13 @@ void CWaypointExtra::BuildLinks()
|
||||
{
|
||||
mLinks.clear();
|
||||
|
||||
for (u32 iLink = 0; iLink < mpInstance->NumOutLinks(); iLink++)
|
||||
for (u32 iLink = 0; iLink < mpInstance->NumLinks(eOutgoing); iLink++)
|
||||
{
|
||||
const SLink& rkLink = mpInstance->OutLink(iLink);
|
||||
CLink *pLink = mpInstance->Link(eOutgoing, iLink);
|
||||
|
||||
if (IsPathLink(rkLink))
|
||||
if (IsPathLink(pLink))
|
||||
{
|
||||
CScriptNode *pNode = mpScene->ScriptNodeByID(rkLink.ObjectID);
|
||||
CScriptNode *pNode = mpScene->ScriptNodeByID(pLink->ReceiverID());
|
||||
|
||||
SWaypointLink Link;
|
||||
Link.pWaypoint = pNode;
|
||||
@@ -97,26 +98,26 @@ void CWaypointExtra::BuildLinks()
|
||||
mLinksBuilt = true;
|
||||
}
|
||||
|
||||
bool CWaypointExtra::IsPathLink(const SLink& rkLink)
|
||||
bool CWaypointExtra::IsPathLink(CLink *pLink)
|
||||
{
|
||||
bool Valid = false;
|
||||
|
||||
if (rkLink.State < 0xFF)
|
||||
if (pLink->State() < 0xFF)
|
||||
{
|
||||
if (rkLink.State == 0x1 && rkLink.Message == 0x8) Valid = true; // Arrived / Next (MP1)
|
||||
if (pLink->State() == 0x1 && pLink->Message() == 0x8) Valid = true; // Arrived / Next (MP1)
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
CFourCC State(rkLink.State);
|
||||
CFourCC Message(rkLink.Message);
|
||||
CFourCC State(pLink->State());
|
||||
CFourCC Message(pLink->Message());
|
||||
if (State == "ARRV" && Message == "NEXT") Valid = true; // Arrived / Next (MP2)
|
||||
if (State == "NEXT" && Message == "ATCH") Valid = true; // Next / Attach (MP3/DKCR)
|
||||
}
|
||||
|
||||
if (Valid)
|
||||
{
|
||||
CScriptNode *pNode = mpScene->ScriptNodeByID(rkLink.ObjectID);
|
||||
CScriptNode *pNode = mpScene->ScriptNodeByID(pLink->ReceiverID());
|
||||
|
||||
if (pNode)
|
||||
return pNode->Object()->ObjectTypeID() == mpInstance->ObjectTypeID();
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void AddToSplinePath(CSplinePathExtra *pPath);
|
||||
void RemoveFromSplinePath(CSplinePathExtra *pPath);
|
||||
void BuildLinks();
|
||||
bool IsPathLink(const SLink& rkLink);
|
||||
bool IsPathLink(CLink *pLink);
|
||||
void GetLinkedWaypoints(std::list<CWaypointExtra*>& rOut);
|
||||
|
||||
void LinksModified();
|
||||
|
||||
Reference in New Issue
Block a user