This commit is contained in:
Daveo 2001-05-09 21:56:48 +00:00
parent cd80039a6c
commit efafaba4ba
28 changed files with 246 additions and 188 deletions

View file

@ -28,12 +28,13 @@ enum CmdMsg
CmdMsg_SubViewUpdate, // 15
CmdMsg_SubViewSet, // 16
// TileLayer/TileBank
// Elem
CmdMsg_MirrorX, // 17
CmdMsg_MirrorY, // 18
CmdMsg_SetColFlag, // 19
CmdMsg_ActiveBrushLeft, // 20
CmdMsg_ActiveBrushRight, // 21
CmdMsg_Rotate, // 19
CmdMsg_SetColFlag, // 20
CmdMsg_ActiveBrushLeft, // 21
CmdMsg_ActiveBrushRight, // 22
// Thing
CmdMsg_ThingListDelete, // 23

View file

@ -19,7 +19,7 @@
#include "Layer.h"
#include "LayerTile.h"
const s32 FileVersion=9;
const s32 FileVersion=10;
#define SCREEN_MAP_WIDTH 30
#define SCREEN_MAP_HEIGHT 20

View file

@ -449,10 +449,10 @@ int ColFlags=Flags >> PC_TILE_FLAG_COLLISION_SHIFT;
case PC_TILE_COLLISION_STICKY: glColor4f(1.0f,1.0f,0.0f,0.5); break;
case PC_TILE_COLLISION_WATER: glColor4f(0.0f,0.0f,1.0f,0.5); break;
case PC_TILE_COLLISION_SOLID: glColor4f(0.0f,1.0f,1.0f,0.5); break;
case PC_TILE_COLLISION_DEATH: glColor4f(1.0f,0.5f,0.5f,0.5); break;
case PC_TILE_COLLISION_DEATH: glColor4f(0.0f,0.5f,0.5f,0.5); break;
case PC_TILE_COLLISION_DESTRUCTABLE:glColor4f(0.5f,0.7f,0.6f,0.5); break;
}
}
glEnable(GL_TEXTURE_2D);
if (Render3d)
{

View file

@ -175,6 +175,24 @@ struct sLayerThingHazard
};
struct sLayerThingData
{
int WaypointCount;
int Angle;
int Flip;
union
{
sLayerThingDef RESERVE;
sLayerThingActor Actor;
sLayerThingItem Item;
sLayerThingPlatform Platform;
sLayerThingTrigger Trigger;
sLayerThingFX FX;
sLayerThingHazard Hazard;
};
};
struct sLayerThingDataV9
{
int WaypointCount;

View file

@ -46,6 +46,7 @@ BEGIN_MESSAGE_MAP(GUILayerCollision, CDialog)
ON_BN_CLICKED(IDC_LAYERCOLLISION_WATER, OnLayercollisionWater)
ON_BN_CLICKED(IDC_LAYERCOLLISION_SOLID, OnLayercollisionSolid)
ON_BN_CLICKED(IDC_LAYERCOLLISION_DEATH, OnLayercollisionDeath)
ON_BN_CLICKED(IDC_LAYERCOLLISION_DESTRUCTABLE, OnLayercollisionDestructable)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -60,3 +61,5 @@ void GUILayerCollision::OnLayercollisionSticky() {theApp.GetCurrent()->Command(
void GUILayerCollision::OnLayercollisionWater() {theApp.GetCurrent()->Command(CmdMsg_SetColFlag,PC_TILE_COLLISION_WATER);}
void GUILayerCollision::OnLayercollisionSolid() {theApp.GetCurrent()->Command(CmdMsg_SetColFlag,PC_TILE_COLLISION_SOLID);}
void GUILayerCollision::OnLayercollisionDeath() {theApp.GetCurrent()->Command(CmdMsg_SetColFlag,PC_TILE_COLLISION_DEATH);}
void GUILayerCollision::OnLayercollisionDestructable() {theApp.GetCurrent()->Command(CmdMsg_SetColFlag,PC_TILE_COLLISION_DESTRUCTABLE);}

View file

@ -43,6 +43,7 @@ protected:
afx_msg void OnLayercollisionWater();
afx_msg void OnLayercollisionSolid();
afx_msg void OnLayercollisionDeath();
afx_msg void OnLayercollisionDestructable();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View file

@ -34,6 +34,9 @@ public:
void GUIThingUpdate(bool OnlySel=false);
void GUIThingPointUpdate(bool OnlySel=false);
virtual bool CanMirror(){return(true);}
virtual bool CanRotate(){return(true);}
protected:
CGUILayerActor GUIActor;

View file

@ -156,9 +156,14 @@ int Height=Map.GetHeight();
if (MapElem.Tile)
{
// new OutElem.Tile=(MapElem.Tile-1)<<1;
// OutElem.Tile+=MapElem.Flags & PC_TILE_FLAG_MIRROR_X;
// OutElem.Flags=MapElem.Flags>>PC_TILE_FLAG_COLLISION_SHIFT;
// Old
OutElem.Tile=((MapElem.Tile-1)*4)+1;
OutElem.Tile+=MapElem.Flags & PC_TILE_FLAG_MIRROR_XY;
OutElem.Flags=MapElem.Flags>>PC_TILE_FLAG_COLLISION_SHIFT;
}
else
{

View file

@ -54,6 +54,7 @@ enum TILE_FLAG
PC_TILE_COLLISION_WATER =5,
PC_TILE_COLLISION_SOLID =6,
PC_TILE_COLLISION_DEATH =7,
PC_TILE_COLLISION_DESTRUCTABLE =8,
PC_TILE_FLAG_COLLISION_SHIFT =2,
PC_TILE_FLAG_COLLISION_NORMAL =PC_TILE_COLLISION_NORMAL<<PC_TILE_FLAG_COLLISION_SHIFT,
@ -64,6 +65,7 @@ enum TILE_FLAG
PC_TILE_FLAG_COLLISION_WATER =PC_TILE_COLLISION_WATER<<PC_TILE_FLAG_COLLISION_SHIFT,
PC_TILE_FLAG_COLLISION_SOLID =PC_TILE_COLLISION_SOLID<<PC_TILE_FLAG_COLLISION_SHIFT,
PC_TILE_FLAG_COLLISION_DEATH =PC_TILE_COLLISION_DEATH<<PC_TILE_FLAG_COLLISION_SHIFT,
PC_TILE_FLAG_COLLISION_DESTRUCTABLE =PC_TILE_COLLISION_DESTRUCTABLE<<PC_TILE_FLAG_COLLISION_SHIFT,
PC_TILE_FLAG_COLLISION_MASK = ~PC_TILE_FLAG_MIRROR_XY,
};

View file

@ -35,6 +35,9 @@ public:
void GUIThingUpdate(bool OnlySel=false);
void GUIThingPointUpdate(bool OnlySel=false);
virtual bool CanMirror(){return(true);}
virtual bool CanRotate(){return(true);}
protected:
void RenderThing(CCore *Core,Vector3 &CamPos,sLayerThing &ThisThing,bool Render3d,bool Selected);

View file

@ -37,6 +37,9 @@ public:
void Export(CCore *Core,CExport &Exp);
void ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing);
virtual bool CanMirror(){return(true);}
virtual bool CanRotate(){return(true);}
protected:
CGUILayerHazard GUIHazard;

View file

@ -72,7 +72,20 @@ int i,ListSize;
}
else
{
File->Read(&ThisThing.Data,sizeof(sLayerThingData));
if (Version==9)
{
sLayerThingDataV9 V9Data;
File->Read(&V9Data,sizeof(sLayerThingDataV9));
ThisThing.Data.WaypointCount=V9Data.WaypointCount;
ThisThing.Data.Flip=0;
ThisThing.Data.Angle=0;
ThisThing.Data.RESERVE=V9Data.RESERVE;
}
else
{
File->Read(&ThisThing.Data,sizeof(sLayerThingData));
}
}
}
LoadThingNames(File,Version);
@ -186,6 +199,8 @@ int i,ListSize=ThingScript.GetGroupCount();
memset(&ThisDef.Data,0,sizeof(sLayerThingData));
ThisDef.Name=Name;
ThisDef.Data.WaypointCount=ThingScript.GetInt(Name,"WayPoints");
ThisDef.Data.Flip=0;
ThisDef.Data.Angle=0;
LoadDefThing(Name,ThisDef);
ThisDef.XY.resize(1);
@ -249,7 +264,10 @@ int ListSize=ThisThing.XY.size();
glColor4f(1,1,1,1); // Set default Color
glEnable(GL_DEPTH_TEST);
glTranslatef(0,0,ScrOfs.z);
ThingBank->RenderElem(ThisThing.ElemID,0,0,Render3d);
glPushMatrix();
glRotatef(ThisThing.Data.Angle,0,0,1);
ThingBank->RenderElem(ThisThing.ElemID,0,ThisThing.Data.Flip,Render3d);
glPopMatrix();
glDisable(GL_DEPTH_TEST);
glTranslatef(0,0,-ScrOfs.z);
if (Selected)
@ -421,6 +439,31 @@ bool Ret=false;
switch(CmdMsg)
{
case CmdMsg_MirrorX:
if (CanMirror())
if (CurrentThing!=-1)
{
ThingList[CurrentThing].Data.Flip^=PC_TILE_FLAG_MIRROR_X;
}
break;
case CmdMsg_MirrorY:
if (CanMirror())
if (CurrentThing!=-1)
{
ThingList[CurrentThing].Data.Flip^=PC_TILE_FLAG_MIRROR_Y;
}
break;
case CmdMsg_Rotate:
if (CanRotate())
if (CurrentThing!=-1)
{
ThingList[CurrentThing].Data.Angle+=90;
if (ThingList[CurrentThing].Data.Angle>359)
{
ThingList[CurrentThing].Data.Angle=0;
}
}
break;
case CmdMsg_ThingListDelete:
DeleteThing();
break;

View file

@ -79,6 +79,8 @@ virtual void ExportThing(CCore *Core,CExport &Exp,sLayerThing &ThisThing);
virtual void ExportThingData(CCore *Core,CExport &Exp,sLayerThing &ThisThing,sLayerThingData &OutThing){}
virtual void ExportThingNames(CExport &Exp);
virtual bool CanMirror(){return(false);}
virtual bool CanRotate(){return(false);}
// Functions
virtual bool LButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);
virtual bool RButtonControl(CCore *Core,UINT nFlags, CPoint &point,bool DownFlag);

