SBSPSS/Utils/MapEdit/LayerItem.cpp

131 lines
3.5 KiB
C++
Raw Normal View History

2001-03-29 19:59:01 +02:00
/**********************/
2001-03-13 22:00:34 +01:00
/*** Layer Item ***/
2001-03-29 19:59:01 +02:00
/**********************/
2001-03-13 15:37:04 +01: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"
2001-03-26 23:29:09 +02:00
#include "LayerThing.h"
2001-03-13 22:00:34 +01:00
#include "LayerItem.h"
2001-03-13 15:37:04 +01:00
#include "Utils.h"
#include "Export.h"
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
CLayerItem::CLayerItem(sLayerDef &Def)
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
InitLayer(Def);
2001-03-13 15:37:04 +01:00
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::InitLayer(sLayerDef &Def)
{
CLayerThing::InitLayer(Def);
LoadThingScript(theApp.GetConfigStr("LayerScript","ItemScript"));
}
2001-03-13 15:37:04 +01:00
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::InitSubView(CCore *Core)
2001-03-13 15:37:04 +01:00
{
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
/*** Gui *********************************************************************/
/*****************************************************************************/
void CLayerItem::GUIInit(CCore *Core)
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
// GUI.DisableCallback(true);
2001-03-31 03:30:53 +02:00
Core->GUIAdd(GUI,IDD_LAYER_ITEM);
2001-03-29 19:59:01 +02:00
// GUI.DisableCallback(false);
2001-03-13 15:37:04 +01:00
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::GUIKill(CCore *Core)
2001-03-13 15:37:04 +01:00
{
2001-03-31 03:30:53 +02:00
Core->GUIRemove(GUI,IDD_LAYER_ITEM);
2001-03-13 15:37:04 +01:00
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::GUIUpdate(CCore *Core)
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
int i,ListSize;
CComboBox &List=GUI.m_List;
// Setup Def Item List
ListSize=DefList.size();
List.ResetContent();
for (i=0; i<ListSize; i++)
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
List.AddString(DefList[i].Name);
2001-03-13 15:37:04 +01:00
}
2001-03-29 19:59:01 +02:00
List.SetCurSel(CurrentDefThing);
2001-03-31 03:30:53 +02:00
// GUIThingUpdate();
2001-03-13 15:37:04 +01:00
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::GUIThingDefClear()
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
CComboBox &List=GUI.m_List;
CurrentDefThing=-1;
List.SetCurSel(CurrentDefThing);
2001-03-13 15:37:04 +01:00
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::GUIThingUpdate()
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
int i,ListSize;
CComboBox &List=GUI.m_LevelList;
// Setup ThingList
ListSize=ThingList.size();
TRACE1("%i\n",ListSize);
List.ResetContent();
for (i=0; i<ListSize; i++)
{
List.AddString(ThingList[i].Name);
}
List.SetCurSel(CurrentThing);
GUIThingPointUpdate();
2001-03-13 15:37:04 +01:00
}
/*****************************************************************************/
2001-03-13 22:00:34 +01:00
void CLayerItem::GUIChanged(CCore *Core)
2001-03-13 15:37:04 +01:00
{
}
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
/*** Functions ***************************************************************/
2001-03-13 15:37:04 +01:00
/*****************************************************************************/
2001-03-29 19:59:01 +02:00
void CLayerItem::ExportThing(CExport &Exp,sLayerThing &ThisThing)
2001-03-13 15:37:04 +01:00
{
2001-03-29 19:59:01 +02:00
/*
int i,ListSize=ThisThing.XY.size();
sExpLayerItem OutThing;
// Point List
Exp.Write(&ListSize,sizeof(int));
for (i=0 ;i<ListSize; i++)
{
Exp.Write(&ThisThing.XY[i],sizeof(CPoint));
}
// Thing
OutThing.Health=ThisThing.Data.Health;
OutThing.AttackStrength=ThisThing.Data.AttackStrength;
OutThing.Speed=ThisThing.Data.Speed;
OutThing.TurnRate=ThisThing.Data.TurnRate;
OutThing.CollisionFlag=ThisThing.Data.CollisionFlag;
OutThing.PlayerFlag=ThisThing.Data.PlayerFlag;
Exp.Write(&OutThing,sizeof(sExpLayerItem));
*/
2001-03-13 15:37:04 +01:00
}