2001-03-26 23:29:09 +02:00
|
|
|
/**********************/
|
|
|
|
/*** Layer Platform ***/
|
|
|
|
/**********************/
|
2001-03-26 17:34:29 +02:00
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <Vector3.h>
|
|
|
|
#include <gl\gl.h>
|
|
|
|
#include <gl\glu.h>
|
|
|
|
#include "GLEnabledView.h"
|
|
|
|
|
|
|
|
#include "MapEdit.h"
|
|
|
|
#include "MapEditDoc.h"
|
|
|
|
#include "MapEditView.h"
|
|
|
|
#include "MainFrm.h"
|
|
|
|
|
|
|
|
#include "Core.h"
|
|
|
|
#include "LayerThing.h"
|
2001-03-26 23:29:09 +02:00
|
|
|
#include "LayerPlatform.h"
|
2001-03-26 17:34:29 +02:00
|
|
|
#include "Utils.h"
|
|
|
|
#include "Export.h"
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
CLayerPlatform::CLayerPlatform(sLayerDef &Def)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-03-29 19:59:01 +02:00
|
|
|
InitLayer(Def);
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
void CLayerPlatform::InitLayer(sLayerDef &Def)
|
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
ThingBank=new CElemBank(-1,-1,false,CElem::CentreModeLR /*| CElem::CentreModeB*/);
|
2001-03-29 19:59:01 +02:00
|
|
|
CLayerThing::InitLayer(Def);
|
|
|
|
LoadThingScript(theApp.GetConfigStr("LayerScript","PlatformScript"));
|
|
|
|
}
|
2001-03-26 23:29:09 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
void CLayerPlatform::InitSubView(CCore *Core)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-04-30 23:49:54 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::LoadDefThing(const char *Name,sLayerThing &ThisDef)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::LoadOldThing(CFile *File,sLayerThing &ThisThing)
|
|
|
|
{
|
|
|
|
sLayerThingDataOLD OldThing;
|
|
|
|
|
|
|
|
File->Read(&OldThing,sizeof(sLayerThingDataOLD));
|
|
|
|
ThisThing.Data.Platform.PlatformSpeed=OldThing.Speed;
|
|
|
|
ThisThing.Data.Platform.PlatformTurnRate=OldThing.TurnRate;
|
|
|
|
ThisThing.Data.Platform.PlatformType=OldThing.PlatformType;
|
|
|
|
ThisThing.Data.Platform.PlatformMoveType=OldThing.MoveType;
|
|
|
|
ThisThing.Data.Platform.PlatformCollisionFlag=OldThing.CollisionFlag;
|
|
|
|
ThisThing.Data.Platform.PlatformTriCount=OldThing.TriCount; // Not needed but what the hell!!
|
|
|
|
ThisThing.Data.Platform.PlatformTriStart=OldThing.TriStart; // Not needed but what the hell!!
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-26 17:34:29 +02:00
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
/*** Gui *********************************************************************/
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::GUIInit(CCore *Core)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
GUIPlatform.DisableCallback(true);
|
|
|
|
Core->GUIAdd(GUIThing,IDD_LAYER_THING);
|
|
|
|
Core->GUIAdd(GUIThingPos,IDD_LAYER_THING_POS);
|
|
|
|
Core->GUIAdd(GUIPlatform,IDD_LAYER_PLATFORM);
|
|
|
|
GUIPlatform.DisableCallback(false);
|
|
|
|
|
2001-04-09 16:56:05 +02:00
|
|
|
GUIPlatform.m_SpeedSpin.SetRange(0,255);
|
|
|
|
GUIPlatform.m_TurnRateSpin.SetRange(0,255);
|
2001-05-05 23:18:12 +02:00
|
|
|
GUIPlatform.m_Param0Spin.SetRange(0,255);
|
2001-04-09 16:56:05 +02:00
|
|
|
|
2001-04-07 23:05:33 +02:00
|
|
|
// Init type lists
|
|
|
|
{
|
|
|
|
CComboBox &List=GUIPlatform.m_MoveList;
|
|
|
|
List.AddString("Linear");
|
|
|
|
List.AddString("Circular");
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
CComboBox &List=GUIPlatform.m_Type;
|
|
|
|
List.AddString("Normal");
|
|
|
|
List.AddString("Weighted");
|
|
|
|
List.AddString("Rotating");
|
|
|
|
}
|
2001-05-05 23:18:12 +02:00
|
|
|
GUIPlatform.m_Param0Txt.ShowWindow(SW_HIDE);
|
|
|
|
GUIPlatform.m_Param0.ShowWindow(SW_HIDE);
|
|
|
|
GUIPlatform.m_Param0Spin.ShowWindow(SW_HIDE);
|
|
|
|
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
void CLayerPlatform::GUIKill(CCore *Core)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
Core->GUIRemove(GUIThing,IDD_LAYER_THING);
|
|
|
|
Core->GUIRemove(GUIThingPos,IDD_LAYER_THING_POS);
|
|
|
|
Core->GUIRemove(GUIPlatform,IDD_LAYER_PLATFORM);
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
void CLayerPlatform::GUIUpdate(CCore *Core)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-03-29 19:59:01 +02:00
|
|
|
int i,ListSize;
|
2001-04-07 23:05:33 +02:00
|
|
|
CComboBox &List=GUIThing.m_DefList;
|
2001-03-29 19:59:01 +02:00
|
|
|
|
|
|
|
// Setup Def Platform List
|
|
|
|
ListSize=DefList.size();
|
|
|
|
List.ResetContent();
|
|
|
|
for (i=0; i<ListSize; i++)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-03-29 19:59:01 +02:00
|
|
|
List.AddString(DefList[i].Name);
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
2001-03-29 19:59:01 +02:00
|
|
|
List.SetCurSel(CurrentDefThing);
|
|
|
|
|
|
|
|
GUIThingUpdate();
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-29 19:59:01 +02:00
|
|
|
void CLayerPlatform::GUIThingDefClear()
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
CComboBox &List=GUIThing.m_DefList;
|
2001-03-29 19:59:01 +02:00
|
|
|
CurrentDefThing=-1;
|
|
|
|
List.SetCurSel(CurrentDefThing);
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-31 17:40:20 +02:00
|
|
|
void CLayerPlatform::GUIThingUpdate(bool OnlySel)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
GUIThingUpdateList(GUIThing.m_List,false);
|
|
|
|
// Params
|
|
|
|
GUIPlatform.DisableCallback(true);
|
|
|
|
if (CurrentThing!=-1)
|
2001-03-29 19:59:01 +02:00
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
sLayerThing &ThisThing=ThingList[CurrentThing];
|
2001-04-30 23:49:54 +02:00
|
|
|
GUIPlatform.SetVal(GUIPlatform.m_Speed,ThisThing.Data.Platform.PlatformSpeed);
|
|
|
|
GUIPlatform.SetVal(GUIPlatform.m_TurnRate,ThisThing.Data.Platform.PlatformTurnRate);
|
|
|
|
GUIPlatform.m_Collision.SetCheck(ThisThing.Data.Platform.PlatformCollisionFlag);
|
|
|
|
GUIPlatform.m_MoveList.SetCurSel(ThisThing.Data.Platform.PlatformMoveType);
|
|
|
|
GUIPlatform.m_Type.SetCurSel(ThisThing.Data.Platform.PlatformType);
|
2001-05-05 23:18:12 +02:00
|
|
|
// Additional Params
|
|
|
|
char *Param0Txt=ThingScript.GetStr(ThisThing.Name,"Param0");
|
|
|
|
if (Param0Txt)
|
|
|
|
{
|
|
|
|
GUIPlatform.m_Param0Txt.SetWindowText(Param0Txt);
|
|
|
|
GUIPlatform.SetVal(GUIPlatform.m_Param0,ThisThing.Data.Platform.PlatformParam0);
|
|
|
|
GUIPlatform.m_Param0Txt.ShowWindow(SW_SHOW);
|
|
|
|
GUIPlatform.m_Param0.ShowWindow(SW_SHOW);
|
|
|
|
GUIPlatform.m_Param0Spin.ShowWindow(SW_SHOW);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GUIPlatform.m_Param0Txt.ShowWindow(SW_HIDE);
|
|
|
|
GUIPlatform.m_Param0.ShowWindow(SW_HIDE);
|
|
|
|
GUIPlatform.m_Param0Spin.ShowWindow(SW_HIDE);
|
|
|
|
}
|
2001-03-29 19:59:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-07 23:05:33 +02:00
|
|
|
GUIPlatform.m_Speed.SetWindowText("");
|
|
|
|
GUIPlatform.m_TurnRate.SetWindowText("");
|
|
|
|
GUIPlatform.m_Collision.SetCheck(false);
|
|
|
|
GUIPlatform.m_MoveList.SetCurSel(-1);
|
|
|
|
GUIPlatform.m_Type.SetCurSel(-1);
|
2001-05-05 23:18:12 +02:00
|
|
|
|
2001-03-29 19:59:01 +02:00
|
|
|
}
|
2001-04-07 23:05:33 +02:00
|
|
|
GUIPlatform.DisableCallback(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::GUIThingPointUpdate(bool OnlySel)
|
|
|
|
{
|
|
|
|
GUIThingPointUpdateList(GUIThingPos.m_List,OnlySel);
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2001-03-26 23:29:09 +02:00
|
|
|
void CLayerPlatform::GUIChanged(CCore *Core)
|
2001-03-26 17:34:29 +02:00
|
|
|
{
|
2001-03-29 19:59:01 +02:00
|
|
|
if (CurrentThing!=-1)
|
|
|
|
{
|
|
|
|
sLayerThing &ThisThing=ThingList[CurrentThing];
|
2001-04-30 23:49:54 +02:00
|
|
|
ThisThing.Data.Platform.PlatformSpeed=GUIPlatform.GetVal(GUIPlatform.m_Speed);
|
|
|
|
ThisThing.Data.Platform.PlatformTurnRate=GUIPlatform.GetVal(GUIPlatform.m_TurnRate);
|
|
|
|
ThisThing.Data.Platform.PlatformCollisionFlag=GUIPlatform.m_Collision.GetCheck()!=0;
|
|
|
|
ThisThing.Data.Platform.PlatformMoveType=GUIPlatform.m_MoveList.GetCurSel();
|
|
|
|
ThisThing.Data.Platform.PlatformType=GUIPlatform.m_Type.GetCurSel();
|
2001-05-05 23:18:12 +02:00
|
|
|
ThisThing.Data.Platform.PlatformParam0=GUIPlatform.GetVal(GUIPlatform.m_Param0);
|
2001-04-07 23:05:33 +02:00
|
|
|
SetThingParams(ThisThing);
|
2001-03-29 19:59:01 +02:00
|
|
|
}
|
2001-03-26 17:34:29 +02:00
|
|
|
}
|
|
|
|
|
2001-04-07 23:05:33 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::SetThingParams(sLayerThing &Thing)
|
|
|
|
{
|
2001-04-30 23:49:54 +02:00
|
|
|
switch(Thing.Data.Platform.PlatformMoveType)
|
2001-04-07 23:05:33 +02:00
|
|
|
{
|
|
|
|
case MoveTypeLinear:
|
|
|
|
Thing.Data.WaypointCount=16;
|
|
|
|
break;
|
|
|
|
case MoveTypeCirular:
|
|
|
|
Thing.Data.WaypointCount=1;
|
|
|
|
if (Thing.XY.size()>2)
|
|
|
|
{
|
|
|
|
Thing.XY.resize(2);
|
|
|
|
GUIThingPointUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-04-23 16:51:44 +02:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::Export(CCore *Core,CExport &Exp)
|
|
|
|
{
|
|
|
|
CLayerThing::Export(Core,Exp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
void CLayerPlatform::ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing)
|
|
|
|
{
|
|
|
|
CElem &ThisElem=ThingBank->GetElem(ThisThing.ElemID,0);
|
|
|
|
|
2001-04-30 23:49:54 +02:00
|
|
|
Exp.ExportElem3d(Core,ThisElem,OutThing.Platform.PlatformTriStart,OutThing.Platform.PlatformTriCount);
|
2001-04-23 16:51:44 +02:00
|
|
|
|
|
|
|
}
|