View file

@ -2,7 +2,7 @@
[General Info]
Version=1
LastClass=CGUILayerShade
LastClass=CMapEditDoc
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h"
@ -37,27 +37,27 @@ Class25=CMapEditDoc
Class26=CMapEditView
ResourceCount=21
Resource1=IDD_LAYER_HAZARD
Resource2=IDR_MAPEDITYPE (English (U.S.))
Resource3=IDD_LAYER_COLLISION
Resource4=IDD_MULTIBAR (English (U.S.))
Resource5=IDD_LAYER_ACTOR
Resource6=IDD_LAYER_THING_POS
Resource7=IDD_LAYER_FX
Resource8=IDD_LAYER_PLATFORM
Resource9=IDD_ADDLAYER
Resource10=IDD_RESIZE
Resource11=IDD_LAYER_LIST
Resource12=IDD_LAYER_TRIGGER
Resource13=IDD_ELEMLIST
Resource14=IDR_TOOLBAR (English (U.S.))
Resource15=IDD_ABOUTBOX (English (U.S.))
Resource16=IDD_LAYER_THING
Resource17=IDD_NEWMAP
Resource18=IDR_MAINFRAME (English (U.S.))
Resource19=IDD_TILEBANK
Resource20=IDD_TOOLBAR
Resource21=IDD_LAYER_SHADE
Resource1=IDD_LAYER_COLLISION
Resource2=IDD_LAYER_THING_POS
Resource3=IDD_MULTIBAR (English (U.S.))
Resource4=IDD_LAYER_THING
Resource5=IDD_RESIZE
Resource6=IDD_ADDLAYER
Resource7=IDD_LAYER_SHADE
Resource8=IDD_TILEBANK
Resource9=IDD_LAYER_TRIGGER
Resource10=IDD_LAYER_PLATFORM
Resource11=IDR_MAPEDITYPE (English (U.S.))
Resource12=IDD_TOOLBAR
Resource13=IDD_LAYER_LIST
Resource14=IDD_ABOUTBOX (English (U.S.))
Resource15=IDD_LAYER_ACTOR
Resource16=IDD_NEWMAP
Resource17=IDD_LAYER_FX
Resource18=IDD_ELEMLIST
Resource19=IDR_TOOLBAR (English (U.S.))
Resource20=IDR_MAINFRAME (English (U.S.))
Resource21=IDD_LAYER_HAZARD
[CLS:CChildFrame]
Type=0
@ -94,6 +94,9 @@ Type=0
BaseClass=CDialog
HeaderFile=GUILayerCollision.h
ImplementationFile=GUILayerCollision.cpp
LastObject=GUILayerCollision
Filter=D
VirtualFilter=dWC
[CLS:CGUILayerFX]
Type=0
@ -221,6 +224,9 @@ Type=0
BaseClass=CDocument
HeaderFile=MapEditDoc.h
ImplementationFile=MapEditDoc.cpp
Filter=N
VirtualFilter=DC
LastObject=ID_ROTATE
[CLS:CMapEditView]
Type=0
@ -264,7 +270,7 @@ Control14=IDC_ACTOR_COLLISION,button,1342243363
[DLG:IDD_LAYER_COLLISION]
Type=1
Class=GUILayerCollision
ControlCount=8
ControlCount=9
Control1=IDC_LAYERCOLLISION_NORMAL,button,1342242816
Control2=IDC_LAYERCOLLISION_DAMAGE,button,1342242816
Control3=IDC_LAYERCOLLISION_SLIPPERY,button,1342242816
@ -273,6 +279,7 @@ Control5=IDC_LAYERCOLLISION_STICKY,button,1342242816
Control6=IDC_LAYERCOLLISION_WATER,button,1342242816
Control7=IDC_LAYERCOLLISION_SOLID,button,1342242816
Control8=IDC_LAYERCOLLISION_DEATH,button,1342242816
Control9=IDC_LAYERCOLLISION_DESTRUCTABLE,button,1342242816
[DLG:IDD_LAYER_FX]
Type=1
@ -540,16 +547,17 @@ Command19=ID_ZOOM_IN
Command20=ID_ZOOM_OUT
Command21=ID_MIRRORX
Command22=ID_MIRRORY
Command23=ID_ACTIVEBRUSH_LEFT
Command24=ID_ACTIVEBRUSH_RIGHT
Command25=ID_TOGGLE_SUBVIEW
Command26=ID_2D_3D_TOGGLE
Command27=ID_WINDOW_NEW
Command28=ID_WINDOW_CASCADE
Command29=ID_WINDOW_TILE_HORZ
Command30=ID_WINDOW_ARRANGE
Command31=ID_APP_ABOUT
CommandCount=31
Command23=ID_ROTATE
Command24=ID_ACTIVEBRUSH_LEFT
Command25=ID_ACTIVEBRUSH_RIGHT
Command26=ID_TOGGLE_SUBVIEW
Command27=ID_2D_3D_TOGGLE
Command28=ID_WINDOW_NEW
Command29=ID_WINDOW_CASCADE
Command30=ID_WINDOW_TILE_HORZ
Command31=ID_WINDOW_ARRANGE
Command32=ID_APP_ABOUT
CommandCount=32
[ACL:IDR_MAINFRAME (English (U.S.))]
Type=1
@ -564,22 +572,23 @@ Command7=ID_EDIT_COPY
Command8=ID_TOGGLE_GRID
Command9=ID_FILE_NEW
Command10=ID_FILE_OPEN
Command11=ID_FILE_SAVE
Command12=ID_EDIT_PASTE
Command13=ID_ZOOM_IN
Command14=ID_EDIT_UNDO
Command15=ID_EDIT_CUT
Command16=ID_EDIT_COPY
Command17=ID_EDIT_PASTE
Command18=ID_TOGGLE_SUBVIEW
Command19=ID_ZOOM_OUT
Command20=ID_NEXT_PANE
Command21=ID_PREV_PANE
Command22=ID_MIRRORX
Command23=ID_EDIT_CUT
Command24=ID_MIRRORY
Command25=ID_EDIT_UNDO
CommandCount=25
Command11=ID_ROTATE
Command12=ID_FILE_SAVE
Command13=ID_EDIT_PASTE
Command14=ID_ZOOM_IN
Command15=ID_EDIT_UNDO
Command16=ID_EDIT_CUT
Command17=ID_EDIT_COPY
Command18=ID_EDIT_PASTE
Command19=ID_TOGGLE_SUBVIEW
Command20=ID_ZOOM_OUT
Command21=ID_NEXT_PANE
Command22=ID_PREV_PANE
Command23=ID_MIRRORX
Command24=ID_EDIT_CUT
Command25=ID_MIRRORY
Command26=ID_EDIT_UNDO
CommandCount=26
[DLG:IDD_ABOUTBOX (English (U.S.))]
Type=1

