Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,110 @@
// AblMemDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "AblMemDlg.h"
#include <Adept\Entity.hpp>
#include <mw4\AI.hpp>
#ifdef _DEBUG
//#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// AblMemDlg dialog
AblMemDlg::AblMemDlg(Entity* entity, CWnd* pParent /*=NULL*/)
: CDialog(AblMemDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(AblMemDlg)
m_Mem0 = 0.0f;
m_Mem1 = 0.0f;
m_Mem2 = 0.0f;
m_Mem3 = 0.0f;
m_Mem4 = 0.0f;
m_Mem5 = 0.0f;
m_Mem6 = 0.0f;
m_Mem7 = 0.0f;
m_Mem8 = 0.0f;
m_Mem9 = 0.0f;
//}}AFX_DATA_INIT
m_entity = entity;
}
void AblMemDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(AblMemDlg)
DDX_Text(pDX, IDC_EDIT1, m_Mem0);
DDX_Text(pDX, IDC_EDIT2, m_Mem1);
DDX_Text(pDX, IDC_EDIT3, m_Mem2);
DDX_Text(pDX, IDC_EDIT4, m_Mem3);
DDX_Text(pDX, IDC_EDIT5, m_Mem4);
DDX_Text(pDX, IDC_EDIT6, m_Mem5);
DDX_Text(pDX, IDC_EDIT7, m_Mem6);
DDX_Text(pDX, IDC_EDIT8, m_Mem7);
DDX_Text(pDX, IDC_EDIT9, m_Mem8);
DDX_Text(pDX, IDC_EDIT10, m_Mem9);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(AblMemDlg, CDialog)
//{{AFX_MSG_MAP(AblMemDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// AblMemDlg message handlers
BOOL AblMemDlg::OnInitDialog()
{
CDialog::OnInitDialog();
MWObject *obj;
obj = Cast_Object (MWObject *,m_entity);
m_Mem0 = obj->m_AI->RealMemory(0);
m_Mem1 = obj->m_AI->RealMemory(1);
m_Mem2 = obj->m_AI->RealMemory(2);
m_Mem3 = obj->m_AI->RealMemory(3);
m_Mem4 = obj->m_AI->RealMemory(4);
m_Mem5 = obj->m_AI->RealMemory(5);
m_Mem6 = obj->m_AI->RealMemory(6);
m_Mem7 = obj->m_AI->RealMemory(7);
m_Mem8 = obj->m_AI->RealMemory(8);
m_Mem9 = obj->m_AI->RealMemory(9);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void AblMemDlg::OnOK()
{
UpdateData(TRUE);
MWObject *obj;
obj = Cast_Object (MWObject *,m_entity);
obj->m_AI->RealMemory(0,m_Mem0);
obj->m_AI->RealMemory(1,m_Mem1);
obj->m_AI->RealMemory(2,m_Mem2);
obj->m_AI->RealMemory(3,m_Mem3);
obj->m_AI->RealMemory(4,m_Mem4);
obj->m_AI->RealMemory(5,m_Mem5);
obj->m_AI->RealMemory(6,m_Mem6);
obj->m_AI->RealMemory(7,m_Mem7);
obj->m_AI->RealMemory(8,m_Mem8);
obj->m_AI->RealMemory(9,m_Mem9);
CDialog::OnOK();
}
@@ -0,0 +1,59 @@
#if !defined(AFX_ABLMEMDLG_H__4173D8E0_8B1D_11D3_8E25_00105A17BC83__INCLUDED_)
#define AFX_ABLMEMDLG_H__4173D8E0_8B1D_11D3_8E25_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// AblMemDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// AblMemDlg dialog
class AblMemDlg : public CDialog
{
// Construction
public:
AblMemDlg(Entity* entity, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(AblMemDlg)
enum { IDD = IDD_ABLMEMDLG };
float m_Mem0;
float m_Mem1;
float m_Mem2;
float m_Mem3;
float m_Mem4;
float m_Mem5;
float m_Mem6;
float m_Mem7;
float m_Mem8;
float m_Mem9;
//}}AFX_DATA
Entity*
m_entity;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(AblMemDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(AblMemDlg)
virtual BOOL OnInitDialog();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ABLMEMDLG_H__4173D8E0_8B1D_11D3_8E25_00105A17BC83__INCLUDED_)
@@ -0,0 +1,325 @@
#include "stdafx.h"
#include "MW4GameEd.h"
#include "AddCommand.h"
#include "TransDlg.h"
#include <Adept\Player.hpp>
#include <Adept\Interface.hpp>
#include <Adept\Entity.hpp>
#include <Adept\EntityManager.hpp>
#include <Adept\Map.hpp>
#include <Adept\VideoRenderer.hpp>
#include <mw4\NavPoint.hpp>
#include <Adept\CameraComponent.hpp>
#include "InstanceWindow.h"
#include "DisplayWindow.h"
#include "OverviewWindow.h"
#include "EditorWaypoint.h"
extern CMW4GameEdApp theApp;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
AddCommand::AddCommand(Entity *object)
: Command()
{
Check_Object(object);
addedObject = object;
Check_Pointer(theApp.instanceWindow);
if (!object->IsDerivedFrom(EditorPathNode::DefaultData))
theApp.instanceWindow->ResetInstanceLists();
if (object->IsDerivedFrom(NavPoint::DefaultData))
{
NavPoint*node = Cast_Object(NavPoint*,object);
node->SetToDisplay();
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
AddCommand::~AddCommand()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
AddCommand::Execute()
{
Move();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
AddCommand::Undo()
{
Check_Object(addedObject);
if (addedObject->IsDerivedFrom(EditorPathNode::DefaultData))
{
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,addedObject);
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->ErasePoint(node->index);
if (node->prevnode)
{
node->prevnode->m_PathLinkPointData[1] = node->prevnode->m_PathLinkPointData[0];
node->prevnode->nextnode = NULL;
node->prevnode->UpdateLinkPointData();
}
if(node->m_PathLinkLineCloud)
{
Unregister_Pointer(node->m_PathLinkLineCloud);
delete node->m_PathLinkLineCloud;
node->m_PathLinkLineCloud=NULL;
}
if(node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints.size() == 0)
{
Check_Object(NameTable::Instance);
NameTable::Instance->RemoveEntry(node->pathSlot.GetCurrent()->objectID);
Map::Instance->RemoveChild(node->pathSlot.GetCurrent()->pathSlot.GetCurrent());
NameTable::Instance->RemoveEntry(node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->objectID);
theApp.instanceWindow->RemoveInstance(node->pathSlot.GetCurrent());
theApp.instanceWindow->RemoveInstance(node->pathSlot.GetCurrent()->pathSlot.GetCurrent());
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->SentenceToDeathRow();
node->pathSlot.GetCurrent()->SentenceToDeathRow();
NameTable::Instance->IsValid();
}
node->SentenceToDeathRow();
theApp.m_CurPath = NULL;
}
else if (addedObject->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
EditorLatticeNode* latticeNode;
latticeNode = Cast_Object(EditorLatticeNode*,addedObject);
if (latticeNode->railNode)
MW4AI::g_MissionGraph->DeleteNode(latticeNode->railNode->ID());
}
else if (addedObject->IsDerivedFrom(EditorDropNode::DefaultData))
{
EditorDropNode* node;
node = Cast_Object(EditorDropNode*,addedObject);
Check_Object(NameTable::Instance);
NameTable::Instance->RemoveEntry(node->dropZone->objectID);
NameTable::Instance->IsValid();
node->dropZone->SentenceToDeathRow();
}
else if (addedObject->IsDerivedFrom(EditorDropZonePoint::DefaultData))
{
EditorDropZonePoint* node;
node = Cast_Object(EditorDropZonePoint*,addedObject);
node->dropNode->pointChain.Remove(node);
node->dropNode->UpdatePoints();
}
else if (addedObject->IsDerivedFrom(EditorObjectiveMarker::DefaultData))
{
theApp.m_NumObjectives--;
EditorObjectiveMarker* node;
node = Cast_Object(EditorObjectiveMarker*,addedObject);
Check_Object(NameTable::Instance);
NameTable::Instance->RemoveEntry(node->objective->objectID);
NameTable::Instance->IsValid();
node->objective->SentenceToDeathRow();
}
else if (addedObject->IsDerivedFrom(EditorCameraShip::DefaultData))
{
EditorCameraShip* node;
node = Cast_Object(EditorCameraShip*,addedObject);
Check_Object(NameTable::Instance);
NameTable::Instance->RemoveEntry(node->cameraShip->objectID);
Verify(NameTable::Instance->IsValid());
node->cameraShip->SentenceToDeathRow();
Map::Instance->RemoveChild(node->cameraShip);
}
Check_Object(NameTable::Instance);
Entity *parent=addedObject->GetParentEntity();
parent->RemoveChild(addedObject);
NameTable::Instance->RemoveEntry(addedObject->objectID);
NameTable::Instance->IsValid();
Check_Pointer(theApp.instanceWindow);
// theApp.instanceWindow->RemoveInstance(addedObject);
theApp.instanceWindow->ResetInstanceLists();
theApp.overviewWindow->DrawWindow();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
AddCommand::Move()
{
Check_Object(addedObject);
Check_Object(Map::Instance);
Check_Pointer(this);
Point3D target_in_world;
YawPitchRoll current_rotation;
LinearMatrix4D new_local_to_world = LinearMatrix4D::Identity;
Point3D translation = Point3D::Identity, lastPoint;
lastPoint = addedObject->GetLocalToWorld();
int x_down = GetAsyncKeyState(KEY_X) & 0x8000;
int y_down = GetAsyncKeyState(KEY_Y) & 0x8000;
int z_down = GetAsyncKeyState(KEY_Z) & 0x8000;
Check_Object(Player::Instance);
Check_Object(Player::Instance->playerInterface);
Entity *reticule;
reticule = Player::Instance->playerInterface->reticuleEntity.GetCurrent();
if(reticule && reticule == Map::Instance)
{
Point3D world_offset = Player::Instance->playerInterface->reticuleOffset;
LinearMatrix4D new_local_to_parent = LinearMatrix4D::Identity;
new_local_to_parent.Multiply(reticule->GetLocalToParent(), world_offset);
translation = new_local_to_parent;
if (theApp.gridOn)
theApp.GetGridCoords(translation);
}
else if (!y_down)
return; // must be pointing at the sky
bool x_blocked = false, y_blocked = true, z_blocked = false;
if (x_down || y_down || z_down)
{
x_blocked = !x_down;
y_blocked = !y_down;
z_blocked = !z_down;
}
if (x_blocked)
translation.x = lastPoint.x;
if (z_blocked)
translation.z = lastPoint.z;
if (!y_blocked)
{
Vector2DOf<Scalar> cursor;
gos_GetMouseInfo(&cursor.x, &cursor.y, NULL, NULL, NULL, NULL);
// Clean out the interface data
Check_Object(VideoRenderer::Instance);
EntityComponentWeb *web =
Cast_Object(EntityComponentWeb*,VideoRenderer::Instance->GetSceneCamera()->GetComponentWeb());
Interface *intface = Cast_Object(Interface*, web->GetEntity());
intface->reticuleEntity.Remove();
// Figure out the eyeline
Line3D world_line;
VideoRenderer::Instance->GetSceneCamera()->ComputeEyeLine(&world_line, cursor);
Point3D point,y_offset;
point = addedObject->GetLocalToWorld();
Vector3D vector(world_line.m_direction.x,0,world_line.m_direction.z);
Normal3D plane_normal;
plane_normal.Normalize(vector);
Stuff::Plane plane(plane_normal,plane_normal * point);
Scalar axis;
Scalar length = world_line.GetDistanceTo(plane,&axis);
world_line.Project(length,&y_offset);
translation.y = y_offset.y;
}
current_rotation = addedObject->GetLocalToParent();
new_local_to_world.BuildTranslation(translation);
new_local_to_world.BuildRotation(current_rotation);
addedObject->SetNewLocalToParent(new_local_to_world);
addedObject->SyncMatrices(true);
// EntityManager::Instance->RequestPostCollisionExecution(addedObject);
Map::Instance->UpdateZone(addedObject);
if (addedObject->GetCollisionMask() == Entity::EditorIsMovingFlag)
{
if (addedObject->IsMultiZone())
addedObject->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawRedBounds);
else if (addedObject->IsMultiTile())
addedObject->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawYellowBounds);
else
addedObject->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawGreenBounds);
}
else
addedObject->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawGreenBounds);
if (addedObject->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
EditorLatticeNode* node;
node = Cast_Object(EditorLatticeNode*,addedObject);
target_in_world = new_local_to_world;
node->railNode->Location(target_in_world);
node->railNode->UpdateRadiusPointData();
}
else if (addedObject->IsDerivedFrom(EditorPathNode::DefaultData))
{
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,addedObject);
target_in_world = new_local_to_world;
Check_Object(node->pathSlot.GetCurrent());
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints[node->index] = target_in_world;
node->UpdateLinkPointData();
node->SetLinkColor(Stuff::RGBAColor(1.0f,1.0f,0.0f,0.0f));
}
else if (addedObject->IsDerivedFrom(EditorDropNode::DefaultData))
{
EditorDropNode* node;
node = Cast_Object(EditorDropNode*,addedObject);
node->dropZone->SetNewLocalToParent(new_local_to_world);
node->dropZone->SyncMatrices(true);
}
else if (addedObject->IsDerivedFrom(EditorDropZonePoint::DefaultData))
{
EditorDropZonePoint* node;
node = Cast_Object(EditorDropZonePoint*,addedObject);
node->SetNewLocalToParent(new_local_to_world);
node->SyncMatrices(true);
node->UpdateLinkPointData();
Point3D newPoint;
newPoint = new_local_to_world;
node->offset = node->dropNode->GetLocalToWorld();
node->offset -= newPoint;
node->dropNode->UpdatePoints();
}
else if (addedObject->IsDerivedFrom(EditorObjectiveMarker::DefaultData))
{
EditorObjectiveMarker* node;
node = Cast_Object(EditorObjectiveMarker*,addedObject);
node->objective->SetNewLocalToParent(new_local_to_world);
node->objective->SyncMatrices(true);
}
else if (addedObject->IsDerivedFrom(EditorPointLight::DefaultData) ||
addedObject->IsDerivedFrom(EditorSpotLight::DefaultData))
{
EditorLight* light;
light = Cast_Object(EditorLight*,addedObject);
light->SetLightToWorldMatrix(light->GetLocalToWorld());
}
else if (addedObject->IsDerivedFrom(EditorCameraShip::DefaultData))
{
EditorCameraShip* node;
node = Cast_Object(EditorCameraShip*,addedObject);
node->cameraShip->SetNewLocalToParent(new_local_to_world);
node->cameraShip->SyncMatrices(true);
}
}
@@ -0,0 +1,26 @@
// File: AddCommand.hpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
#pragma once
#include "Command.h"
#include <MW4\MW4Headers.hpp>
class AddCommand :
public Command
{
public:
AddCommand(Adept::Entity *entity);
virtual ~AddCommand();
Adept::Entity
*addedObject;
void
Execute();
void
Undo();
void
Move();
};
@@ -0,0 +1,25 @@
#include "stdafx.h"
#include "AddLinkCommand.h"
#include <MW4\Rail_move.hpp>
using namespace MW4AI;
AddLinkCommand::AddLinkCommand(EditorLatticeNode* node)
{
node1 = node;
}
void AddLinkCommand::ConnectLink(EditorLatticeNode* node)
{
float weight[NUM_MOVE_TYPES][2];
node2 = node;
memset(&weight,0,sizeof(weight));
id = MW4AI::g_MissionGraph->AddLink(node1->railNode->ID(),node2->railNode->ID(),weight,MW4AI::twomax);
MW4AI::g_MissionGraph->Link(id)->ShowLink(true);
}
void AddLinkCommand::Undo()
{
MW4AI::g_MissionGraph->DeleteLink(id);
}
@@ -0,0 +1,22 @@
#pragma once
#include "Command.h"
#include "EditorWaypoint.h"
class AddLinkCommand :
public Command
{
public:
AddLinkCommand(EditorLatticeNode* node);
//Member Variables
int id;
EditorLatticeNode* node1;
EditorLatticeNode* node2;
void
ConnectLink(EditorLatticeNode* node);
void
Undo();
};
@@ -0,0 +1,48 @@
// BriefEdit.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "BriefEdit.h"
/////////////////////////////////////////////////////////////////////////////
// CBriefEdit
CBriefEdit::CBriefEdit()
{
}
CBriefEdit::~CBriefEdit()
{
}
BEGIN_MESSAGE_MAP(CBriefEdit, CEdit)
//{{AFX_MSG_MAP(CBriefEdit)
ON_WM_CONTEXTMENU()
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBriefEdit message handlers
void CBriefEdit::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
VERIFY(menu.LoadMenu(IDR_OBJECTPOPUP));
CMenu* pPopup = menu.GetSubMenu(1);
ASSERT(pPopup != NULL);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,point.x,point.y,this);
}
HBRUSH CBriefEdit::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CEdit::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return hbr;
}
@@ -0,0 +1,49 @@
#if !defined(AFX_BRIEFEDIT_H__F4742481_FD57_11D2_8457_00105A17BC83__INCLUDED_)
#define AFX_BRIEFEDIT_H__F4742481_FD57_11D2_8457_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BriefEdit.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CBriefEdit window
class CBriefEdit : public CEdit
{
// Construction
public:
CBriefEdit();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBriefEdit)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CBriefEdit();
// Generated message map functions
protected:
//{{AFX_MSG(CBriefEdit)
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BRIEFEDIT_H__F4742481_FD57_11D2_8457_00105A17BC83__INCLUDED_)
@@ -0,0 +1,49 @@
// ChildOfDialogMessagePusher.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "ChildOfDialogMessagePusher.h"
#include "dlgobjectbalance.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildOfDialogMessagePusher
CChildOfDialogMessagePusher::CChildOfDialogMessagePusher()
{
}
CChildOfDialogMessagePusher::~CChildOfDialogMessagePusher()
{
}
BEGIN_MESSAGE_MAP(CChildOfDialogMessagePusher, CStatic)
//{{AFX_MSG_MAP(CChildOfDialogMessagePusher)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildOfDialogMessagePusher message handlers
BOOL CChildOfDialogMessagePusher::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
return ((CDlgObjectBalance *)GetParent())->OnNotify_Public(wParam, lParam, pResult);
//return CStatic::OnNotify(wParam, lParam, pResult);
}
BOOL CChildOfDialogMessagePusher::OnCommand(WPARAM wParam, LPARAM lParam)
{
return ((CDlgObjectBalance *)GetParent())->OnCommand_Public(wParam, lParam);
// return CStatic::OnCommand(wParam, lParam);
}
@@ -0,0 +1,51 @@
#if !defined(AFX_CHILDOFDIALOGMESSAGEPUSHER_H__FA692A7F_44DE_44B1_9D85_8B2F15CFFCFE__INCLUDED_)
#define AFX_CHILDOFDIALOGMESSAGEPUSHER_H__FA692A7F_44DE_44B1_9D85_8B2F15CFFCFE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ChildOfDialogMessagePusher.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CChildOfDialogMessagePusher window
class CChildOfDialogMessagePusher : public CStatic
{
// Construction
public:
CChildOfDialogMessagePusher();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildOfDialogMessagePusher)
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CChildOfDialogMessagePusher();
// Generated message map functions
protected:
//{{AFX_MSG(CChildOfDialogMessagePusher)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHILDOFDIALOGMESSAGEPUSHER_H__FA692A7F_44DE_44B1_9D85_8B2F15CFFCFE__INCLUDED_)
@@ -0,0 +1,91 @@
//===========================================================================//
// File: Command.cpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 12/15/97 DPB Created this kick ass file //
//---------------------------------------------------------------------------//
// Copyright (C) 1997, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "Command.h"
#include "Selection.h"
Command*
Current_Command = NULL;
extern CMW4GameEdApp theApp;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Command::Command():
Plug(Plug::DefaultData),
selectedEntities(NULL)
{
CSelectionNode *selection_node;
CSelectionNode *command_node;
ChainIteratorOf<CSelectionNode*> iterator(&CSelectionList::Instance->selectionList);
iterator.First();
while((selection_node = iterator.ReadAndNext()) != NULL)
{
Check_Pointer(selection_node);
command_node = new CSelectionNode(selection_node->selectedEntity);
Register_Object(command_node);
selectedEntities.Add(command_node);
}
theApp.m_MissionSaved = false;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Command::~Command()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Command::Execute()
{
//Nothing here. Need to override on higher layer
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Command::Undo()
{
//Nothing here. Need to override on higher layer
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Command::Delete()
{
CSelectionNode *selection_node;
if (!selectedEntities.IsEmpty())
{
ChainIteratorOf<CSelectionNode*> iterator(&selectedEntities);
iterator.First();
while((selection_node = iterator.ReadAndNext()) != NULL)
{
Check_Object(selection_node->selectedEntity);
selection_node->selectedEntity->SentenceToDeathRow();
}
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Command::TestInstance()
{
}
@@ -0,0 +1,52 @@
//===========================================================================//
// File: Command.hpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 12/15/97 DPB Create file //
//---------------------------------------------------------------------------//
// Copyright (C) 1997, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#pragma once
#include <Stuff\StuffHeaders.hpp>
//This is the command class. It is the base class for all commands
//It contains two virtual functions that must be overridden in
//the next layer. It also stores all the entites that are currently
//selected for the command to process. There will be an extern
//that stores the current command. This way all areas know what
//they need to do. It is also there for the Undo and Redo Functionality
class CSelectionNode;
class Command :
public Plug
{
public:
Command();
virtual ~Command();
virtual void
Execute();
virtual void
Undo();
virtual void
Delete();
void
TestInstance();
public:
Stuff::ChainOf<CSelectionNode *>
selectedEntities;
Stuff::Point3D
cursorPosition;
};
extern Command
*Current_Command;
@@ -0,0 +1,76 @@
// ConfirmDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "ConfirmDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CConfirmDlg dialog
CConfirmDlg::CConfirmDlg(int id, CWnd* pParent /*=NULL*/)
: CDialog(CConfirmDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CConfirmDlg)
m_NeverCheck = FALSE;
//}}AFX_DATA_INIT
m_ID = id;
m_Show = true;
m_Title = "";
m_MessageText = "No Text Was Specified!!!";
CString keyname = "ConfirmDlg";
char string[8];
keyname += itoa(m_ID,string,10);
DWORD size=sizeof(m_Show);
gos_LoadDataFromRegistry((char *)(LPCTSTR)keyname,&m_Show,&size);
}
void CConfirmDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConfirmDlg)
DDX_Control(pDX, IDC_CONFIRMTEXT, m_ConfirmText);
DDX_Check(pDX, IDC_CONFIRMCHECK, m_NeverCheck);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConfirmDlg, CDialog)
//{{AFX_MSG_MAP(CConfirmDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfirmDlg message handlers
BOOL CConfirmDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(m_Title);
m_ConfirmText.SetWindowText(m_MessageText);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
int CConfirmDlg::DoModal()
{
int retVal = IDOK;
if (m_Show)
retVal = CDialog::DoModal();
if (m_NeverCheck)
{
m_Show = false;
CString keyname = "ConfirmDlg";
char string[8];
keyname += itoa(m_ID,string,10);
gos_SaveDataToRegistry((char *)(LPCTSTR)keyname,&m_Show,sizeof(m_Show));
}
return retVal;
}
@@ -0,0 +1,56 @@
#if !defined(AFX_CONFIRMDLG_H__6F5E8077_2DAE_11D3_8458_00105A17BC83__INCLUDED_)
#define AFX_CONFIRMDLG_H__6F5E8077_2DAE_11D3_8458_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ConfirmDlg.h : header file
//
#define CONFIRM_FILEDELETE 0
/////////////////////////////////////////////////////////////////////////////
// CConfirmDlg dialog
class CConfirmDlg : public CDialog
{
// Construction
public:
CConfirmDlg(int id, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CConfirmDlg)
enum { IDD = IDD_CONFIRMDLG };
CStatic m_ConfirmText;
BOOL m_NeverCheck;
//}}AFX_DATA
MString m_Title;
MString m_MessageText;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CConfirmDlg)
public:
virtual int DoModal();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CConfirmDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
int m_ID;
bool m_Show;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CONFIRMDLG_H__6F5E8077_2DAE_11D3_8458_00105A17BC83__INCLUDED_)
@@ -0,0 +1,416 @@
#include "stdafx.h"
#include "MW4GameEd.h"
#include "DeleteCommand.h"
#include <Adept\Entity.hpp>
#include <Adept\Map.hpp>
#include <mw4\building.hpp>
#include "EditorWaypoint.h"
#include <MW4\rail_move.hpp>
#include <mw4\Cultural.hpp>
#include <Adept\NameTable.hpp>
#include <mw4\mwobject.hpp>
#include "TransDlg.h"
#include "DisplayWindow.h"
#include "OverviewWindow.h"
#include "InstanceWindow.h"
#include "Selection.h"
#include <mw4\noncom.hpp>
#include <mw4\navpoint.hpp>
extern CMW4GameEdApp theApp;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
DeleteCommand::DeleteCommand()
: Command()
{
Check_Object(Map::Instance);
CSelectionNode *selection_node;
Entity *entity = NULL;
ChainIteratorOf<CSelectionNode *> iterator(&selectedEntities);
theApp.MakeObjectNamesUnique();
int sels,cursel,i;
sels=iterator.GetSize();
CSelectionNode **sel_list=new CSelectionNode *[sels];
cursel=0;
while((selection_node = iterator.ReadAndNext()) != NULL)
{
sel_list[cursel++]=selection_node;
}
for(cursel=0;cursel<sels;cursel++)
{
if (sel_list[cursel]!=NULL && sel_list[cursel]->selectedEntity->IsDerivedFrom(MWObject::DefaultData))
{
MWObject *obj;
obj = Cast_Object (MWObject *,sel_list[cursel]->selectedEntity);
if (obj->m_AI) //Remove redundant AI objects
{
for(i=0;i<sels;i++)
{
if(sel_list[i] != NULL &&
sel_list[i]->selectedEntity->objectID==obj->m_AI->objectID)
{
sel_list[i]=NULL;
}
}
}
}
}
for(cursel=0;cursel<sels;cursel++)
{
selection_node=sel_list[cursel];
if(selection_node!=NULL)
{
Check_Object(selection_node);
entity = selection_node->selectedEntity;
if (entity->IsDerivedFrom (MWObject::DefaultData))
{
MWObject *obj;
obj = Cast_Object (MWObject *,entity);
if (obj->m_AI)
{
Map::Instance->RemoveChild(obj->m_AI);
NameTable::Instance->RemoveEntry(obj->m_AI->objectID);
NameTable::Instance->IsValid();
}
}
if (entity->IsDerivedFrom(EditorObjectiveMarker::DefaultData))
{
EditorObjectiveMarker* node;
node = Cast_Object(EditorObjectiveMarker*,entity);
Map::Instance->RemoveChild(node->objective);
}
else if (entity->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
EditorLatticeNode* latticeNode;
latticeNode = Cast_Object(EditorLatticeNode*,entity);
if (latticeNode->railNode)
MW4AI::g_MissionGraph->DeleteNode(latticeNode->railNode->ID());
}
else if (entity->IsDerivedFrom(EditorDropZonePoint::DefaultData))
{
EditorDropZonePoint* node;
node = Cast_Object(EditorDropZonePoint*,entity);
node->dropNode->pointChain.Remove(node);
node->dropNode->UpdatePoints();
}
else if (entity->IsDerivedFrom(EditorMovementPath::DefaultData))
{
EditorMovementPath* path;
EditorPathNode* node;
path = Cast_Object(EditorMovementPath*,entity);
ChainIteratorOf<EditorPathNode*> nodeIterator(&path->pathNodes);
while ((node = nodeIterator.ReadAndNext()) != NULL)
{
node->ShowLink(false);
if(node->GetParentEntity())
{
NameTable::Instance->RemoveEntry(node->objectID);
NameTable::Instance->IsValid();
Map::Instance->RemoveChild(node);
}
}
NameTable::Instance->RemoveEntry(path->pathSlot.GetCurrent()->objectID);
NameTable::Instance->IsValid();
Map::Instance->RemoveChild(path->pathSlot.GetCurrent());
}
else if (entity->IsDerivedFrom(EditorPathNode::DefaultData))
{
Point3D loc;
loc = entity->GetLocalToWorld();
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,entity);
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->ErasePoint(node->index);
node->pathSlot.GetCurrent()->pathNodes.Remove(node);
if (node->prevnode)
node->prevnode->nextnode = node->nextnode;
if (node->nextnode)
node->nextnode->prevnode = node->prevnode;
else
theApp.m_LastPathNode = node->prevnode;
EditorPathNode* tnode = node->nextnode;
while (tnode)
{
tnode->index--;
tnode = tnode->nextnode;
}
if (node->nextnode)
node->nextnode->UpdateLinkPointData();
else if (node->prevnode)
node->prevnode->UpdateLinkPointData(true);
node->ShowLink(false);
if (!node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints.size())
{
Map::Instance->RemoveChild(node->pathSlot.GetCurrent());
NameTable::Instance->RemoveEntry(node->pathSlot.GetCurrent()->objectID);
theApp.instanceWindow->RemoveInstance(node->pathSlot.GetCurrent());
Map::Instance->RemoveChild(node->pathSlot.GetCurrent()->pathSlot.GetCurrent());
NameTable::Instance->RemoveEntry(node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->objectID);
theApp.instanceWindow->RemoveInstance(node->pathSlot.GetCurrent()->pathSlot.GetCurrent());
theApp.displayWindow->translationDlg->CheckObject(node->pathSlot.GetCurrent()->pathSlot.GetCurrent());
NameTable::Instance->IsValid();
}
}
else if(entity->IsDerivedFrom(EditorLight::DefaultData))
{
EditorLight* light;
light = Cast_Object(EditorLight*,entity);
light->LightSwitch();
}
Check_Object(entity);
NameTable::Instance->RemoveEntry(entity->objectID);
Map::Instance->RemoveChild(entity);
NameTable::Instance->IsValid();
if (entity)
{
theApp.instanceWindow->RemoveInstance(entity);
theApp.displayWindow->translationDlg->CheckObject(entity);
}
}
}
undone = false;
delete sel_list;
theApp.overviewWindow->DrawWindow();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
DeleteCommand::~DeleteCommand()
{
if (!undone)
{
CSelectionNode *selection_node;
Entity *entity;
ChainIteratorOf<CSelectionNode *> iterator(&selectedEntities);
while((selection_node = iterator.ReadAndNext()) != NULL)
{
Check_Object(selection_node);
entity = selection_node->selectedEntity;
Check_Object(entity);
if(entity->IsDerivedFrom(EditorDropNode::DefaultData))
{
Check_Object(NameTable::Instance);
NameTable::Instance->RemoveEntry(entity->objectID);
NameTable::Instance->IsValid();
}
if(entity->IsDerivedFrom(EditorCameraShip::DefaultData))
{
Check_Object(NameTable::Instance);
NameTable::Instance->RemoveEntry(entity->objectID);
NameTable::Instance->IsValid();
}
else if (entity->IsDerivedFrom(EditorMovementPath::DefaultData))
{
EditorMovementPath* path;
path = Cast_Object(EditorMovementPath*,entity);
ChainIteratorOf<EditorPathNode*> node_iterator(&path->pathNodes);
node_iterator.DeletePlugs();
// NameTable::Instance->RemoveEntry(path->objectID);
// delete Cast_Object(Stuff::Plug *, path);
}
else if(entity->IsDerivedFrom(EditorPathNode::DefaultData))
{
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,entity);
EditorMovementPath *editor_path;
editor_path = node->pathSlot.GetCurrent();
if(editor_path)
{
Check_Object(editor_path);
Path *adept_path;
adept_path = editor_path->pathSlot.GetCurrent();
if(adept_path)
{
Check_Object(adept_path);
if(adept_path->pathPoints.size() == 0)
{
delete Cast_Object(Stuff::Plug *, node->pathSlot.GetCurrent()->pathSlot.GetCurrent());
delete Cast_Object(Stuff::Plug *, node->pathSlot.GetCurrent());
}
}
}
}
delete Cast_Object(Stuff::Plug *, entity);
}
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
DeleteCommand::Execute()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
DeleteCommand::Undo()
{
CSelectionNode *selection_node;
Entity *entity = NULL;
ChainIteratorOf<CSelectionNode *> iterator(&selectedEntities);
while((selection_node = iterator.ReadAndNext()) != NULL)
{
Check_Object(selection_node);
entity = selection_node->selectedEntity;
Check_Object(entity);
Check_Object(Map::Instance);
Map::Instance->AddChild(entity);
if(entity->IsDerivedFrom(Vehicle::DefaultData))
NameTable::Instance->AddEntry(selection_node->selectedEntity, NameTable::VehicleArray);
else if(entity->IsDerivedFrom(Building::DefaultData) || entity->IsDerivedFrom(Cultural::DefaultData))
NameTable::Instance->AddEntry(selection_node->selectedEntity, NameTable::BuildingArray);
else if(entity->IsDerivedFrom(NavPoint::DefaultData))
NameTable::Instance->AddEntry(selection_node->selectedEntity, NameTable::NavArray);
else if(entity->IsDerivedFrom(DropZone::DefaultData))
NameTable::Instance->AddEntry(selection_node->selectedEntity, NameTable::DropZoneArray);
else if(entity->IsDerivedFrom(NonCom::DefaultData))
NameTable::Instance->AddEntry(selection_node->selectedEntity, NameTable::BuildingArray);
else
NameTable::Instance->AddEntry(selection_node->selectedEntity);
NameTable::Instance->IsValid();
if (entity->IsDerivedFrom (MWObject::DefaultData))
{
MWObject *obj;
obj = Cast_Object (MWObject *,entity);
if (obj->m_AI)
{
Map::Instance->AddChild(obj->m_AI);
NameTable::Instance->AddEntry(obj->m_AI,NameTable::AIArray);
NameTable::Instance->IsValid();
}
}
entity->SyncMatrices(true);
if (entity->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
EditorLatticeNode* latticeNode;
latticeNode = Cast_Object(EditorLatticeNode*,entity);
MW4AI::g_MissionGraph->AddNode(latticeNode->railNode);
}
else if (entity->IsDerivedFrom(EditorDropZonePoint::DefaultData))
{
EditorDropZonePoint* node;
node = Cast_Object(EditorDropZonePoint*,entity);
node->dropNode->pointChain.Add(node);
node->dropNode->UpdatePoints();
}
else if (entity->IsDerivedFrom(EditorMovementPath::DefaultData))
{
EditorMovementPath* path;
EditorPathNode* node;
path = Cast_Object(EditorMovementPath*,entity);
ChainIteratorOf<EditorPathNode*> nodeIterator(&path->pathNodes);
while ((node = nodeIterator.ReadAndNext()) != NULL)
{
Map::Instance->AddChild(node);
node->ShowLink(true);
node->SyncMatrices(true);
node->GetElement()->Sync();
Time till = gos_GetElapsedTime();
node->PostCollisionExecute(till);
}
Map::Instance->AddChild(path->pathSlot.GetCurrent());
NameTable::Instance->AddEntry(path->pathSlot.GetCurrent(), NameTable::PathArray);
NameTable::Instance->IsValid();
path->pathSlot.GetCurrent()->SyncMatrices(true);
}
else if (entity->IsDerivedFrom(EditorPathNode::DefaultData))
{
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,entity);
if (!node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints.size())
{
Map::Instance->AddChild(node->pathSlot.GetCurrent());
node->pathSlot.GetCurrent()->SyncMatrices(true);
// node->path->objectID = NameTable::Instance->AddEntry(node->path, NameTable::PathArray);
}
Point3D loc;
loc = node->GetLocalToWorld();
if (node->nextnode) // insert node
{
LinearMatrix4D matrix = LinearMatrix4D::Identity;
node->nextnode->InsertNode(node);
matrix.BuildTranslation(loc);
node->SetNewLocalToParent(matrix);
node->SyncMatrices(true);
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints[node->index] = loc;
node->pathSlot.GetCurrent()->pathNodes.Add(node);
node->SetLinkColor(Stuff::RGBAColor(1.0f,1.0f,0.0f,0.0f));
node->ShowLink(true);
node->GetElement()->SetVolumeCullMode();
node->GetElement()->Sync();
node->UpdateLinkPointData();
}
else // append node
{
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints.push_back(loc);
theApp.m_LastPathNode = node;
if (node->prevnode)
{
node->prevnode->SetLinkColor(Stuff::RGBAColor(1.0f,1.0f,0.0f,0.0f));
node->prevnode->ShowLink(true);
node->prevnode->GetElement()->SetVolumeCullMode();
node->prevnode->GetElement()->Sync();
node->prevnode->UpdateLinkPointData();
}
}
Time till = gos_GetElapsedTime();
node->PostCollisionExecute(till);
}
else if(entity->IsDerivedFrom(EditorLight::DefaultData))
{
EditorLight* light;
light = Cast_Object(EditorLight*,entity);
light->LightSwitch();
}
}
undone = true;
theApp.instanceWindow->ResetInstanceLists();
theApp.overviewWindow->DrawWindow();
}
@@ -0,0 +1,25 @@
// File: AddCommand.hpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
#pragma once
#include "Command.h"
class DeleteCommand :
public Command
{
bool
undone;
public:
DeleteCommand();
virtual ~DeleteCommand();
void
Execute();
void
Undo();
void
Move();
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,160 @@
#if !defined(AFX_DISPLAYWINDOW_H__208FF836_376B_11D2_9DE3_0060973CEE04__INCLUDED_)
#define AFX_DISPLAYWINDOW_H__208FF836_376B_11D2_9DE3_0060973CEE04__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// DisplayWindow.h : header file
//
#include <Adept\Entity.hpp>
#include <ElementRenderer\ElementRenderer.hpp>
#include <ElementRenderer\GroupElement.hpp>
#include <ElementRenderer\ListElement.hpp>
#include <ElementRenderer\StateChange.hpp>
#include <ElementRenderer\CameraElement.hpp>
#include <ElementRenderer\SwitchElement.hpp>
#include <ElementRenderer\ShapeElement.hpp>
#include <gosFX\gosFX.hpp>
#include <MLR\MLR.hpp>
#include <MLR\MLRHeaders.hpp>
#include <MFCPlatform\MFCPlatform.hpp>
#include "EditorChildWnd.h"
#include "EditEntityDlg.h"
//#include "LatticeLinkDlg.h"
class CLatticeLinkDlg;
#define TERRAIN 0
#define HIGHESTPOINT 1
#define NOCOLLIDE 2
/////////////////////////////////////////////////////////////////////////////
// CDisplayWindow frame
class CTransDlg;
class CDisplayWindow : public CEditorChildWnd//CSnapWnd
{
DECLARE_DYNCREATE(CDisplayWindow)
protected:
public:
CTransDlg* translationDlg;
CLatticeLinkDlg* latticeLinkDlg;
CDisplayWindow(); // protected constructor used by dynamic creation
virtual ~CDisplayWindow();
// void Draw();
bool GetPointOnMap(Point3D* point);
Stuff::Scalar GetMapPointVertical(Stuff::Scalar x = -1.0f, Stuff::Scalar z = -1.0f, Adept::Entity::CollisionMask collisionType = Adept::Entity::CanBeWalkedOnFlag,Entity *ignore_entity=NULL);
// Attributes
public:
MLRState
state,
state2;
MLRTexture
*texture;
ElementRenderer::CameraElement
*Camera;
ElementRenderer::StateChange
*Camera_State;
ElementRenderer::ListElement
*Scene;
ElementRenderer::SwitchElement
*Switch;
bool
mouseLook;
int
timer;
// Operations
public:
LRESULT
WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
void
ExecuteCamera();
void
ProcessIO();
Adept::Entity
*TraceToParent(Adept::Entity *entity);
Scalar
mapX;
Scalar
mapZ;
void
OnObjAlignment(Adept::Entity* entity);
void
OnAddDropPoint();
void
AppendPathNode(Adept::Entity* entity);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDisplayWindow)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
protected:
// void
// GetGridCoords(Point3D& point);
// Generated message map functions
//{{AFX_MSG(CDisplayWindow)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT, CPoint);
afx_msg void OnMouseMove(UINT, CPoint);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSetObjectName();
afx_msg void OnSetObjectParameters();
afx_msg void OnSetObjectTranslation();
afx_msg void OnObjEditDriver();
afx_msg void OnObjEditScript();
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnPaint();
afx_msg void OnObjDamageArmor();
afx_msg void OnObjDamageInternal();
afx_msg void OnEditLatticeLinks();
afx_msg void OnShowRadius();
afx_msg void OnUpdateShowRadius(CCmdUI* pCmdUI);
afx_msg void OnAddLink();
afx_msg void OnInsertPathNode();
afx_msg void OnAppendPathNode();
afx_msg void OnObjSpecifyScript();
afx_msg void OnInsertBoundaryNode();
afx_msg void OnObjRemoveinstance();
afx_msg void OnObjAlignment();
afx_msg void OnObjSubsystem();
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg void OnClearAI();
afx_msg void OnABLMemory();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DISPLAYWINDOW_H__208FF836_376B_11D2_9DE3_0060973CEE04__INCLUDED_)
@@ -0,0 +1,75 @@
// DlgCameraName.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "DlgCameraName.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgCameraName dialog
CDlgCameraName::CDlgCameraName(CWnd* pParent /*=NULL*/)
: CDialog(CDlgCameraName::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgCameraName)
m_strCameraName = _T("");
//}}AFX_DATA_INIT
}
void CDlgCameraName::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgCameraName)
DDX_Text(pDX, IDC_CAMERA_NAME, m_strCameraName);
DDV_MaxChars(pDX, m_strCameraName, 15);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgCameraName, CDialog)
//{{AFX_MSG_MAP(CDlgCameraName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgCameraName message handlers
BOOL CDlgCameraName::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgCameraName::OnOK()
{
UpdateData(TRUE);
CDialog::OnOK();
}
void CDlgCameraName::OnCancel()
{
CDialog::OnCancel();
return;
}
void CDlgCameraName::SetCameraName(LPCSTR szCameraName)
{
m_strCameraName = szCameraName;
}
void CDlgCameraName::GetCameraName(LPSTR szCameraName)
{
lstrcpy(szCameraName, (LPCSTR)m_strCameraName);
}
@@ -0,0 +1,51 @@
#if !defined(AFX_DLGCAMERANAME_H__9EA7B35D_2EFC_49BA_8E6E_7394DDD1165C__INCLUDED_)
#define AFX_DLGCAMERANAME_H__9EA7B35D_2EFC_49BA_8E6E_7394DDD1165C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgCameraName.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDlgCameraName dialog
class CDlgCameraName : public CDialog
{
// Construction
public:
CDlgCameraName(CWnd* pParent = NULL); // standard constructor
void SetCameraName(LPCSTR szCameraName);
void GetCameraName(LPSTR szCameraName);
// Dialog Data
//{{AFX_DATA(CDlgCameraName)
enum { IDD = IDD_RENAME_CAMERA };
CString m_strCameraName;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgCameraName)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
void OnOK();
void OnCancel();
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgCameraName)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGCAMERANAME_H__9EA7B35D_2EFC_49BA_8E6E_7394DDD1165C__INCLUDED_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,265 @@
#if !defined(AFX_DlgObjectProperties_H__AF411833_39CE_4B0D_A270_FE0CD3E73C32__INCLUDED_)
#define AFX_DlgObjectProperties_H__AF411833_39CE_4B0D_A270_FE0CD3E73C32__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgObjectProperties.h : header file
//
//!!!!!WARNING!!!!!
// If you change any of the below typedefs you will have to be carefull to maintain the Allocate_... functions
// which support them. They need to know how to point internally to the various portions of the data when allocated
// since none of them use fixed size arrays internally.
//
typedef BOOL (_stdcall * FileFilterCallback)(LPCSTR szCurrentFileName);
typedef enum {
eSingleSubdirectory = 0,
eRootOnly,
eAllSubdirectories
} DIRECTORYSEARCHTYPE;
typedef enum {
efloat =0,
eint,
eLPSTR,
eBOOL,
eVector3D
} CDOPVARTYPE;
typedef struct _TAG_CDOPPROPERTIES_TO_EDIT_ENTRY
{
char szPropertyTag[128]; // should be formated as <page name>\<entry name>
char szPropertyTagForDisplay[48]; // for header column
CDOPVARTYPE ePropertyType; // should be one of the above enum types, if more are added they
// need to be added to the below union, and to the code that switches
// based on the variable type
//
// The below do not need to be initialized. But since we don't copy the structure and use the
// pointer passed in instead it allows you to use the values in fPresent and uPropValue on return
// from the function if you need to use the data after calling DoModal() on the dialog;
//
UINT uiReserved1_CTRLID;
} CDOPPROPERTIES_TO_EDIT_ENTRY;
typedef struct _TAG_CDOPPROPERTIES_TO_EDIT_ARRAY
{
int nCount;
CDOPPROPERTIES_TO_EDIT_ENTRY * ppProperties_To_Edit_Entry[1];// using 1 just to set the memory, actual buffer is bigger when allocated and assigned
} CDOPPROPERTIES_TO_EDIT_ARRAY;
typedef struct _TAG_CDOPPROPERTYVALUE
{
BOOL fPresent;
union {
int nValue;
float fltValue;
BOOL fValue;
char szValue[128];
struct {
float x;
float y;
float z;
} v3dValues; // for vector3d type values
} uPropValue;
} CDOPPROPERTYVALUE;
typedef struct _TAG_CDOPPROPERTIES_OBJECT_PROPERTIES
{
int nProperties; // must match nCount from CDOPPROPERTIES_TO_EDIT_ARRAY!!!!!!
BOOL fDirty;
BOOL fReadOnly;
char szObjectName[MAX_PATH+1];
CDOPPROPERTYVALUE * ppObjectProperties[1]; // using 1 just to set the memory, actual buffer is bigger when allocated and assigned
} CDOPPROPERTIES_OBJECT_PROPERTIES;
typedef struct _TAG_CDOPPROPERTIES_OBJECT_LIST
{
int nObjectCount;
CDOPPROPERTIES_OBJECT_PROPERTIES * ppPropertiesArray[1];// using 1 just to set the memory, actual buffer is bigger when allocated and assigned
} CDOPPROPERTIES_OBJECT_LIST;
/////////////////////////////////////////////////////////////////////////////
// CDlgObjectProperties dialog
class CDlgObjectProperties : public CDialog
{
public:
public:
// Construction
public:
CDlgObjectProperties(CWnd* pParent = NULL); // standard constructor
~CDlgObjectProperties();
// Dialog Data
//{{AFX_DATA(CDlgObjectProperties)
enum { IDD = IDD_OBJECTPROPERTIES };
CListBox m_lbObjectList;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgObjectProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgObjectProperties)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeObjectlist();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void CreateSubControlsForProperties();
void ClearObjectDataSet();
BOOL SaveObjectData();
BOOL LoadObjectData(LPCSTR szDirectoryToSearchFor /*Directory passed in must end in a backslash*/, DIRECTORYSEARCHTYPE eSearchType);
BOOL LoadDataFilesFromSubdirectory(CString strSubdirectory);
BOOL LoadObjectDataFromFile(CString strFullWeaponFilename, BOOL fReadOnly );
void OnOK();
void OnCancel();
BOOL DisableAllControls();
BOOL EnableControlsForCurrentSelection();
BOOL MoveCurSelDataToOrFromControls(BOOL fToControls);
public:
//
// These functions have to be called before DoModal is called since they set important information
//
//
// Sets the root directory to search under. Only goes one level deep currently
//
BOOL SetObjectFilesDirectory(LPCSTR lpszDirectoryPath);
//
// Sets the root file name type to search for like "*.data"
//
BOOL SetFileNameToSearchSubdirectoriesFor(LPCSTR lpszFileSearchString);
//
// Allows additional control over what files are accepted. ie... you can filter out "basic.data"
//
BOOL SetFileFilterCallBack(FileFilterCallback fnFilterFunction)
{
m_fnFilterFunction = fnFilterFunction;
return TRUE;
};
//
// Specify the properties of the files that you want editted here.
//
//
// !!!WARNING: We only store the pointer, we don't copy the data so be sure to
// verify that the data is in scope the whole time the dialog is up.
//
BOOL SetPropertyListToEdit(CDOPPROPERTIES_TO_EDIT_ARRAY * ppteaPropertyToEdit)
{m_paPropertiesToEdit = ppteaPropertyToEdit; return TRUE;};
// Specifies whether the list box should show the whole name of the object including
// directory path. Cuts off everything up until the last "\"
BOOL ShowFullObjectNames(BOOL fShowFullObjectName)
{m_fShowFullObjectName = fShowFullObjectName; return TRUE;};
// Specifies whether the static for each property should show the whole name including
// the page name or just the entry name
BOOL ShowFullPropertyName(BOOL fShowFullPropertyName)
{m_fShowFullPropertyName = fShowFullPropertyName; return TRUE;};
// Specify whether you want to search just the root directory, the
// first subdirectory or all subdirectories
BOOL SetSearchWhichSubdirectories(DIRECTORYSEARCHTYPE eSearchType)
{m_eSearchType = eSearchType; return TRUE;};
//
// These structure have to be setup correctly when allocated and should never be created on the stack
//
//
CDOPPROPERTIES_TO_EDIT_ARRAY * Allocate_CDOPPROPERTIES_TO_EDIT_ARRAY(int nPropertyCount, CDOPPROPERTIES_TO_EDIT_ARRAY * * ppCDOPPROPERTIES_TO_EDIT_ARRAY = NULL);
CDOPPROPERTIES_OBJECT_PROPERTIES * Allocate_CDOPPROPERTIES_OBJECT_PROPERTIES(int nPropertyCount, CDOPPROPERTIES_OBJECT_PROPERTIES * * ppCDOPPROPERTIES_OBJECT_PROPERTIES = NULL);
CDOPPROPERTIES_OBJECT_LIST * Allocate_CDOPPROPERTIES_OBJECT_LIST(int nObjectCount, int nPropertyCount, CDOPPROPERTIES_OBJECT_LIST ** ppCDOPPROPERTIES_OBJECT_LIST = NULL);
//
// Memcpy and memcmp can not be used on these structures since they contain pointers to memory
//
BOOL Copy_CDOPPROPERTIES_TO_EDIT_ARRAY(CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY_DEST, CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY_SRC);
BOOL Copy_CDOPPROPERTIES_OBJECT_PROPERTIES(CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES_DEST, CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES_SRC);
BOOL Copy_CDOPPROPERTIES_OBJECT_LIST(CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST_DEST, CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST_SRC);
BOOL IsEqual_CDOPPROPERTIES_TO_EDIT_ARRAY(CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY1, CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY2);
BOOL IsEqual_CDOPPROPERTIES_OBJECT_PROPERTIES(CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES1, CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES2);
BOOL IsEqual_CDOPPROPERTIES_OBJECT_LIST(CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST1, CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST2);
//
// This function allows you to create the properties array easily by calling this function with the format:
// CreatePropertiesToEditArray(2,
// efloat, "GameData\Heat",
// eint, "GameData\Ammo");
//
CDOPPROPERTIES_TO_EDIT_ARRAY * CreatePropertiesToEditArray(int nCount, ...);
BOOL UpdateControlData(BOOL fToControls);
LPCSTR GetEntryNameToPropertyName(LPCSTR szPropertyName);
LPCSTR GetPageNameToPropertyName(LPCSTR szPropertyName) ;
// Override to do parameter checking
virtual int DoModal();
protected:
BOOL GetBOOLFromControl(UINT uiID, BOOL * pfDest);
BOOL GetfloatFromControl(UINT uiID, float * pfltDest);
BOOL GetLPSTRFromControl(UINT uiID, LPSTR pszDest);
BOOL GetintFromControl(UINT uiID, int * pnDest);
BOOL GetVector3DFromControl(UINT uiID, float * pfltx, float * pflty, float * pfltz);
BOOL GetBOOLFromButton(UINT uiID, BOOL * pfDest);
BOOL SetBOOLToButton(UINT uiID, BOOL fSrc);
BOOL SetBOOLToControl(UINT uiID, BOOL fSrc);
BOOL SetfloatToControl(UINT uiID, float fltSrc);
BOOL SetLPSTRToControl(UINT uiID, LPSTR pszSrc);
BOOL SetintToControl(UINT uiID, int nSrc);
BOOL SetVector3DToControl(UINT uiID, float fltx, float flty, float fltz);
// Data
// Object list, these are the "files" that we are editting.
CDOPPROPERTIES_OBJECT_LIST * m_pObjectList;
// This is the properties list that the caller is requesting. It is just a pointer to
// the callers memory.
CDOPPROPERTIES_TO_EDIT_ARRAY * m_paPropertiesToEdit;
// Root directory to search in
CString m_strObjectFilesRootDirectory;
// Wild card specification for what files we are looking for ie... "*.data"
CString m_strFileNameToSearchSubdirectoriesFor;
// Currently selected index in the list box control
int m_nCurSel;
// This function if specified gets called for ever file we think should be added
// it will
FileFilterCallback m_fnFilterFunction;
BOOL m_fShowFullObjectName;
BOOL m_fShowFullPropertyName;
DIRECTORYSEARCHTYPE m_eSearchType;
CDOPPROPERTIES_OBJECT_PROPERTIES * m_popCurObjectPropertiesArray;
UINT m_nLastControlID;
BOOL m_fDirty;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DlgObjectProperties_H__AF411833_39CE_4B0D_A270_FE0CD3E73C32__INCLUDED_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,119 @@
#if !defined(AFX_EDITENTITYDLG_H__C262B693_F353_11D2_B195_00C04F682855__INCLUDED_)
#define AFX_EDITENTITYDLG_H__C262B693_F353_11D2_B195_00C04F682855__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// EditEntityDlg.h : header file
//
#define EDIT_GAME_MODEL 0
#define EDIT_DAMAGE_OBJECTARMOR 1
#define EDIT_DAMAGE_OBJECTINTERNAL 2
#define EDIT_SUBSYSTEM 3
class UndoGameModelChanges :
public Stuff::Plug
{
public:
UndoGameModelChanges() :
Plug(Plug::DefaultData)
{}
CString attribute_name;
CString attribute_value;
};
class UndoDamageObjectChanges :
public Stuff::Plug
{
public:
UndoDamageObjectChanges() :
Plug(Plug::DefaultData)
{}
CString name;
Stuff::Scalar value;
};
/////////////////////////////////////////////////////////////////////////////
// EditEntityDlg dialog
class EditEntityDlg : public CDialog
{
// Construction
public:
CString m_Title;
EditEntityDlg(CWnd* pParent = NULL, Adept::Entity *entity = NULL,int type = EDIT_GAME_MODEL, void* data = NULL); // standard constructor
~EditEntityDlg();
int
timer;
bool
needsSave;
bool
newGameModel;
bool
warned;
int
dlgType;
void*
exData;
// Dialog Data
//{{AFX_DATA(EditEntityDlg)
enum { IDD = IDD_EDITENTITYDLG };
CEdit m_gameModelEdit;
CEdit m_floatingEdit;
CListBox m_entityValueList;
CButton m_CancelBtn;
CListBox m_entityPropertiesList;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(EditEntityDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
Adept::Entity
*selectedEntity;
ChainOf<UndoGameModelChanges*> modelUndoChain;
ChainOf<UndoDamageObjectChanges*> damageUndoChain;
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(EditEntityDlg)
virtual BOOL OnInitDialog();
afx_msg void OnDblclkEntityProperties();
afx_msg void OnSelchangeEntityProperties();
afx_msg void OnSelchangeEntityValues();
afx_msg void OnTimer(UINT nIDEvent);
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnGamemodelsavebtn();
afx_msg void OnChangeEntityeditbox();
afx_msg void OnKillfocusEntityeditbox();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMyok();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void InitGameModel();
void InitDamageObjectArmor();
void InitDamageObjectInternal();
void InitSubsystem();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EDITENTITYDLG_H__C262B693_F353_11D2_B195_00C04F682855__INCLUDED_)
@@ -0,0 +1,238 @@
// EditWnd.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "EditWnd.h"
#include <direct.h>
#define __mbsrchr(s,c) (char*)_mbsrchr((const unsigned char*)(s),(c))
extern CMW4GameEdApp theApp;
static DWORD CALLBACK MyStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CFile* pFile = (CFile*) dwCookie;
*pcb = pFile->Read(pbBuff, cb);
return 0;
}
static DWORD CALLBACK MyStreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CFile* pFile = (CFile*) dwCookie;
pFile->Write(pbBuff, cb);
*pcb = cb;
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CEditWnd
CEditWnd::CEditWnd()
{
CloseCallback = NULL;
}
CEditWnd::CEditWnd(char* string)
{
path = string;
}
CEditWnd::~CEditWnd()
{
}
BEGIN_MESSAGE_MAP(CEditWnd, CEditorChildWnd)
//{{AFX_MSG_MAP(CEditWnd)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_CLOSE()
ON_WM_VSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditWnd message handlers
BOOL CEditWnd::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= WS_CHILD | WS_OVERLAPPEDWINDOW;
return CWnd::PreCreateWindow(cs);
}
int CEditWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
RECT r;
GetClientRect(&r);
editWnd.Create(ES_LEFT | ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_CHILD | WS_VISIBLE,r,this,0);
editWnd.SetBackgroundColor(TRUE,RGB(255,255,0));
LoadFile();
return 0;
}
void CEditWnd::OnSize(UINT nType, int cx, int cy)
{
CEditorChildWnd::OnSize(nType, cx, cy);
editWnd.SetWindowPos(NULL,0,0,cx,cy,SWP_NOZORDER);
}
void CEditWnd::OnClose()
{
MessageBeep(MB_ICONQUESTION);
if (MessageBox("Save this data?","Save",MB_ICONQUESTION | MB_YESNO) == IDYES)
{
if (path)
{
CFile cFile(path,CFile::modeCreate | CFile::modeWrite);
EDITSTREAM es;
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = MyStreamOutCallback;
editWnd.StreamOut(SF_TEXT, es);
cFile.Close();
if (CloseCallback)
CloseCallback((char*)(LPCTSTR)path);
}
else
{
char scriptPath[MAX_PATH],oldDir[MAX_PATH],path[MAX_PATH],*p;
OPENFILENAME ofn;
_getcwd(oldDir,MAX_PATH - 1);
strcpy(path,theApp.missionFileName);
p = __mbsrchr(path,'\\');
*p = 0;
_chdir(path);
memset(&scriptPath,0,MAX_PATH);
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFilter = "ABL files {*.ABL}\0*.abl\0All Files {*.*}\0*.*\0\0";
ofn.lpstrFile = scriptPath;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "abl";
if (GetSaveFileName(&ofn))
{
CFile cFile(ofn.lpstrFile,CFile::modeCreate | CFile::modeWrite);
EDITSTREAM es;
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = MyStreamOutCallback;
editWnd.StreamOut(SF_TEXT, es);
cFile.Close();
if (CloseCallback && !CloseCallback(ofn.lpstrFile))
return;
}
else
return;
}
}
else
LoadFile();
ShowWindow(SW_HIDE);
// CEditorChildWnd::OnClose();
}
void CEditWnd::LoadFile(char* filepath)
{
if (filepath)
path = filepath;
if (path)
{
CFile cFile;
EDITSTREAM es;
if (cFile.Open(path,CFile::modeRead,NULL))
{
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = MyStreamInCallback;
editWnd.StreamIn(SF_TEXT, es);
cFile.Close();
}
}
}
void CEditWnd::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CEditorChildWnd::OnVScroll(nSBCode, nPos, pScrollBar);
}
/////////////////////////////////////////////////////////////////////////////
// CEditCtrl
CEditCtrl::CEditCtrl()
{
}
CEditCtrl::~CEditCtrl()
{
}
BEGIN_MESSAGE_MAP(CEditCtrl, CRichEditCtrl)
//{{AFX_MSG_MAP(CEditCtrl)
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
ON_WM_CREATE()
ON_WM_VSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditCtrl message handlers
int CEditCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CRichEditCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
SetEventMask(GetEventMask() | ENM_CHANGE);
ShowScrollBar(SB_VERT);
return 0;
}
void CEditCtrl::OnChange()
{
SCROLLINFO scroll;
scroll.cbSize = sizeof(scroll);
scroll.fMask = SIF_DISABLENOSCROLL | SIF_RANGE;// | SIF_PAGE;
scroll.nMin = 0;
scroll.nMax = GetLineCount();
// scroll.nPage = ;
SetScrollInfo(SB_VERT,&scroll);
}
void CEditCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (nSBCode == SB_THUMBTRACK)
{
LineScroll(GetFirstVisibleLine() - GetScrollPos(SB_VERT));
}
else
SetScrollPos(SB_VERT,GetFirstVisibleLine());
CRichEditCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
}
@@ -0,0 +1,97 @@
#if !defined(AFX_EDITWND_H__B1F14863_6AD3_11D3_845D_00105A17BC83__INCLUDED_)
#define AFX_EDITWND_H__B1F14863_6AD3_11D3_845D_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// EditWnd.h : header file
//
#include "EditorChildWnd.h"
/////////////////////////////////////////////////////////////////////////////
// CEditCtrl window
class CEditCtrl : public CRichEditCtrl
{
// Construction
public:
CEditCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEditCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CEditCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CEditCtrl)
afx_msg void OnChange();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CEditWnd window
class CEditWnd : public CEditorChildWnd
{
// Construction
public:
CEditWnd();
CEditWnd(char* string);
// Attributes
public:
CEditCtrl editWnd;
CString path;
bool (* CloseCallback)(char* filename);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEditWnd)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CEditWnd();
void LoadFile(char* filepath = NULL);
// Generated message map functions
protected:
//{{AFX_MSG(CEditWnd)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnClose();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EDITWND_H__B1F14863_6AD3_11D3_845D_00105A17BC83__INCLUDED_)
@@ -0,0 +1,118 @@
// EditorChildWnd.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "EditorChildWnd.h"
/////////////////////////////////////////////////////////////////////////////
// CEditorChildWnd
IMPLEMENT_DYNCREATE(CEditorChildWnd, CMDIChildWnd)
CEditorChildWnd::CEditorChildWnd()
{
}
CEditorChildWnd::~CEditorChildWnd()
{
}
BEGIN_MESSAGE_MAP(CEditorChildWnd, CMDIChildWnd)
//{{AFX_MSG_MAP(CEditorChildWnd)
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEditorChildWnd message handlers
void CEditorChildWnd::OnClose()
{
ShowWindow(SW_HIDE);
// CMDIChildWnd::OnClose();
}
void CEditorChildWnd::ToggleVisible()
{
if(IsWindowVisible())
ShowWindow(SW_HIDE);
else
ShowWindow(SW_SHOW);
}
void CEditorChildWnd::OnDestroy()
{
CMDIChildWnd::OnDestroy();
// TODO: Add your message handler code here
}
int CEditorChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
BOOL CEditorChildWnd::DestroyWindow()
{
return CMDIChildWnd::DestroyWindow();
}
void CEditorChildWnd::SaveState()
{
CString winname,keyname;
GetWindowText(winname);
winname.Remove(' ');
keyname=winname+"_Visible";
BOOL vflag;
vflag=IsWindowVisible();
gos_SaveDataToRegistry((char *)(LPCSTR)keyname,&vflag,sizeof(vflag));
WINDOWPLACEMENT wp;
keyname=winname+"_Placement";
GetWindowPlacement(&wp);
gos_SaveDataToRegistry((char *)(LPCSTR)keyname,&wp,sizeof(wp));
}
void CEditorChildWnd::LoadState()
{
CString winname,keyname;
GetWindowText(winname);
winname.Remove(' ');
keyname=winname+"_Visible";
BOOL vflag;
DWORD size=sizeof(vflag);
gos_LoadDataFromRegistry((char *)(LPCSTR)keyname,&vflag,&size);
if(size==sizeof(vflag))
{
ShowWindow(vflag?SW_SHOW:SW_HIDE);
}
else
{
ShowWindow(SW_SHOW);
}
keyname=winname+"_Placement";
WINDOWPLACEMENT wp;
size=sizeof(wp);
gos_LoadDataFromRegistry((char *)(LPCSTR)keyname,&wp,&size);
if (size == sizeof(wp))
{
SetWindowPlacement(&wp);
}
}
@@ -0,0 +1,53 @@
#if !defined(AFX_EDITORCHILDWND_H__D588AF27_E1E9_11D2_A5F1_00902712C9AE__INCLUDED_)
#define AFX_EDITORCHILDWND_H__D588AF27_E1E9_11D2_A5F1_00902712C9AE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// EditorChildWnd.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CEditorChildWnd frame
class CEditorChildWnd : public CMDIChildWnd
{
DECLARE_DYNCREATE(CEditorChildWnd)
protected:
CEditorChildWnd(); // protected constructor used by dynamic creation
// Attributes
public:
// Operations
public:
void LoadState();
void SaveState();
void ToggleVisible();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEditorChildWnd)
public:
virtual BOOL DestroyWindow();
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CEditorChildWnd();
// Generated message map functions
//{{AFX_MSG(CEditorChildWnd)
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EDITORCHILDWND_H__D588AF27_E1E9_11D2_A5F1_00902712C9AE__INCLUDED_)
@@ -0,0 +1,20 @@
// EditorEntityData.cpp: implementation of the CEditorEntityData class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "EditorEntityData.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CEditorEntityData::CEditorEntityData()
{
VOffset=0.0f;
}
CEditorEntityData::~CEditorEntityData()
{
}
@@ -0,0 +1,28 @@
// EditorEntityData.h: interface for the CEditorEntityData class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_EDITORENTITYDATA_H__00806863_BE9B_11D3_8B36_00902712C9AE__INCLUDED_)
#define AFX_EDITORENTITYDATA_H__00806863_BE9B_11D3_8B36_00902712C9AE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
namespace Adept
{
class Entity;
};
class CEditorEntityData
{
public:
Adept::Entity *entity;
float VOffset;
CEditorEntityData();
virtual ~CEditorEntityData();
};
#endif // !defined(AFX_EDITORENTITYDATA_H__00806863_BE9B_11D3_8B36_00902712C9AE__INCLUDED_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,935 @@
#pragma once
#include <Adept\Entity.hpp>
#include "MW4\rail_move.hpp"
#include "MW4\Path.hpp"
#include <ElementRenderer\LineCloudElement.hpp>
#include <Adept\DropZone.hpp>
#include <MW4\Objective.hpp>
#include <MW4\CameraShip.hpp>
#include <Adept\LightManager.hpp>
#include<Stuff\StuffHeaders.hpp>
typedef Adept::Entity__CreateMessage EditorWaypoint__CreateMessage;
typedef Adept::Entity__Message EditorWaypoint__Message;
class EditorWaypoint : public Adept::Entity
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorWaypoint__CreateMessage CreateMessage;
typedef EditorWaypoint__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorWaypoint*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorWaypoint(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorWaypoint();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
};
class EditorMovementPath;
typedef Adept::Entity__CreateMessage EditorPathNode__CreateMessage;
typedef Adept::Entity__Message EditorPathNode__Message;
class EditorPathNode :
public EditorWaypoint
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorPathNode__CreateMessage CreateMessage;
typedef EditorPathNode__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorPathNode*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorPathNode(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorPathNode();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
public:
Stuff::SlotOf<EditorMovementPath*> pathSlot;
int index;
EditorPathNode* nextnode;
EditorPathNode* prevnode;
ElementRenderer::LineCloudElement* m_PathLinkLineCloud;
Stuff::Point3D m_PathLinkPointData[2];
Stuff::RGBAColor m_PathLinkColorData[2];
unsigned m_PathLinkPointCount;
void CreateLink();
void UpdateLinkPointData(bool calledFromOtherNode = false);
void ShowLink(bool show)
{
if (show)
{
m_PathLinkLineCloud->SetNeverCullMode();
}
else
m_PathLinkLineCloud->SetAlwaysCullMode();
m_PathLinkLineCloud->Sync();
}
void SetLinkColor(Stuff::RGBAColor rgb)
{
m_PathLinkColorData[0] = m_PathLinkColorData[1] = rgb;
}
void InsertNode(EditorPathNode* node);
};
typedef Adept::Entity__CreateMessage EditorMovementPath__CreateMessage;
typedef Adept::Entity__Message EditorMovementPath__Message;
class EditorMovementPath : public Adept::Entity
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorMovementPath__CreateMessage CreateMessage;
typedef EditorMovementPath__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorMovementPath*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorMovementPath(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorMovementPath();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
public:
Stuff::SlotOf<MechWarrior4::Path*> pathSlot;
Stuff::ChainOf<EditorPathNode*> pathNodes;
};
typedef Adept::Entity__CreateMessage EditorBoundaryNode__CreateMessage;
typedef Adept::Entity__Message EditorBoundaryNode__Message;
class EditorBoundaryNode :
public EditorWaypoint
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorBoundaryNode__CreateMessage CreateMessage;
typedef EditorBoundaryNode__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorBoundaryNode*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorBoundaryNode(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorBoundaryNode();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
int index;
EditorBoundaryNode* nextnode;
EditorBoundaryNode* prevnode;
DynamicArrayOf<Stuff::Vector2DOf<Stuff::Scalar> > *myBoundary;
EditorBoundaryNode* firstBoundaryNode;
ElementRenderer::LineCloudElement* m_PathLinkLineCloud;
Stuff::Point3D m_PathLinkPointData[2];
Stuff::RGBAColor m_PathLinkColorData[2];
unsigned m_PathLinkPointCount;
void CreateLink();
void UpdateLinkPointData(bool calledFromOtherNode = false);
void ShowLink(bool show)
{
if (show)
{
m_PathLinkLineCloud->SetNeverCullMode();
}
else
m_PathLinkLineCloud->SetAlwaysCullMode();
m_PathLinkLineCloud->Sync();
}
void SetLinkColor(Stuff::RGBAColor rgb)
{
m_PathLinkColorData[0] = m_PathLinkColorData[1] = rgb;
}
void InsertNode(EditorBoundaryNode* node);
bool CheckValidPos();
};
// accessed through MW4AI::g_MissionGraph
typedef Adept::Entity__CreateMessage EditorLatticeNode__CreateMessage;
typedef Adept::Entity__Message EditorLatticeNode__Message;
class EditorLatticeNode :
public EditorWaypoint
{
public:
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorLatticeNode__CreateMessage CreateMessage;
typedef EditorLatticeNode__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorLatticeNode*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorLatticeNode(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorLatticeNode();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
public:
MW4AI::CRailNode* railNode;
};
typedef Adept::Entity__CreateMessage EditorDropZonePoint__CreateMessage;
typedef Adept::Entity__Message EditorDropZonePoint__Message;
class EditorDropNode;
class EditorDropZonePoint :
public EditorWaypoint
{
public:
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorDropZonePoint__CreateMessage CreateMessage;
typedef EditorDropZonePoint__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorDropZonePoint*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorDropZonePoint(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorDropZonePoint();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
EditorDropNode* dropNode;
Stuff::Point3D offset;
ElementRenderer::LineCloudElement* m_PointLineCloud;
Stuff::Point3D m_PointData[2];
Stuff::RGBAColor m_PointColorData[2];
unsigned m_PointCount;
void CreateLink();
void UpdateLinkPointData();
void ShowLink(bool show)
{
if (show)
{
m_PointLineCloud->SetNeverCullMode();
}
else
m_PointLineCloud->SetAlwaysCullMode();
m_PointLineCloud->Sync();
}
void SetLinkColor(Stuff::RGBAColor rgb)
{
m_PointColorData[0] = m_PointColorData[1] = rgb;
}
};
typedef Adept::Entity__CreateMessage EditorDropNode__CreateMessage;
typedef Adept::Entity__Message EditorDropNode__Message;
class EditorDropNode :
public EditorWaypoint
{
public:
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorDropNode__CreateMessage CreateMessage;
typedef EditorDropNode__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorDropNode*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorDropNode(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorDropNode();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
public:
Adept::DropZone* dropZone;
Stuff::ChainOf<EditorDropZonePoint*> pointChain;
void SetDropZone(Adept::DropZone* zone);
void UpdatePoints();
void MakePointsResource(const char *resource_name);
};
typedef Adept::Entity__CreateMessage EditorObjectiveMarker__CreateMessage;
typedef Adept::Entity__Message EditorObjectiveMarker__Message;
class EditorObjectiveMarker :
public EditorWaypoint
{
public:
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorObjectiveMarker__CreateMessage CreateMessage;
typedef EditorObjectiveMarker__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorObjectiveMarker*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorObjectiveMarker(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorObjectiveMarker();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class Data
//
public:
MechWarrior4::Objective* objective;
void SetObjective(MechWarrior4::Objective* obj);
};
typedef Adept::Entity__CreateMessage EditorLight__CreateMessage;
typedef Adept::Entity__Message EditorLight__Message;
class EditorLight : public Adept::Entity
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorLight__CreateMessage CreateMessage;
typedef EditorLight__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorLight*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorLight(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorLight();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
gosFX::Light*
light;
gosFX::LightManager::Info
lightInfo;
Stuff::Scalar
lastIntensity;
void SetColor(Stuff::Scalar Red, Stuff::Scalar Green, Stuff::Scalar Blue);
void SetLightToWorldMatrix(Stuff::LinearMatrix4D matrix);
void UpdateLight();
void LightSwitch();
void SetLight(gosFX::Light* gosLight = NULL);
};
typedef Adept::Entity__CreateMessage EditorAmbientLight__CreateMessage;
typedef Adept::Entity__Message EditorAmbientLight__Message;
class EditorAmbientLight : public EditorLight
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorAmbientLight__CreateMessage CreateMessage;
typedef EditorAmbientLight__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorAmbientLight*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorAmbientLight(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorAmbientLight();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
};
typedef Adept::Entity__CreateMessage EditorInfiniteLight__CreateMessage;
typedef Adept::Entity__Message EditorInfiniteLight__Message;
class EditorInfiniteLight : public EditorLight
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorInfiniteLight__CreateMessage CreateMessage;
typedef EditorInfiniteLight__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorInfiniteLight*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorInfiniteLight(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorInfiniteLight();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
};
typedef Adept::Entity__CreateMessage EditorPointLight__CreateMessage;
typedef Adept::Entity__Message EditorPointLight__Message;
class EditorPointLight : public EditorLight
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorPointLight__CreateMessage CreateMessage;
typedef EditorPointLight__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorPointLight*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorPointLight(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorPointLight();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
};
typedef Adept::Entity__CreateMessage EditorSpotLight__CreateMessage;
typedef Adept::Entity__Message EditorSpotLight__Message;
class EditorSpotLight : public EditorLight
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorSpotLight__CreateMessage CreateMessage;
typedef EditorSpotLight__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorSpotLight*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorSpotLight(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorSpotLight();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
};
typedef Adept::Entity__CreateMessage EditorCameraShip__CreateMessage;
typedef Adept::Entity__Message EditorCameraShip__Message;
class EditorCameraShip : public Adept::Entity
{
public:
static void
InitializeClass();
static void
TerminateClass();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Inheritance Support
//
typedef EditorCameraShip__CreateMessage CreateMessage;
typedef EditorCameraShip__Message Message;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Run-time Construction and Destruction Support
//
public:
static EditorCameraShip*
Make(
CreateMessage *message,
Adept::ReplicatorID *base_id
);
protected:
EditorCameraShip(
ClassData *class_data,
CreateMessage *message,
Adept::ReplicatorID *base_id,
ElementRenderer::Element *element
);
~EditorCameraShip();
public:
MechWarrior4::CameraShip* cameraShip;
void SetCameraShip(MechWarrior4::CameraShip* ship);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Shared Data support
//
public:
static ClassData
*DefaultData;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Test Support
//
public:
void
TestInstance();
};
@@ -0,0 +1,317 @@
// FileDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "FileDlg.h"
#include "ConfirmDlg.h"
#include <io.h>
#include <direct.h>
/////////////////////////////////////////////////////////////////////////////
// CFileDlg dialog
extern CMW4GameEdApp theApp;
CFileDlg::CFileDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFileDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFileDlg)
//}}AFX_DATA_INIT
}
CFileDlg::~CFileDlg()
{
}
void CFileDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFileDlg)
DDX_Control(pDX, IDC_FILEDLGNUMOBJEDIT, m_NumObj);
DDX_Control(pDX, IDC_FILEDLGMAPNAMEEDIT, m_MapName);
DDX_Control(pDX, IDC_FILEDLGLIST, m_FileList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFileDlg, CDialog)
//{{AFX_MSG_MAP(CFileDlg)
ON_BN_CLICKED(IDFILEDLGDELETE, OnFiledlgdelete)
ON_BN_CLICKED(IDFILEDLGOPEN, OnFiledlgopen)
ON_LBN_SELCHANGE(IDC_FILEDLGLIST, OnSelchangeFiledlglist)
ON_LBN_DBLCLK(IDC_FILEDLGLIST, OnDblclkFiledlglist)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileDlg message handlers
BOOL CFileDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText("Open Mission File");
((CButton*)(GetDlgItem(IDFILEDLGOPEN)))->ShowWindow(SW_SHOW);
/*
MString path = Working_Directory;
path += "\\Content\\Missions\\*.*";
Directory *directory;
directory = new Directory(path, true);
Check_Object(directory);
Stuff::IsolateDirectory(&path);
Check_Object(directory);
delete directory;
*/
LoadMissionList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFileDlg::LoadMissionList()
{
ClearListData();
Stuff::NotationFile build_file("Content\\MechWarrior4.build");
Page *core_page = build_file.FindPage("");
if (core_page)
{
Check_Object(core_page);
Page::NoteIterator *core_notes = core_page->MakeNoteIterator();
Check_Object(core_notes);
Note *core_note;
while ((core_note = core_notes->ReadAndNext()) != NULL)
{
Check_Object(core_note);
NotationFile map_file;
core_note->GetEntry(&map_file);
Page *maps_page = map_file.FindPage("");
Check_Object(maps_page);
Page::NoteIterator *map_notes = maps_page->MakeNoteIterator();
Check_Object(map_notes);
Note *map_note;
while ((map_note = map_notes->ReadAndNext()) != NULL)
{
Check_Object(map_note);
NotationFile mission_file;
map_note->GetEntry(&mission_file);
Page *missions_page = mission_file.FindPage("");
if(missions_page)
{
Check_Object(missions_page);
Page::NoteIterator *mission_notes = missions_page->MakeNoteIterator();
Check_Object(mission_notes);
Note *mission_note;
while ((mission_note = mission_notes->ReadAndNext()) != NULL)
{
CString misname;
misname=mission_note->GetName();
misname=misname.Left(misname.ReverseFind('.'));
misname=misname.Mid(misname.ReverseFind('\\')+1);
int index = m_FileList.AddString(misname);
CString path;
char *p;
path.Format("Content\\Missions\\%s\\%s.instance",misname,misname);
p = new char[path.GetLength() + 1];
strcpy(p,(LPCSTR)path);
m_FileList.SetItemDataPtr(index,p);
}
}
}
}
}
}
void RemoveFolder(char* folderName)
{
struct _finddata_t file;
long hFile;
char path[MAX_PATH],fileName[MAX_PATH];
sprintf(path,"%s\\*.*",folderName);
if((hFile = _findfirst(path,&file)) != -1L)
{
do
{
if (file.name[0] == '.')
continue;
sprintf(fileName,"%s\\%s",folderName,file.name);
if (file.attrib & _A_SUBDIR)
{
RemoveFolder(fileName);
continue;
}
SetFileAttributes(fileName,FILE_ATTRIBUTE_NORMAL);
remove(fileName);
}
while(_findnext(hFile,&file) == 0);
_rmdir(folderName);
}
}
void CFileDlg::OnFiledlgdelete()
{
int authorization = 0;
char missionName[MAX_PATH];
m_FileList.GetText(m_FileList.GetCurSel(),missionName);
if (strstr(theApp.missionFileName,missionName))
{
if (MessageBox("If you delete the currently loaded file, you will not be able to save it afterwards. Are you sure you want to permenantly delete this file?", // Localize
"Mission Delete Warning",MB_YESNO) == IDNO)
{
return;
}
authorization = IDOK;
theApp.OnFileClose();
}
struct _finddata_t file;
long hFile;
if ((hFile = _findfirst("Content\\resources.build",&file)) == -1L)
STOP (("Could not find Content\\Resources.build. Please reinstall")); // Localize
if (file.attrib & _A_RDONLY)
{
if (MessageBox("Content\\resources.build is marked read only. Would you like to change the file to writable and continue?",
"Resource Error",MB_YESNO) == IDNO)
{
MessageBox("Unable to remove mission.","Mission Delete Error");
return;
}
SetFileAttributes("Content\\resources.build",FILE_ATTRIBUTE_NORMAL);
}
if (authorization == 0)
{
CConfirmDlg dlg(CONFIRM_FILEDELETE);
dlg.m_Title = "File Delete Confirmation"; // Localize
dlg.m_MessageText = "Are you sure you want to permanently remove this file?"; // Localize
authorization = dlg.DoModal();
}
if (authorization == IDOK)
{
char path[MAX_PATH];
sprintf(path,"Content\\Missions\\%s",missionName);
RemoveFolder(path);
LoadMissionList();
FILE* oldFile, *newFile;
if ((oldFile = fopen("Content\\Resources.build","r")) == NULL)
{
MessageBox("Unable to open Content\\Resource.build. The mission has been deleted but you will probably get a warning the next time you start.","Mission Delete Error"); // Localize
return;
}
if ((newFile = fopen("Content\\Resources.del","w")) == NULL)
{
MessageBox("Unable to create temperary file. The mission has been deleted but you will probably get a warning the next time you start.","Mission Delete Error"); // Localize
return;
}
char buffer[512];
do
{
fgets(buffer,511,oldFile);
if (feof(oldFile))
break;
if (strstr(strlwr(buffer),strlwr(missionName)) || buffer[0] == 10)
{
continue;
}
fputs(buffer,newFile);
}
while (1);
fclose(oldFile);
fclose(newFile);
remove("Content\\Resources.build");
rename("Content\\Resources.del","Content\\Resources.build");
}
}
void CFileDlg::OnFiledlgopen()
{
m_PathName = (char*)m_FileList.GetItemDataPtr(m_FileList.GetCurSel());
ClearListData();
CDialog::OnOK();
}
void CFileDlg::OnSelchangeFiledlglist()
{
int index = m_FileList.GetCurSel();
char* path = (char*)m_FileList.GetItemDataPtr(index);
if (path)
{
NotationFile file(path);
char drive[_MAX_DRIVE],dir[_MAX_DIR],fname[_MAX_FNAME],ext[_MAX_EXT],contentFile[MAX_PATH];
const char* mapFile;
_splitpath(path,drive,dir,fname,ext);
_makepath(contentFile,drive,dir,fname,"contents");
Page *page = file.GetPage(fname);
Check_Object(page);
page->GetEntry("Map",&mapFile,true);
_splitpath(mapFile,drive,dir,fname,ext);
m_MapName.SetWindowText(fname);
NotationFile propFile(contentFile);
char numString[8];
NotationFile::PageIterator *pages = propFile.MakePageIterator();
Check_Object(pages);
m_NumObj.SetWindowText(itoa(pages->GetSize(),numString,10));
delete pages;
}
else
{
// You should never get here
MessageBox("Could not associate an instance file with that mission","File Error");
}
}
void CFileDlg::OnDblclkFiledlglist()
{
OnFiledlgopen();
}
char* CFileDlg::GetPathName()
{
return ((char*)LPCTSTR(m_PathName));
}
void CFileDlg::ClearListData()
{
while (m_FileList.GetCount())
{
char* path = (char*)m_FileList.GetItemDataPtr(0);
if (path)
delete [] path;
m_FileList.DeleteString(0);
}
}
void CFileDlg::OnCancel()
{
ClearListData();
CDialog::OnCancel();
}
@@ -0,0 +1,60 @@
#if !defined(AFX_FILEDLG_H__3FF204A1_2B06_11D3_8458_00105A17BC83__INCLUDED_)
#define AFX_FILEDLG_H__3FF204A1_2B06_11D3_8458_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FileDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CFileDlg dialog
class CFileDlg : public CDialog
{
// Construction
public:
CFileDlg(CWnd* pParent = NULL); // standard constructor
~CFileDlg();
// Dialog Data
//{{AFX_DATA(CFileDlg)
enum { IDD = IDD_FILEDLG };
CEdit m_NumObj;
CEdit m_MapName;
CListBox m_FileList;
//}}AFX_DATA
CString m_PathName;
char* GetPathName();
void LoadMissionList();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFileDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CFileDlg)
afx_msg void OnFiledlgdelete();
afx_msg void OnFiledlgopen();
virtual BOOL OnInitDialog();
afx_msg void OnSelchangeFiledlglist();
afx_msg void OnDblclkFiledlglist();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void ClearListData();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FILEDLG_H__3FF204A1_2B06_11D3_8458_00105A17BC83__INCLUDED_)
+456
View File
@@ -0,0 +1,456 @@
// FogDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "FogDlg.h"
#include <Adept\Mission.hpp>
#include <ElementRenderer\StateChange.hpp>
#include <MLR\MLRPrimitiveBase.hpp>
/////////////////////////////////////////////////////////////////////////////
// FogDlg dialog
FogDlg::FogDlg(CWnd* pParent /*=NULL*/)
: CDialog(FogDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(FogDlg)
m_CustomDensity = 0.0f;
m_Blue = 0.0f;
m_CustomEnd = 0.0f;
m_CustomStart = 0.0f;
m_GeneralDensity = 0.0f;
m_GeneralEnd = 0.0f;
m_GeneralStart = 0.0f;
m_Green = 0.0f;
m_LightDensity = 0.0f;
m_LightEnd = 0.0f;
m_LightStart = 0.0f;
m_Red = 0.0f;
//}}AFX_DATA_INIT
}
void FogDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FogDlg)
DDX_Text(pDX, IDC_EDITCUSTOMDENSITY, m_CustomDensity);
DDX_Text(pDX, IDC_EDITBLUE, m_Blue);
DDX_Text(pDX, IDC_EDITCUSTOMEND, m_CustomEnd);
DDX_Text(pDX, IDC_EDITCUSTOMSTART, m_CustomStart);
DDX_Text(pDX, IDC_EDITGENERALDENSITY, m_GeneralDensity);
DDX_Text(pDX, IDC_EDITGENERALEND, m_GeneralEnd);
DDX_Text(pDX, IDC_EDITGENERALSTART, m_GeneralStart);
DDX_Text(pDX, IDC_EDITGREEN, m_Green);
DDX_Text(pDX, IDC_EDITLIGHTDENSITY, m_LightDensity);
DDX_Text(pDX, IDC_EDITLIGHTEND, m_LightEnd);
DDX_Text(pDX, IDC_EDITLIGHTSTART, m_LightStart);
DDX_Text(pDX, IDC_EDITRED, m_Red);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FogDlg, CDialog)
//{{AFX_MSG_MAP(FogDlg)
ON_EN_KILLFOCUS(IDC_EDITBLUE, OnKillfocusEditblue)
ON_EN_KILLFOCUS(IDC_EDITCUSTOMDENSITY, OnKillfocusEditcustomdensity)
ON_EN_KILLFOCUS(IDC_EDITCUSTOMEND, OnKillfocusEditcustomend)
ON_EN_KILLFOCUS(IDC_EDITCUSTOMSTART, OnKillfocusEditcustomstart)
ON_EN_KILLFOCUS(IDC_EDITGENERALDENSITY, OnKillfocusEditgeneraldensity)
ON_EN_KILLFOCUS(IDC_EDITGENERALEND, OnKillfocusEditgeneralend)
ON_EN_KILLFOCUS(IDC_EDITGENERALSTART, OnKillfocusEditgeneralstart)
ON_EN_KILLFOCUS(IDC_EDITGREEN, OnKillfocusEditgreen)
ON_EN_KILLFOCUS(IDC_EDITLIGHTDENSITY, OnKillfocusEditlightdensity)
ON_EN_KILLFOCUS(IDC_EDITLIGHTEND, OnKillfocusEditlightend)
ON_EN_KILLFOCUS(IDC_EDITLIGHTSTART, OnKillfocusEditlightstart)
ON_EN_KILLFOCUS(IDC_EDITRED, OnKillfocusEditred)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINBLUE, OnDeltaposSpinblue)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINCUSTOMDENSITY, OnDeltaposSpincustomdensity)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINCUSTOMEND, OnDeltaposSpincustomend)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINCUSTOMSTART, OnDeltaposSpincustomstart)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINGENERALDENSITY, OnDeltaposSpingeneraldensity)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINGENERALEND, OnDeltaposSpingeneralend)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINGENERALSTART, OnDeltaposSpingeneralstart)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINGREEN, OnDeltaposSpingreen)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTDENSITY, OnDeltaposSpinlightdensity)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTEND, OnDeltaposSpinlightend)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTSTART, OnDeltaposSpinlightstart)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINRED, OnDeltaposSpinred)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FogDlg message handlers
BOOL FogDlg::OnInitDialog()
{
CDialog::OnInitDialog();
const Mission__GameModel *model = Mission::Instance->GetGameModel();
m_CustomDensity = model->m_customFogDensity;
m_CustomStart = model->m_customFogStart;
m_CustomEnd = model->m_customFogEnd;
m_GeneralDensity = model->m_generalFogDensity;
m_GeneralStart = model->m_generalFogStart;
m_GeneralEnd = model->m_generalFogEnd;
m_LightDensity = model->m_lightFogDensity;
m_LightStart = model->m_lightFogStart;
m_LightEnd = model->m_lightFogEnd;
Stuff::RGBAColor color = model->m_fogColor;
m_Red = color.red;
m_Green = color.green;
m_Blue = color.blue;
m_OldCustomDensity = m_CustomDensity;
m_OldBlue = m_Blue;
m_OldCustomEnd = m_CustomEnd;
m_OldCustomStart = m_CustomStart;
m_OldGeneralDensity = m_GeneralDensity;
m_OldGeneralEnd = m_GeneralEnd;
m_OldGeneralStart = m_GeneralStart;
m_OldGreen = m_Green;
m_OldLightDensity = m_LightDensity;
m_OldLightEnd = m_LightEnd;
m_OldLightStart = m_LightStart;
m_OldRed = m_Red;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void FogDlg::OnOK()
{
UpdateData(TRUE);
if (!SetFogValue("CustomFogDensity",m_CustomDensity))
return;
if (!SetFogValue("CustomFogStart",m_CustomStart))
return;
if (!SetFogValue("CustomFogEnd",m_CustomEnd))
return;
if (!SetFogValue("GeneralFogDensity",m_GeneralDensity))
return;
if (!SetFogValue("GeneralFogStart",m_GeneralStart))
return;
if (!SetFogValue("GeneralFogEnd",m_GeneralEnd))
return;
if (!SetFogValue("LightFogDensity",m_LightDensity))
return;
if (!SetFogValue("LightFogStart",m_LightStart))
return;
if (!SetFogValue("LightFogEnd",m_LightEnd))
return;
RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
if (!SetFogValue("FogColor",color))
return;
CDialog::OnOK();
}
void FogDlg::OnCancel()
{
SetFogValue("CustomFogDensity",m_OldCustomDensity);
SetFogValue("CustomFogStart",m_OldCustomStart);
SetFogValue("CustomFogEnd",m_OldCustomEnd);
SetFogValue("GeneralFogDensity",m_OldGeneralDensity);
SetFogValue("GeneralFogStart",m_OldGeneralStart);
SetFogValue("GeneralFogEnd",m_OldGeneralEnd);
SetFogValue("LightFogDensity",m_OldLightDensity);
SetFogValue("LightFogStart",m_OldLightStart);
SetFogValue("LightFogEnd",m_OldLightEnd);
RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
CDialog::OnCancel();
}
bool FogDlg::SetFogValue(char* attributeName, Scalar value)
{
char string[16];
return SetFogValue(attributeName,gcvt(value,3,string));
}
bool FogDlg::SetFogValue(char* attributeName, RGBAColor value)
{
char color[32];
sprintf(color,"%4.2f %4.2f %4.2f 1.0",m_Red,m_Green,m_Blue);
return SetFogValue("FogColor",color);
}
bool FogDlg::SetFogValue(char* attributeName, char* value)
{
bool result = true;
char *error_message;
error_message = new char[256];
Register_Pointer(error_message);
const Mission__GameModel *model = Mission::Instance->GetGameModel();
Check_Object(model);
Mission::ClassData *class_data;
class_data = Mission::Instance->GetClassData();
Check_Object(class_data);
ModelAttributeEntry *attrib_entry;
attrib_entry =
class_data->gameModelAttributeTable.GetAttributeEntry(attributeName);
Check_Object(attrib_entry);
if(!(*class_data->modelVerifier)((Entity__GameModel *)model, attrib_entry, value, &error_message,255))
{
char error[256];
sprintf(error,"Error with %s: %s",attributeName,error_message);
AfxMessageBox(error, MB_OK);
result = false;
}
Unregister_Pointer(error_message);
delete [] error_message;
// const GameModel *model = GetGameModel();
// Check_Object(model);
ElementRenderer::StateChange::SetFogColor(model->m_fogColor);
MidLevelRenderer::MLRPrimitiveBase::SetFogTableEntry(
1,
model->m_generalFogStart,
model->m_generalFogEnd,
model->m_generalFogDensity
);
MidLevelRenderer::MLRPrimitiveBase::SetFogTableEntry(
2,
model->m_lightFogStart,
model->m_lightFogEnd,
model->m_lightFogDensity
);
MidLevelRenderer::MLRPrimitiveBase::SetFogTableEntry(
3,
model->m_customFogStart,
model->m_customFogEnd,
model->m_customFogDensity
);
return result;
}
void FogDlg::OnKillfocusEditcustomdensity()
{
UpdateData(TRUE);
SetFogValue("CustomFogDensity",m_CustomDensity);
}
void FogDlg::OnKillfocusEditcustomend()
{
UpdateData(TRUE);
SetFogValue("CustomFogEnd",m_CustomEnd);
}
void FogDlg::OnKillfocusEditcustomstart()
{
UpdateData(TRUE);
SetFogValue("CustomFogStart",m_CustomStart);
}
void FogDlg::OnKillfocusEditgeneraldensity()
{
UpdateData(TRUE);
SetFogValue("GeneralFogDensity",m_GeneralDensity);
}
void FogDlg::OnKillfocusEditgeneralend()
{
UpdateData(TRUE);
SetFogValue("GeneralFogEnd",m_GeneralEnd);
}
void FogDlg::OnKillfocusEditgeneralstart()
{
UpdateData(TRUE);
SetFogValue("GeneralFogStart",m_GeneralStart);
}
void FogDlg::OnKillfocusEditlightdensity()
{
UpdateData(TRUE);
SetFogValue("LightFogDensity",m_LightDensity);
}
void FogDlg::OnKillfocusEditlightend()
{
UpdateData(TRUE);
SetFogValue("LightFogEnd",m_LightEnd);
}
void FogDlg::OnKillfocusEditlightstart()
{
UpdateData(TRUE);
SetFogValue("LightFogStart",m_LightStart);
}
void FogDlg::OnKillfocusEditred()
{
UpdateData(TRUE);
Stuff::RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
}
void FogDlg::OnKillfocusEditgreen()
{
UpdateData(TRUE);
Stuff::RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
}
void FogDlg::OnKillfocusEditblue()
{
UpdateData(TRUE);
Stuff::RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
}
void FogDlg::OnDeltaposSpincustomdensity(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_CustomDensity -= (pNMUpDown->iDelta > 0) ? 0.01f : -0.01f;
SetFogValue("CustomFogDensity",m_CustomDensity);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpincustomend(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_CustomEnd -= pNMUpDown->iDelta;
SetFogValue("CustomFogEnd",m_CustomEnd);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpincustomstart(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_CustomStart -= pNMUpDown->iDelta;
SetFogValue("CustomFogStart",m_CustomStart);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpingeneraldensity(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_GeneralDensity -= (pNMUpDown->iDelta > 0) ? 0.01f : -0.01f;
SetFogValue("GeneralFogDensity",m_GeneralDensity);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpingeneralend(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_GeneralEnd -= pNMUpDown->iDelta;
SetFogValue("GeneralFogEnd",m_GeneralEnd);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpingeneralstart(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_GeneralStart -= pNMUpDown->iDelta;
SetFogValue("GeneralFogStart",m_GeneralStart);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpinlightdensity(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_LightDensity -= (pNMUpDown->iDelta > 0) ? 0.01f : -0.01f;
SetFogValue("LightFogDensity",m_LightDensity);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpinlightend(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_LightEnd -= pNMUpDown->iDelta;
SetFogValue("LightFogEnd",m_LightEnd);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpinlightstart(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_LightStart -= pNMUpDown->iDelta;
SetFogValue("LightFogStart",m_LightStart);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpinred(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_Red -= (pNMUpDown->iDelta > 0) ? 0.01f : -0.01f;
Stuff::RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpinblue(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_Blue -= (pNMUpDown->iDelta > 0) ? 0.01f : -0.01f;
Stuff::RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
UpdateData(FALSE);
*pResult = 0;
}
void FogDlg::OnDeltaposSpingreen(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
m_Green -= (pNMUpDown->iDelta > 0) ? 0.01f : -0.01f;
Stuff::RGBAColor color(m_Red,m_Green,m_Blue,1.0f);
SetFogValue("FogColor",color);
UpdateData(FALSE);
*pResult = 0;
}
+101
View File
@@ -0,0 +1,101 @@
#if !defined(AFX_FOGDLG_H__043F9801_8BBE_11D3_8E25_00105A17BC83__INCLUDED_)
#define AFX_FOGDLG_H__043F9801_8BBE_11D3_8E25_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FogDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// FogDlg dialog
class FogDlg : public CDialog
{
// Construction
public:
FogDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(FogDlg)
enum { IDD = IDD_FOGDLG };
float m_CustomDensity;
float m_Blue;
float m_CustomEnd;
float m_CustomStart;
float m_GeneralDensity;
float m_GeneralEnd;
float m_GeneralStart;
float m_Green;
float m_LightDensity;
float m_LightEnd;
float m_LightStart;
float m_Red;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(FogDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
float m_OldCustomDensity;
float m_OldBlue;
float m_OldCustomEnd;
float m_OldCustomStart;
float m_OldGeneralDensity;
float m_OldGeneralEnd;
float m_OldGeneralStart;
float m_OldGreen;
float m_OldLightDensity;
float m_OldLightEnd;
float m_OldLightStart;
float m_OldRed;
// Generated message map functions
//{{AFX_MSG(FogDlg)
virtual BOOL OnInitDialog();
virtual void OnOK();
afx_msg void OnKillfocusEditblue();
afx_msg void OnKillfocusEditcustomdensity();
afx_msg void OnKillfocusEditcustomend();
afx_msg void OnKillfocusEditcustomstart();
afx_msg void OnKillfocusEditgeneraldensity();
afx_msg void OnKillfocusEditgeneralend();
afx_msg void OnKillfocusEditgeneralstart();
afx_msg void OnKillfocusEditgreen();
afx_msg void OnKillfocusEditlightdensity();
afx_msg void OnKillfocusEditlightend();
afx_msg void OnKillfocusEditlightstart();
afx_msg void OnKillfocusEditred();
afx_msg void OnDeltaposSpinblue(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpincustomdensity(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpincustomend(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpincustomstart(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpingeneraldensity(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpingeneralend(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpingeneralstart(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpingreen(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightdensity(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightend(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightstart(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinred(NMHDR* pNMHDR, LRESULT* pResult);
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
bool SetFogValue(char* attributeName, char* value);
bool SetFogValue(char* attributeName, Scalar value);
bool SetFogValue(char* attributeName, RGBAColor value);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FOGDLG_H__043F9801_8BBE_11D3_8E25_00105A17BC83__INCLUDED_)
@@ -0,0 +1,28 @@
//===========================================================================//
// File: GameEdHeaders.hpp //
///--------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 09/09/98 JSE Inital base class based off of Shadowrun/Adept //
// 10/26/98 SMJ Modified for GameEd //
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Fasa Interactive //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#pragma once
/*
#include "MW4GameEd.h"
#include <Stuff\Stuff.hpp>
#include "Selection.h"
using namespace MWGOS;
using namespace MechWarrior4;
using namespace Adept;
using namespace Stuff;
using namespace MW4AI;
using namespace ElementRenderer;
using namespace gosFX;
using namespace MidLevelRenderer;
*/
@@ -0,0 +1,169 @@
// GenericListDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "GenericListDlg.h"
#include <direct.h>
#include <io.h>
/////////////////////////////////////////////////////////////////////////////
// CGenericListDlg dialog
CGenericListDlg::CGenericListDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGenericListDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CGenericListDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_Title = "";
m_Strict = true;
FillCallback = NULL;
}
void CGenericListDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGenericListDlg)
DDX_Control(pDX, IDC_GENLIST, m_List);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGenericListDlg, CDialog)
//{{AFX_MSG_MAP(CGenericListDlg)
ON_WM_CLOSE()
ON_LBN_DBLCLK(IDC_GENLIST, OnDblclkGenlist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGenericListDlg message handlers
BOOL CGenericListDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(m_Title);
_finddata_t dirinfo,fileinfo;
char oldDir[MAX_PATH],key[MAX_PATH],*p;
_getcwd(oldDir,MAX_PATH - 1);
_chdir(m_Path.GetBuffer(MAX_PATH));
long dirHandle = _findfirst("*.*",&dirinfo);
if (dirHandle != -1)
{
do
{
if (dirinfo.attrib & _A_SUBDIR)
{
if (strstr(dirinfo.name,"."))
continue;
_chdir(dirinfo.name);
if (m_Strict)
{
sprintf(key,"%s.%s",dirinfo.name,m_Extension);
if (_findfirst(key,&fileinfo) != -1)
{
strcpy(key,fileinfo.name);
p = strrchr(key,'.');
*p = 0;
int index = m_List.AddString(key);
char* path = new char [strlen(fileinfo.name) + strlen(m_Path) + strlen(dirinfo.name) + 3];
sprintf(path,"%s\\%s\\%s",m_Path,dirinfo.name,fileinfo.name);
m_List.SetItemDataPtr(index,(void*)path);
}
}
else
{
sprintf(key,"*.%s",m_Extension);
long handle = _findfirst(key,&fileinfo);
if (handle != -1)
{
strcpy(key,fileinfo.name);
p = strrchr(key,'.');
*p = 0;
int index = m_List.AddString(key);
char* path = new char [strlen(fileinfo.name) + strlen(m_Path) + strlen(dirinfo.name) + 3];
sprintf(path,"%s\\%s\\%s",m_Path,dirinfo.name,fileinfo.name);
m_List.SetItemDataPtr(index,(void*)path);
while (_findnext(handle,&fileinfo) == 0)
{
strcpy(key,fileinfo.name);
p = strrchr(key,'.');
*p = 0;
index = m_List.AddString(key);
path = new char [strlen(fileinfo.name) + strlen(m_Path) + strlen(dirinfo.name) + 3];
sprintf(path,"%s\\%s\\%s",m_Path,dirinfo.name,fileinfo.name);
m_List.SetItemDataPtr(index,(void*)path);
}
}
}
_chdir("..");
}
}
while(_findnext(dirHandle,&dirinfo) == 0);
}
_chdir(oldDir);
m_List.SetCurSel(0);
if (FillCallback)
FillCallback(&m_List);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CGenericListDlg::DeletePathStrings()
{
for (int i = 0; i < m_List.GetCount(); i++)
{
char* p = (char*)m_List.GetItemDataPtr(i);
delete [] p;
}
CDialog::OnClose();
}
void CGenericListDlg::OnOK()
{
int sel = m_List.GetCurSel();
if (sel != -1)
{
m_List.GetText(m_List.GetCurSel(),m_Name);
m_Path = (char*) m_List.GetItemData(m_List.GetCurSel());
}
DeletePathStrings();
CDialog::OnOK();
}
void CGenericListDlg::OnClose()
{
DeletePathStrings();
}
void CGenericListDlg::OnCancel()
{
DeletePathStrings();
CDialog::OnCancel();
}
void CGenericListDlg::OnDblclkGenlist()
{
OnOK();
}
@@ -0,0 +1,60 @@
#if !defined(AFX_GENERICLISTDLG_H__99D8B047_2FD9_11D3_8458_00105A17BC83__INCLUDED_)
#define AFX_GENERICLISTDLG_H__99D8B047_2FD9_11D3_8458_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GenericListDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CGenericListDlg dialog
class CGenericListDlg : public CDialog
{
// Construction
public:
CGenericListDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CGenericListDlg)
enum { IDD = IDD_GENERICLISTDLG };
CListBox m_List;
//}}AFX_DATA
CString m_Title;
CString m_Path;
CString m_Extension;
CString m_Name;
bool m_Strict;
void (* FillCallback)(CListBox* listbox);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGenericListDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void DeletePathStrings();
// Generated message map functions
//{{AFX_MSG(CGenericListDlg)
virtual BOOL OnInitDialog();
afx_msg void OnClose();
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnDblclkGenlist();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GENERICLISTDLG_H__99D8B047_2FD9_11D3_8458_00105A17BC83__INCLUDED_)
@@ -0,0 +1,61 @@
// GenericTextDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "GenericTextDlg.h"
#include <Adept\EntityManager.hpp>
/////////////////////////////////////////////////////////////////////////////
// CGenericTextDlg dialog
CGenericTextDlg::CGenericTextDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGenericTextDlg::IDD, pParent)
{
addStyle = 0;
editRect.left = 120;
editRect.top = 187;
editRect.right = 303;
editRect.bottom = 210;
//{{AFX_DATA_INIT(CGenericTextDlg)
m_EditText = _T("");
//}}AFX_DATA_INIT
}
void CGenericTextDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGenericTextDlg)
DDX_Control(pDX, IDC_NEWTABDLGMESSAGE, m_Message);
DDX_Text(pDX, IDC_TABNAME, m_EditText);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGenericTextDlg, CDialog)
//{{AFX_MSG_MAP(CGenericTextDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGenericTextDlg message handlers
BOOL CGenericTextDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(m_Title);
m_Message.SetWindowText(m_MessageText);
CEdit* editBox = (CEdit*)GetDlgItem(IDC_TABNAME);
editBox->ModifyStyle(0,addStyle);
editBox->SetWindowPos(&wndTopMost,editRect.left,editRect.top,editRect.right - editRect.left,editRect.bottom - editRect.top,SWP_SHOWWINDOW);
editBox->SetWindowText(m_EditText);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -0,0 +1,54 @@
#if !defined(AFX_GENERICTEXTDLG_H__F07F96E9_BC1E_11D2_8457_00105A17BC83__INCLUDED_)
#define AFX_GENERICTEXTDLG_H__F07F96E9_BC1E_11D2_8457_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GenericTextDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CGenericTextDlg dialog
class CGenericTextDlg : public CDialog
{
// Construction
public:
CGenericTextDlg(CWnd* pParent = NULL); // standard constructor
MString m_Title;
MString m_MessageText;
// MString m_EditText;
RECT editRect;
UINT addStyle;
// Dialog Data
//{{AFX_DATA(CGenericTextDlg)
enum { IDD = IDD_NEWTAB };
CStatic m_Message;
CString m_EditText;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGenericTextDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CGenericTextDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GENERICTEXTDLG_H__F07F96E9_BC1E_11D2_8457_00105A17BC83__INCLUDED_)
@@ -0,0 +1,9 @@
#define APP_MENU_VIEW 2
#define APP_MENU_TOOLS 3
// Editor Modes
#define TOOLS_MENU_CAMERA_POSITIONS 6
#define EM_NONE 0
#define EM_RESOURCE 1
//extern UndoChain UndoManager;
@@ -0,0 +1,44 @@
// GridProps.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "GridProps.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGridProps dialog
CGridProps::CGridProps(CWnd* pParent /*=NULL*/)
: CDialog(CGridProps::IDD, pParent)
{
//{{AFX_DATA_INIT(CGridProps)
m_GSize = 0.0f;
//}}AFX_DATA_INIT
}
void CGridProps::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGridProps)
DDX_Text(pDX, IDC_GSIZE, m_GSize);
DDV_MinMaxFloat(pDX, m_GSize, 2.f, 1000.f);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGridProps, CDialog)
//{{AFX_MSG_MAP(CGridProps)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGridProps message handlers
@@ -0,0 +1,46 @@
#if !defined(AFX_GRIDPROPS_H__9034901A_D019_11D3_8B36_00902712C9AE__INCLUDED_)
#define AFX_GRIDPROPS_H__9034901A_D019_11D3_8B36_00902712C9AE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GridProps.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CGridProps dialog
class CGridProps : public CDialog
{
// Construction
public:
CGridProps(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CGridProps)
enum { IDD = IDD_GRIDPROPS };
float m_GSize;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGridProps)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CGridProps)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GRIDPROPS_H__9034901A_D019_11D3_8B36_00902712C9AE__INCLUDED_)
@@ -0,0 +1,174 @@
#include "stdafx.h"
#include "MW4GameEd.h"
#include "InsertPathNodeCommand.h"
#include <Adept\Player.hpp>
#include <Adept\Interface.hpp>
#include <Adept\Entity.hpp>
#include <Adept\EntityManager.hpp>
#include <Adept\Map.hpp>
#include "TransDlg.h"
#include "DisplayWindow.h"
#include "OverviewWindow.h"
#include "InstanceWindow.h"
#include "ResourceWindow.h"
#include "Selection.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
extern CMW4GameEdApp theApp;
InsertPathNodeCommand::InsertPathNodeCommand(EditorPathNode *beforeMe)
: Command()
{
Check_Object(beforeMe);
Entity* entity = theApp.resourceWindow->CreateNewInstance("Content\\Editor\\Reserved\\PathNode\\PathNode.data",
"PathNode","PathNode");
SPEW(("scottjan","Hey! These should probably not be hardcoded"));
if (entity)
{
insertedNode = Cast_Object(EditorPathNode*,entity);
beforeMe->InsertNode(insertedNode);
insertedNode->SetLinkColor(Stuff::RGBAColor(1.0f,1.0f,0.0f,0.0f));
insertedNode->ShowLink(true);
insertedNode->GetElement()->SetVolumeCullMode();
insertedNode->GetElement()->Sync();
Time till = gos_GetElapsedTime();
insertedNode->PostCollisionExecute(till);
CSelectionList::Instance->ClearSelectionList();
CSelectionList::Instance->AddSelection(entity);
CSelectionList::Instance->RemoveCollision();
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
InsertPathNodeCommand::~InsertPathNodeCommand()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void InsertPathNodeCommand::Undo()
{
Check_Object(insertedNode);
CSelectionList::Instance->ClearSelectionList();
EditorPathNode* n = insertedNode->nextnode;
while (n)
{
n->index--;
n = n->nextnode;
}
insertedNode->pathSlot.GetCurrent()->pathSlot.GetCurrent()->ErasePoint (insertedNode->index);
if (insertedNode->prevnode)
{
insertedNode->prevnode->nextnode = insertedNode->nextnode;
insertedNode->prevnode->UpdateLinkPointData();
}
if (insertedNode->nextnode)
{
insertedNode->nextnode->prevnode = insertedNode->prevnode;
insertedNode->nextnode->UpdateLinkPointData();
}
insertedNode->SentenceToDeathRow();
theApp.overviewWindow->DrawWindow();
Check_Pointer(theApp.instanceWindow);
theApp.instanceWindow->RemoveInstance(insertedNode);
theApp.displayWindow->translationDlg->CheckObject(insertedNode);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
InsertBoundaryNodeCommand::InsertBoundaryNodeCommand(EditorBoundaryNode *beforeMe)
: Command()
{
Check_Object(beforeMe);
Entity* tmpentity = theApp.resourceWindow->CreateNewInstance("Content\\Editor\\Reserved\\BoundaryNode\\BoundaryNode.data","MovementPath","MovementPath");
EditorBoundaryNode *entity = Cast_Object(EditorBoundaryNode*,tmpentity);
SPEW(("scottjan","Hey! I am an idiot. You guys will never make this thing work"));
if (entity)
{
insertedNode = Cast_Object(EditorBoundaryNode*,entity);
insertedNode->myBoundary=beforeMe->myBoundary;
insertedNode->firstBoundaryNode=beforeMe->firstBoundaryNode;
beforeMe->InsertNode(insertedNode);
insertedNode->SetLinkColor(Stuff::RGBAColor(1.0f,1.0f,1.0f,0.0f));
insertedNode->ShowLink(true);
insertedNode->GetElement()->SetVolumeCullMode();
insertedNode->GetElement()->Sync();
Time till = gos_GetElapsedTime();
insertedNode->PostCollisionExecute(till);
CSelectionList::Instance->ClearSelectionList();
CSelectionList::Instance->AddSelection(entity);
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
InsertBoundaryNodeCommand::~InsertBoundaryNodeCommand()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void InsertBoundaryNodeCommand::Undo()
{
Check_Object(insertedNode);
CSelectionList::Instance->ClearSelectionList();
EditorBoundaryNode* n = insertedNode->nextnode;
while (n->index != 0)
{
n->index--;
n = n->nextnode;
}
if (insertedNode->prevnode)
{
insertedNode->prevnode->nextnode = insertedNode->nextnode;
insertedNode->prevnode->UpdateLinkPointData();
}
if (insertedNode->nextnode)
{
insertedNode->nextnode->prevnode = insertedNode->prevnode;
insertedNode->nextnode->UpdateLinkPointData();
}
insertedNode->myBoundary->SetLength(insertedNode->myBoundary->GetLength() - 1);
Point3D point;
n = insertedNode->firstBoundaryNode;
do
{
point = n->GetLocalToWorld();
(*(insertedNode->myBoundary))[n->index].x = point.x;
(*(insertedNode->myBoundary))[n->index].y = point.z;
n = n->nextnode;
}
while (n->index != 0);
insertedNode->SentenceToDeathRow();
theApp.overviewWindow->DrawWindow();
Check_Pointer(theApp.instanceWindow);
theApp.instanceWindow->RemoveInstance(insertedNode);
theApp.displayWindow->translationDlg->CheckObject(insertedNode);
}
@@ -0,0 +1,37 @@
// File: AddCommand.hpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
#pragma once
#include "Command.h"
#include "EditorWaypoint.h"
class InsertPathNodeCommand :
public Command
{
public:
InsertPathNodeCommand(EditorPathNode* node);
virtual ~InsertPathNodeCommand();
EditorPathNode
*insertedNode;
void
Undo();
};
class InsertBoundaryNodeCommand :
public Command
{
public:
InsertBoundaryNodeCommand(EditorBoundaryNode* node);
virtual ~InsertBoundaryNodeCommand();
EditorBoundaryNode
*insertedNode;
void
Undo();
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,123 @@
#pragma once
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ResourceWindow.h : header file
//
#include "TagListDlg.h"
#include "ObjWindow.h"
#include "EditorChildWnd.h"
#include <Adept\Entity.hpp>
#include <MW4\Mech_ai.hpp>
#include "EditWnd.h"
/////////////////////////////////////////////////////////////////////////////
// CInstanceWindow frame
class CInstanceWindow : public CEditorChildWnd
{
friend class CTagListDlg;
DECLARE_DYNCREATE(CInstanceWindow)
protected:
void
AddInstance(Adept::Entity* entity, bool fill = true);
// Attributes
public:
// Operations
public:
CInstanceWindow(); // protected constructor used by dynamic creation
virtual ~CInstanceWindow();
Stuff::ChainOf<TabList *>
mechList;
Stuff::ChainOf<TabList *>
buildingList;
Stuff::ChainOf<TabList *>
vehicleList;
Stuff::ChainOf<TabList *>
miscList;
void
ClearInstanceLists();
void
ResetInstanceLists();
void
RemoveInstance(Adept::Entity* entity);
void
FillTabBox(int tab = -1);
void
FillTabBox(ChainIteratorOf<TabList*> &iterator);
int
GetSelectedObject();
void
ResetSel();
void
ObjEditScript(char* file = NULL, int line = 0);
void
ChangeObjName();
void
CheckHiddenObject(Entity* entity);
void
OnObjSpecifyScript(Entity* entity);
CObjWindow
*TLDlg;
CEditWnd*
scriptWnd;
void
OnClearAI(Entity* entity);
void
OnABLMemory(Entity* entity);
void OnEditSkill(Entity* entity);
protected:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInstanceWindow)
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
public:
// Generated message map functions
//{{AFX_MSG(CInstanceWindow)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnObjName();
afx_msg void OnObjParameters();
afx_msg void OnObjTranslation();
afx_msg void OnObjRemoveinstance();
afx_msg void OnObjGotoinstance();
afx_msg void OnObjDamageobjArmor();
afx_msg void OnObjDamageobjInternal();
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnObjEditDriver();
afx_msg void OnObjEditObjective();
afx_msg void OnObjSpecifyScript();
afx_msg void OnObjEditScript();
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnObjAlignment();
afx_msg void OnEditLight();
afx_msg void OnClearAI();
afx_msg void OnABLMemory();
afx_msg void OnEditSkill();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
@@ -0,0 +1,393 @@
// LatticeLinkDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "LatticeLinkDlg.h"
#include "EditorWaypoint.h"
#include <Adept\Map.hpp>
/////////////////////////////////////////////////////////////////////////////
// CLatticeLinkDlg dialog
CLatticeLinkDlg::CLatticeLinkDlg(CWnd* pParent /*=NULL*/)
: CDialog(CLatticeLinkDlg::IDD, pParent),
m_UndoDeleteChain(NULL),
m_UndoDataChain(NULL)
{
//{{AFX_DATA_INIT(CLatticeLinkDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CLatticeLinkDlg::~CLatticeLinkDlg()
{
}
void CLatticeLinkDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLatticeLinkDlg)
DDX_Control(pDX, IDC_LINKLIST, m_LinksList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLatticeLinkDlg, CDialog)
//{{AFX_MSG_MAP(CLatticeLinkDlg)
ON_BN_CLICKED(IDC_LLCHECKFLY, OnLlcheckfly)
ON_BN_CLICKED(IDC_LLCHECKHELI, OnLlcheckheli)
ON_BN_CLICKED(IDC_LLCHECKHOVER, OnLlcheckhover)
ON_BN_CLICKED(IDC_LLCHECKJUMP, OnLlcheckjump)
ON_BN_CLICKED(IDC_LLCHECKLEG, OnLlcheckleg)
ON_BN_CLICKED(IDC_LLCHECKTRACK, OnLlchecktrack)
ON_BN_CLICKED(IDC_LLCHECKWHEEL, OnLlcheckwheel)
ON_EN_CHANGE(IDC_LL_WEIGHTFLY, OnChangeLlWeightfly)
ON_EN_CHANGE(IDC_LL_WEIGHTHELI, OnChangeLlWeightheli)
ON_EN_CHANGE(IDC_LL_WEIGHTHOVER, OnChangeLlWeighthover)
ON_EN_CHANGE(IDC_LL_WEIGHTJUMP, OnChangeLlWeightjump)
ON_EN_CHANGE(IDC_LL_WEIGHTLEG, OnChangeLlWeightleg)
ON_EN_CHANGE(IDC_LL_WEIGHTTRACK, OnChangeLlWeighttrack)
ON_EN_CHANGE(IDC_LL_WEIGHTWHEEL, OnChangeLlWeightwheel)
ON_LBN_SELCHANGE(IDC_LINKLIST, OnSelchangeLinklist)
ON_BN_CLICKED(IDC_BLOCKLINKBTN, OnBlocklinkbtn)
ON_BN_CLICKED(IDC_REMOVELINKBTN, OnRemovelinkbtn)
ON_WM_CLOSE()
ON_BN_CLICKED(IDOK, OnMyOK)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLatticeLinkDlg message handlers
BOOL CLatticeLinkDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CLatticeLinkDlg::SetNode(Entity* newNode)
{
editNode = newNode;
m_LinksList.ResetContent();
char string[32];
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
for (int i = 0; i < node->railNode->NumLinks(); i++)
{
sprintf(string,"Link_%d",node->railNode->Link(i)->ID());
m_LinksList.SetItemData(m_LinksList.AddString(string),i);
OriginalLinkData* orgData = new OriginalLinkData(node->railNode->Link(i));
m_UndoDataChain.Add(orgData);
}
m_LinksList.SetCurSel(0);
UpdateFields();
OnSelchangeLinklist();
}
void CLatticeLinkDlg::UpdateFields()
{
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
int curSel = m_LinksList.GetItemData(m_LinksList.GetCurSel());
((CEdit*)GetDlgItem(IDC_LLNODE1EDIT))->SetWindowText((char*)node->instanceName);
// Find the other one, This might take some time
CRailNode* railNode = node->railNode->Link(curSel)->Location(0);
if (railNode == node->railNode)
railNode = node->railNode->Link(curSel)->Location(1);
Check_Object(Map::Instance);
ChainIteratorOf<Entity *> iterator(&Map::Instance->childEntityChain);
Entity* entity;
while((entity = iterator.ReadAndNext()) != NULL)
{
if (entity->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
EditorLatticeNode* latNode = Cast_Object(EditorLatticeNode*,entity);
if (latNode->railNode == railNode)
{
((CEdit*)GetDlgItem(IDC_LLNODE2EDIT))->SetWindowText((char*)latNode->instanceName);
break;
}
}
}
SetTypeCombo(curSel,IDC_LLCHECKLEG,IDC_LL_WEIGHTLEG,MW4AI::LEGINDEX);
SetTypeCombo(curSel,IDC_LLCHECKJUMP,IDC_LL_WEIGHTJUMP,MW4AI::JUMPINDEX);
SetTypeCombo(curSel,IDC_LLCHECKTRACK,IDC_LL_WEIGHTTRACK,MW4AI::TRACKINDEX);
SetTypeCombo(curSel,IDC_LLCHECKHOVER,IDC_LL_WEIGHTHOVER,MW4AI::HOVERINDEX);
SetTypeCombo(curSel,IDC_LLCHECKWHEEL,IDC_LL_WEIGHTWHEEL,MW4AI::WHEELINDEX);
SetTypeCombo(curSel,IDC_LLCHECKFLY,IDC_LL_WEIGHTFLY,MW4AI::FLYINDEX);
SetTypeCombo(curSel,IDC_LLCHECKHELI,IDC_LL_WEIGHTHELI,MW4AI::HELIINDEX);
}
void CLatticeLinkDlg::SetTypeCombo(int curSel, int checkID, int editID, int index)
{
char string[32];
int checked;
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
CEdit* edit;
checked = node->railNode->Link(curSel)->Legged(node->railNode);
((CButton*)GetDlgItem(checkID))->SetCheck(checked);
edit = (CEdit*)GetDlgItem(editID);
if (checked)
{
edit->EnableWindow();
sprintf(string,"%f",node->railNode->Link(curSel)->Weight(index,node->railNode));
edit->SetWindowText(string);
}
else
{
edit->EnableWindow(FALSE);
edit->SetWindowText("N/A");
}
}
void CLatticeLinkDlg::OnLlcheckfly()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Flyer(((CButton*)GetDlgItem(IDC_LLCHECKFLY))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKFLY,IDC_LL_WEIGHTFLY,MW4AI::FLYINDEX);
}
void CLatticeLinkDlg::OnLlcheckheli()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Heli(((CButton*)GetDlgItem(IDC_LLCHECKHELI))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKHELI,IDC_LL_WEIGHTHELI,MW4AI::HELIINDEX);
}
void CLatticeLinkDlg::OnLlcheckhover()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Hover(((CButton*)GetDlgItem(IDC_LLCHECKHOVER))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKHOVER,IDC_LL_WEIGHTHOVER,MW4AI::HOVERINDEX);
}
void CLatticeLinkDlg::OnLlcheckjump()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Jump(((CButton*)GetDlgItem(IDC_LLCHECKJUMP))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKJUMP,IDC_LL_WEIGHTJUMP,MW4AI::JUMPINDEX);
}
void CLatticeLinkDlg::OnLlcheckleg()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Legged(((CButton*)GetDlgItem(IDC_LLCHECKLEG))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKLEG,IDC_LL_WEIGHTLEG,MW4AI::LEGINDEX);
}
void CLatticeLinkDlg::OnLlchecktrack()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Tracked(((CButton*)GetDlgItem(IDC_LLCHECKTRACK))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKTRACK,IDC_LL_WEIGHTTRACK,MW4AI::TRACKINDEX);
}
void CLatticeLinkDlg::OnLlcheckwheel()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Wheeled(((CButton*)GetDlgItem(IDC_LLCHECKWHEEL))->GetCheck(),node->railNode);
SetTypeCombo(m_LinksList.GetItemData(m_LinksList.GetCurSel()),IDC_LLCHECKWHEEL,IDC_LL_WEIGHTWHEEL,MW4AI::WHEELINDEX);
}
void CLatticeLinkDlg::OnChangeLlWeightfly()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTFLY))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::FLYINDEX,node->railNode);
}
void CLatticeLinkDlg::OnChangeLlWeightheli()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTHELI))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::HELIINDEX,node->railNode);
}
void CLatticeLinkDlg::OnChangeLlWeighthover()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTHOVER))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::HOVERINDEX,node->railNode);
}
void CLatticeLinkDlg::OnChangeLlWeightjump()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTJUMP))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::JUMPINDEX,node->railNode);
}
void CLatticeLinkDlg::OnChangeLlWeightleg()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTLEG))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::LEGINDEX,node->railNode);
}
void CLatticeLinkDlg::OnChangeLlWeighttrack()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTTRACK))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::TRACKINDEX,node->railNode);
}
void CLatticeLinkDlg::OnChangeLlWeightwheel()
{
#pragma warning (disable :4800)
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
char string[32];
((CEdit*)GetDlgItem(IDC_LL_WEIGHTWHEEL))->GetWindowText(string,31);
node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()))->Weight((float)atof(string),MW4AI::WHEELINDEX,node->railNode);
}
void CLatticeLinkDlg::OnCancel()
{
OriginalLinkData* datLink;
ChainIteratorOf<OriginalLinkData*> iterator(&m_UndoDataChain);
iterator.First();
while((datLink = iterator.GetCurrent()) != NULL)
{
datLink->link->Flyer(datLink->m_flyUse,datLink->link->Location (0));
datLink->link->Heli(datLink->m_heliUse,datLink->link->Location (0));
datLink->link->Hover(datLink->m_hoverUse,datLink->link->Location (0));
datLink->link->Jump(datLink->m_jumpUse,datLink->link->Location (0));
datLink->link->Legged(datLink->m_legUse,datLink->link->Location (0));
datLink->link->Tracked(datLink->m_trackUse,datLink->link->Location (0));
datLink->link->Wheeled(datLink->m_wheelUse,datLink->link->Location (0));
datLink->link->Weight(datLink->m_flyWeight,MW4AI::JUMPINDEX,datLink->link->Location (0));
datLink->link->Weight(datLink->m_heliWeight,MW4AI::TRACKINDEX,datLink->link->Location (0));
datLink->link->Weight(datLink->m_hoverWeight,MW4AI::FLYINDEX,datLink->link->Location (0));
datLink->link->Weight(datLink->m_jumpWeight,MW4AI::WHEELINDEX,datLink->link->Location (0));
datLink->link->Weight(datLink->m_legWeight,MW4AI::LEGINDEX,datLink->link->Location (0));
datLink->link->Weight(datLink->m_trackWeight,MW4AI::HOVERINDEX,datLink->link->Location (0));
datLink->link->Weight(datLink->m_wheelWeight,MW4AI::HELIINDEX,datLink->link->Location (0));
m_UndoDataChain.Remove(datLink);
iterator.First();
}
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
CRailLink* link;
DeletedLink* delLink;
ChainIteratorOf<DeletedLink*> deliterator(&m_UndoDeleteChain);
RGBAColor gray(192,192,192,0);
deliterator.First();
while((delLink = deliterator.GetCurrent()) != NULL)
{
link = node->railNode->Link(delLink->id);
link->SetLinkColor(gray);
link->ShowLink(true);
m_UndoDeleteChain.Remove(delLink);
deliterator.First();
}
CDialog::OnCancel();
}
void CLatticeLinkDlg::OnOK()
{
// CDialog::OnOK();
}
void CLatticeLinkDlg::OnSelchangeLinklist()
{
static CRailLink* last = NULL;
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
RGBAColor pink(255,255,255,0),gray(192,192,192,0);
if (last)
last->SetLinkColor(gray);
last = node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()));
last->SetLinkColor(pink);
UpdateFields();
}
void CLatticeLinkDlg::OnBlocklinkbtn()
{
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
CRailLink* link = node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()));
link->ShowLink(false);
DeletedLink* delLink = new DeletedLink(m_LinksList.GetItemData(m_LinksList.GetCurSel()),true);
delLink->node1 = link->Location(0)->ID();
delLink->node2 = link->Location(1)->ID();
m_UndoDeleteChain.Add(delLink);
m_LinksList.DeleteString(m_LinksList.GetCurSel());
}
void CLatticeLinkDlg::OnRemovelinkbtn()
{
EditorLatticeNode* node = Cast_Object(EditorLatticeNode*,editNode);
CRailLink* link = node->railNode->Link(m_LinksList.GetItemData(m_LinksList.GetCurSel()));
link->ShowLink(false);
DeletedLink* delLink = new DeletedLink(m_LinksList.GetItemData(m_LinksList.GetCurSel()),false);
m_UndoDeleteChain.Add(delLink);
m_LinksList.DeleteString(m_LinksList.GetCurSel());
}
void CLatticeLinkDlg::OnClose()
{
ShowWindow(SW_HIDE);
// CDialog::OnClose();
}
void CLatticeLinkDlg::OnMyOK()
{
DeletedLink* delLink;
ChainIteratorOf<DeletedLink*> iterator(&m_UndoDeleteChain);
iterator.First();
while((delLink = iterator.GetCurrent()) != NULL)
{
MW4AI::g_MissionGraph->DeleteLink(delLink->id);
if (delLink->block)
MW4AI::g_MissionGraph->BlockLink(delLink->node1,delLink->node2);
m_UndoDeleteChain.Remove(delLink);
iterator.First();
}
CDialog::OnOK();
}
@@ -0,0 +1,145 @@
#if !defined(AFX_LATTICELINKDLG_H__620E2F21_6060_11D3_845A_00105A17BC83__INCLUDED_)
#define AFX_LATTICELINKDLG_H__620E2F21_6060_11D3_845A_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LatticeLinkDlg.h : header file
//
#include <Adept\Entity.hpp>
#include "EditorWaypoint.h"
using namespace MW4AI;
class DeletedLink : public Plug
{
public:
DeletedLink(int i,bool blocked):
Plug(Plug::DefaultData)
{
id = i;
block = blocked;
}
int id;
bool block;
int node1;
int node2;
};
class OriginalLinkData : public Plug
{
public:
OriginalLinkData(CRailLink* oldData):
Plug(Plug::DefaultData)
{
link = oldData;
m_jumpUse = oldData->Jump(oldData->Location (0));
m_trackUse = oldData->Tracked(oldData->Location (0));
m_flyUse = oldData->Flyer(oldData->Location (0));
m_wheelUse = oldData->Wheeled(oldData->Location (0));
m_legUse = oldData->Legged(oldData->Location (0));
m_hoverUse = oldData->Hover(oldData->Location (0));
m_heliUse = oldData->Heli(oldData->Location (0));
m_jumpWeight = oldData->Weight(MW4AI::JUMPINDEX,oldData->Location (0));
m_trackWeight = oldData->Weight(MW4AI::TRACKINDEX,oldData->Location (0));
m_flyWeight = oldData->Weight(MW4AI::FLYINDEX,oldData->Location (0));
m_wheelWeight = oldData->Weight(MW4AI::WHEELINDEX,oldData->Location (0));
m_legWeight = oldData->Weight(MW4AI::LEGINDEX,oldData->Location (0));
m_hoverWeight = oldData->Weight(MW4AI::HOVERINDEX,oldData->Location (0));
m_heliWeight = oldData->Weight(MW4AI::HELIINDEX,oldData->Location (0));
}
CRailLink* link;
bool m_jumpUse;
bool m_trackUse;
bool m_flyUse;
bool m_wheelUse;
bool m_legUse;
bool m_hoverUse;
bool m_heliUse;
float m_jumpWeight;
float m_trackWeight;
float m_flyWeight;
float m_wheelWeight;
float m_legWeight;
float m_hoverWeight;
float m_heliWeight;
};
/////////////////////////////////////////////////////////////////////////////
// CLatticeLinkDlg dialog
class CLatticeLinkDlg : public CDialog
{
// Construction
public:
CLatticeLinkDlg(CWnd* pParent = NULL); // standard constructor
~CLatticeLinkDlg();
void SetNode(Entity* node);
// Dialog Data
//{{AFX_DATA(CLatticeLinkDlg)
enum { IDD = IDD_LATTICELINKDLG };
CListBox m_LinksList;
//}}AFX_DATA
void OnOK();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLatticeLinkDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
Entity* editNode;
ChainOf<DeletedLink*> m_UndoDeleteChain;
ChainOf<OriginalLinkData*> m_UndoDataChain;
void UpdateFields();
void SetTypeCombo(int curSel, int checkID, int editID, int index);
// Generated message map functions
//{{AFX_MSG(CLatticeLinkDlg)
afx_msg void OnLlcheckfly();
afx_msg void OnLlcheckheli();
afx_msg void OnLlcheckhover();
afx_msg void OnLlcheckjump();
afx_msg void OnLlcheckleg();
afx_msg void OnLlchecktrack();
afx_msg void OnLlcheckwheel();
afx_msg void OnChangeLlWeightfly();
afx_msg void OnChangeLlWeightheli();
afx_msg void OnChangeLlWeighthover();
afx_msg void OnChangeLlWeightjump();
afx_msg void OnChangeLlWeightleg();
afx_msg void OnChangeLlWeighttrack();
afx_msg void OnChangeLlWeightwheel();
virtual void OnCancel();
afx_msg void OnSelchangeLinklist();
virtual BOOL OnInitDialog();
afx_msg void OnBlocklinkbtn();
afx_msg void OnRemovelinkbtn();
afx_msg void OnClose();
afx_msg void OnMyOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LATTICELINKDLG_H__620E2F21_6060_11D3_845A_00105A17BC83__INCLUDED_)
@@ -0,0 +1,592 @@
// LightWnd.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "LightWnd.h"
#include "EditorWayPoint.h"
float REDUCEANGLE(float x)
{
float whole, dec, div, tmp = x;
whole = float(int(tmp));
dec = tmp - whole;
div = float(int(whole / 360));
x = whole - (div * 360) + dec;
return (x);
}
/////////////////////////////////////////////////////////////////////////////
// CLightWnd dialog
CLightWnd::CLightWnd(CWnd* pParent /*=NULL*/)
: CDialog(CLightWnd::IDD, pParent)
{
//{{AFX_DATA_INIT(CLightWnd)
//}}AFX_DATA_INIT
light = NULL;
}
void CLightWnd::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLightWnd)
DDX_Control(pDX, IDC_SPINANGLE, m_AngleSpin);
DDX_Control(pDX, IDC_EDITANGLE, m_AngleEdit);
DDX_Control(pDX, IDC_SPINOUTERRADIUS, m_OuterRadiusSpin);
DDX_Control(pDX, IDC_SPINLIGHTZ, m_ZSpin);
DDX_Control(pDX, IDC_SPINLIGHTYAW, m_YawSpin);
DDX_Control(pDX, IDC_SPINLIGHTY, m_YSpin);
DDX_Control(pDX, IDC_SPINLIGHTX, m_XSpin);
DDX_Control(pDX, IDC_SPINLIGHTROLL, m_RollSpin);
DDX_Control(pDX, IDC_SPINLIGHTPITCH, m_PitchSpin);
DDX_Control(pDX, IDC_SPININNERRADIUS, m_InnerRadiusSpin);
DDX_Control(pDX, IDC_EDITOUTTERRADIUS, m_OuterRadius);
DDX_Control(pDX, IDC_EDITLIGHTZ, m_ZEdit);
DDX_Control(pDX, IDC_EDITLIGHTROLL, m_RollEdit);
DDX_Control(pDX, IDC_EDITLIGHTYAW, m_YawEdit);
DDX_Control(pDX, IDC_EDITLIGHTY, m_YEdit);
DDX_Control(pDX, IDC_EDITLIGHTX, m_XEdit);
DDX_Control(pDX, IDC_EDITLIGHTPITCH, m_PitchEdit);
DDX_Control(pDX, IDC_EDITINNERRADIUS, m_InnerRadiusEdit);
DDX_Control(pDX, IDC_REDSLIDER, m_RedSlider);
DDX_Control(pDX, IDC_GREENSLIDER, m_GreenSlider);
DDX_Control(pDX, IDC_BLUESLIDER, m_BlueSlider);
DDX_Control(pDX, IDC_REDEDIT, m_RedEdit);
DDX_Control(pDX, IDC_GREENEDIT, m_GreenEdit);
DDX_Control(pDX, IDC_BLUEEDIT, m_BlueEdit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLightWnd, CDialog)
//{{AFX_MSG_MAP(CLightWnd)
ON_BN_CLICKED(IDMYOK, OnMyok)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_REDSLIDER, OnReleasedcaptureRedslider)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_GREENSLIDER, OnReleasedcaptureGreenslider)
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_BLUESLIDER, OnReleasedcaptureBlueslider)
ON_BN_CLICKED(IDRESET, OnReset)
ON_WM_HSCROLL()
ON_EN_KILLFOCUS(IDC_EDITINNERRADIUS, OnKillfocusEditinnerradius)
ON_EN_KILLFOCUS(IDC_EDITLIGHTPITCH, OnKillfocusEditlightpitch)
ON_EN_KILLFOCUS(IDC_EDITLIGHTROLL, OnKillfocusEditlightroll)
ON_EN_KILLFOCUS(IDC_EDITLIGHTX, OnKillfocusEditlightx)
ON_EN_KILLFOCUS(IDC_EDITLIGHTY, OnKillfocusEditlighty)
ON_EN_KILLFOCUS(IDC_EDITLIGHTYAW, OnKillfocusEditlightyaw)
ON_EN_KILLFOCUS(IDC_EDITLIGHTZ, OnKillfocusEditlightz)
ON_EN_KILLFOCUS(IDC_EDITOUTTERRADIUS, OnKillfocusEditoutterradius)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPININNERRADIUS, OnDeltaposSpininnerradius)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTPITCH, OnDeltaposSpinlightpitch)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTROLL, OnDeltaposSpinlightroll)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTX, OnDeltaposSpinlightx)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTY, OnDeltaposSpinlighty)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTYAW, OnDeltaposSpinlightyaw)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINLIGHTZ, OnDeltaposSpinlightz)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINOUTERRADIUS, OnDeltaposSpinouterradius)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINANGLE, OnDeltaposSpinangle)
ON_EN_KILLFOCUS(IDC_EDITANGLE, OnKillfocusEditangle)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLightWnd message handlers
void CLightWnd::OnMyok()
{
CDialog::OnOK();
}
void CLightWnd::OnCancel()
{
light->SetColor(oldRed,oldGreen,oldBlue);
CDialog::OnCancel();
}
void CLightWnd::OnReleasedcaptureRedslider(NMHDR* pNMHDR, LRESULT* pResult)
{
curRed = Scalar(m_RedSlider.GetPos()) / 100.0f;
light->SetColor(curRed,curGreen,curBlue);
UpdateControls();
*pResult = 0;
}
void CLightWnd::OnReleasedcaptureGreenslider(NMHDR* pNMHDR, LRESULT* pResult)
{
curGreen = Scalar(m_GreenSlider.GetPos()) / 100.0f;
light->SetColor(curRed,curGreen,curBlue);
UpdateControls();
*pResult = 0;
}
void CLightWnd::OnReleasedcaptureBlueslider(NMHDR* pNMHDR, LRESULT* pResult)
{
curBlue = Scalar(m_BlueSlider.GetPos()) / 100.0f;
light->SetColor(curRed,curGreen,curBlue);
UpdateControls();
*pResult = 0;
}
void CLightWnd::UpdateControls()
{
if (!light)
return;
m_RedSlider.SetPos(int(curRed * 100));
m_GreenSlider.SetPos(int(curGreen * 100));
m_BlueSlider.SetPos(int(curBlue * 100));
char string[32];
sprintf(string,"%4.2f",curRed);
m_RedEdit.SetWindowText(string);
sprintf(string,"%4.2f",curGreen);
m_GreenEdit.SetWindowText(string);
sprintf(string,"%4.2f",curBlue);
m_BlueEdit.SetWindowText(string);
Point3D point;
YawPitchRoll ypr;
point = worldMatrix;
ypr = worldMatrix;
sprintf(string,"%7.2f",point.x);
m_XEdit.SetWindowText(string);
sprintf(string,"%7.2f",point.y);
m_YEdit.SetWindowText(string);
sprintf(string,"%7.2f",point.z);
m_ZEdit.SetWindowText(string);
Scalar scalar;
scalar = REDUCEANGLE(Degrees_Per_Radian * ypr.yaw);
if (scalar < 0) scalar += 360;
sprintf(string,"%7.2f",scalar);
m_YawEdit.SetWindowText(string);
scalar = REDUCEANGLE(Degrees_Per_Radian * ypr.pitch);
if (scalar < 0) scalar += 360;
sprintf(string,"%7.2f",scalar);
m_PitchEdit.SetWindowText(string);
scalar = REDUCEANGLE(Degrees_Per_Radian * ypr.roll);
if (scalar < 0) scalar += 360;
sprintf(string,"%7.2f",scalar);
m_RollEdit.SetWindowText(string);
sprintf(string,"%7.2f",light->lightInfo.m_outer);
m_OuterRadius.SetWindowText(string);
sprintf(string,"%7.2f",light->lightInfo.m_inner);
m_InnerRadiusEdit.SetWindowText(string);
scalar = REDUCEANGLE(Degrees_Per_Radian * light->lightInfo.m_spread);
if (scalar < 0) scalar += 360;
sprintf(string,"%7.2f",scalar);
m_AngleEdit.SetWindowText(string);
}
void CLightWnd::OnReset()
{
curRed = oldRed;
curGreen = oldGreen;
curBlue = oldBlue;
light->SetColor(curRed,curGreen,curBlue);
UpdateControls();
}
BOOL CLightWnd::OnInitDialog()
{
CDialog::OnInitDialog();
m_RedSlider.SetRange(0,100);
m_GreenSlider.SetRange(0,100);
m_BlueSlider.SetRange(0,100);
m_RedSlider.SetBuddy(&m_RedEdit,FALSE);
m_GreenSlider.SetBuddy(&m_GreenEdit,FALSE);
m_BlueSlider.SetBuddy(&m_BlueEdit,FALSE);
oldRed = oldGreen = oldBlue = 0;
curRed = curGreen = curBlue = 0;
worldMatrix = LinearMatrix4D::Identity;
UpdateControls();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CLightWnd::SetLight(EditorLight* Light)
{
light = Light;
light->light->GetInfo(&light->lightInfo);
oldRed = light->lightInfo.m_color.red;
oldGreen = light->lightInfo.m_color.green;
oldBlue = light->lightInfo.m_color.blue;
worldMatrix = light->lightInfo.m_origin;
SetWindowText(light->instanceName);
if (light->IsDerivedFrom(EditorAmbientLight::DefaultData))
{
m_InnerRadiusEdit.EnableWindow(FALSE);
m_InnerRadiusSpin.EnableWindow(FALSE);
m_OuterRadius.EnableWindow(FALSE);
m_OuterRadiusSpin.EnableWindow(FALSE);
m_XEdit.EnableWindow(FALSE);
m_XSpin.EnableWindow(FALSE);
m_YEdit.EnableWindow(FALSE);
m_YSpin.EnableWindow(FALSE);
m_ZEdit.EnableWindow(FALSE);
m_ZSpin.EnableWindow(FALSE);
m_YawEdit.EnableWindow(FALSE);
m_YawSpin.EnableWindow(FALSE);
m_PitchEdit.EnableWindow(FALSE);
m_PitchSpin.EnableWindow(FALSE);
m_RollEdit.EnableWindow(FALSE);
m_RollSpin.EnableWindow(FALSE);
m_AngleEdit.EnableWindow(FALSE);
m_AngleSpin.EnableWindow(FALSE);
}
if (light->IsDerivedFrom(EditorInfiniteLight::DefaultData))
{
m_InnerRadiusEdit.EnableWindow(FALSE);
m_InnerRadiusSpin.EnableWindow(FALSE);
m_OuterRadius.EnableWindow(FALSE);
m_OuterRadiusSpin.EnableWindow(FALSE);
m_XEdit.EnableWindow(FALSE);
m_XSpin.EnableWindow(FALSE);
m_YEdit.EnableWindow(FALSE);
m_YSpin.EnableWindow(FALSE);
m_ZEdit.EnableWindow(FALSE);
m_ZSpin.EnableWindow(FALSE);
m_YawEdit.EnableWindow(TRUE);
m_YawSpin.EnableWindow(TRUE);
m_PitchEdit.EnableWindow(FALSE);
m_PitchSpin.EnableWindow(FALSE);
m_RollEdit.EnableWindow(FALSE);
m_RollSpin.EnableWindow(FALSE);
m_AngleEdit.EnableWindow(FALSE);
m_AngleSpin.EnableWindow(FALSE);
}
if (light->IsDerivedFrom(EditorPointLight::DefaultData))
{
m_InnerRadiusEdit.EnableWindow(TRUE);
m_InnerRadiusSpin.EnableWindow(TRUE);
m_OuterRadius.EnableWindow(TRUE);
m_OuterRadiusSpin.EnableWindow(TRUE);
m_XEdit.EnableWindow(TRUE);
m_XSpin.EnableWindow(TRUE);
m_YEdit.EnableWindow(TRUE);
m_YSpin.EnableWindow(TRUE);
m_ZEdit.EnableWindow(TRUE);
m_ZSpin.EnableWindow(TRUE);
m_YawEdit.EnableWindow(FALSE);
m_YawSpin.EnableWindow(FALSE);
m_PitchEdit.EnableWindow(FALSE);
m_PitchSpin.EnableWindow(FALSE);
m_RollEdit.EnableWindow(FALSE);
m_RollSpin.EnableWindow(FALSE);
m_AngleEdit.EnableWindow(FALSE);
m_AngleSpin.EnableWindow(FALSE);
}
if (light->IsDerivedFrom(EditorSpotLight::DefaultData))
{
m_InnerRadiusEdit.EnableWindow(TRUE);
m_InnerRadiusSpin.EnableWindow(TRUE);
m_OuterRadius.EnableWindow(TRUE);
m_OuterRadiusSpin.EnableWindow(TRUE);
m_XEdit.EnableWindow(TRUE);
m_XSpin.EnableWindow(TRUE);
m_YEdit.EnableWindow(TRUE);
m_YSpin.EnableWindow(TRUE);
m_ZEdit.EnableWindow(TRUE);
m_ZSpin.EnableWindow(TRUE);
m_YawEdit.EnableWindow(TRUE);
m_YawSpin.EnableWindow(TRUE);
m_PitchEdit.EnableWindow(TRUE);
m_PitchSpin.EnableWindow(TRUE);
m_RollEdit.EnableWindow(TRUE);
m_RollSpin.EnableWindow(TRUE);
m_AngleEdit.EnableWindow(TRUE);
m_AngleSpin.EnableWindow(TRUE);
}
OnReset();
}
void CLightWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
char string[8];
if (pScrollBar->m_hWnd == m_RedSlider.m_hWnd)
{
curRed = Scalar(m_RedSlider.GetPos()) / 100.0f;
sprintf(string,"%4.2f",curRed);
m_RedEdit.SetWindowText(string);
}
else if (pScrollBar->m_hWnd == m_GreenSlider.m_hWnd)
{
curGreen = Scalar(m_GreenSlider.GetPos()) / 100.0f;
sprintf(string,"%4.2f",curGreen);
m_GreenEdit.SetWindowText(string);
}
else if (pScrollBar->m_hWnd == m_BlueSlider.m_hWnd)
{
curBlue = Scalar(m_BlueSlider.GetPos()) / 100.0f;
sprintf(string,"%4.2f",curBlue);
m_BlueEdit.SetWindowText(string);
}
light->SetColor(curRed,curGreen,curBlue);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CLightWnd::OnKillfocusEditlightx()
{
char string[8];
Point3D loc;
loc = worldMatrix;
m_XEdit.GetWindowText(string,7);
loc.x = (Scalar)atof(string);
worldMatrix.BuildTranslation(loc);
SetWorldMatrix();
}
void CLightWnd::OnKillfocusEditlighty()
{
char string[8];
Point3D loc;
loc = worldMatrix;
m_YEdit.GetWindowText(string,7);
loc.y = (Scalar)atof(string);
worldMatrix.BuildTranslation(loc);
SetWorldMatrix();
}
void CLightWnd::OnKillfocusEditlightz()
{
char string[8];
Point3D loc;
loc = worldMatrix;
m_ZEdit.GetWindowText(string,7);
loc.z = (Scalar)atof(string);
worldMatrix.BuildTranslation(loc);
SetWorldMatrix();
}
void CLightWnd::OnKillfocusEditlightyaw()
{
char string[8];
YawPitchRoll ypr;
ypr = worldMatrix;
m_YawEdit.GetWindowText(string,7);
ypr.yaw = Radians_Per_Degree * (Scalar)atof(string);
worldMatrix.BuildRotation(ypr);
SetWorldMatrix();
}
void CLightWnd::OnKillfocusEditlightpitch()
{
char string[8];
YawPitchRoll ypr;
ypr = worldMatrix;
m_PitchEdit.GetWindowText(string,7);
ypr.pitch = Radians_Per_Degree * (Scalar)atof(string);
worldMatrix.BuildRotation(ypr);
SetWorldMatrix();
}
void CLightWnd::OnKillfocusEditlightroll()
{
char string[8];
YawPitchRoll ypr;
ypr = worldMatrix;
m_RollEdit.GetWindowText(string,7);
ypr.roll = Radians_Per_Degree * (Scalar)atof(string);
worldMatrix.BuildRotation(ypr);
SetWorldMatrix();
}
void CLightWnd::OnKillfocusEditinnerradius()
{
char string[8];
m_InnerRadiusEdit.GetWindowText(string,7);
light->lightInfo.m_inner = (Scalar)atof(string);
light->UpdateLight();
}
void CLightWnd::OnKillfocusEditoutterradius()
{
char string[8];
m_OuterRadius.GetWindowText(string,7);
light->lightInfo.m_outer = (Scalar)atof(string);
light->UpdateLight();
}
void CLightWnd::OnKillfocusEditangle()
{
char string[8];
m_AngleEdit.GetWindowText(string,7);
light->lightInfo.m_spread = Radians_Per_Degree * (Scalar)atof(string);
light->UpdateLight();
}
void CLightWnd::OnDeltaposSpinlightx(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
Point3D loc;
loc = worldMatrix;
loc.x -= (float)pNMUpDown->iDelta;
worldMatrix.BuildTranslation(loc);
SetWorldMatrix();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinlighty(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
Point3D loc;
loc = worldMatrix;
loc.y -= (float)pNMUpDown->iDelta;
worldMatrix.BuildTranslation(loc);
SetWorldMatrix();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinlightz(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
Point3D loc;
loc = worldMatrix;
loc.z -= (float)pNMUpDown->iDelta;
worldMatrix.BuildTranslation(loc);
SetWorldMatrix();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinlightyaw(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
YawPitchRoll ypr;
ypr = worldMatrix;
ypr.yaw -= Radians_Per_Degree * (float)pNMUpDown->iDelta;
worldMatrix.BuildRotation(ypr);
SetWorldMatrix();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinlightpitch(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
YawPitchRoll ypr;
ypr = worldMatrix;
ypr.pitch -= Radians_Per_Degree * (float)pNMUpDown->iDelta;
worldMatrix.BuildRotation(ypr);
SetWorldMatrix();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinlightroll(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
YawPitchRoll ypr;
ypr = worldMatrix;
ypr.roll -= Radians_Per_Degree * (float)pNMUpDown->iDelta;
worldMatrix.BuildRotation(ypr);
SetWorldMatrix();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpininnerradius(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
light->lightInfo.m_inner -= (float)pNMUpDown->iDelta;
light->UpdateLight();
UpdateControls();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinouterradius(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
light->lightInfo.m_outer -= (float)pNMUpDown->iDelta;
light->UpdateLight();
UpdateControls();
*pResult = 0;
}
void CLightWnd::OnDeltaposSpinangle(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
light->lightInfo.m_spread -= Radians_Per_Degree * (float)pNMUpDown->iDelta;
light->UpdateLight();
UpdateControls();
*pResult = 0;
}
void CLightWnd::SetWorldMatrix()
{
light->SetLightToWorldMatrix(worldMatrix);
light->SetNewLocalToParent(worldMatrix);
light->SyncMatrices(true);
UpdateControls();
}
+124
View File
@@ -0,0 +1,124 @@
#if !defined(AFX_LIGHTWND_H__E6569C80_83ED_11D3_8E25_00105A17BC83__INCLUDED_)
#define AFX_LIGHTWND_H__E6569C80_83ED_11D3_8E25_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LightWnd.h : header file
//
#include <MLR\MLRLight.hpp>
class EditorLight;
/////////////////////////////////////////////////////////////////////////////
// CLightWnd dialog
class CLightWnd : public CDialog
{
// Construction
public:
CLightWnd(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CLightWnd)
enum { IDD = IDD_LIGHTDLG };
CSpinButtonCtrl m_AngleSpin;
CEdit m_AngleEdit;
CSpinButtonCtrl m_OuterRadiusSpin;
CSpinButtonCtrl m_ZSpin;
CSpinButtonCtrl m_YawSpin;
CSpinButtonCtrl m_YSpin;
CSpinButtonCtrl m_XSpin;
CSpinButtonCtrl m_RollSpin;
CSpinButtonCtrl m_PitchSpin;
CSpinButtonCtrl m_InnerRadiusSpin;
CEdit m_OuterRadius;
CEdit m_ZEdit;
CEdit m_RollEdit;
CEdit m_YawEdit;
CEdit m_YEdit;
CEdit m_XEdit;
CEdit m_PitchEdit;
CEdit m_InnerRadiusEdit;
CSliderCtrl m_RedSlider;
CSliderCtrl m_GreenSlider;
CSliderCtrl m_BlueSlider;
CEdit m_RedEdit;
CEdit m_GreenEdit;
CEdit m_BlueEdit;
//}}AFX_DATA
Scalar
oldRed;
Scalar
oldGreen;
Scalar
oldBlue;
Scalar
curRed;
Scalar
curGreen;
Scalar
curBlue;
LinearMatrix4D
worldMatrix;
void SetLight(EditorLight* Light);
EditorLight* GetLight() {return light;}
void SetWorldMatrix();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLightWnd)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
EditorLight*
light;
void UpdateControls();
// Generated message map functions
//{{AFX_MSG(CLightWnd)
afx_msg void OnMyok();
virtual void OnCancel();
afx_msg void OnReleasedcaptureRedslider(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnReleasedcaptureGreenslider(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnReleasedcaptureBlueslider(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnReset();
virtual BOOL OnInitDialog();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnKillfocusEditinnerradius();
afx_msg void OnKillfocusEditlightpitch();
afx_msg void OnKillfocusEditlightroll();
afx_msg void OnKillfocusEditlightx();
afx_msg void OnKillfocusEditlighty();
afx_msg void OnKillfocusEditlightyaw();
afx_msg void OnKillfocusEditlightz();
afx_msg void OnKillfocusEditoutterradius();
afx_msg void OnDeltaposSpininnerradius(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightpitch(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightroll(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightx(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlighty(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightyaw(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinlightz(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinouterradius(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinangle(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnKillfocusEditangle();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LIGHTWND_H__E6569C80_83ED_11D3_8E25_00105A17BC83__INCLUDED_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,798 @@
# Microsoft Developer Studio Project File - Name="MW4GameEd" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=MW4GameEd - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "MW4GameEd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "MW4GameEd.mak" CFG="MW4GameEd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MW4GameEd - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "MW4GameEd - Win32 Profile" (based on "Win32 (x86) Application")
!MESSAGE "MW4GameEd - Win32 Armor" (based on "Win32 (x86) Application")
!MESSAGE "MW4GameEd - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "MW4GameEd - Win32 icecap" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "MW4GameEd - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W4 /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /D "NDEBUG" /D "_AFXDLL" /D "_MBCS" /D "MFC" /D "_WINDOWS" /D "WIN32" /D "GAMEEDITOR" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rpcrt4.lib /nologo /subsystem:windows /machine:I386 /out:"../../../rel.bin/MW4Ed.exe"
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=attrib -r ..\..\Binaries\MW4\MW4Ed_r.exe copy Release\MW4Ed.exe ..\..\Binaries\MW4\MW4Ed_r.exe attrib -r ..\..\Binaries\MW4\MW4Ed_r.pdb copy Release\MW4Ed_r.pdb ..\..\Binaries\MW4\MW4Ed_r.pdb
# End Special Build Tool
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Profile"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Profile"
# PROP BASE Intermediate_Dir "Profile"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../pro.bin"
# PROP Intermediate_Dir "Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\Libraries" /I "..\..\Code" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "MFC" /Yu"stdafx.h" /FD /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /G6 /Zp4 /MD /W4 /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /D "LAB_ONLY" /D "MULTI_PLAYER" /D "USE_PROTOTYPES" /D "STRICT" /D TEST_CLASS=50 /D "NDEBUG" /D "_AFXDLL" /D "_MBCS" /D "MFC" /D "_WINDOWS" /D "WIN32" /D "GAMEEDITOR" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rpcrt4.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../../pro.bin/MW4Ed.exe"
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=attrib -r ..\..\Binaries\MW4\MW4Ed_p.exe copy Profile\MW4Ed.exe ..\..\Binaries\MW4\MW4Ed_p.exe attrib -r ..\..\Binaries\MW4\MW4Ed_p.pdb copy Profile\MW4Ed_p.pdb ..\..\Binaries\MW4\MW4Ed_p.pdb
# End Special Build Tool
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Armor"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Armor"
# PROP BASE Intermediate_Dir "Armor"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../arm.bin"
# PROP Intermediate_Dir "Armor"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\Libraries" /I "..\..\Code" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "MFC" /Yu"stdafx.h" /FD /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /G6 /Zp4 /MD /W4 /GR /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /D "LAB_ONLY" /D "MULTI_PLAYER" /D "USE_PROTOTYPES" /D "STRICT" /D TEST_CLASS=50 /D "NDEBUG" /D "_ARMOR" /D "_AFXDLL" /D "_MBCS" /D "MFC" /D "_WINDOWS" /D "WIN32" /D "GAMEEDITOR" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rpcrt4.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../../arm.bin/MW4Ed.exe"
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=attrib -r ..\..\Binaries\MW4\MW4Ed_a.exe copy Armor\MW4Ed.exe ..\..\Binaries\MW4\MW4Ed_a.exe attrib -r ..\..\Binaries\MW4\MW4Ed_a.pdb copy Armor\MW4Ed_a.pdb ..\..\Binaries\MW4\MW4Ed_a.pdb
# End Special Build Tool
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /G6 /Zp4 /MDd /W4 /GR /Zi /Od /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /D "LAB_ONLY" /D "_ARMOR" /D "_DEBUG" /D "_AFXDLL" /D "_MBCS" /D "MFC" /D "_WINDOWS" /D "WIN32" /D "GAMEEDITOR" /Fr /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 rpcrt4.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../../dbg.bin/MW4Ed.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=attrib -r ..\..\Binaries\MW4\MW4Ed_d.exe copy Debug\MW4Ed.exe ..\..\Binaries\MW4\MW4Ed_d.exe attrib -r ..\..\Binaries\MW4\MW4Ed_d.pdb copy Debug\MW4Ed_d.pdb ..\..\Binaries\MW4\MW4Ed_d.pdb
# End Special Build Tool
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 icecap"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MW4GameEd___Win32_icecap"
# PROP BASE Intermediate_Dir "MW4GameEd___Win32_icecap"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../ice.bin"
# PROP Intermediate_Dir "icecap"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /Zp4 /MD /W4 /Zi /Ox /Ot /Oa /Og /Oi /Gy /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /D "LAB_ONLY" /D "MULTI_PLAYER" /D "USE_PROTOTYPES" /D "STRICT" /D TEST_CLASS=50 /D "NDEBUG" /D "_AFXDLL" /D "_MBCS" /D "MFC" /D "_WINDOWS" /D "WIN32" /D "GAMEEDITOR" /Yu"stdafx.h" /FD /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /G6 /Zp4 /MD /W4 /Zi /Ot /Oa /Oi /Gy /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /D "LAB_ONLY" /D "MULTI_PLAYER" /D "USE_PROTOTYPES" /D "STRICT" /D TEST_CLASS=50 /D "_AFXDLL" /D "_MBCS" /D "MFC" /D "_WINDOWS" /D "GAMEEDITOR" /D "NDEBUG" /D "WIN32" /D "_ICECAP" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Og
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rpcrt4.lib /nologo /subsystem:windows /pdb:"Profile/MW4Ed_p.pdb" /debug /machine:I386 /out:"Profile/MW4Ed.exe"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rpcrt4.lib /nologo /subsystem:windows /debug /machine:I386 /out:"../../../ice.bin/MW4Ed.exe"
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=attrib -r ..\..\Binaries\MW4\MW4Ed_p.exe copy Profile\MW4Ed.exe ..\..\Binaries\MW4\MW4Ed_p.exe attrib -r ..\..\Binaries\MW4\MW4Ed_p.pdb copy Profile\MW4Ed_p.pdb ..\..\Binaries\MW4\MW4Ed_p.pdb
# End Special Build Tool
!ENDIF
# Begin Target
# Name "MW4GameEd - Win32 Release"
# Name "MW4GameEd - Win32 Profile"
# Name "MW4GameEd - Win32 Armor"
# Name "MW4GameEd - Win32 Debug"
# Name "MW4GameEd - Win32 icecap"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\AblMemDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\AddCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\AddLinkCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\aidriver.cpp
# End Source File
# Begin Source File
SOURCE=.\BriefEdit.cpp
# End Source File
# Begin Source File
SOURCE=.\ChildOfDialogMessagePusher.cpp
# End Source File
# Begin Source File
SOURCE=.\Command.cpp
# End Source File
# Begin Source File
SOURCE=.\ConfirmDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\DeleteCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\DisplayWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\DlgCameraName.cpp
# End Source File
# Begin Source File
SOURCE=.\dlgObjectBalance.cpp
# End Source File
# Begin Source File
SOURCE=.\DlgObjectProperties.cpp
# End Source File
# Begin Source File
SOURCE=.\EditEntityDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\EditorChildWnd.cpp
# End Source File
# Begin Source File
SOURCE=.\EditorEntityData.cpp
# End Source File
# Begin Source File
SOURCE=.\EditorWaypoint.cpp
# End Source File
# Begin Source File
SOURCE=.\editskilldlg.cpp
# End Source File
# Begin Source File
SOURCE=.\EditWnd.cpp
# End Source File
# Begin Source File
SOURCE=.\FileDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\FogDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\GenericListDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\GenericTextDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\GridProps.cpp
# End Source File
# Begin Source File
SOURCE=.\InsertPathNodeCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\InstanceWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\LatticeLinkDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\LightWnd.cpp
# End Source File
# Begin Source File
SOURCE=.\MainFrm.cpp
# End Source File
# Begin Source File
SOURCE=.\MissionData.cpp
!IF "$(CFG)" == "MW4GameEd - Win32 Release"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Profile"
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Armor"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Debug"
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 icecap"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\MoveCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\MsgDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\MW4GameEd.cpp
# End Source File
# Begin Source File
SOURCE=.\MW4GameEd.rc
# End Source File
# Begin Source File
SOURCE=.\MW4GameEdApplication.cpp
# End Source File
# Begin Source File
SOURCE=.\NewMissionDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\objective.cpp
# End Source File
# Begin Source File
SOURCE=.\ObjectiveDLG.cpp
# End Source File
# Begin Source File
SOURCE=.\ObjListBox.cpp
!IF "$(CFG)" == "MW4GameEd - Win32 Release"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Profile"
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Armor"
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 Debug"
!ELSEIF "$(CFG)" == "MW4GameEd - Win32 icecap"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ObjWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\OpenMapFileDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\OverviewWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\ProgDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\ResourceWindow.cpp
# End Source File
# Begin Source File
SOURCE=.\RevolveCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\RotateCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\selection.cpp
# End Source File
# Begin Source File
SOURCE=.\Splash.cpp
# End Source File
# Begin Source File
SOURCE=.\SprayCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\StartDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\TagListDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\TipDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\TitleWnd.cpp
# End Source File
# Begin Source File
SOURCE=.\TransDlg.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\AblMemDlg.h
# End Source File
# Begin Source File
SOURCE=.\AddCommand.h
# End Source File
# Begin Source File
SOURCE=.\AddLinkCommand.h
# End Source File
# Begin Source File
SOURCE=.\BriefEdit.h
# End Source File
# Begin Source File
SOURCE=.\ChildOfDialogMessagePusher.h
# End Source File
# Begin Source File
SOURCE=.\Command.h
# End Source File
# Begin Source File
SOURCE=.\ConfirmDlg.h
# End Source File
# Begin Source File
SOURCE=.\DeleteCommand.h
# End Source File
# Begin Source File
SOURCE=.\DisplayWindow.h
# End Source File
# Begin Source File
SOURCE=.\DlgCameraName.h
# End Source File
# Begin Source File
SOURCE=.\DlgObjectBalance.h
# End Source File
# Begin Source File
SOURCE=.\DlgObjectProperties.h
# End Source File
# Begin Source File
SOURCE=.\DlgWeaponProperties.h
# End Source File
# Begin Source File
SOURCE=.\EditEntityDlg.h
# End Source File
# Begin Source File
SOURCE=.\EditorChildWnd.h
# End Source File
# Begin Source File
SOURCE=.\EditorEntityData.h
# End Source File
# Begin Source File
SOURCE=.\EditorWaypoint.h
# End Source File
# Begin Source File
SOURCE=.\editskilldlg.hpp
# End Source File
# Begin Source File
SOURCE=.\EditWnd.h
# End Source File
# Begin Source File
SOURCE=.\FileDlg.h
# End Source File
# Begin Source File
SOURCE=.\FogDlg.h
# End Source File
# Begin Source File
SOURCE=.\GameEdHeaders.hpp
# End Source File
# Begin Source File
SOURCE=.\GenericListDlg.h
# End Source File
# Begin Source File
SOURCE=.\GenericTextDlg.h
# End Source File
# Begin Source File
SOURCE=.\GridProps.h
# End Source File
# Begin Source File
SOURCE=.\InsertPathNodeCommand.h
# End Source File
# Begin Source File
SOURCE=.\InstanceWindow.h
# End Source File
# Begin Source File
SOURCE=.\LatticeLinkDlg.h
# End Source File
# Begin Source File
SOURCE=.\LightWnd.h
# End Source File
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\MissionData.h
# End Source File
# Begin Source File
SOURCE=.\MoveCommand.h
# End Source File
# Begin Source File
SOURCE=.\MsgDlg.h
# End Source File
# Begin Source File
SOURCE=.\MW4GameEd.h
# End Source File
# Begin Source File
SOURCE=.\MW4GameEdApplication.hpp
# End Source File
# Begin Source File
SOURCE=.\NewMissionDlg.h
# End Source File
# Begin Source File
SOURCE=.\ObjectiveDLG.h
# End Source File
# Begin Source File
SOURCE=.\ObjListBox.h
# End Source File
# Begin Source File
SOURCE=.\ObjWindow.h
# End Source File
# Begin Source File
SOURCE=.\OverviewWindow.h
# End Source File
# Begin Source File
SOURCE=.\ProgDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\ResourceWindow.h
# End Source File
# Begin Source File
SOURCE=.\RevolveCommand.h
# End Source File
# Begin Source File
SOURCE=.\RotateCommand.h
# End Source File
# Begin Source File
SOURCE=.\Selection.h
# End Source File
# Begin Source File
SOURCE=.\Splash.h
# End Source File
# Begin Source File
SOURCE=.\SprayCommand.h
# End Source File
# Begin Source File
SOURCE=.\StartDlg.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\TagListDlg.h
# End Source File
# Begin Source File
SOURCE=.\TipDlg.h
# End Source File
# Begin Source File
SOURCE=.\TitleWnd.h
# End Source File
# Begin Source File
SOURCE=.\TransDlg.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\arrow.cur
# End Source File
# Begin Source File
SOURCE=.\Res\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\bitmap2.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\bitmap3.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\bitmap4.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\bitmap5.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\bmp00001.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\cursor1.cur
# End Source File
# Begin Source File
SOURCE=.\Res\litebulb.bmp
# End Source File
# Begin Source File
SOURCE=.\res\MW4GameEd.ico
# End Source File
# Begin Source File
SOURCE=.\res\MW4GameEd.rc2
# End Source File
# Begin Source File
SOURCE=.\res\Mw4LogoWhite.BMP
# End Source File
# Begin Source File
SOURCE=.\Splsh16.bmp
# End Source File
# Begin Source File
SOURCE=.\res\StartDlg.bmp
# End Source File
# Begin Source File
SOURCE=.\Res\TITLE.bmp
# End Source File
# Begin Source File
SOURCE=.\res\Toolbar.bmp
# End Source File
# Begin Source File
SOURCE=.\res\undobmp.bmp
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
# Section MW4GameEd : {72ADFD54-2C39-11D0-9903-00A0C91BC942}
# 1:17:CG_IDS_DIDYOUKNOW:106
# 1:22:CG_IDS_TIPOFTHEDAYMENU:105
# 1:18:CG_IDS_TIPOFTHEDAY:104
# 1:22:CG_IDS_TIPOFTHEDAYHELP:109
# 1:19:CG_IDP_FILE_CORRUPT:108
# 1:7:IDD_TIP:103
# 1:13:IDB_LIGHTBULB:102
# 1:18:CG_IDS_FILE_ABSENT:107
# 2:17:CG_IDS_DIDYOUKNOW:CG_IDS_DIDYOUKNOW
# 2:7:CTipDlg:CTipDlg
# 2:22:CG_IDS_TIPOFTHEDAYMENU:CG_IDS_TIPOFTHEDAYMENU
# 2:18:CG_IDS_TIPOFTHEDAY:CG_IDS_TIPOFTHEDAY
# 2:12:CTIP_Written:OK
# 2:22:CG_IDS_TIPOFTHEDAYHELP:CG_IDS_TIPOFTHEDAYHELP
# 2:2:BH:
# 2:19:CG_IDP_FILE_CORRUPT:CG_IDP_FILE_CORRUPT
# 2:7:IDD_TIP:IDD_TIP
# 2:8:TipDlg.h:TipDlg.h
# 2:13:IDB_LIGHTBULB:IDB_LIGHTBULB
# 2:18:CG_IDS_FILE_ABSENT:CG_IDS_FILE_ABSENT
# 2:10:TipDlg.cpp:TipDlg.cpp
# End Section
# Section MW4GameEd : {72ADFD78-2C39-11D0-9903-00A0C91BC942}
# 1:10:IDB_SPLASH:113
# 2:21:SplashScreenInsertKey:4.0
# End Section
# Section MW4GameEd : {72ADFD7E-2C39-11D0-9903-00A0C91BC942}
# 1:17:CG_IDS_DISK_SPACE:111
# 1:19:CG_IDS_PHYSICAL_MEM:110
# 1:25:CG_IDS_DISK_SPACE_UNAVAIL:112
# 2:14:PhysicalMemory:CG_IDS_PHYSICAL_MEM
# 2:9:DiskSpace:CG_IDS_DISK_SPACE
# 2:16:SpaceUnavailable:CG_IDS_DISK_SPACE_UNAVAIL
# 2:10:SysInfoKey:1234
# End Section
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "MW4GameEd"=.\MW4GameEd.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,511 @@
// MW4GameEd.h : main header file for the MW4GAMEED application
//
#if !defined(AFX_MW4GAMEED_H__808CF88A_6E5A_11D2_8455_00105A17BC83__INCLUDED_)
#define AFX_MW4GAMEED_H__808CF88A_6E5A_11D2_8455_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include <MW4\MW4.hpp>
using namespace MechWarrior4;
using namespace Adept;
using namespace Stuff;
#include <Adept\Entity.hpp>
#include "MissionData.h"
//#include "EditorWaypoint.h"
#include "EditorEntityData.h"
#define CAMERA_FOLLOW_GROUND 0
#define CAMERA_FOLLOW_HIGHESTPOINT 1
#define CAMERA_FOLLOW_NONE 2
class Command;
class CEditWnd;
class CLightWnd;
class FogDlg;
class EditorMovementPath;
class EditorPathNode;
class EditorBoundaryNode;
class EditorLatticeNode;
/////////////////////////////////////////////////////////////////////////////
// CMW4GameEdApp:
// See MW4GameEd.cpp for the implementation of this class
//
extern char Working_Directory[128];
class MissionNamePlug :
public Plug
{
public:
MissionNamePlug() :
Plug(Plug::DefaultData)
{
name = NULL;
}
~MissionNamePlug()
{
if (name)
delete [] name;
}
char* name;
};
//
//-----------
// Class ID's
//-----------
//
enum
{
MW4GameEdApplicationClassID = MechWarrior4::FirstFreeMW4ClassID,
EditorWaypointClassID,
EditorLatticeNodeClassID,
EditorPathNodeClassID,
EditorBoundaryNodeClassID,
FirstFreeMW4GameEdClassID,
EditorDropNodeClassID,
EditorDropZonePointClassID,
EditorObjectiveMarkerClassID,
EditorMovementPathClassID,
EditorAmbientLightClassID,
EditorInfiniteLightClassID,
EditorPointLightClassID,
EditorSpotLightClassID,
EditorLightClassID,
EditorCameraShipClassID
};
class CDisplayWindow;
class COverviewWindow;
class CResourceWindow;
class CInstanceWindow;
class MW4GameEdApplication;
class CMainFrame;
class CMW4GameEdApp : public CWinApp
{
friend class MW4GameEdApplication;
friend class CMainFrame;
public:
CMW4GameEdApp();
~CMW4GameEdApp();
bool CreateNewScenario(char* missionName, char* mapPath, char* skyPath);
CDisplayWindow
*displayWindow;
COverviewWindow
*overviewWindow;
CResourceWindow
*resourceWindow;
CInstanceWindow
*instanceWindow;
CToolBarCtrl
*toolBar;
CString
missionFileName;
CString
lightFileName;
CString
audioFileName;
CString
m_graphName,m_moveGridName,m_rectGridName,m_airMoveGridName;
Command
*currentCommand;
Stuff::Scalar
cameraHeight;
int
cameraSpeed;
int
cameraFollowing;
int
ambientLightIndex;
int
keyLightIndex;
int
fillLightIndex;
int
m_nDefaultAlignmentForPlacedObjects;
bool
gridOn;
int
gridValue;
bool
didIdle;
bool
needsToSave;
bool
m_showLattice;
bool
m_showLatticeLinks;
bool
m_showRadii;
bool
m_showPaths;
bool
m_showBoundary;
bool
m_showDropZones;
bool
m_showTileBorder;
bool
m_showAI;
bool
m_MechLabActive;
bool
m_MissionSaved;
int
m_NumLinks;
int
m_NumObjectives;
CString
briefingPath;
CString m_ScriptName;
char
m_title[256];
bool
m_MultiDrop;
Stuff::ChainOf<Entity *>
culturalList;
void DisperseCulturals();
void RemoveCulturals();
CEditorEntityData *
GetEntityData(Entity *entity);
bool
CreateMissionInstanceFile(char* missionName, char* mapPath, char* skyPath, bool create_new);
bool
SaveMissionContentsFile(char *prop_name);
bool
SaveMissionDataFile(char* filename);
bool
SaveLightFile(char* fname = NULL);
bool
SaveAudioFile(char *fname = NULL);
void
CreateMissionResource(char* missionInstance);
void
GetGridCoords(Point3D& point);
void RemoveEditorObjects (void);
void
StopMultiPlace();
void
CreateLightDlg();
int
nextDamageFileID;
int
nextSubsystemFileID;
void
LoadLattice();
void
RemoveLattice();
void
LoadPaths();
void
LoadLights();
void
LoadBoundary();
void
DeleteBoundaryNodes();
void
LoadDropZones();
void
LoadObjectives();
void
LoadCameras();
void
VerifyObjectPlacement(bool feedback = false);
void RotateSel90CCW();
void RotateSel90CW();
Stuff::DynamicArrayOf<CEditorEntityData *> m_ExtraDataList;
bool
m_AllLoaded;
enum EditorStateType
{
InitializingState = 0,
NoGameIdleState,
AddingObjectState,
IdleState,
SelectingObjectState,
DragSelectState,
ReadyToMoveObjectState,
MovingObjectState,
ReadyToStartNavState,
PlacingNavPointState,
RotateState,
RevolveState,
AddingLinkState,
SprayingState,
WaitingToAddState,
WaitingToSprayState,
AfterMovingState
};
EditorStateType
m_editorState;
Stuff::ChainOf<Command *>
undoChain;
CString
m_VersionString;
bool
m_AutoBackupOnSave;
EditorMovementPath*
m_CurPath;
EditorPathNode*
m_LastPathNode;
int
m_CurPathNodeCount;
Stuff::LinearMatrix4D
m_DefCameraPos[10];
char m_DefCameraName[10][16];
CEditWnd*
briefingWnd;
HCURSOR m_WaitCursor;
CMissionData m_MissionData;
ChainOf<PlugOf<Resource*>*> dirtyGameModelResources;
CLightWnd* lightDlg;
FogDlg* fogDlg;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMW4GameEdApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
virtual BOOL OnIdle(LONG lCount);
virtual int Run();
//}}AFX_VIRTUAL
// Implementation
protected:
HMENU m_hMDIMenu;
HACCEL m_hMDIAccel;
int m_VideoResolution;
DynamicArrayOf<Stuff::Vector2DOf<Stuff::Scalar> > missionBoundary,warningBoundary;
// Stuff::SortedChainOf<LatticeLinkListNode*,int>
// LatticeLinkChain;
private:
// Redundant camera position data/code
LinearMatrix4D m_4DCameraBookmark[10];
char m_szCameraBookmarkNames[10][16];
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
void LoadWindowStates();
void SaveWindowStates();
void OpenFile(char* filename);
void WriteDirtyGameModels();
void VerifyWaypointRadius();
void InitMovementLatticeData() ;
void CreateLatticeNodeRadius(Entity* entity);
void CreateLatticeNodeRadius(EditorLatticeNode* node);
void EditorConstructMissionCreateMessage();
void FixPaths();
void MakeObjectsTileBased();
void MakeObjectsZoneBased();
void MakeObjectNamesUnique();
bool IsNameUnique(char *name,Entity *ignore=NULL);
void MakeNameUnique(MString *str);
int GetDefaultAlignmentForPlacedObjects() { return m_nDefaultAlignmentForPlacedObjects;};
//{{AFX_MSG(CMW4GameEdApp)
afx_msg void OnAppAbout();
afx_msg void OnFileNew();
afx_msg void OnToggleOverviewWindow();
afx_msg void OnToggleResourceWindow();
afx_msg void OnEditUndo();
afx_msg void OnAdjustGrid();
afx_msg void OnFileOpen();
afx_msg void OnUpdateViewOverviewwindow(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewResourcewindow(CCmdUI* pCmdUI);
afx_msg void OnViewDisplaywindow();
afx_msg void OnUpdateViewDisplaywindow(CCmdUI* pCmdUI);
afx_msg void OnFileSaveAs();
afx_msg void OnToolsCameraheightFourtimesmechheight40m();
afx_msg void OnToolsCameraheightGround();
afx_msg void OnToolsCameraheightMechheight10m();
afx_msg void OnToolsCameraheightTwicemechheight20m();
afx_msg void OnToolsCameraspeedSlow();
afx_msg void OnToolsCameraspeedRegular();
afx_msg void OnToolsCameraspeedFast();
afx_msg void OnViewInstancewindow();
afx_msg void OnUpdateViewInstancewindow(CCmdUI* pCmdUI);
afx_msg void OnToolsBriefingfile();
afx_msg void OnFileSave();
afx_msg void OnToolsCamerafollowingGround();
afx_msg void OnToolsCamerafollowingHighestpoint();
afx_msg void OnToolsCamerafollowingNone();
afx_msg void OnUpdateToolsCamerafollowingGround(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsCamerafollowingHighestpoint(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsCamerafollowingNone(CCmdUI* pCmdUI);
afx_msg void OnToolsCameraheightUserdefined();
afx_msg void OnViewResize1024();
afx_msg void OnUpdateViewResize1024(CCmdUI* pCmdUI);
afx_msg void OnViewResize1152();
afx_msg void OnUpdateViewResize1152(CCmdUI* pCmdUI);
afx_msg void OnViewResize1280();
afx_msg void OnUpdateViewResize1280(CCmdUI* pCmdUI);
afx_msg void OnViewResize1600();
afx_msg void OnUpdateViewResize1600(CCmdUI* pCmdUI);
afx_msg void OnViewResize640();
afx_msg void OnUpdateViewResize640(CCmdUI* pCmdUI);
afx_msg void OnViewResize800();
afx_msg void OnUpdateViewResize800(CCmdUI* pCmdUI);
afx_msg void OnFileAutobackuponsave();
afx_msg void OnUpdateFileAutobackuponsave(CCmdUI* pCmdUI);
afx_msg void OnFileClose();
afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
afx_msg void OnFileDelete();
afx_msg void OnToolsMovementlattice();
afx_msg void OnUpdateToolsMovementlattice(CCmdUI* pCmdUI);
afx_msg void OnToolsMovmentlayerShowlatticelinks();
afx_msg void OnUpdateToolsMovmentlayerShowlatticelinks(CCmdUI* pCmdUI);
afx_msg void OnToolsMovmentlayerRecalclatticelinks();
afx_msg void OnEditCut();
afx_msg void OnEditPaste();
afx_msg void OnToolsMovmentlayerShowall();
afx_msg void OnToolsMovmentlayerShownoderadii();
afx_msg void OnToolsMovmentlayerShowpaths();
afx_msg void OnUpdateToolsMovmentlayerShowall(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsMovmentlayerShownoderadii(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsMovmentlayerShowpaths(CCmdUI* pCmdUI);
afx_msg void OnToolsMechlab();
afx_msg void OnToolsMovmentlayerShowmissionboundary();
afx_msg void OnUpdateToolsMovmentlayerShowmissionboundary(CCmdUI* pCmdUI);
afx_msg void OnToolsVerifyobjectplacement();
afx_msg void OnToolsMovmentlayerShowdropzones();
afx_msg void OnUpdateToolsMovmentlayerShowdropzones(CCmdUI* pCmdUI);
afx_msg void OnToolsEditmissionscript();
afx_msg void OnToolsMovmentlayerShowobjectives();
afx_msg void OnUpdateToolsMovmentlayerShowobjectives(CCmdUI* pCmdUI);
afx_msg void OnViewShowtileborders();
afx_msg void OnUpdateViewShowtileborders(CCmdUI* pCmdUI);
afx_msg void OnToolsSpecifymissionscript();
afx_msg void OnToolsCheckscripts ();
afx_msg void OnToolsMovmentlayerCreatelattice();
afx_msg void OnToolsMovmentlayerCreateRects();
afx_msg void OnToolsMissionparametersEditfog();
afx_msg void OnUpdateToolsCameraspeedFast(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsCameraspeedRegular(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsCameraspeedSlow(CCmdUI* pCmdUI);
afx_msg void OnToolsSnapobjectstoterrain();
afx_msg void OnEditCopy();
afx_msg void OnToolsWeaponsProperties();
afx_msg void OnUpdateToolsMechProperties(CCmdUI* pCmdUI);
afx_msg void OnToolsMechProperties();
afx_msg void OnUpdateToolsWeaponsProperties(CCmdUI* pCmdUI);
afx_msg void OnToolsWeaponsBalancing();
afx_msg void OnUpdateToolsWeaponsBalancing(CCmdUI* pCmdUI);
afx_msg void OnToolsArmorBalancing();
afx_msg void OnUpdateToolsArmorBalancing(CCmdUI* pCmdUI);
afx_msg void OnToolsPlacewithmap();
afx_msg void OnToolsDisperseculturalwithbitmap();
afx_msg void OnToolsRemoveculturals();
//}}AFX_MSG
afx_msg void OnUpdateDefaultAlignmentMenu(CCmdUI* pCmdUI);
afx_msg void OnDefaultAlignmentMenu(UINT uiID);
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnNameNumberedCameraPosition (UINT nID);
afx_msg void OnSetNumberedCameraPosition (UINT nID);
afx_msg void OnGotoNumberedCameraPosition(UINT nID);
afx_msg void OnMenuAvailableNumberedCameraPosition(CCmdUI* pCmdUI );
void UpdateCameraMenus(int index);
/*
afx_msg void OnToolsLightingAmbient();
afx_msg void OnToolsLightingFill();
afx_msg void OnToolsLightingKey();
*/
private:
void ShowTipAtStartup(void);
private:
void ShowTipOfTheDay(void);
void LoadInSavedCameraPositions(char * filename);
void SaveEditCameraInfo();
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MW4GAMEED_H__808CF88A_6E5A_11D2_8455_00105A17BC83__INCLUDED_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,524 @@
//===========================================================================//
// File: MW4EdApplication.cpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 12/02/97 DPB Infrastructure changes. //
// 11/03/98 SMJ MW4 changes. //
//---------------------------------------------------------------------------//
// Copyright (C) 1995-97, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "MW4GameEdApplication.hpp"
#include <MW4\MWApplication.hpp>
#include <Adept\Map.hpp>
#include <ElementRenderer\GridElement.hpp>
#include <MW4\VehicleInterface.hpp>
#include <Adept\Player.hpp>
#include "MainFrm.h"
#include <MW4\Rail_move.hpp>
#include <mw4\mwmission.hpp>
#include <Adept\DropZone.hpp>
#include <Adept\EntityManager.hpp>
#include <io.h>
#include <Adept\Mission.hpp>
#include "DisplayWindow.h"
#include "OverviewWindow.h"
#include "InstanceWindow.h"
#include <MW4\MWTool.hpp>
#include <BuildNum\BuildNum.h>
#include <Adept\ResourceEffectLibrary.hpp>
#include <MW4\MWPlayer.hpp>
#define __mbschr(s,c) (char*)_mbschr((const unsigned char*)(s),(c))
#define __mbsrchr(s,c) (char*)_mbsrchr((const unsigned char*)(s),(c))
extern CMW4GameEdApp theApp;
using namespace MW4AI;
//#############################################################################
//######################## MW4GameEdApplication ######################
//#############################################################################
//#############################################################################
// Message Support
//
const Receiver::MessageEntry
MW4GameEdApplication::MessageEntries[]=
{
MESSAGE_ENTRY(MW4GameEdApplication, PauseGame)
};
MW4GameEdApplication::ClassData*
MW4GameEdApplication::DefaultData = NULL;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MW4GameEdApplication::InitializeClass()
{
Verify(!DefaultData);
DefaultData =
new ClassData(
MW4GameEdApplicationClassID,
"MW4GameEdApplication",
MWApplication::DefaultData,
ELEMENTS(MessageEntries),
MessageEntries
);
Check_Object(DefaultData);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MW4GameEdApplication::TerminateClass()
{
Check_Object(DefaultData);
delete DefaultData;
DefaultData = NULL;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MW4GameEdApplication*
MW4GameEdApplication::Make()
{
return new MW4GameEdApplication;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MW4GameEdApplication::MW4GameEdApplication():
MWApplication(DefaultData,false)
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MW4GameEdApplication::~MW4GameEdApplication()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MW4GameEdApplication::LoadGameMessageHandler(int connection, Stuff::MemoryStream *message)
{
Check_Object(this);
theApp.m_NumObjectives = 0;
MWApplication::LoadGameMessageHandler(connection, message);
theApp.overviewWindow->LoadImageFromMissionInstance(theApp.missionFileName);
BYTE r, c;
Scalar rowcell, colcell, offset = 0;
Check_Object(Map::Instance);
Map::Instance->GetElement()->GetSize(&r, &c);
Map::Instance->GetElement()->GetDimensions(&offset,&offset,&rowcell,&colcell);
theApp.displayWindow->mapX = c * colcell;
theApp.displayWindow->mapZ = r * rowcell;
theApp.overviewWindow->mapWidth = int(theApp.displayWindow->mapX);
theApp.overviewWindow->mapHeight = int(theApp.displayWindow->mapZ);
//
//-------------------------------------------------------
//We need to create a drop zone with the name PlayerStart
//-------------------------------------------------------
//
if(NameTable::Instance->FindID("PlayerStart") == NameTable::NullObjectID)
{
Resource model_resource;
SPEW(("scottjan","Get rid of the hard coded data file"));
NotationFile dropzone_file("Content\\Misc\\DropZone.data");
Tool::Instance->ConstructDataList(&model_resource, &dropzone_file);
Check_Object(&model_resource);
Verify(model_resource.DoesResourceExist());
Entity::ClassID class_ID;
class_ID = Entity::GetClassIDFromDataListID(model_resource.GetResourceID());
Verify(class_ID != NullClassID);
LinearMatrix4D matrix = LinearMatrix4D::Identity;
// Point3D translation(500.0, 0.0, 500.0);
Scalar f;
f = -45.0f;
Point3D translation(f, 0.0, f);
matrix.BuildTranslation(translation);
Adept::DropZone::CreateMessage drop_zone_message(
sizeof(Adept::DropZone::CreateMessage),
DefaultEventPriority,
Adept::DropZone::CreateMessage::DefaultFlags,
class_ID,
Adept::DropZone::DefaultFlags,
model_resource.GetResourceID(),
matrix,
0.0f,
Entity__ExecutionStateEngine::NeverExecuteState,
NameTable::NullObjectID,
Entity::DefaultAlignment,
ResourceID::Null
);
MemoryStream stream(&drop_zone_message, drop_zone_message.messageLength);
ReplicatorID Path_id = Connection::Local->GetNextReplicatorID();
Entity* entity;
entity = Entity::CreateEntity(&stream, &Path_id, false);
Check_Object(entity);
Verify(entity->IsDerivedFrom(DropZone::DefaultData));
//Check_Object(EntityManager::Instance);
//EntityManager::Instance->GetNameSocket()->Remove(entity);
entity->instanceName = "PlayerStart";
//EntityManager::Instance->GetNameSocket()->AddValue(entity, entity->instanceName);
Check_Object(Map::Instance);
Map::Instance->AddChild(entity);
entity->SetPropType(Entity::MissionPropType);
entity->SyncMatrices(true);
Verify(entity->IsDerivedFrom(DropZone::DefaultData));
NameTable::Instance->AddEntry(entity, NameTable::DropZoneArray);
NameTable::Instance->IsValid();
// EntityManager::Instance->RequestPostCollisionExecution(entity);
Map::Instance->UpdateZone(entity);
}
theApp.m_MissionSaved = true;
MWMission *mission = Cast_Object (MWMission *,Mission::Instance);
theApp.m_ScriptName = mission->scriptName;
theApp.ambientLightIndex = -1;
theApp.keyLightIndex = -1;
theApp.fillLightIndex = -1;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MW4GameEdApplication::EnterRunningGameState(void* data)
{
Check_Object(this);
MWApplication::EnterRunningGameState(data);
// CMenu* m = theApp.m_pMainWnd->GetMenu();
// m->EnableMenuItem(3,MF_ENABLED | MF_BYPOSITION);
theApp.m_pMainWnd->DrawMenuBar();
theApp.toolBar->EnableButton(ID_FILE_SAVE);
theApp.m_editorState = CMW4GameEdApp::SelectingObjectState;
if (!MW4AI::g_MissionGraph)
{
MW4AI::g_MissionGraph = new CRailGraph(CRailGraph::DefaultData);
// write RailGraph=xGraph.data in mission.instance
// CreateMissionResource(missionname);
}
theApp.LoadLattice();
theApp.m_showLattice = true;
theApp.OnToolsMovementlattice(); // this will set m_showLattice to false
theApp.m_showDropZones = true;
theApp.OnToolsMovmentlayerShowdropzones();
theApp.m_showAI = true;
theApp.OnToolsMovmentlayerShowobjectives();
theApp.m_CurPath = NULL;
theApp.m_CurPathNodeCount = 0;
// Create editor iface objects for paths
theApp.LoadPaths();
theApp.LoadLights();
theApp.LoadObjectives();
theApp.LoadCameras();
int i;
Adept::Mission::Instance->GetMissionPolygon(theApp.missionBoundary);
Adept::Mission::Instance->GetWarningPolygon(theApp.warningBoundary);
for (i = 0; i < theApp.missionBoundary.GetLength(); i++)
{
theApp.missionBoundary[i].x /= Map::Instance->GetColumnZoneScale();
theApp.missionBoundary[i].y /= Map::Instance->GetRowZoneScale();
theApp.missionBoundary[i].x-=theApp.overviewWindow->mapWidth*0.5f;
theApp.missionBoundary[i].y-=theApp.overviewWindow->mapHeight*0.5f;
}
for ( i = 0; i < theApp.warningBoundary.GetLength(); i++)
{
theApp.warningBoundary[i].x /= Map::Instance->GetColumnZoneScale();
theApp.warningBoundary[i].y /= Map::Instance->GetRowZoneScale();
theApp.warningBoundary[i].x-=theApp.overviewWindow->mapWidth*0.5f;
theApp.warningBoundary[i].y-=theApp.overviewWindow->mapHeight*0.5f;
}
theApp.LoadBoundary();
theApp.LoadDropZones();
// Load any predefined camera positions
_finddata_t filedata;
char path[MAX_PATH],tmpString[MAX_PATH],*p;
strcpy(tmpString,theApp.missionFileName);
p = strrchr(tmpString,'.');
*p = 0;
sprintf(path,"%s.editcameras",tmpString);
if (_findfirst(path,&filedata) == -1) // no presets file
{
for (int i = 0; i < 10; i++)
{
theApp.m_DefCameraPos[i] = Stuff::LinearMatrix4D::Identity;
theApp.m_DefCameraName[i][0] = (char)('0' + (char)i);
theApp.m_DefCameraName[i][1] = 0;
}
}
else
{
Stuff::Point3D trans;
Stuff::YawPitchRoll rot;
Stuff::LinearMatrix4D matrix = Stuff::LinearMatrix4D::Identity;
NotationFile infile(path);
for (int i = 0; i < 10; i++)
{
Page *page = infile.FindPage(itoa(i,tmpString,10));
if (page)
{
page->GetEntry("Translation",&trans);
page->GetEntry("YawPitchRoll",&rot);
const char * ptr = NULL;
page->GetEntry("CameraName", &(ptr), FALSE);
if (ptr)
lstrcpy(theApp.m_DefCameraName[i], ptr);
}
if (!page || (trans.x == 0.0f && trans.y == 0.0f && trans.z == 0.0f &&
rot.yaw == 0.0f && rot.pitch == 0.0f && rot.roll == 0.0f))
{
theApp.m_DefCameraPos[i] = Stuff::LinearMatrix4D::Identity;
theApp.m_DefCameraName[i][0] = (char)('0' + (char)i);
theApp.m_DefCameraName[i][1] = 0;
}
else
{
matrix.BuildTranslation(trans);
matrix.BuildRotation(rot);
theApp.m_DefCameraPos[i] = matrix;
}
}
theApp.UpdateCameraMenus(-1);
}
MW4AI::g_MissionGraph->m_SaveLineElementMemory = true;
VehicleInterface *temp_interface =
Cast_Object(VehicleInterface *, Player::Instance->playerInterface);
temp_interface->cameraOffset = Point3D::Identity;
LinearMatrix4D new_local_to_parent = LinearMatrix4D::Identity;
Point3D new_position = Point3D::Identity;
YawPitchRoll new_rotation = YawPitchRoll::Identity;
new_position.x = 0.0f;
new_position.z = 0.0f;
new_position.y = theApp.displayWindow->GetMapPointVertical(new_position.x,new_position.z) + theApp.cameraHeight;
new_rotation.yaw = 0;
new_local_to_parent.BuildTranslation(new_position);
new_local_to_parent.BuildRotation(new_rotation);
Player::Instance->SetNewLocalToParent(new_local_to_parent);
Player::Instance->SyncMatrices(true);
theApp.overviewWindow->UpdateCamera();
theApp.overviewWindow->DrawWindow();
theApp.OnToolsCameraheightMechheight10m();
theApp.instanceWindow->ResetInstanceLists();
}
void
MW4GameEdApplication::PauseGameMessageHandler(const PauseGameMessage *message)
{
Check_Object(this);
Check_Object(message);
Verify(message->messageID == PauseGameMessageID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void
MW4GameEdApplication::LoadMissionResources(const char *mission_name)
{
//
//---------------------------------------------------------
// Get the mission instance name and the resource file name
//---------------------------------------------------------
//
Stuff::MString mission_instance = mission_name;
Stuff::MString res_name = "Resources\\";
res_name += __mbschr(mission_instance,'\\')+1;
char *p = __mbsrchr(res_name, '\\');
Check_Pointer(p);
Str_Copy(p, ".mw4", res_name.GetLength() - (p - res_name));
//
//-------------------------------------------------------------------
// Open up the resource file as a database and access record 0. This
// will contain the list of resource files this one is dependant on
//-------------------------------------------------------------------
//
Stuff::DatabaseHandle *database =
new Stuff::DatabaseHandle(res_name, false, VER_CONTENTVERSION);
Stuff::RecordHandle record;
record.m_databaseHandle = database;
record.m_ID = ResourceID::BuildDependenciesRecordID;
#if defined(_ARMOR)
bool result =
#endif
record.FindID();
Verify(result);
//
//-------------------------
// Load up the core effects
//-------------------------
//
Verify(!gosFX::EffectLibrary::Instance);
gosFX::EffectLibrary::Instance = new ResourceEffectLibrary;
Resource core_libraries("{effects}");
Verify(core_libraries.DoesResourceExist());
ResourceID *lib = Cast_Pointer(ResourceID*, core_libraries.GetPointer());
for (unsigned i=0; i<core_libraries.GetSize()/sizeof(ResourceID); ++i, ++lib)
{
Resource library(*lib);
gosFX::EffectLibrary::Instance->Load(&library);
}
//
//----------------------------------------------------------------------
// The data points to a series of null terminated strings. Step through
// them until done
//----------------------------------------------------------------------
//
const char* data = reinterpret_cast<const char*>(record.m_data);
int level=MapResourceFileID;
for (DWORD count=0; count<record.m_length; ++level)
{
if (!data[count])
break;
MString depstr=data+count;
strcpy(strrchr(depstr,'.')+1,"dep");
//
//---------------------------
// Load this resource file up
//---------------------------
//
ResourceManager::Instance->OpenResourceFile(
data+count,
depstr,
level,
VER_CONTENTVERSION,
true,
false
);
//
//----------------------------
// Load up this file's effects
//----------------------------
//
Resource libraries("{effects}");
if (libraries.DoesResourceExist() && libraries.GetResourceID().GetFileID() == level)
{
ResourceID *lib = Cast_Pointer(ResourceID*, libraries.GetPointer());
for (unsigned i=0; i<libraries.GetSize()/sizeof(ResourceID); ++i, ++lib)
{
Resource library(*lib);
gosFX::EffectLibrary::Instance->Load(&library);
}
}
count += strlen(data+count)+1;
}
//
//---------------------------------
// Now create our own resource file
//---------------------------------
//
MString depstr=res_name;
strcpy(strrchr(depstr,'.')+1,"dep");
ResourceManager::Instance->OpenResourceFile(database,
depstr,
level,
VER_CONTENTVERSION,
true,
false);
Resource libraries("{effects}");
if (libraries.DoesResourceExist() && libraries.GetResourceID().GetFileID() == level)
{
ResourceID *lib = Cast_Pointer(ResourceID*, libraries.GetPointer());
for (unsigned i=0; i<libraries.GetSize()/sizeof(ResourceID); ++i, ++lib)
{
Resource library(*lib);
gosFX::EffectLibrary::Instance->Load(&library);
}
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Entity::CreateMessage *
MW4GameEdApplication::MakePlayerCreationMessage(int player_id)
{
Resource vehicle_instance("Content\\Mechs\\ShadowCat\\shadowcat.instance");
MString interface_name = "Interfaces\\SimpleInterface\\SimpleInterface.instance";
Resource interface_instance(interface_name);
Resource player_data("Players\\TestPlayer\\TestPlayer.data");
MWPlayer::CreateMessage *player_message =
new MWPlayer::CreateMessage(
sizeof(MWPlayer::CreateMessage),
DefaultEventPriority,
MWPlayer::CreateMessage::DefaultFlags,
MWPlayerClassID,
0,
player_data.GetResourceID(),
LinearMatrix4D::Identity,
0.0f,
MWPlayer::ExecutionStateEngine::AlwaysExecuteState,
NameTableEntry::BuildObjectID(NameTable::PlayerArray, 0),
Entity::Player,
vehicle_instance.GetResourceID(),
interface_instance.GetResourceID(),
NameTable::NullObjectID,
0,
DefaultSkinPrefix,
0,
0
);
Check_Object(player_message);
return player_message;
}
@@ -0,0 +1,69 @@
// 12/02/97 DPB First writing of //
// 11/03/98 SMJ Modified for MW4 //
//---------------------------------------------------------------------------//
// Copyright (C) 1995-98, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#pragma once
#include "MW4GameEd.h"
#include <MW4\MWApplication.hpp>
#include <MW4\MW4.hpp>
//##########################################################################
//##################### MW4GameEdApplication #########################
//##########################################################################
// typedef Application__LoadGameMessage MWGameEdApplication__LoadGameMessage;
class MW4GameEdApplication:
public MechWarrior4::MWApplication
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
public:
// typedef MWGameEdApplication__LoadGameMessage LoadGameMessage;
static void
InitializeClass();
static void
TerminateClass();
MW4GameEdApplication();
~MW4GameEdApplication();
static MW4GameEdApplication*
Make();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Message Support
//
public:
void
LoadMissionResources(const char *mission_name);
void
LoadGameMessageHandler(int connection, Stuff::MemoryStream *message);
void
EnterRunningGameState(void* data);
void
PauseGameMessageHandler(const PauseGameMessage *message);
Entity::CreateMessage *
MakePlayerCreationMessage(int player_id);
protected:
static const MessageEntry
MessageEntries[];
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
public:
static ClassData
*DefaultData;
};
@@ -0,0 +1,26 @@
#include "stdafx.h"
#include "MW4GameEdTool.hpp"
//#############################################################################
//########################### MW4GameEdTool ##############################
//#############################################################################
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MW4GameEdTool::MW4GameEdTool():
GOSTool()
{
Check_Pointer(this);
modeManager = new ModeManager(ModeManager::AlwaysActiveMode);
Register_Object(modeManager);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MW4GameEdTool::~MW4GameEdTool()
{
Check_Object(this);
Unregister_Object(modeManager);
delete modeManager;
modeManager = NULL;
}
@@ -0,0 +1,37 @@
//===========================================================================//
// File: MW4GameEdTool.hpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 08/25/97 JMA Infrastructure changes. //
// 08/25/97 ECH Infrastructure changes. //
// 11/03/98 SMJ Made id MW4. //
//---------------------------------------------------------------------------//
// Copyright (C) 1995-97, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#if !defined(MW4GAMEEDTOOL_HPP)
#define MW4GAMEEDTOOL_HPP
#if !defined(GOSADEPT_GOSTOOL_HPP)
#include <GOSAdept\GOSTool.hpp>
#endif
//##########################################################################
//######################## MW4GameEdTool ##############################
//##########################################################################
class MW4GameEdTool:
public GOSAdept::GOSTool
{
public:
MW4GameEdTool();
~MW4GameEdTool();
Adept::ModeManager
*modeManager;
};
#endif
@@ -0,0 +1,528 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "MainFrm.h"
#include <Adept\Player.hpp>
#include <ElementRenderer\LineCloudElement.hpp>
#include <ElementRenderer\GridElement.hpp>
#include <Adept\RendererManager.hpp>
#include <Adept\Map.hpp>
#include <Adept\Mission.hpp>
#include "EditEntityDlg.h"
#include "GridProps.h"
#include "GenericListDlg.h"
#include "DisplayWindow.h"
#include "OverviewWindow.h"
#include "GlobalDefs.h"
#include "selection.h"
#include "Splash.h"
#define PLACEOBJECT_TOOL 7
extern CMW4GameEdApp theApp;
ElementRenderer::LineCloudElement*
GridLineCloud = NULL;
Stuff::Point3D*
GridPointData = NULL;
Stuff::RGBAColor*
GridColorData = NULL;
Scalar GridSpacing=10.0f;
Scalar GridSize=750.0f;
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_WM_INITMENU()
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_GRIDTOGGLE, OnGridToggle)
ON_WM_CLOSE()
ON_WM_MOUSEMOVE()
ON_WM_TIMER()
ON_COMMAND(ID_EDIT_SUBSYSTEMS, OnEditSubsystems)
ON_WM_KEYDOWN()
ON_COMMAND(ID_VIEW_OVERVIEWWINDOW_HEIGHTFIELD, OnViewOverviewwindowHeightfield)
ON_COMMAND(ID_VIEW_OVERVIEWWINDOW_SLOPEMAP, OnViewOverviewwindowSlopemap)
ON_COMMAND(ID_VIEW_OVERVIEWWINDOW_TEXTURE, OnViewOverviewwindowTexture)
ON_UPDATE_COMMAND_UI(ID_VIEW_OVERVIEWWINDOW_HEIGHTFIELD, OnUpdateViewOverviewwindowHeightfield)
ON_UPDATE_COMMAND_UI(ID_VIEW_OVERVIEWWINDOW_SLOPEMAP, OnUpdateViewOverviewwindowSlopemap)
ON_UPDATE_COMMAND_UI(ID_VIEW_OVERVIEWWINDOW_TEXTURE, OnUpdateViewOverviewwindowTexture)
ON_COMMAND(ID_TOOLS_SHOWGRID, OnToolsShowgrid)
ON_UPDATE_COMMAND_UI(ID_TOOLS_SHOWGRID, OnUpdateToolsShowgrid)
ON_COMMAND(ID_VIEW_GRIDPROPERTIES, OnViewGridproperties)
ON_COMMAND(ID_TOOLS_RESETMISSIONBOUNDS, OnToolsResetmissionbounds)
ON_COMMAND(ID_EDIT_ROTATESELECTION90CW, OnEditRotateselection90cw)
ON_COMMAND(ID_EDIT_ROTATESELECTION90CCW, OnEditRotateselection90ccw)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
/*
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
*/
theApp.toolBar = &(m_wndToolBar.GetToolBarCtrl());
// CG: The following line was added by the Splash Screen component.
CSplashWnd::ShowSplashScreen(this);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_MOVE:
{
return theApp.displayWindow->WindowProc(message, wParam, lParam);
}
}
return CMDIFrameWnd::WindowProc(message, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
BOOL CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
return CMDIFrameWnd::OnNotify(wParam, lParam, pResult);
}
void CMainFrame::OnGridToggle()
{
theApp.gridOn = !theApp.gridOn;
if (theApp.gridOn)
{
CMenu* m = theApp.m_pMainWnd->GetMenu();
m->GetSubMenu(APP_MENU_TOOLS)->CheckMenuItem(0,MF_BYPOSITION | MF_CHECKED);
theApp.toolBar->CheckButton(ID_GRIDTOGGLE);
CreateGridData();
}
else
{
CMenu* m = theApp.m_pMainWnd->GetMenu();
m->GetSubMenu(APP_MENU_TOOLS)->CheckMenuItem(0,MF_BYPOSITION | MF_UNCHECKED);
theApp.toolBar->CheckButton(ID_GRIDTOGGLE,FALSE);
HideGrid();
}
HideGrid();
}
void CMainFrame::OnClose()
{
theApp.OnFileClose();
theApp.SaveWindowStates();
if (!theApp.m_MechLabActive)
CMDIFrameWnd::OnClose();
}
void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
{
CMDIFrameWnd::OnMouseMove(nFlags, point);
}
void CMainFrame::OnTimer(UINT nIDEvent)
{
CMDIFrameWnd::OnTimer(nIDEvent);
}
void CMainFrame::OnInitMenu(CMenu* pMenu)
{
CMDIFrameWnd::OnInitMenu(pMenu);
// CG: This block added by 'Tip of the Day' component.
{
// TODO: This code adds the "Tip of the Day" menu item
// on the fly. It may be removed after adding the menu
// item to all applicable menu items using the resource
// editor.
// Add Tip of the Day menu item on the fly!
static CMenu* pSubMenu = NULL;
CString strHelp; strHelp.LoadString(CG_IDS_TIPOFTHEDAYHELP);
CString strMenu;
int nMenuCount = pMenu->GetMenuItemCount();
BOOL bFound = FALSE;
for (int i=0; i < nMenuCount; i++)
{
pMenu->GetMenuString(i, strMenu, MF_BYPOSITION);
if (strMenu == strHelp)
{
pSubMenu = pMenu->GetSubMenu(i);
bFound = TRUE;
ASSERT(pSubMenu != NULL);
}
}
CString strTipMenu;
strTipMenu.LoadString(CG_IDS_TIPOFTHEDAYMENU);
if (!bFound)
{
// Help menu is not available. Please add it!
if (pSubMenu == NULL)
{
// The same pop-up menu is shared between mainfrm and frame
// with the doc.
static CMenu popUpMenu;
pSubMenu = &popUpMenu;
pSubMenu->CreatePopupMenu();
pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION,
CG_IDS_TIPOFTHEDAY, strTipMenu);
}
pMenu->AppendMenu(MF_STRING|MF_BYPOSITION|MF_ENABLED|MF_POPUP,
(UINT)pSubMenu->m_hMenu, strHelp);
DrawMenuBar();
}
else
{
// Check to see if the Tip of the Day menu has already been added.
pSubMenu->GetMenuString(0, strMenu, MF_BYPOSITION);
if (strMenu != strTipMenu)
{
// Tip of the Day submenu has not been added to the
// first position, so add it.
pSubMenu->InsertMenu(0, MF_BYPOSITION); // Separator
pSubMenu->InsertMenu(0, MF_STRING|MF_BYPOSITION,
CG_IDS_TIPOFTHEDAY, strTipMenu);
}
}
}
}
void CMainFrame::DestroyGridData()
{
if (GridLineCloud)
{
Mission::Instance->GetElement()->DetachChild(GridLineCloud);
delete GridLineCloud;
delete GridPointData;
delete GridColorData;
GridLineCloud = NULL;
}
}
void CMainFrame::ShowGrid()
{
if (!theApp.gridOn)
{
Mission::Instance->GetElement()->AttachChild(GridLineCloud);
}
}
void CMainFrame::HideGrid()
{
Mission::Instance->GetElement()->DetachChild(GridLineCloud);
}
unsigned int numPoints;
void CMainFrame::CreateGridData()
{
if (GridLineCloud)
ShowGrid();
int numLines = (int)(GridSize/GridSpacing)*2;
Verify(numLines<512);
numPoints = numLines * 2;
GridPointData = new Stuff::Point3D [numPoints];
GridColorData = new Stuff::RGBAColor [numPoints];
for (int i = 0; i < numPoints; i++)
GridColorData[i] = Stuff::RGBAColor(1.0f, 0.0f, 1.0f, 0.0f);
gos_PushCurrentHeap(ElementRenderer::g_Heap);
GridLineCloud = new ElementRenderer::LineCloudElement(numPoints);
GridLineCloud->SetDataPointers(&numPoints, GridPointData, GridColorData);
GridLineCloud->m_localOBB.localToParent = LinearMatrix4D::Identity;
GridLineCloud->m_localOBB.sphereRadius = GridSize;
Mission::Instance->GetElement()->AttachChild(GridLineCloud);
ElementRenderer::StateChange *state = new ElementRenderer::StateChange();
Check_Object(state);
state->DisableZBufferCompare();
state->DisableZBufferWrite();
state->SetRenderPriority(ElementRenderer::StateChange::HUDPriority0);
GridLineCloud->AdoptStateChange(state);
GridLineCloud->SetVolumeCullMode();
// GridLineCloud->SetName("Grid Cloud");
GridLineCloud->Sync();
Scalar curloc=0.0f;
for (i = 0; i < numPoints; i+=4)
{
GridPointData[i].x = curloc;
GridPointData[i].y = 0.0f;
GridPointData[i].z = 0.0f;
GridPointData[i+1].x = curloc;
GridPointData[i+1].y = 0.0f;
GridPointData[i+1].z = GridSize;
GridPointData[i+2].x = 0.0f;
GridPointData[i+2].y = 0.0f;
GridPointData[i+2].z = curloc;
GridPointData[i+3].x = GridSize;
GridPointData[i+3].y = 0.0f;
GridPointData[i+3].z = curloc;
curloc+=GridSpacing;
}
gos_PopCurrentHeap();
SetGridLocation();
}
void CMainFrame::OnEditSubsystems()
{
CGenericListDlg listDlg;
listDlg.m_Title = "Select Subsystem"; // localize
listDlg.m_Path = "Content\\WeaponSubsystems";
listDlg.m_Extension = "data";
listDlg.m_Strict = false;
if (listDlg.DoModal() == IDOK)
{
EditEntityDlg editDlg(NULL,NULL,EDIT_SUBSYSTEM,(void *)((LPCTSTR)listDlg.m_Path));
editDlg.DoModal();
}
}
void CMainFrame::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CMDIFrameWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CMainFrame::OnViewOverviewwindowHeightfield()
{
if(theApp.overviewWindow->CurrentVMode!=COverviewWindow::VM_HFIELD)
{
theApp.overviewWindow->CurrentVMode=COverviewWindow::VM_HFIELD;
theApp.overviewWindow->BuildBackBuffer();
theApp.overviewWindow->DrawWindow();
}
}
void CMainFrame::OnViewOverviewwindowSlopemap()
{
if(theApp.overviewWindow->CurrentVMode!=COverviewWindow::VM_SLOPEMAP)
{
theApp.overviewWindow->CurrentVMode=COverviewWindow::VM_SLOPEMAP;
theApp.overviewWindow->BuildBackBuffer();
theApp.overviewWindow->DrawWindow();
}
}
void CMainFrame::OnViewOverviewwindowTexture()
{
if(theApp.overviewWindow->CurrentVMode!=COverviewWindow::VM_TEXTURE)
{
theApp.overviewWindow->CurrentVMode=COverviewWindow::VM_TEXTURE;
theApp.overviewWindow->BuildBackBuffer();
theApp.overviewWindow->DrawWindow();
}
}
void CMainFrame::OnUpdateViewOverviewwindowHeightfield(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(theApp.overviewWindow->CurrentVMode==COverviewWindow::VM_HFIELD?1:0);
}
void CMainFrame::OnUpdateViewOverviewwindowSlopemap(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(theApp.overviewWindow->CurrentVMode==COverviewWindow::VM_SLOPEMAP?1:0);
}
void CMainFrame::OnUpdateViewOverviewwindowTexture(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(theApp.overviewWindow->CurrentVMode==COverviewWindow::VM_TEXTURE?1:0);
}
void CMainFrame::OnToolsShowgrid()
{
if(GridLineCloud)
DestroyGridData();
else
CreateGridData();
}
void CMainFrame::OnUpdateToolsShowgrid(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(GridLineCloud?1:0);
}
void CMainFrame::SetGridLocation()
{
if (!GridLineCloud) return;
Stuff::Point3D pos;
pos = Player::Instance->GetLocalToParent();
pos.x=GridSpacing*(Scalar)floor(pos.x/GridSpacing)-GridSize/2.0f;
pos.z=GridSpacing*(Scalar)floor(pos.z/GridSpacing)-GridSize/2.0f;
pos.y=0.0f;
LinearMatrix4D new_local_to_parent(pos);
GridLineCloud->SetLocalToParent(new_local_to_parent);
GridLineCloud->Sync();
}
void CMainFrame::OnViewGridproperties()
{
CGridProps dlg;
dlg.m_GSize=GridSpacing;
if(dlg.DoModal()==IDOK )
{
GridSpacing=dlg.m_GSize;
if(GridLineCloud)
{
DestroyGridData();
CreateGridData();
}
}
}
void CMainFrame::OnToolsResetmissionbounds()
{
Scalar minz,maxz,minx,maxx,xsize,zsize;
Map::Instance->GetMapExtents(&minz,&maxz,&minx,&maxx);
xsize=maxx-minx;
zsize=maxz-minz;
theApp.missionBoundary.SetLength(4);
theApp.missionBoundary[0].x=minx+xsize/10.0f;
theApp.missionBoundary[0].y=minz+zsize/10.0f;
theApp.missionBoundary[1].x=minx+xsize/10.0f;
theApp.missionBoundary[1].y=maxz-zsize/10.0f;
theApp.missionBoundary[2].x=maxx-xsize/10.0f;
theApp.missionBoundary[2].y=maxz-zsize/10.0f;
theApp.missionBoundary[3].x=maxx-xsize/10.0f;
theApp.missionBoundary[3].y=minz+zsize/10.0f;
theApp.warningBoundary.SetLength(4);
theApp.warningBoundary[0].x=minx+xsize/15.0f;
theApp.warningBoundary[0].y=minz+zsize/15.0f;
theApp.warningBoundary[1].x=minx+xsize/15.0f;
theApp.warningBoundary[1].y=maxz-zsize/15.0f;
theApp.warningBoundary[2].x=maxx-xsize/15.0f;
theApp.warningBoundary[2].y=maxz-zsize/15.0f;
theApp.warningBoundary[3].x=maxx-xsize/15.0f;
theApp.warningBoundary[3].y=minz+zsize/15.0f;
theApp.DeleteBoundaryNodes();
theApp.LoadBoundary();
}
void CMainFrame::OnEditRotateselection90cw()
{
theApp.RotateSel90CW();
}
void CMainFrame::OnEditRotateselection90ccw()
{
theApp.RotateSel90CCW();
}
@@ -0,0 +1,88 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__808CF88E_6E5A_11D2_8455_00105A17BC83__INCLUDED_)
#define AFX_MAINFRM_H__808CF88E_6E5A_11D2_8455_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMainFrame : public CMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
// Attributes
public:
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CToolTipCtrl m_ToolTip;
// Operations
public:
void DestroyGridData();
void CreateGridData();
void ShowGrid();
void HideGrid();
void SetGridLocation();
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
// Generated message map functions
protected:
afx_msg void OnInitMenu(CMenu* pMenu);
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnGridToggle();
afx_msg void OnClose();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnEditSubsystems();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnViewOverviewwindowHeightfield();
afx_msg void OnViewOverviewwindowSlopemap();
afx_msg void OnViewOverviewwindowTexture();
afx_msg void OnUpdateViewOverviewwindowHeightfield(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewOverviewwindowSlopemap(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewOverviewwindowTexture(CCmdUI* pCmdUI);
afx_msg void OnToolsShowgrid();
afx_msg void OnUpdateToolsShowgrid(CCmdUI* pCmdUI);
afx_msg void OnViewGridproperties();
afx_msg void OnToolsResetmissionbounds();
afx_msg void OnEditRotateselection90cw();
afx_msg void OnEditRotateselection90ccw();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__808CF88E_6E5A_11D2_8455_00105A17BC83__INCLUDED_)
@@ -0,0 +1,15 @@
#include "stdafx.h"
#include "MissionData.h"
void CMissionData::InitValues()
{
m_Cull = "NeverCull";
m_Fog = true;
m_FogDensity = 0.0f;
m_FogStart = 500.0f;
m_FogEnd = 1000.0f;
m_FogColor[0] = 0.613f;
m_FogColor[1] = 0.707f;
m_FogColor[2] = 0.836f;
}
@@ -0,0 +1,22 @@
#pragma once
#include "stdafx.h"
class CMissionData
{
public:
CString m_Cull;
bool m_Fog;
float m_FogDensity;
float m_FogStart;
float m_FogEnd;
float m_FogColor[3];
CMissionData()
{
InitValues();
}
void InitValues();
};
@@ -0,0 +1,382 @@
#include "stdafx.h"
#include "MW4GameEd.h"
#include "MoveCommand.h"
#include "EditorWaypoint.h"
#include <Adept\Player.hpp>
#include <Adept\Entity.hpp>
#include <Adept\Interface.hpp>
#include <Adept\EntityManager.hpp>
#include <Adept\VideoRenderer.hpp>
#include <Adept\CameraComponent.hpp>
#include <Adept\Map.hpp>
#include "DisplayWindow.h"
#include "OverviewWindow.h"
#include "Selection.h"
extern CMW4GameEdApp theApp;
MoveCommand::MoveCommand(Entity *object)
: Command()
{
Check_Object(object);
moveOffset = Point3D::Identity;
cursorPosition = object->GetLocalToWorld();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MoveCommand::~MoveCommand()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MoveCommand::Execute()
{
Move();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MoveCommand::Undo()
{
theApp.MakeObjectsZoneBased();
LinearMatrix4D new_local_to_world;
Point3D target_in_world;
CSelectionNode *selection_node;
YawPitchRoll current_rotation;
Entity* entity;
if (!selectedEntities.IsEmpty())
{
ChainIteratorOf<CSelectionNode*> iterator(&selectedEntities);
while((selection_node = iterator.ReadAndNext()) != NULL)
{
entity = selection_node->selectedEntity;
target_in_world = entity->GetLocalToWorld();
target_in_world -= moveOffset;
current_rotation = entity->GetLocalToParent();
new_local_to_world.BuildTranslation(target_in_world);
new_local_to_world.BuildRotation(current_rotation);
Check_Object(entity);
entity->SetNewLocalToParent(new_local_to_world);
entity->SyncMatrices(true);
if (entity->IsDerivedFrom(EditorPathNode::DefaultData))
{
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,entity);
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints[node->index] = target_in_world;
node->UpdateLinkPointData();
}
else if (entity->IsDerivedFrom(EditorBoundaryNode::DefaultData))
{
EditorBoundaryNode* node;
node = Cast_Object(EditorBoundaryNode*,entity);
(*node->myBoundary)[node->index].x = target_in_world.x;
(*node->myBoundary)[node->index].y = target_in_world.z;
node->UpdateLinkPointData();
}
else if (entity->IsDerivedFrom(EditorDropNode::DefaultData))
{
EditorDropNode* node;
node = Cast_Object(EditorDropNode*,entity);
node->dropZone->SetNewLocalToParent(new_local_to_world);
node->dropZone->SyncMatrices(true);
EditorDropZonePoint* point;
Point3D newPoint;
LinearMatrix4D matrix = LinearMatrix4D::Identity;
ChainIteratorOf<EditorDropZonePoint*> iterator(&node->pointChain);
while((point = iterator.ReadAndNext()) != NULL)
{
newPoint = new_local_to_world;
newPoint -= point->offset;
newPoint.y = theApp.displayWindow->GetMapPointVertical(newPoint.x,newPoint.z);
matrix.BuildTranslation(newPoint);
point->SetNewLocalToParent(matrix);
point->SyncMatrices(true);
point->UpdateLinkPointData();
}
node->UpdatePoints();
}
else if (entity->IsDerivedFrom(EditorDropZonePoint::DefaultData))
{
EditorDropZonePoint* node;
node = Cast_Object(EditorDropZonePoint*,entity);
node->SetNewLocalToParent(new_local_to_world);
node->SyncMatrices(true);
node->UpdateLinkPointData();
node->dropNode->UpdatePoints();
}
/*
else if (entity->IsDerivedFrom(EditorObjectiveMarker::DefaultData))
{
EditorObjectiveMarker* node;
node = Cast_Object(EditorObjectiveMarker*,entity);
node->objective->SetNewLocalToParent(new_local_to_world);
node->objective->SyncMatrices(true);
}
*/
else if (entity->IsDerivedFrom(EditorPointLight::DefaultData))
{
EditorPointLight* pointLight;
pointLight = Cast_Object(EditorPointLight*,entity);
pointLight->SetLightToWorldMatrix(pointLight->GetLocalToWorld());
}
else if (entity->IsDerivedFrom(EditorSpotLight::DefaultData))
{
EditorSpotLight* spotLight;
spotLight = Cast_Object(EditorSpotLight*,entity);
spotLight->SetLightToWorldMatrix(spotLight->GetLocalToWorld());
}
else if (entity->IsDerivedFrom(EditorCameraShip::DefaultData))
{
EditorCameraShip* node;
node = Cast_Object(EditorCameraShip*,entity);
node->cameraShip->SetNewLocalToParent(new_local_to_world);
node->cameraShip->SyncMatrices(true);
}
}
}
theApp.MakeObjectsTileBased();
theApp.overviewWindow->DrawWindow();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
MoveCommand::Move()
{
//This function needs to run through the list and move all according
//to the offset of the cursor. This is not going to be as easy as it
//seems. First just move one.
Check_Object(Map::Instance);
theApp.MakeObjectsZoneBased();
Point3D new_offset;
LinearMatrix4D new_local_to_world;
CSelectionNode *selection_node;
Entity* entity;
Point3D translation = Point3D::Identity;
Check_Object(Player::Instance);
Check_Object(Player::Instance->playerInterface);
int x_down = GetAsyncKeyState(KEY_X) & 0x8000;
int y_down = GetAsyncKeyState(KEY_Y) & 0x8000;
int z_down = GetAsyncKeyState(KEY_Z) & 0x8000;
Entity *reticule;
reticule = Player::Instance->playerInterface->reticuleEntity.GetCurrent();
if(reticule)
{
Point3D world_offset = Player::Instance->playerInterface->reticuleOffset;
LinearMatrix4D new_local_to_parent = LinearMatrix4D::Identity;
new_local_to_parent.Multiply(reticule->GetLocalToParent(), world_offset);
translation = new_local_to_parent;
}
else if (!y_down) // make sure we're not trying to move vertically.
return; // must be pointing at the sky
bool x_blocked = false, y_blocked = true, z_blocked = false;
if (x_down || y_down || z_down)
{
x_blocked = !x_down;
y_blocked = !y_down;
z_blocked = !z_down;
}
new_offset = translation;
new_offset -= cursorPosition;
if (x_blocked)
new_offset.x = 0;
if (z_blocked)
new_offset.z = 0;
if (!(selectedEntities.IsEmpty()))
{
ChainIteratorOf<CSelectionNode*> iterator(&selectedEntities);
iterator.First();
while((selection_node = iterator.ReadAndNext()) != NULL)
{
entity = selection_node->selectedEntity;
Point3D target_in_world,old_entity_pos;
target_in_world = entity->GetLocalToWorld();
old_entity_pos = target_in_world;
YawPitchRoll current_rotation;
current_rotation = entity->GetLocalToParent();
if (y_blocked)
{
target_in_world += new_offset;
moveOffset += new_offset;
target_in_world.y = theApp.displayWindow->GetMapPointVertical(target_in_world.x,target_in_world.z);
CEditorEntityData *exdata=theApp.GetEntityData(entity);
if(exdata)
target_in_world.y+=exdata->VOffset;
}
else
{
Vector2DOf<Scalar> cursor;
gos_GetMouseInfo(&cursor.x, &cursor.y, NULL, NULL, NULL, NULL);
// Clean out the interface data
Check_Object(VideoRenderer::Instance);
EntityComponentWeb *web =
Cast_Object(EntityComponentWeb*,VideoRenderer::Instance->GetSceneCamera()->GetComponentWeb());
Interface *intface = Cast_Object(Interface*, web->GetEntity());
intface->reticuleEntity.Remove();
// Figure out the eyeline
Line3D world_line;
VideoRenderer::Instance->GetSceneCamera()->ComputeEyeLine(&world_line, cursor);
Point3D point,y_offset;
point = entity->GetLocalToWorld();
Vector3D vector(world_line.m_direction.x,0,world_line.m_direction.z);
Normal3D plane_normal;
plane_normal.Normalize(vector);
Stuff::Plane plane(plane_normal,plane_normal * point);
Scalar axis;
Scalar length = world_line.GetDistanceTo(plane,&axis);
world_line.Project(length,&y_offset);
target_in_world += new_offset;
moveOffset += new_offset;
}
if (theApp.gridOn && !(x_down || y_down || z_down))
theApp.GetGridCoords(target_in_world);
new_local_to_world.BuildTranslation(target_in_world);
new_local_to_world.BuildRotation(current_rotation);
Check_Object(entity);
entity->SetNewLocalToParent(new_local_to_world);
entity->SyncMatrices(true);
// EntityManager::Instance->RequestPostCollisionExecution(entity);
Map::Instance->UpdateZone(entity);
Check_Object(EntityManager::Instance);
if (entity->GetSolidVolume() || entity->GetCollisionMask() == Entity::EditorIsMovingFlag)
{
if (entity->IsMultiZone())
entity->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawRedBounds);
else if (entity->IsMultiTile())
entity->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawYellowBounds);
else
entity->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawGreenBounds);
}
else
entity->GetElement()->SetCallbackIndex(ElementRenderer::Element::DrawGreenBounds);
if (entity->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
EditorLatticeNode* node;
node = Cast_Object(EditorLatticeNode*,entity);
node->railNode->Location(target_in_world);
node->railNode->UpdateRadiusPointData();
}
else if (entity->IsDerivedFrom(EditorPathNode::DefaultData))
{
EditorPathNode* node;
node = Cast_Object(EditorPathNode*,entity);
node->pathSlot.GetCurrent()->pathSlot.GetCurrent()->pathPoints[node->index] = target_in_world;
node->UpdateLinkPointData();
}
else if (entity->IsDerivedFrom(EditorBoundaryNode::DefaultData))
{
EditorBoundaryNode* node;
node = Cast_Object(EditorBoundaryNode*,entity);
(*node->myBoundary)[node->index].x = target_in_world.x;
(*node->myBoundary)[node->index].y = target_in_world.z;
node->CheckValidPos();
node->UpdateLinkPointData();
}
else if (entity->IsDerivedFrom(EditorDropNode::DefaultData))
{
EditorDropNode* node;
node = Cast_Object(EditorDropNode*,entity);
node->dropZone->SetNewLocalToParent(new_local_to_world);
node->dropZone->SyncMatrices(true);
EditorDropZonePoint* point;
LinearMatrix4D matrix = LinearMatrix4D::Identity;
ChainIteratorOf<EditorDropZonePoint*> iterator(&node->pointChain);
Point3D newPoint;
while((point = iterator.ReadAndNext()) != NULL)
{
newPoint = new_local_to_world;
newPoint -= point->offset;
newPoint.y = theApp.displayWindow->GetMapPointVertical(newPoint.x,newPoint.z);
matrix.BuildTranslation(newPoint);
point->SetNewLocalToParent(matrix);
point->SyncMatrices(true);
point->UpdateLinkPointData();
}
node->UpdatePoints();
}
else if (entity->IsDerivedFrom(EditorDropZonePoint::DefaultData))
{
EditorDropZonePoint* node;
node = Cast_Object(EditorDropZonePoint*,entity);
node->SetNewLocalToParent(new_local_to_world);
node->SyncMatrices(true);
node->UpdateLinkPointData();
Point3D newPoint;
newPoint = new_local_to_world;
node->offset = node->dropNode->GetLocalToWorld();
node->offset -= newPoint;
node->dropNode->UpdatePoints();
}
/*
else if (entity->IsDerivedFrom(EditorObjectiveMarker::DefaultData))
{
EditorObjectiveMarker* node;
node = Cast_Object(EditorObjectiveMarker*,entity);
node->objective->SetNewLocalToParent(new_local_to_world);
node->objective->SyncMatrices(true);
}
*/
else if (entity->IsDerivedFrom(EditorPointLight::DefaultData) ||
entity->IsDerivedFrom(EditorSpotLight::DefaultData))
{
EditorLight* light;
light = Cast_Object(EditorLight*,entity);
light->SetLightToWorldMatrix(light->GetLocalToWorld());
}
else if (entity->IsDerivedFrom(EditorCameraShip::DefaultData))
{
EditorCameraShip* node;
node = Cast_Object(EditorCameraShip*,entity);
node->cameraShip->SetNewLocalToParent(new_local_to_world);
node->cameraShip->SyncMatrices(true);
}
}
cursorPosition = translation;
}
theApp.MakeObjectsTileBased();
}
@@ -0,0 +1,40 @@
// File: MoveCommand.hpp //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 12/17/97 DPB Initial coding. //
//---------------------------------------------------------------------------//
// Copyright (C) 1997, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide. //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#pragma once
#include<Stuff\StuffHeaders.hpp>
#include"Command.h"
namespace Adept
{
class Entity;
};
class MoveCommand :
public Command
{
public:
MoveCommand(Adept::Entity *object);
virtual ~MoveCommand();
void
Execute();
void
Undo();
void
Move();
Stuff::Point3D
moveOffset;
};
@@ -0,0 +1,94 @@
// MsgDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "MsgDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CMsgDlg dialog
CMsgDlg::CMsgDlg(char* msg, char* font, int fontSize, CWnd* pParent, int x, int y, int cx, int cy)
: CDialog(CMsgDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMsgDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
if (!font)
m_Font = "Arial";
else
m_Font = font;
m_Text = msg;
m_Size = fontSize;
backColor = GetSysColor(COLOR_3DFACE);
textColor = RGB(0,30,240);
Create(CMsgDlg::IDD,pParent);
if (x > 0)
{
SetWindowPos(NULL,x,y,cx,cy,0);
sized = true;
}
else
sized = false;
}
void CMsgDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMsgDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMsgDlg, CDialog)
//{{AFX_MSG_MAP(CMsgDlg)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMsgDlg message handlers
void CMsgDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
dc.SetBkColor(backColor);
dc.SetTextColor(textColor);
CFont font;
font.CreatePointFont(m_Size,m_Font,&dc);
SetFont(&font,FALSE);
CFont* def_font = dc.SelectObject(&font);
CSize size = dc.GetTextExtent(m_Text);
RECT r;
if (!sized)
{
CWnd* pParent = GetParent();
if (pParent)
pParent->GetClientRect(&r);
else
{
r.right = GetSystemMetrics(SM_CXSCREEN);
r.bottom = GetSystemMetrics(SM_CYSCREEN);
}
size.cx += 15;
size.cy += 15;
SetWindowPos(NULL,r.right / 2 - size.cx / 2,r.bottom / 2 - size.cy / 2,size.cx,size.cy,0);
sized = true;
}
GetClientRect(&r);
CRect etor(r.right / 2 - size.cx / 2,r.bottom / 2 - size.cy / 2,size.cx,size.cy);
dc.ExtTextOut(r.right / 2 - size.cx / 2,r.bottom / 2 - size.cy / 2,ETO_OPAQUE,&etor,m_Text,NULL);
dc.SelectObject(def_font);
font.DeleteObject();
}
+62
View File
@@ -0,0 +1,62 @@
#if !defined(AFX_MSGDLG_H__FF876285_2A96_11D3_8458_00105A17BC83__INCLUDED_)
#define AFX_MSGDLG_H__FF876285_2A96_11D3_8458_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MsgDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMsgDlg dialog
class CMsgDlg : public CDialog
{
// Construction
public:
CMsgDlg(char* msg, char* font = NULL, int fontSize = 120, CWnd* pParent = NULL,
int x = -1, int y = -1, int cx = -1, int cy = -1);
// Dialog Data
//{{AFX_DATA(CMsgDlg)
enum { IDD = IDD_MSGDLG };
//}}AFX_DATA
int
m_Size;
CString
m_Text;
CString
m_Font;
COLORREF
backColor;
COLORREF
textColor;
void SetBackColor(COLORREF bc) {backColor = bc;}
void SetTextColor(COLORREF tc) {textColor = tc;}
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMsgDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
bool
sized;
// Generated message map functions
//{{AFX_MSG(CMsgDlg)
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MSGDLG_H__FF876285_2A96_11D3_8458_00105A17BC83__INCLUDED_)
@@ -0,0 +1,149 @@
// NewMissionDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "NewMissionDlg.h"
#include "GenericListDlg.h"
#include <direct.h>
#include <errno.h>
//extern int _errno;
extern CMW4GameEdApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CNewMissionDlg dialog
CNewMissionDlg::CNewMissionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNewMissionDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewMissionDlg)
//}}AFX_DATA_INIT
m_MapFilePath = "";
m_SkyFilePath = "";
}
void CNewMissionDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewMissionDlg)
DDX_Control(pDX, IDC_MISSIONSKYPATH, m_SkyPath);
DDX_Control(pDX, IDC_MISSIONNAMEEDIT, m_Name);
DDX_Control(pDX, IDC_MISSIONMAPPATH, m_MapPath);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewMissionDlg, CDialog)
//{{AFX_MSG_MAP(CNewMissionDlg)
ON_BN_CLICKED(IDC_MISSIONMAPPATHBTN, OnMissionmappathbtn)
ON_BN_CLICKED(IDC_MISSIONSKYPATHBTN, OnMissionskypathbtn)
ON_EN_CHANGE(IDC_MISSIONNAMEEDIT, OnChangeMissionnameedit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNewMissionDlg message handlers
void CNewMissionDlg::OnOK()
{
if (theApp.m_editorState != CMW4GameEdApp::NoGameIdleState)
{
theApp.OnFileClose();
}
CString missionName;
m_Name.GetWindowText(missionName);
missionName.TrimRight();
if (!missionName)
{
MessageBox("You must name a mission before it can be created.","Mission Creation Error"); // Localize
return;
}
if (missionName.GetLength() > 32)
{
MessageBox("The mission name is too long.","Mission Creation Error"); // Localize
return;
}
if (!m_MapFilePath)
{
MessageBox("You must select a map to create a mission.","Mission Creation Error"); // Localize
return;
}
if (!m_SkyFilePath)
{
MessageBox("You must select a sky to create a mission.","Mission Creation Error"); // Localize
return;
}
char oldDir[MAX_PATH];
_getcwd(oldDir,MAX_PATH - 1);
CString missionPath = "Content\\Missions\\";
missionPath += missionName;
if (_chdir(missionPath) == 0)
{
MessageBox("A mission with that name already exists. Please rename the mission.","New Mission Error"); // Localize
_chdir(oldDir);
return;
}
else
{
theApp.m_MissionData.InitValues();
if (theApp.CreateNewScenario(missionName.GetBuffer(MAX_PATH),m_MapFilePath.GetBuffer(MAX_PATH),m_SkyFilePath.GetBuffer(MAX_PATH)))
{
char missionInstance[MAX_PATH];
sprintf(missionInstance,"Content\\Missions\\%s\\%s.instance",missionName.GetBuffer(MAX_PATH),missionName.GetBuffer(MAX_PATH));
theApp.OpenFile(missionInstance);
}
}
CDialog::OnOK();
}
void CNewMissionDlg::OnMissionmappathbtn()
{
CGenericListDlg dlg;
dlg.m_Title = "Select Map"; // localize
dlg.m_Path = "Content\\Maps";
dlg.m_Extension = "instance";
if (dlg.DoModal() == IDOK)
{
m_MapFilePath = dlg.m_Path;
m_MapPath.SetWindowText(dlg.m_Name);
}
}
void CNewMissionDlg::OnMissionskypathbtn()
{
CGenericListDlg dlg;
dlg.m_Title = "Select Sky"; // localize
dlg.m_Path = "Content\\Skies";
dlg.m_Extension = "erf";
if (dlg.DoModal() == IDOK)
{
m_SkyFilePath = dlg.m_Path;
m_SkyPath.SetWindowText(dlg.m_Name);
}
}
void CNewMissionDlg::OnChangeMissionnameedit()
{
}
BOOL CNewMissionDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -0,0 +1,54 @@
#if !defined(AFX_NEWMISSIONDLG_H__68FA66A2_1D7B_11D3_8458_00105A17BC83__INCLUDED_)
#define AFX_NEWMISSIONDLG_H__68FA66A2_1D7B_11D3_8458_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// NewMissionDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CNewMissionDlg dialog
class CNewMissionDlg : public CDialog
{
// Construction
public:
CNewMissionDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CNewMissionDlg)
enum { IDD = IDD_NEWMISSIONDLG };
CEdit m_SkyPath;
CEdit m_Name;
CEdit m_MapPath;
//}}AFX_DATA
CString m_MapFilePath;
CString m_SkyFilePath;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewMissionDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CNewMissionDlg)
virtual void OnOK();
afx_msg void OnMissionmappathbtn();
afx_msg void OnMissionskypathbtn();
afx_msg void OnChangeMissionnameedit();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NEWMISSIONDLG_H__68FA66A2_1D7B_11D3_8458_00105A17BC83__INCLUDED_)
@@ -0,0 +1,76 @@
#include "stdafx.h"
#include "objListBox.h"
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// CObjListBox
CObjListBox::CObjListBox()
{
}
CObjListBox::~CObjListBox()
{
}
BEGIN_MESSAGE_MAP(CObjListBox, CListBox)
//{{AFX_MSG_MAP(CObjListBox)
ON_WM_LBUTTONDBLCLK()
ON_WM_RBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CObjListBox message handlers
void CObjListBox::OnLButtonDblClk(UINT nFlags, CPoint point)
{
GetParent()->SendMessage(WM_LBUTTONDBLCLK,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CListBox::OnLButtonDblClk(nFlags, point);
}
void CObjListBox::OnRButtonDown(UINT nFlags, CPoint point)
{
BOOL outside;
SetCurSel(ItemFromPoint(point,outside));
GetParent()->SendMessage(WM_RBUTTONDOWN,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CListBox::OnRButtonDown(nFlags, point);
}
void CObjListBox::OnLButtonUp(UINT nFlags, CPoint point)
{
GetParent()->SendMessage(WM_LBUTTONUP,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CListBox::OnLButtonUp(nFlags, point);
}
BOOL CObjListBox::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= LBS_WANTKEYBOARDINPUT;
return CListBox::PreCreateWindow(cs);
}
int CObjListBox::VKeyToItem(UINT /*nKey*/, // variable names removed to prevent compiler warning until used
UINT /*nIndex*/
)
{
// TODO: Add your code to handle a particular virtual key
// return -1 = default action
// return -2 = no further action
// return index = perform default action for keystroke on
// item specified by index
return -2;
}
void CObjListBox::OnRButtonDblClk(UINT nFlags, CPoint point)
{
BOOL outside;
SetCurSel(ItemFromPoint(point,outside));
GetParent()->SendMessage(WM_RBUTTONDBLCLK,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CListBox::OnRButtonDblClk(nFlags, point);
}
@@ -0,0 +1,48 @@
#pragma once
#include <afxwin.h>
class ObjListBox : public CListBox
{
};
/////////////////////////////////////////////////////////////////////////////
// CObjListBox window
class CObjListBox : public CListBox
{
// Construction
public:
CObjListBox();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CObjListBox)
public:
virtual int VKeyToItem(UINT nKey, UINT nIndex);
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CObjListBox();
// Generated message map functions
protected:
//{{AFX_MSG(CObjListBox)
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,186 @@
// ObjWindow.cpp : implementation file
//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "ObjWindow.h"
#include "InstanceWindow.h"
#include "EditEntityDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CObjWindow dialog
CObjWindow::CObjWindow(CWnd* pParent /*=NULL*/)
: CDialog(CObjWindow::IDD, pParent)
{
//{{AFX_DATA_INIT(CObjWindow)
//}}AFX_DATA_INIT
curSort = SORT_TYPE;
mechTab = NULL;
buildingTab = NULL;
vehicleTab = NULL;
miscTab = NULL;
}
CObjWindow::~CObjWindow()
{
if (mechTab)
{
if (mechTab->pszText)
delete [] mechTab->pszText;
Unregister_Pointer(mechTab);
delete mechTab;
}
if (buildingTab)
{
if (buildingTab->pszText)
delete [] buildingTab->pszText;
Unregister_Pointer(buildingTab);
delete mechTab;
}
if (vehicleTab)
{
if (vehicleTab->pszText)
delete [] vehicleTab->pszText;
Unregister_Pointer(vehicleTab);
delete mechTab;
}
if (miscTab)
{
if (miscTab->pszText)
delete [] miscTab->pszText;
Unregister_Pointer(miscTab);
delete mechTab;
}
}
void CObjWindow::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CObjWindow)
DDX_Control(pDX, IDC_OBJECTTAB, m_TabCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CObjWindow, CDialog)
//{{AFX_MSG_MAP(CObjWindow)
ON_BN_CLICKED(IDC_INSTANCEALINGMENTBTN, OnInstancealingmentbtn)
ON_BN_CLICKED(IDC_INSTANCETYPEBTN, OnInstancetypebtn)
ON_NOTIFY(TCN_SELCHANGE, IDC_OBJECTTAB, OnSelchangeObjecttab)
ON_WM_CREATE()
ON_WM_LBUTTONDBLCLK()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CObjWindow message handlers
void CObjWindow::OnInstancealingmentbtn()
{
curSort = SORT_ALIGNMENT;
((CInstanceWindow*)GetParent())->FillTabBox();
}
void CObjWindow::OnInstancetypebtn()
{
curSort = SORT_TYPE;
((CInstanceWindow*)GetParent())->FillTabBox();
}
void CObjWindow::OnSelchangeObjecttab(NMHDR* pNMHDR, LRESULT* pResult)
{
NMHDR lParam;
lParam.hwndFrom = m_hWnd;
lParam.idFrom = IDC_OBJECTTAB;
lParam.code = m_TabCtrl.GetCurSel();
GetParent()->SendMessage(WM_NOTIFY,WPARAM(IDC_OBJECTTAB),LPARAM(&lParam));
*pResult = 0;
}
int CObjWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
mechTab = new TCITEM;
Register_Pointer(mechTab);
mechTab->mask = TCIF_TEXT;
mechTab->cchTextMax = strlen("Mechs"); // Localize
mechTab->pszText = new char[mechTab->cchTextMax + 1];
strcpy(mechTab->pszText,"Mechs"); // Localize
buildingTab = new TCITEM;
Register_Pointer(buildingTab);
buildingTab->mask = TCIF_TEXT;
buildingTab->cchTextMax = strlen("Buildings"); // Localize
buildingTab->pszText = new char[buildingTab->cchTextMax + 1];
strcpy(buildingTab->pszText,"Buildings"); // Localize
vehicleTab = new TCITEM;
Register_Pointer(vehicleTab);
vehicleTab->mask = TCIF_TEXT;
vehicleTab->cchTextMax = strlen("Vehicles"); // Localize
vehicleTab->pszText = new char[vehicleTab->cchTextMax + 1];
strcpy(vehicleTab->pszText,"Vehicles"); // Localize
miscTab = new TCITEM;
Register_Pointer(miscTab);
miscTab->mask = TCIF_TEXT;
miscTab->cchTextMax = strlen("Misc"); // Localize
miscTab->pszText = new char[miscTab->cchTextMax + 1];
strcpy(miscTab->pszText,"Misc"); // Localize
return 0;
}
void CObjWindow::OnLButtonDblClk(UINT nFlags, CPoint point)
{
GetParent()->SendMessage(WM_LBUTTONDBLCLK,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CDialog::OnLButtonDblClk(nFlags, point);
}
void CObjWindow::OnRButtonDown(UINT nFlags, CPoint point)
{
GetParent()->SendMessage(WM_RBUTTONDOWN,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CDialog::OnRButtonDown(nFlags, point);
}
void CObjWindow::OnLButtonUp(UINT nFlags, CPoint point)
{
GetParent()->SendMessage(WM_LBUTTONUP,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CDialog::OnLButtonUp(nFlags, point);
}
void CObjWindow::OnOK()
{
// someone in MFC thought it would be a good idea to have this function get called everytime
// the ENTER key is pressed.
return;
}
void CObjWindow::OnCancel()
{
// someone in MFC thought it would be a good idea to have this function get called everytime
// the ESCAPE key is pressed.
return;
}
void CObjWindow::OnRButtonDblClk(UINT nFlags, CPoint point)
{
GetParent()->SendMessage(WM_RBUTTONDBLCLK,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
CDialog::OnRButtonDblClk(nFlags, point);
}
@@ -0,0 +1,98 @@
#if !defined(AFX_OBJWINDOW_H__E8AB4568_CB26_11D2_8457_00105A17BC83__INCLUDED_)
#define AFX_OBJWINDOW_H__E8AB4568_CB26_11D2_8457_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ObjWindow.h : header file
//
#define SORT_ALIGNMENT 0
#define SORT_TYPE 1
#define MECH_TAB 0
#define BUILDING_TAB 1
#define VEHICLE_TAB 2
#define MISC_TAB 3
#include "ObjListBox.h"
class TabList :
public Plug
{
public:
TabList() :
Plug(Plug::DefaultData)
{
}
CString itemString;
CString itemPath;
DWORD data;
};
/////////////////////////////////////////////////////////////////////////////
// CObjWindow dialog
class CObjWindow : public CDialog
{
friend class CDisplayWindow;
// Construction
public:
CObjWindow(CWnd* pParent = NULL); // standard constructor
~CObjWindow();
// Dialog Data
//{{AFX_DATA(CObjWindow)
enum { IDD = IDD_OBJECTDLG };
CTabCtrl m_TabCtrl;
//}}AFX_DATA
CObjListBox
m_ObjList;
int
curSort;
TCITEM*
mechTab;
TCITEM*
buildingTab;
TCITEM*
vehicleTab;
TCITEM*
miscTab;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CObjWindow)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void OnOK();
void OnCancel();
// Generated message map functions
//{{AFX_MSG(CObjWindow)
afx_msg void OnInstancealingmentbtn();
afx_msg void OnInstancetypebtn();
afx_msg void OnSelchangeObjecttab(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OBJWINDOW_H__E8AB4568_CB26_11D2_8457_00105A17BC83__INCLUDED_)
@@ -0,0 +1,109 @@
// ObjectiveDLG.cpp : implementation file
//
#include "stdafx.h"
#include "mw4gameed.h"
#include "ObjectiveDLG.h"
#include <MW4\Objective.hpp>
using namespace MechWarrior4;
/////////////////////////////////////////////////////////////////////////////
// ObjectiveDLG dialog
ObjectiveDLG::ObjectiveDLG(Objective* entity,CWnd* pParent /*=NULL*/)
: CDialog(ObjectiveDLG::IDD, pParent)
{
//{{AFX_DATA_INIT(ObjectiveDLG)
m_Visible = FALSE;
m_State = FALSE;
m_Description = _T("");
m_Failed = _T("");
m_Incomplete = _T("");
m_Success = _T("");
m_Primary = FALSE;
m_HelpMessage = FALSE;
m_Objective = entity;
//}}AFX_DATA_INIT
}
void ObjectiveDLG::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ObjectiveDLG)
DDX_Check(pDX, IDC_VisibleObjective, m_Visible);
DDX_Check(pDX, IDC_StateObjective, m_State);
DDX_Text(pDX, IDC_DESCEDIT, m_Description);
DDV_MaxChars(pDX, m_Description, 255);
DDX_Text(pDX, IDC_FAILEDIT, m_Failed);
DDV_MaxChars(pDX, m_Failed, 255);
DDX_Text(pDX, IDC_INCEDIT, m_Incomplete);
DDV_MaxChars(pDX, m_Incomplete, 255);
DDX_Text(pDX, IDC_SUCCESSEDIT, m_Success);
DDV_MaxChars(pDX, m_Success, 255);
DDX_Check(pDX, IDC_PrimaryObjective, m_Primary);
DDX_Check(pDX, IDC_HELPOBJETIVE, m_HelpMessage);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ObjectiveDLG, CDialog)
//{{AFX_MSG_MAP(ObjectiveDLG)
ON_BN_CLICKED(IDC_StateObjective, OnStateObjective)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ObjectiveDLG message handlers
void ObjectiveDLG::OnStateObjective()
{
// TODO: Add your control notification handler code here
}
BOOL ObjectiveDLG::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Visible = m_Objective->m_VisibleObjective;
m_Primary = m_Objective->m_Primary;
m_State = m_Objective->m_ObjectiveState;
m_HelpMessage = m_Objective->m_HelpMessage;
m_Description = m_Objective->m_DescriptionText;
m_Failed = m_Objective->m_FailText;
m_Success = m_Objective->m_SucceedText;
m_Incomplete = m_Objective->m_NeutralText;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void ObjectiveDLG::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
Check_Object (m_Objective);
#pragma warning (disable:4800)
m_Objective->m_VisibleObjective = (bool) m_Visible;
m_Objective->m_Primary = (bool) m_Primary;
m_Objective->m_HelpMessage = (bool) m_HelpMessage;
#pragma warning (default:4800)
m_Objective->m_ObjectiveState = m_State;
Str_Copy (m_Objective->m_FailText,((LPCTSTR) m_Failed),sizeof (m_Objective->m_FailText));
Str_Copy (m_Objective->m_SucceedText,((LPCTSTR) m_Success),sizeof (m_Objective->m_SucceedText));
Str_Copy (m_Objective->m_NeutralText,((LPCTSTR) m_Incomplete),sizeof (m_Objective->m_NeutralText));
Str_Copy (m_Objective->m_DescriptionText,((LPCTSTR) m_Description),sizeof (m_Objective->m_DescriptionText));
CDialog::OnOK();
}
@@ -0,0 +1,61 @@
#if !defined(AFX_OBJECTIVEDLG_H__F94DE119_FB55_4BDD_9CCA_6F4E9853FF09__INCLUDED_)
#define AFX_OBJECTIVEDLG_H__F94DE119_FB55_4BDD_9CCA_6F4E9853FF09__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ObjectiveDLG.h : header file
//
namespace MechWarrior4
{
class Objective;
}
/////////////////////////////////////////////////////////////////////////////
// ObjectiveDLG dialog
class ObjectiveDLG : public CDialog
{
// Construction
public:
ObjectiveDLG(MechWarrior4::Objective* entity,CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(ObjectiveDLG)
enum { IDD = IDD_OBJECTIVEDLG };
BOOL m_Visible;
int m_State;
CString m_Description;
CString m_Failed;
CString m_Incomplete;
CString m_Success;
BOOL m_Primary;
BOOL m_HelpMessage;
//}}AFX_DATA
MechWarrior4::Objective *m_Objective;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ObjectiveDLG)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ObjectiveDLG)
afx_msg void OnStateObjective();
virtual BOOL OnInitDialog();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OBJECTIVEDLG_H__F94DE119_FB55_4BDD_9CCA_6F4E9853FF09__INCLUDED_)
@@ -0,0 +1,218 @@
// OpenMapFileDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "OpenMapFileDlg.h"
#include <direct.h>
#include <io.h>
/////////////////////////////////////////////////////////////////////////////
// COpenMapFileDlg dialog
extern CMW4GameEdApp theApp;
COpenMapFileDlg::COpenMapFileDlg(CWnd* pParent /*=NULL*/)
: CDialog(COpenMapFileDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COpenMapFileDlg)
//}}AFX_DATA_INIT
contentFile[0] = 0;
LoadString(theApp.m_hInstance,IDS_DEFAULTMAPDLGTITLE,title,MAX_PATH);
deleteEnabled = TRUE;
}
void COpenMapFileDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COpenMapFileDlg)
DDX_Control(pDX, IDCANCEL, m_CancelButton);
DDX_Control(pDX, IDC_DELETEFILE, m_DeleteButton);
DDX_Control(pDX, IDC_FILELIST, m_FileList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COpenMapFileDlg, CDialog)
//{{AFX_MSG_MAP(COpenMapFileDlg)
ON_BN_CLICKED(IDC_DELETEFILE, OnDeleteFile)
ON_BN_CLICKED(IDOK, OnOpenFile)
ON_LBN_DBLCLK(IDC_FILELIST, OnDblclkFileList)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// COpenMapFileDlg message handlers
void COpenMapFileDlg::OnDeleteFile()
{
NotationFile infile("Content\\Games\\UserGames.contents");
// Find the entry to delete
char file[MAX_PATH];
const char *entryData;
char entryName[16];
int c = m_FileList.GetItemData(m_FileList.GetCurSel());
m_FileList.DeleteString(m_FileList.GetCurSel());
sprintf(entryName,"EntryData%d",c);
Page *user_page = infile.GetPage("UserGames");
Check_Object(user_page);
user_page->GetEntry(entryName,&entryData);
strcpy(file,entryData);
user_page->DeleteNote(entryName);
sprintf(entryName,"EntryText%d",c);
user_page->DeleteNote(entryName);
// Delete all the associated files
struct _finddata_t fileInfo;
char oldDir[MAX_PATH];
char drive[_MAX_DRIVE],dir[_MAX_DIR],fname[_MAX_FNAME],ext[_MAX_EXT];
_splitpath(file,drive,dir,fname,ext);
_getcwd(oldDir,MAX_PATH);
_chdir(dir);
long fhand = _findfirst("*.*",&fileInfo);
remove(fileInfo.name);
int i = 0;
while(!i)
{
i = _findnext(fhand,&fileInfo);
remove(fileInfo.name);
}
_chdir(oldDir);
_rmdir(dir);
// Now we deal with the fact our numbers are all messed up
Page::NoteIterator *user_games = user_page->MakeNoteIterator();
Check_Object(user_games);
i = user_games->GetSize() / 2;
while (c < i)
{
sprintf(entryName,"EntryText%d",c+1);
user_page->GetEntry(entryName,&entryData);
strcpy(file,entryData);
user_page->DeleteNote(entryName);
sprintf(entryName,"EntryText%d",c);
user_page->AppendEntry(entryName,file);
sprintf(entryName,"EntryData%d",c+1);
user_page->GetEntry(entryName,&entryData);
strcpy(file,entryData);
user_page->DeleteNote(entryName);
sprintf(entryName,"EntryData%d",c);
user_page->AppendEntry(entryName,file);
c++;
}
delete user_games;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void COpenMapFileDlg::OnOpenFile()
{
NotationFile infile(contentFile);
char entryName[16];
const char *tabName;
sprintf(entryName,"EntryData%d",m_FileList.GetItemData(m_FileList.GetCurSel()));
Page *user_page = infile.GetPage("UserGames");
Check_Object(user_page);
user_page->GetEntry(entryName,&tabName);
char drive[_MAX_DRIVE],dir[_MAX_DIR],fname[_MAX_FNAME],ext[_MAX_EXT],oldDir[MAX_PATH];
_splitpath(tabName,drive,dir,fname,ext);
_getcwd(oldDir,MAX_PATH);
if (deleteEnabled && _chdir(dir)) // if !create and chdir failed
{
char string[MAX_PATH],title[MAX_PATH];
LoadString(theApp.m_hInstance,IDS_OPENSCENARIOERRORTITLE,title,MAX_PATH);
LoadString(theApp.m_hInstance,IDS_MAPDELETEDERROR,string,MAX_PATH);
MessageBox(string,title);
OnDeleteFile();
_chdir(oldDir);
SetUpListBox();
return;
}
_chdir(oldDir);
strcpy(contentFile,tabName);
EndDialog(IDOK);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void COpenMapFileDlg::SetUpListBox()
{
while (m_FileList.DeleteString(0) > 0);
NotationFile infile(contentFile);
char entryName[16];
const char *tab_name;
Page *user_page = infile.GetPage("UserGames");
Check_Object(user_page);
user_page->GetEntry("TabName",&tab_name);
int e = 0;
while (1)
{
sprintf(entryName,"EntryText%d",e);
if (!user_page->GetEntry(entryName,&tab_name))
break;
m_FileList.AddString(tab_name);
m_FileList.SetItemData(m_FileList.FindStringExact(0,tab_name),e);
e++;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
BOOL COpenMapFileDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText(title);
if (!deleteEnabled)
{
RECT r;
m_DeleteButton.ShowWindow(SW_HIDE);
m_DeleteButton.GetWindowRect(&r);
ScreenToClient(&r);
m_CancelButton.MoveWindow(&r);
}
SetUpListBox();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void COpenMapFileDlg::OnCancel()
{
contentFile[0] = 0;
CDialog::OnCancel();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void COpenMapFileDlg::OnDblclkFileList()
{
OnOpenFile();
}
@@ -0,0 +1,62 @@
#if !defined(AFX_OPENMAPFILEDLG_H__E7D29FA1_B9C2_11D2_8457_00105A17BC83__INCLUDED_)
#define AFX_OPENMAPFILEDLG_H__E7D29FA1_B9C2_11D2_8457_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// OpenMapFileDlg.h : header file
//
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// COpenMapFileDlg dialog
class COpenMapFileDlg : public CDialog
{
// Construction
public:
COpenMapFileDlg(CWnd* pParent = NULL); // standard constructor
void SetUpListBox();
// Dialog Data
//{{AFX_DATA(COpenMapFileDlg)
enum { IDD = IDD_MAPSELECTDLG };
CButton m_CancelButton;
CButton m_DeleteButton;
CListBox m_FileList;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COpenMapFileDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
public:
char contentFile[MAX_PATH];
char title[MAX_PATH];
BOOL deleteEnabled;
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(COpenMapFileDlg)
afx_msg void OnDeleteFile();
afx_msg void OnOpenFile();
virtual BOOL OnInitDialog();
virtual void OnCancel();
afx_msg void OnDblclkFileList();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OPENMAPFILEDLG_H__E7D29FA1_B9C2_11D2_8457_00105A17BC83__INCLUDED_)
@@ -0,0 +1,928 @@
// OverviewWindow1.cpp : implementation file
//
#include "stdafx.h"
#include "MW4GameEd.h"
#include "OverviewWindow.h"
#include "EditorChildWnd.h"
#include "EditorWaypoint.h"
#include "MainFrm.h"
#include <Adept\Player.hpp>
#include <Adept\Interface.hpp>
#include <Adept\AdeptHeaders.hpp>
#include <Adept\Map.hpp>
#include <Adept\Mission.hpp>
#include <MW4\Mech.hpp>
#include <MW4\Vehicle.hpp>
#include <MW4\Building.hpp>
#include "DisplayWindow.h"
#include <Adept\Application.hpp>
#define __mbsrchr(s,c) (char*)_mbsrchr((const unsigned char*)(s),(c))
extern CMW4GameEdApp theApp;
/////////////////////////////////////////////////////////////////////////////
// COverviewWindow
IMPLEMENT_DYNCREATE(COverviewWindow, CEditorChildWnd)
COverviewWindow::COverviewWindow()
{
CString title;
CRect rect;
CurrentVMode=VM_TEXTURE;
title.LoadString(IDS_OVERVIEWWINDOWTITLE);
rect.top = 2; rect.left = 650; rect.bottom = 202; rect.right = 850;
ImgReady=false;
BBufReady=false;
mapWidth = 0;
mapHeight = 0;
Create(NULL,title,
WS_CHILD | WS_CLIPSIBLINGS | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_VISIBLE,rect);
}
COverviewWindow::~COverviewWindow()
{
BackBuffer.DeleteObject();
}
BEGIN_MESSAGE_MAP(COverviewWindow, CEditorChildWnd)
//{{AFX_MSG_MAP(COverviewWindow)
ON_WM_SIZE()
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COverviewWindow message handlers
int COverviewWindow::LoadImageFromMissionInstance(const char* missionFile)
{
char drive[_MAX_DRIVE],dir[_MAX_DIR],fname[_MAX_FNAME],ext[_MAX_EXT];
_splitpath(missionFile,drive,dir,fname,ext);
NotationFile not(missionFile);
const char* filename;
Page *page = not.GetPage(fname);
Check_Object(page);
page->GetEntry("Map",&filename);
char* p = __mbsrchr(filename,'\\');
*p = 0;
sprintf(fname,"Content\\Textures\\%s\\*.*",filename);
Directory* currentDir;
currentDir = new Directory(fname,true);
Register_Object(currentDir);
int last = 0, blockX = 0, blockY = 0;
do
{
p = currentDir->GetCurrentFolderName();
if (!p) break;
currentDir->AdvanceCurrentFolder();
if (strlen(p) > 2) continue;
strlwr(p);
if (*p == 'a')
blockX++;
if (*p != last)
{
blockY++;
last = *p;
}
}
while (p);
Unregister_Object(currentDir);
delete currentDir;
// OK, we're assuming the TGA is 24 bit so it had better be
RGBMask mask=RGBMask(0xff0000,0x00ff00,0x0000ff);
MapImage.CreateBlank(blockX * 256,blockY * 256,ITYPE_RGB,24,mask);
currentDir = new Directory(fname,true);
Register_Object(currentDir);
char tmp[MAX_PATH];
strcpy(tmp,fname);
p = __mbsrchr(tmp,'\\');
*p = 0;
strcpy(dir,tmp);
p = __mbsrchr(dir,'\\') + 1;
strcpy(dir,p);
int i = 0;
CRect dst,src;
src.left = 0;
src.top = 0;
src.right = 255;
src.bottom = 255;
do
{
p = currentDir->GetCurrentFolderName();
if (!p) break;
currentDir->AdvanceCurrentFolder();
if (strlen(p) > 2) continue;
CString noextfname,finalfname;
noextfname.Format("%s\\%s\\%s_%s_0_0000",tmp,p,dir,p);
finalfname=noextfname+".Png";
if(!gos_DoesFileExist((LPCSTR)finalfname))
finalfname=noextfname+".tga";
Image img((char *)(LPCSTR)finalfname);
int x = MapImage.GetWidth() - 255 * (i % blockX + 1);
int y = MapImage.GetHeight() - 255 * (i / blockX + 1);
dst.left = x;
dst.top = y;
dst.right = x + 255;
dst.bottom = y + 255;
MapImage.Blt(img,dst,src);
i++;
}
while (p);
// MapImage.Rotate180();
// MapImage.MakeRGB24();
CString map_name;
map_name=filename;
map_name=map_name.Right(map_name.GetLength()-map_name.ReverseFind('\\')-1);
CString tctpath,hfpath;
tctpath.Format("Content\\Maps\\%s\\tctd.ini",map_name);
if(gos_DoesFileExist((char *)(LPCSTR)tctpath))
{
NotationFile hfinfo((char *)(LPCSTR)tctpath);
page = hfinfo.GetPage((char *)(LPCSTR)map_name);
Check_Object(page);
const char *hfname;
page->GetEntry("HeightField",&hfname);
Point3D map_scale;
page->GetEntry("DeltaX",&map_scale.x);
page->GetEntry("DeltaY",&map_scale.y);
page->GetEntry("DeltaZ",&map_scale.z);
hfpath.Format("Content\\Maps\\%s\\%s",map_name,hfname);
HField.Load((char *)(LPCSTR)hfpath);
HField.MakeRGB24();
SlopeMap=HField;
SlopeMap.ShowSlopeLimit(map_scale.x,
map_scale.z,
map_scale.y,
20.0f,ImgRGBColor(0,0,0),ImgRGBColor(255,255,255));
SlopeMap.MakeRGB24();
}
else
{
PAUSE(("Tctd.ini Not Checked it for Map %s" ,(char *)(LPCSTR)map_name));
HField=MapImage;
SlopeMap=HField;
}
ImgReady=true;
BuildBackBuffer();
Unregister_Object(currentDir);
delete currentDir;
return (1);
}
void COverviewWindow::OnSize(UINT nType, int cx, int cy)
{
BuildBackBuffer();
/*
static int last = 0;
static int recursing = 0;
int width,height;
if (!recursing)
{
recursing = 1;
if (cx != last)
{
width = cx + GetSystemMetrics(SM_CXSIZEFRAME) * 2;
height = cx + GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
last = cx;
SetWindowPos(&wndTop,0,0,width,height,SWP_NOZORDER | SWP_NOMOVE);
}
else if (cy != last)
{
width = cy + GetSystemMetrics(SM_CXSIZEFRAME) * 2;
height = cy + GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
last = cy;
SetWindowPos(&wndTop,0,0,width,height,SWP_NOZORDER | SWP_NOMOVE);
}
recursing = 0;
}
CMDIChildWnd::OnSize(nType, last, last);//cx, cy);
*/
}
void COverviewWindow::OnPaint()
{
CPaintDC dc(this);
//CEditorChildWnd::OnPaint();
DrawWindow();
// Do not call CEditorChildWnd::OnPaint() for painting messages
}
void COverviewWindow::PaintCameraPos(CDC* pDC)
{
if (Player::Instance)
{
LinearMatrix4D localToWorld;
Point3D new_position;
YawPitchRoll new_rotation;
CRect r;
GetClientRect(&r);
localToWorld = Player::Instance->GetLocalToWorld();
new_position = localToWorld;
new_rotation = localToWorld;
CPoint end;
CPen pen(PS_SOLID,1,RGB(255,0,0)), *oldPen;
end.x = int(sin(new_rotation.yaw) * 10.0f);
end.x += cameraClientCoords.x;
end.y = int(cos(new_rotation.yaw) * 10.0f);
end.y += cameraClientCoords.y;
oldPen = pDC->SelectObject(&pen);
pDC->MoveTo(Flip(cameraClientCoords));
pDC->LineTo(Flip(end));
cameraClientCoords.x = long(float(r.right) * float(new_position.x+mapWidth*0.5f) / float(mapWidth));
cameraClientCoords.y = long(float(r.bottom) * float(new_position.z+mapHeight*0.5f) / float(mapHeight));
r.left = cameraClientCoords.x - 2;
r.right = cameraClientCoords.x + 2;
r.top = cameraClientCoords.y - 2;
r.bottom = cameraClientCoords.y + 2;
CRect trect=Flip(r);
pDC->Ellipse(&trect);
pDC->SelectObject(oldPen);
}
}
void COverviewWindow::PaintCircle(CDC* pDC, CPoint point, int extent, COLORREF clr, bool fill)
{
CRect r;
CPen pen(PS_SOLID,1,clr), *oldPen;
point=Flip(point);
oldPen = pDC->SelectObject(&pen);
r.left = point.x - int(extent * xScale);
r.right = point.x + int(extent * xScale);
r.top = point.y - int(extent * yScale);
r.bottom = point.y + int(extent * yScale);
if (fill)
{
CBrush brush(clr), *oldBrush;
oldBrush = pDC->SelectObject(&brush);
pDC->Ellipse(&r);
pDC->SelectObject(oldBrush);
}
else
{
pDC->Ellipse(&r);
}
pDC->SelectObject(oldPen);
}
void COverviewWindow::PaintSquare(CDC* pDC, CPoint point, int extent, COLORREF clr)
{
CRect r;
point=Flip(point);
r.left = point.x - int(extent * xScale);
r.right = point.x + int(extent * xScale);
r.top = point.y - int(extent * yScale);
r.bottom = point.y + int(extent * yScale);
CPen pen(PS_SOLID,1,clr), *oldPen;
CBrush brush(clr), *oldBrush;
oldBrush = pDC->SelectObject(&brush);
oldPen = pDC->SelectObject(&pen);
pDC->Ellipse(&r);
pDC->SelectObject(oldBrush);
pDC->SelectObject(oldPen);
}
void COverviewWindow::PaintTriangle(CDC* pDC, CPoint point, int extent, COLORREF clr, bool fill)
{
CPoint points[4];
point=Flip(point);
points[0].x = point.x;
points[0].y = point.y - int(extent * yScale);
points[1].x = point.x - int(extent * xScale);
points[1].y = point.y + int(extent * yScale);
points[2].x = point.x + int(extent * xScale);
points[2].y = point.y + int(extent * yScale);
points[3].x = point.x;
points[3].y = point.y - int(extent * yScale);
CPen pen(PS_SOLID,1,clr), *oldPen;
CBrush brush(clr), *oldBrush;
oldBrush = pDC->SelectObject(&brush);
oldPen = pDC->SelectObject(&pen);
pDC->Polygon(points,4);
pDC->SelectObject(oldPen);
// pDC->FloodFill(point.x,point.y,clr);
pDC->SelectObject(oldBrush);
}
void COverviewWindow::PaintX(CDC* pDC, CPoint point, COLORREF clr)
{
CPen pen(PS_SOLID,1,clr), *oldPen;
oldPen = pDC->SelectObject(&pen);
point=Flip(point);
pDC->MoveTo(point.x - 2,point.y - 2);
pDC->LineTo(point.x + 2,point.y + 2);
pDC->MoveTo(point.x + 2,point.y - 2);
pDC->LineTo(point.x - 2,point.y + 2);
pDC->SelectObject(oldPen);
}
void COverviewWindow::PaintPlus(CDC* pDC, CPoint point, COLORREF clr)
{
CPen pen(PS_SOLID,1,clr), *oldPen;
oldPen = pDC->SelectObject(&pen);
point=Flip(point);
pDC->MoveTo(point.x - 2,point.y);
pDC->LineTo(point.x + 2,point.y);
pDC->MoveTo(point.x,point.y - 2);
pDC->LineTo(point.x,point.y + 2);
pDC->SelectObject(oldPen);
}
void COverviewWindow::OnLButtonDown(UINT nFlags, CPoint point)
{
if((theApp.m_editorState != CMW4GameEdApp::NoGameIdleState) &&
(Application::Instance->GetApplicationState() == ApplicationStateEngine::RunningGameState))
{
// save the current camera rotation
cameraRotation = Player::Instance->GetLocalToWorld();
SetCameraPos(point);
}
CEditorChildWnd::OnLButtonDown(nFlags, point);
}
void COverviewWindow::OnRButtonDown(UINT nFlags, CPoint point)
{
if((theApp.m_editorState != CMW4GameEdApp::NoGameIdleState) &&
(Application::Instance->GetApplicationState() == ApplicationStateEngine::RunningGameState))
{
// save the current rotation so we don't lose pitch and roll
cameraRotation = Player::Instance->GetLocalToWorld();
SetCameraRot(point);
}
CEditorChildWnd::OnRButtonDown(nFlags, point);
}
void COverviewWindow::OnMouseMove(UINT nFlags, CPoint point)
{
if((theApp.m_editorState != CMW4GameEdApp::NoGameIdleState) &&
(Application::Instance->GetApplicationState() == ApplicationStateEngine::RunningGameState))
{
if (nFlags & MK_LBUTTON)
{
SetCameraPos(point);
}
if (nFlags & MK_RBUTTON)
{
SetCameraRot(point);
}
}
CEditorChildWnd::OnMouseMove(nFlags, point);
}
void COverviewWindow::SetCameraPos()
{
Check_Object(Player::Instance);
Check_Object(Player::Instance->playerInterface);
Stuff::Point3D pos;
pos = Player::Instance->GetLocalToParent();
CRect rect;
GetClientRect(&rect);
cameraClientCoords.x = int(pos.x * (float(rect.right) / float(mapWidth)));
cameraClientCoords.y = int(pos.z * (float(rect.bottom) / float(mapHeight)));
DrawWindow();
}
void COverviewWindow::SetCameraPos(CPoint point)
{
Check_Object(Player::Instance);
Check_Object(Player::Instance->playerInterface);
point=Flip(point);
cameraClientCoords = point;
CRect r;
float x,y;
GetClientRect(&r);
x = float(point.x) / r.right;
y = float(point.y) / r.bottom;
Stuff::LinearMatrix4D newPos = LinearMatrix4D::Identity;
Stuff::Point3D pos;
// rot.yaw = cameraRotation;
// Old code just kept the yaw and not the pitch
// Now we just keep the whole rotation.
//
// Stuff::YawPitchRoll rot = YawPitchRoll::Identity;
Stuff::YawPitchRoll rot = cameraRotation;
pos.x = mapWidth * x;
pos.z = mapHeight * y;
pos.x -= mapWidth * 0.5f;
pos.z -= mapHeight * 0.5f;
if (theApp.cameraFollowing == CAMERA_FOLLOW_NONE)
{
pos.y = theApp.cameraHeight;
}
else
{
Entity::CollisionMask collisionType = (theApp.cameraFollowing == CAMERA_FOLLOW_NONE) ? Entity::AlwaysCollidesMask : Entity::CanBeWalkedOnFlag;
pos.y = theApp.displayWindow->GetMapPointVertical(pos.x,pos.z,collisionType) + theApp.cameraHeight;
}
newPos.BuildTranslation(pos);
newPos.BuildRotation(rot);
Player::Instance->SetNewLocalToParent(newPos);
Player::Instance->SyncMatrices(true);
((CMainFrame*)theApp.m_pMainWnd)->SetGridLocation();
DrawWindow();
}
void COverviewWindow::SetCameraRot()
{
Check_Object(Player::Instance);
Check_Object(Player::Instance->playerInterface);
Stuff::YawPitchRoll rot;
rot = Player::Instance->GetLocalToParent();
// Switching over to using cameraRotation to store the whole rotation data
// cameraRotation = rot.yaw - Pi;
cameraRotation = rot;
InvalidateCamera();
}
void COverviewWindow::SetCameraRot(CPoint point)
{
Check_Object(Player::Instance);
Check_Object(Player::Instance->playerInterface);
point=Flip(point);
CRect r;
GetClientRect(&r);
Stuff::LinearMatrix4D newRot = Player::Instance->GetLocalToParent();
Stuff::Point3D pos;
Stuff::YawPitchRoll rot;
pos = newRot;
rot.pitch = 0;
rot.roll = 0;
float a,b;
if (point.y > cameraClientCoords.y)
{
b = float(point.y - cameraClientCoords.y);
if (point.x > cameraClientCoords.x)
{
a = float(point.x - cameraClientCoords.x);
cameraRotation.yaw = float(Pi + atan(a / b));
}
else
{
a = float(cameraClientCoords.x - point.x);
cameraRotation.yaw = float(Pi - atan(a / b));
}
}
else
{
b = float(cameraClientCoords.y - point.y);
if (point.x > cameraClientCoords.x)
{
if (b == 0.0f)
{
cameraRotation.yaw = 270 * Radians_Per_Degree;
}
else
{
a = float(point.x - cameraClientCoords.x);
cameraRotation.yaw = float(Two_Pi - atan(a / b));
}
}
else
{
if (b == 0.0f)
{
cameraRotation.yaw = 90 * Radians_Per_Degree;
}
else
{
a = float(cameraClientCoords.x - point.x);
cameraRotation.yaw = float(atan(a / b));
}
}
}
cameraRotation.yaw -= Pi;
// rot.yaw = cameraRotation;
rot = cameraRotation;
newRot.BuildTranslation(pos);
newRot.BuildRotation(rot);
Player::Instance->SetNewLocalToParent(newRot);
Player::Instance->SyncMatrices(true);
InvalidateCamera();
}
void COverviewWindow::InvalidateCamera()
{
CRect r;
r.top = cameraClientCoords.y - 11;
r.left = cameraClientCoords.x - 11;
r.right = cameraClientCoords.x + 11;
r.bottom = cameraClientCoords.y + 11;
DrawWindow();
}
void COverviewWindow::UpdateCamera()
{
SetCameraPos();
SetCameraRot();
}
void COverviewWindow::DrawWindow()
{
CDC *pDC=GetDC();
if(Application::Instance->GetApplicationState() == ApplicationStateEngine::RunningGameState &&
BBufReady )
{
CRect destrect;
GetClientRect(&destrect);
CDC memDC;
memDC.CreateCompatibleDC(pDC);
memDC.SelectObject(BackBuffer);
pDC->BitBlt(0,0,destrect.Width(),destrect.Height(),&memDC,0,0,SRCCOPY);
Check_Object(Map::Instance);
ChainIteratorOf<Entity *> iterator(&Map::Instance->childEntityChain);
Entity* entity;
xScale = (float)(destrect.right) * 1.0f / (float)(mapWidth);
yScale = (float)(destrect.bottom) * 1.0f / (float)(mapHeight);
while((entity = iterator.ReadAndNext()) != NULL)
{
Check_Object(entity);
COLORREF color;
Point3D point3d;
CPoint point;
point3d = entity->GetLocalToWorld();
point.x = (int)((point3d.x+mapWidth*0.5f) * xScale);
point.y = (int)((point3d.z+mapHeight*0.5f) * yScale);
if (entity->IsDerivedFrom(EditorLatticeNode::DefaultData))
{
if (theApp.m_showLattice)
{
point=Flip(point);
pDC->SetPixel(point.x,point.y,RGB(0,255,255));
pDC->SetPixel(point.x - 1,point.y,RGB(0,255,255));
pDC->SetPixel(point.x,point.y - 1,RGB(0,255,255));
pDC->SetPixel(point.x + 1,point.y,RGB(0,255,255));
pDC->SetPixel(point.x,point.y + 1,RGB(0,255,255));
}
continue;
}
if (entity->IsDerivedFrom(EditorBoundaryNode::DefaultData))
{
if (theApp.m_showBoundary)
{
EditorBoundaryNode* node, *start;
start = Cast_Object(EditorBoundaryNode*,entity);
node = start->nextnode;
pDC->MoveTo(point.x,point.y);
CPen pen(PS_DASH,0,RGB(255,0,0)), *oldPen;
oldPen = pDC->SelectObject(&pen);
while (node != start)
{
point3d = node->GetLocalToWorld();
CPoint pnt;
pnt.x=int((point3d.x+mapWidth*0.5f) * xScale);
pnt.y=int((point3d.z+mapHeight*0.5f) * yScale);
pnt=Flip(pnt);
pDC->LineTo(pnt);
node = node->nextnode;
}
point3d = node->GetLocalToWorld();
CPoint pnt;
pnt.x=int((point3d.x+mapWidth*0.5f) * xScale);
pnt.y=int((point3d.z+mapHeight*0.5f) * yScale);
pnt=Flip(pnt);
pDC->LineTo(pnt);
pDC->SelectObject(oldPen);
}
continue;
}
if (entity->IsDerivedFrom(EditorMovementPath::DefaultData))
{
if (theApp.m_showPaths)
{
EditorMovementPath* path;
EditorPathNode* node;
path = Cast_Object(EditorMovementPath*,entity);
ChainIteratorOf<EditorPathNode*> iterator(&path->pathNodes);
switch (path->alignment)
{
default:
case Entity::DefaultAlignment:
color = RGB(128,128,128);
break;
case Entity::Player:
color = RGB(0,255,255);
break;
case Entity::Enemy:
color = RGB(255,0,0);
break;
case Entity::Team1:
color = RGB(0,0,255);
break;
case Entity::Team2:
color = RGB(255,255,0);
break;
case Entity::Team3:
color = RGB(255,0,255);
break;
case Entity::Team4:
color = RGB(0,255,0);
break;
}
while ((node = iterator.ReadAndNext()) != NULL)
{
point3d = node->GetLocalToWorld();
point.x = int((point3d.x+mapWidth*0.5f) * xScale);
point.y = int((point3d.z+mapHeight*0.5f) * yScale);
PaintCircle(pDC,point,15,color);
point=Flip(point);
if (node->prevnode)
{
CPen pen(PS_SOLID,1,color), *oldPen;
oldPen = pDC->SelectObject(&pen);
pDC->MoveTo(point);
point3d = node->prevnode->GetLocalToWorld();
point.x = int((point3d.x+mapWidth*0.5f)* xScale);
point.y = int((point3d.z+mapHeight*0.5f) * yScale);
point=Flip(point);
pDC->LineTo(point);
pDC->SelectObject(oldPen);
}
}
}
continue;
}
switch (entity->alignment)
{
default:
case Entity::DefaultAlignment:
color = RGB(128,128,128);
break;
case Entity::Player:
color = RGB(0,255,255);
break;
case Entity::Enemy:
color = RGB(255,0,0);
break;
case Entity::Team1:
color = RGB(0,0,255);
break;
case Entity::Team2:
color = RGB(255,255,0);
break;
case Entity::Team3:
color = RGB(255,0,255);
break;
case Entity::Team4:
color = RGB(0,255,0);
break;
}
int extent = 5; // this is the radius of the object so we can scale our shapes to the window size
ElementRenderer::Element* element;
element = entity->GetElement();
if (element->IsBoundedBySphere())
{
extent = int(element->GetWorldOBB().sphereRadius);
}
else if (element->IsBoundedByOBB())
{
// handle OBB's when they come online.
extent = 5;
}
if (entity->IsDerivedFrom(MechWarrior4::Mech::DefaultData))
{
PaintTriangle(pDC,point,extent,color,true);
}
else if (entity->IsDerivedFrom(MechWarrior4::Vehicle::DefaultData))
{
PaintTriangle(pDC,point,extent,color);
}
else if (entity->IsDerivedFrom(MechWarrior4::Building::DefaultData))
{
PaintSquare(pDC,point,extent,color);
}
/* Objectives have no position
else if (entity->IsDerivedFrom(EditorObjectiveMarker::DefaultData))
{
EditorObjectiveMarker* marker;
marker = Cast_Object(EditorObjectiveMarker*,entity);
PaintCircle(pDC,point,color,marker->objective->m_Primary);
}
*/
}
PaintCameraPos(pDC);
}
else
{
CRect r;
GetClientRect(&r);
pDC->FillSolidRect(&r,RGB(0,0,0));
}
ReleaseDC(pDC);
}
void COverviewWindow::BuildBackBuffer()
{
if(!ImgReady) return;
CDC *pDC=GetDC();
BackBuffer.DeleteObject();
CRect rect;
pDC->SetStretchBltMode(COLORONCOLOR);
GetClientRect(&rect);
BackBuffer.CreateCompatibleBitmap(pDC,rect.Width(),rect.Height());
CDC memDC;
memDC.CreateCompatibleDC(pDC);
memDC.SelectObject(BackBuffer);
Image *bimage=NULL;
BITMAPINFO binf;
switch(CurrentVMode)
{
case VM_TEXTURE: bimage=&MapImage; break;
case VM_HFIELD: bimage=&HField; break;
case VM_SLOPEMAP: bimage=&SlopeMap; break;
default:
STOP(("Invalid Mode"));
}
ZeroMemory(&binf,sizeof(binf));
binf.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
binf.bmiHeader.biWidth=bimage->GetWidth();
binf.bmiHeader.biHeight=-bimage->GetHeight();
binf.bmiHeader.biPlanes=1;
binf.bmiHeader.biBitCount=(unsigned short)bimage->GetBpp();
binf.bmiHeader.biCompression=BI_RGB;
Verify(binf.bmiHeader.biBitCount==24 || binf.bmiHeader.biBitCount==32);
int res;
res=StretchDIBits(memDC,0,0,rect.Width(),rect.Height(),
0,0,bimage->GetWidth(),bimage->GetHeight(),
bimage->Lock(),&binf,DIB_RGB_COLORS,SRCCOPY);
Verify(res!=0);
bimage->UnLock();
ReleaseDC(pDC);
BBufReady=true;
}
CPoint COverviewWindow::Flip(CPoint pnt)
{
CRect crect;
GetClientRect(&crect);
pnt.x=crect.Width()-pnt.x;
pnt.y=crect.Height()-pnt.y;
return pnt;
}
CRect COverviewWindow::Flip(CRect rct)
{
CRect crect;
GetClientRect(&crect);
rct.left=crect.Width()-rct.left;
rct.right=crect.Width()-rct.right;
rct.top=crect.Height()-rct.top;
rct.bottom=crect.Height()-rct.bottom;
return rct;
}
@@ -0,0 +1,90 @@
#if !defined(AFX_OVERVIEWWINDOW1_H__E61E44A5_CD65_11D2_8457_00105A17BC83__INCLUDED_)
#define AFX_OVERVIEWWINDOW1_H__E61E44A5_CD65_11D2_8457_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// OverviewWindow1.h : header file
//
#include "EditorChildWnd.h"
#include <Adept\AdeptHeaders.hpp>
#include <ImageLib\Image.h>
/////////////////////////////////////////////////////////////////////////////
// COverviewWindow frame
class COverviewWindow : public CEditorChildWnd
{
DECLARE_DYNCREATE(COverviewWindow)
protected:
CPoint cameraClientCoords;
Image MapImage,HField,SlopeMap;
CBitmap BackBuffer;
// float cameraRotation; // in radians
Stuff::YawPitchRoll cameraRotation;
float xScale;
float yScale;
// Attributes
public:
enum ViewMode {VM_TEXTURE,VM_HFIELD,VM_SLOPEMAP};
bool ImgReady,BBufReady;
int mapWidth;
int mapHeight;
ViewMode CurrentVMode;
// Operations
public:
COverviewWindow(); // protected constructor used by dynamic creation
virtual ~COverviewWindow();
int LoadImageFromMissionInstance(const char* game_name);
void InvalidateCamera();
void BuildBackBuffer();
void SetCameraPos();
void SetCameraPos(CPoint point);
void SetCameraRot();
void SetCameraRot(CPoint point);
void UpdateCamera();
void DrawWindow();
CPoint Flip(CPoint pnt);
CRect Flip(CRect rct);
void PaintCircle(CDC* pDC, CPoint point, int extent, COLORREF clr, bool fill = false);
void PaintSquare(CDC* pDC, CPoint point, int extent, COLORREF clr);
void PaintTriangle(CDC* pDC, CPoint point, int extent, COLORREF clr, bool fill = false);
void PaintX(CDC* pDC, CPoint point, COLORREF clr);
void PaintPlus(CDC* pDC, CPoint point, COLORREF clr);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COverviewWindow)
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(COverviewWindow)
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void PaintCameraPos(CDC* pDC);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OVERVIEWWINDOW1_H__E61E44A5_CD65_11D2_8457_00105A17BC83__INCLUDED_)
@@ -0,0 +1,196 @@
// ProgDlg.cpp : implementation file
// CG: This file was added by the Progress Dialog component
#include "stdafx.h"
#include "resource.h"
#include "ProgDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg dialog
CProgressDlg::CProgressDlg(UINT nCaptionID)
{
m_nCaptionID = CG_IDS_PROGRESS_CAPTION;
if (nCaptionID != 0)
m_nCaptionID = nCaptionID;
m_nLower=0;
m_nUpper=100;
m_nStep=1;
//{{AFX_DATA_INIT(CProgressDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bParentDisabled = FALSE;
}
CProgressDlg::~CProgressDlg()
{
if(m_hWnd!=NULL)
DestroyWindow();
}
BOOL CProgressDlg::DestroyWindow()
{
ReEnableParent();
return CDialog::DestroyWindow();
}
void CProgressDlg::ReEnableParent()
{
if(m_bParentDisabled && (m_pParentWnd!=NULL))
m_pParentWnd->EnableWindow(TRUE);
m_bParentDisabled=FALSE;
}
BOOL CProgressDlg::Create(CWnd *pParent)
{
// Get the true parent of the dialog
m_pParentWnd = CWnd::GetSafeOwner(pParent);
// m_bParentDisabled is used to re-enable the parent window
// when the dialog is destroyed. So we don't want to set
// it to TRUE unless the parent was already enabled.
if((m_pParentWnd!=NULL) && m_pParentWnd->IsWindowEnabled())
{
m_pParentWnd->EnableWindow(FALSE);
m_bParentDisabled = TRUE;
}
if(!CDialog::Create(CProgressDlg::IDD,pParent))
{
ReEnableParent();
return FALSE;
}
return TRUE;
}
void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProgressDlg)
DDX_Control(pDX, CG_IDC_PROGDLG_PROGRESS, m_Progress);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
//{{AFX_MSG_MAP(CProgressDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CProgressDlg::OnCancel()
{
}
void CProgressDlg::SetRange(int nLower,int nUpper)
{
m_nLower = nLower;
m_nUpper = nUpper;
m_Progress.SetRange(short(nLower),short(nUpper));
}
int CProgressDlg::SetPos(int nPos)
{
PumpMessages();
int iResult = m_Progress.SetPos(nPos);
UpdatePercent(nPos);
return iResult;
}
int CProgressDlg::SetStep(int nStep)
{
m_nStep = nStep; // Store for later use in calculating percentage
return m_Progress.SetStep(nStep);
}
int CProgressDlg::OffsetPos(int nPos)
{
PumpMessages();
int iResult = m_Progress.OffsetPos(nPos);
UpdatePercent(iResult+nPos);
return iResult;
}
int CProgressDlg::StepIt()
{
PumpMessages();
int iResult = m_Progress.StepIt();
UpdatePercent(iResult+m_nStep);
return iResult;
}
void CProgressDlg::PumpMessages()
{
// Must call Create() before using the dialog
ASSERT(m_hWnd!=NULL);
MSG msg;
// Handle dialog messages
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(!IsDialogMessage(&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
void CProgressDlg::UpdatePercent(int nNewPos)
{
CWnd *pWndPercent = GetDlgItem(CG_IDC_PROGDLG_PERCENT);
int nPercent;
int nDivisor = m_nUpper - m_nLower;
ASSERT(nDivisor>0); // m_nLower should be smaller than m_nUpper
int nDividend = (nNewPos - m_nLower);
ASSERT(nDividend>=0); // Current position should be greater than m_nLower
nPercent = nDividend * 100 / nDivisor;
// Since the Progress Control wraps, we will wrap the percentage
// along with it. However, don't reset 100% back to 0%
if(nPercent!=100)
nPercent %= 100;
// Display the percentage
CString strBuf;
strBuf.Format(_T("%d%c"),nPercent,_T('%'));
CString strCur; // get current percentage
pWndPercent->GetWindowText(strCur);
if (strCur != strBuf)
pWndPercent->SetWindowText(strBuf);
}
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg message handlers
BOOL CProgressDlg::OnInitDialog()
{
CDialog::OnInitDialog();
/*
m_Progress.SetRange(short(m_nLower),short(m_nUpper));
m_Progress.SetStep(m_nStep);
m_Progress.SetPos(m_nLower);
*/
m_Progress.SetRange(0,100);
m_Progress.SetStep(1);
m_Progress.SetPos(0);
CString strCaption;
VERIFY(strCaption.LoadString(m_nCaptionID));
SetWindowText(strCaption);
return TRUE;
}
@@ -0,0 +1,63 @@
// ProgDlg.h : header file
// CG: This file was added by the Progress Dialog component
/////////////////////////////////////////////////////////////////////////////
// CProgressDlg dialog
#ifndef __PROGDLG_H__
#define __PROGDLG_H__
class CProgressDlg : public CDialog
{
// Construction / Destruction
public:
CProgressDlg(UINT nCaptionID = 0); // standard constructor
~CProgressDlg();
BOOL Create(CWnd *pParent=NULL);
// Progress Dialog manipulation
void SetRange(int nLower,int nUpper);
int SetStep(int nStep);
int SetPos(int nPos);
int OffsetPos(int nPos);
int StepIt();
// Dialog Data
//{{AFX_DATA(CProgressDlg)
enum { IDD = CG_IDD_PROGRESS };
CProgressCtrl m_Progress;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProgressDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
UINT m_nCaptionID;
int m_nLower;
int m_nUpper;
int m_nStep;
BOOL m_bParentDisabled;
void ReEnableParent();
virtual void OnCancel();
virtual void OnOK() {};
void UpdatePercent(int nCurrent);
void PumpMessages();
// Generated message map functions
//{{AFX_MSG(CProgressDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // __PROGDLG_H__
+102
View File
@@ -0,0 +1,102 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : MW4GameEd
========================================================================
AppWizard has created this MW4GameEd application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your MW4GameEd application.
MW4GameEd.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
MW4GameEd.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CMW4GameEdApp application class.
MW4GameEd.cpp
This is the main application source file that contains the application
class CMW4GameEdApp.
MW4GameEd.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
MW4GameEd.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\MW4GameEd.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file MW4GameEd.rc.
res\MW4GameEd.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CMDIFrameWnd and controls all MDI frame features.
res\Toolbar.bmp
This bitmap file is used to create tiled images for the toolbar.
The initial toolbar and status bar are constructed in the CMainFrame
class. Edit this toolbar bitmap using the resource editor, and
update the IDR_MAINFRAME TOOLBAR array in MW4GameEd.rc to add
toolbar buttons.
/////////////////////////////////////////////////////////////////////////////
For the child frame window:
ChildFrm.h, ChildFrm.cpp
These files define and implement the CChildFrame class, which
supports the child windows in an MDI application.
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named MW4GameEd.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////
Binary file not shown.
@@ -0,0 +1,57 @@
//
// MW4GAMEED.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
// Version info is now here since it does not just have magic numbers any more
// and we don't want VC to change this info while we're not paying attention.
#include "..\buildnum\buildnum.h" // get the current build number
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_PRODUCTVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK 0x3fL //VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS 0x1L //VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L //VOS__WINDOWS32
FILETYPE 0x1L //VFT_APP
FILESUBTYPE 0x0L //VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Microsoft Corp.\0"
VALUE "FileDescription", "MechWarrior IV Mission Editor\0"
VALUE "FileVersion", VER_PRODUCTVERSION_STR
VALUE "InternalName", "MUGE\0"
VALUE "LegalCopyright", VER_COPYRIGHT_STR
VALUE "LegalTrademarks", VER_LEGALTRADEMARKS_STR
VALUE "OriginalFilename", "MW4GameEd.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "MechWarrior IV Game Editor\0"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,111 @@
#if !defined(AFX_RESOURCEWINDOW_H__AA251684_4BCA_11D2_8455_00105A17BC83__INCLUDED_)
#define AFX_RESOURCEWINDOW_H__AA251684_4BCA_11D2_8455_00105A17BC83__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ResourceWindow.h : header file
//
#include "TagListDlg.h"
#include "ObjWindow.h"
#include "EditorChildWnd.h"
#include <Adept\Entity.hpp>
namespace MechWarrior4
{
class Path;
}
/////////////////////////////////////////////////////////////////////////////
// CResourceWindow frame
class CResourceWindow : public CEditorChildWnd
{
//friend class CTagListDlg;
DECLARE_DYNCREATE(CResourceWindow)
protected:
// Attributes
public:
// Operations
public:
CResourceWindow(); // protected constructor used by dynamic creation
virtual ~CResourceWindow();
CObjWindow
*TLDlg;
int
numEntitiesAdded;
MString
AssignObjectName(MString name, int *num);
bool
CheckObjectName(MString name);
void
MakeDirectoryList(
Stuff::Directory *current_directory,
int tabNumber,
Stuff::MString directory_name
);
Adept::Entity*
CreateNewInstance(Adept::Entity* entity = NULL);
Adept::Entity*
CResourceWindow::CreateNewInstance(char* game_model_name, char* entity_name, char* instance_name);
MechWarrior4::Path*
CreateMovementPath();
Stuff::NotationFile
*objectInformation;
Stuff::ChainOf<TabList *>
mechList;
Stuff::ChainOf<TabList *>
buildingList;
Stuff::ChainOf<TabList *>
vehicleList;
Stuff::ChainOf<TabList *>
miscList;
ChainIteratorOf<TabList*> *tabListIterator;
void DisperseWithBitmap(bool cultural_flag=false);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CResourceWindow)
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CResourceWindow)
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnPaint();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void FillTabBox(int tabNumber);
void FillTabBox(ChainIteratorOf<TabList*> &iterator);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESOURCEWINDOW_H__AA251684_4BCA_11D2_8455_00105A17BC83__INCLUDED_)

Some files were not shown because too many files have changed in this diff Show More