View file

@ -131,6 +131,8 @@ BEGIN
MENUITEM "Mirror &X", ID_MIRRORX
MENUITEM "Mirror &Y", ID_MIRRORY
MENUITEM SEPARATOR
MENUITEM "&Rotate", ID_ROTATE
MENUITEM SEPARATOR
MENUITEM "View Left Brush", ID_ACTIVEBRUSH_LEFT
MENUITEM "View Right Brush", ID_ACTIVEBRUSH_RIGHT
MENUITEM SEPARATOR
@ -171,6 +173,7 @@ BEGIN
"G", ID_TOGGLE_GRID, VIRTKEY, NOINVERT
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"R", ID_ROTATE, VIRTKEY, NOINVERT
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
VK_ADD, ID_ZOOM_IN, VIRTKEY, NOINVERT
@ -669,6 +672,8 @@ BEGIN
PUSHBUTTON "Water",IDC_LAYERCOLLISION_WATER,100,15,50,10
PUSHBUTTON "Solid",IDC_LAYERCOLLISION_SOLID,0,25,50,10
PUSHBUTTON "Death",IDC_LAYERCOLLISION_DEATH,50,25,50,10
PUSHBUTTON "Destructable",IDC_LAYERCOLLISION_DESTRUCTABLE,100,25,50,
10
END
IDD_ELEMLIST DIALOG DISCARDABLE 0, 0, 156, 26

View file

@ -35,9 +35,10 @@ BEGIN_MESSAGE_MAP(CMapEditDoc, CDocument)
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
ON_COMMAND(ID_2D_3D_TOGGLE, On2d3dToggle)
ON_COMMAND(ID_RESET_VIEW, OnResetView)
ON_COMMAND(ID_RENDER_TO_TGA, OnRenderToTga)
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToggleSubView)
ON_COMMAND(ID_TOGGLE_GRID, OnToggleGrid)
ON_COMMAND(ID_RENDER_TO_TGA, OnRenderToTga)
ON_COMMAND(ID_ROTATE, OnRotate)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -189,6 +190,8 @@ void CMapEditDoc::OnResetView() {Command(CmdMsg_ResetView);}
void CMapEditDoc::OnMirrorx() {Command(CmdMsg_MirrorX);}
void CMapEditDoc::OnMirrory() {Command(CmdMsg_MirrorY);}
void CMapEditDoc::OnRotate() {Command(CmdMsg_Rotate);}
void CMapEditDoc::OnEditCopy() {Command(CmdMsg_Copy);}
void CMapEditDoc::OnEditPaste() {Command(CmdMsg_Paste);}
void CMapEditDoc::OnActivebrushLeft() {Command(CmdMsg_ActiveBrushLeft);}
@ -297,3 +300,4 @@ void CMapEditDoc::FocusView()
/*********************************************************************************/

View file

@ -84,6 +84,7 @@ protected:
afx_msg void On2d3dToggle();
afx_msg void OnResetView();
afx_msg void OnRenderToTga();
afx_msg void OnRotate();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

View file

@ -87,6 +87,7 @@
#define IDC_LAYERSHADE_SHADEG3 1088
#define IDC_LAYERSHADE_EDITB3 1089
#define IDC_LAYERSHADE_SHADEB3 1089
#define IDC_LAYERCOLLISION_DESTRUCTABLE 1089
#define IDC_LAYERSHADE_TRANSTEXT 1090
#define IDC_LAYERSHADE_GFXR0 1091
#define IDC_ACTOR_SPEED_SPIN 1092
@ -154,7 +155,6 @@
#define IDC_FX_SPEED_SPIN 1152
#define IDC_TRIGGER_HEIGHT_SPIN 1163
#define IDC_TRIGGER_TARGETY_SPIN 1164
#define IDC_TRIGGER_TARGETY_SPIN2 1165
#define IDC_TRIGGER_TARGETH_SPIN 1165
#define IDC_HAZARD_SPEED_TEXT 1169
#define IDC_HAZARD_TURNRATE_TEXT 1170
@ -215,6 +215,7 @@
#define ID_ZOOM_OUT 32798
#define ID_RESET_VIEW 32799
#define ID_RENDER_TO_TGA 32800
#define ID_ROTATE 32801
#define ID_INDICATOR_CURSORXY 59142
// Next default values for new objects
@ -223,7 +224,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 180
#define _APS_NEXT_COMMAND_VALUE 32801
#define _APS_NEXT_COMMAND_VALUE 32802
#define _APS_NEXT_CONTROL_VALUE 1215
#define _APS_NEXT_SYMED_VALUE 101
#endif