3 {$INCLUDE ../shared/a_modes.inc}
8 LCLIntf
, LCLType
, SysUtils
, Variants
, Classes
, Graphics
,
9 Controls
, Forms
, Dialogs
, StdCtrls
, Buttons
,
10 ComCtrls
, ValEdit
, Types
, Menus
, ExtCtrls
,
11 CheckLst
, Grids
, OpenGLContext
, utils
, UTF8Process
;
17 TMainForm
= class(TForm
)
22 miMenuFile
: TMenuItem
;
26 miSaveMapAs
: TMenuItem
;
27 miOpenWadMap
: TMenuItem
;
29 miReopenMap
: TMenuItem
;
30 miSaveMiniMap
: TMenuItem
;
31 miDeleteMap
: TMenuItem
;
36 miMenuEdit
: TMenuItem
;
43 miSelectAll
: TMenuItem
;
48 miMenuTools
: TMenuItem
;
49 miSnapToGrid
: TMenuItem
;
51 miSwitchGrid
: TMenuItem
;
52 miShowEdges
: TMenuItem
;
64 miMenuService
: TMenuItem
;
65 miCheckMap
: TMenuItem
;
66 miOptimmization
: TMenuItem
;
67 miMapPreview
: TMenuItem
;
70 miMenuSettings
: TMenuItem
;
71 miMapOptions
: TMenuItem
;
75 miMapTestSettings
: TMenuItem
;
77 miMenuHelp
: TMenuItem
;
79 // Скрытый пункт меню для Ctrl+Tab:
83 // Панель инструментов:
84 MainToolBar
: TToolBar
;
86 pLoadProgress
: TPanel
;
87 RenderPanel
: TOpenGLControl
;
88 tbNewMap
: TToolButton
;
89 tbOpenMap
: TToolButton
;
90 tbSaveMap
: TToolButton
;
91 tbOpenWadMap
: TToolButton
;
93 tbShowMap
: TToolButton
;
97 tbGridOn
: TToolButton
;
100 tbTestMap
: TToolButton
;
101 // Всплывающее меню для кнопки слоев:
103 miLayerP1
: TMenuItem
;
104 miLayerP2
: TMenuItem
;
105 miLayerP3
: TMenuItem
;
106 miLayerP4
: TMenuItem
;
107 miLayerP5
: TMenuItem
;
108 miLayerP6
: TMenuItem
;
109 miLayerP7
: TMenuItem
;
110 miLayerP8
: TMenuItem
;
111 miLayerP9
: TMenuItem
;
112 // Всплывающее меню для кнопки теста карты:
113 pmMapTest
: TPopupMenu
;
114 miMapTestPMSet
: TMenuItem
;
119 sbHorizontal
: TScrollBar
;
120 sbVertical
: TScrollBar
;
124 // Панель применения свойств:
125 PanelPropApply
: TPanel
;
126 bApplyProperty
: TButton
;
127 // Редактор свойств объектов:
128 vleObjectProperty
: TValueListEditor
;
130 // Панель объектов - вкладки:
132 pcObjects
: TPageControl
;
135 lbTextureList
: TListBox
;
136 // Панель настройки текстур:
137 PanelTextures
: TPanel
;
139 lTextureWidth
: TLabel
;
141 lTextureHeight
: TLabel
;
142 cbPreview
: TCheckBox
;
143 bbAddTexture
: TBitBtn
;
144 bbRemoveTexture
: TBitBtn
;
145 bClearTexture
: TButton
;
146 // Панель типов панелей:
147 PanelPanelType
: TPanel
;
148 lbPanelType
: TListBox
;
149 // Вкладка "Предметы":
151 lbItemList
: TListBox
;
154 // Вкладка "Монстры":
155 tsMonsters
: TTabSheet
;
156 lbMonsterList
: TListBox
;
157 rbMonsterLeft
: TRadioButton
;
158 rbMonsterRight
: TRadioButton
;
159 // Вкладка "Области":
161 lbAreasList
: TListBox
;
162 rbAreaLeft
: TRadioButton
;
163 rbAreaRight
: TRadioButton
;
164 // Вкладка "Триггеры":
165 tsTriggers
: TTabSheet
;
166 lbTriggersList
: TListBox
;
167 clbActivationType
: TCheckListBox
;
168 clbKeys
: TCheckListBox
;
171 Splitter1
: TSplitter
;
172 Splitter2
: TSplitter
;
173 StatusBar
: TStatusBar
;
175 // Специальные объекты:
176 ImageList
: TImageList
;
177 ilToolbar
: TImageList
;
178 OpenDialog
: TOpenDialog
;
179 SaveDialog
: TSaveDialog
;
180 selectall1
: TMenuItem
;
181 ColorDialog
: TColorDialog
;
183 procedure aAboutExecute(Sender
: TObject
);
184 procedure aCheckMapExecute(Sender
: TObject
);
185 procedure aMoveToFore(Sender
: TObject
);
186 procedure aMoveToBack(Sender
: TObject
);
187 procedure aCopyObjectExecute(Sender
: TObject
);
188 procedure aCutObjectExecute(Sender
: TObject
);
189 procedure aEditorOptionsExecute(Sender
: TObject
);
190 procedure aExitExecute(Sender
: TObject
);
191 procedure aMapOptionsExecute(Sender
: TObject
);
192 procedure aNewMapExecute(Sender
: TObject
);
193 procedure aOpenMapExecute(Sender
: TObject
);
194 procedure aOptimizeExecute(Sender
: TObject
);
195 procedure aPasteObjectExecute(Sender
: TObject
);
196 procedure aSelectAllExecute(Sender
: TObject
);
197 procedure aSaveMapExecute(Sender
: TObject
);
198 procedure aSaveMapAsExecute(Sender
: TObject
);
199 procedure aUndoExecute(Sender
: TObject
);
200 procedure aDeleteMap(Sender
: TObject
);
201 procedure bApplyPropertyClick(Sender
: TObject
);
202 procedure bbAddTextureClick(Sender
: TObject
);
203 procedure bbRemoveTextureClick(Sender
: TObject
);
204 procedure FormActivate(Sender
: TObject
);
205 procedure FormCloseQuery(Sender
: TObject
; var CanClose
: Boolean);
206 procedure FormCreate(Sender
: TObject
);
207 procedure FormDestroy(Sender
: TObject
);
208 procedure FormDropFiles(Sender
: TObject
; const FileNames
: array of String);
209 procedure FormKeyDown(Sender
: TObject
; var Key
: Word; Shift
: TShiftState
);
210 procedure FormResize(Sender
: TObject
);
211 procedure lbTextureListClick(Sender
: TObject
);
212 procedure lbTextureListDrawItem(Control
: TWinControl
; Index
: Integer;
213 ARect
: TRect
; State
: TOwnerDrawState
);
214 procedure miReopenMapClick(Sender
: TObject
);
215 procedure RenderPanelMouseDown(Sender
: TObject
; Button
: TMouseButton
; Shift
: TShiftState
; X
, Y
: Integer);
216 procedure RenderPanelMouseMove(Sender
: TObject
; Shift
: TShiftState
; X
, Y
: Integer);
217 procedure RenderPanelMouseUp(Sender
: TObject
; Button
: TMouseButton
; Shift
: TShiftState
; X
, Y
: Integer);
218 procedure RenderPanelPaint(Sender
: TObject
);
219 procedure RenderPanelResize(Sender
: TObject
);
220 procedure Splitter1Moved(Sender
: TObject
);
221 procedure vleObjectPropertyEditButtonClick(Sender
: TObject
);
222 procedure vleObjectPropertyApply(Sender
: TObject
);
223 procedure vleObjectPropertyGetPickList(Sender
: TObject
; const KeyName
: String; Values
: TStrings
);
224 procedure vleObjectPropertyKeyDown(Sender
: TObject
; var Key
: Word;
226 procedure tbGridOnClick(Sender
: TObject
);
227 procedure miMapPreviewClick(Sender
: TObject
);
228 procedure miLayer1Click(Sender
: TObject
);
229 procedure miLayer2Click(Sender
: TObject
);
230 procedure miLayer3Click(Sender
: TObject
);
231 procedure miLayer4Click(Sender
: TObject
);
232 procedure miLayer5Click(Sender
: TObject
);
233 procedure miLayer6Click(Sender
: TObject
);
234 procedure miLayer7Click(Sender
: TObject
);
235 procedure miLayer8Click(Sender
: TObject
);
236 procedure miLayer9Click(Sender
: TObject
);
237 procedure tbShowClick(Sender
: TObject
);
238 procedure miSnapToGridClick(Sender
: TObject
);
239 procedure miMiniMapClick(Sender
: TObject
);
240 procedure miSwitchGridClick(Sender
: TObject
);
241 procedure miShowEdgesClick(Sender
: TObject
);
242 procedure minexttabClick(Sender
: TObject
);
243 procedure miSaveMiniMapClick(Sender
: TObject
);
244 procedure bClearTextureClick(Sender
: TObject
);
245 procedure miPackMapClick(Sender
: TObject
);
246 procedure aRecentFileExecute(Sender
: TObject
);
247 procedure miMapTestSettingsClick(Sender
: TObject
);
248 procedure miTestMapClick(Sender
: TObject
);
249 procedure sbVerticalScroll(Sender
: TObject
; ScrollCode
: TScrollCode
;
250 var ScrollPos
: Integer);
251 procedure sbHorizontalScroll(Sender
: TObject
; ScrollCode
: TScrollCode
;
252 var ScrollPos
: Integer);
253 procedure miOpenWadMapClick(Sender
: TObject
);
254 procedure selectall1Click(Sender
: TObject
);
255 procedure Splitter1CanResize(Sender
: TObject
; var NewSize
: Integer;
256 var Accept
: Boolean);
257 procedure Splitter2CanResize(Sender
: TObject
; var NewSize
: Integer;
258 var Accept
: Boolean);
259 procedure vleObjectPropertyEnter(Sender
: TObject
);
260 procedure vleObjectPropertyExit(Sender
: TObject
);
261 procedure FormKeyUp(Sender
: TObject
; var Key
: Word;
265 procedure OnIdle(Sender
: TObject
; var Done
: Boolean);
267 procedure RefreshRecentMenu();
268 procedure OpenMapFile(FileName
: String);
269 function RenderMousePos(): TPoint
;
270 procedure RecountSelectedObjects();
276 LAYER_FOREGROUND
= 2;
284 TEST_MAP_NAME
= '$$$_TEST_$$$';
285 LANGUAGE_FILE_NAME
= '_Editor.txt';
296 DotStepOne
, DotStepTwo
: Byte;
298 DrawTexturePanel
: Boolean;
299 DrawPanelSize
: Boolean;
301 PreviewColor
: TColor
;
302 UseCheckerboard
: Boolean;
304 RecentCount
: Integer;
305 RecentFiles
: TStringList
;
306 slInvalidTextures
: TStringList
;
308 TestGameMode
: String;
310 TestLimScore
: String;
311 TestOptionsTwoPlayers
: Boolean;
312 TestOptionsTeamDamage
: Boolean;
313 TestOptionsAllowExit
: Boolean;
314 TestOptionsWeaponStay
: Boolean;
315 TestOptionsMonstersDM
: Boolean;
317 TestMapOnce
: Boolean;
319 LayerEnabled
: Array [LAYER_BACK
..LAYER_TRIGGERS
] of Boolean =
320 (True, True, True, True, True, True, True, True, True);
321 PreviewMode
: Byte = 0;
327 procedure OpenMap(FileName
: String; mapN
: String);
328 function AddTexture(aWAD
, aSection
, aTex
: String; silent
: Boolean): Boolean;
329 procedure RemoveSelectFromObjects();
330 procedure ChangeShownProperty(Name
: String; NewValue
: String);
335 f_options
, e_graphics
, e_log
, GL
, Math
,
336 f_mapoptions
, g_basic
, f_about
, f_mapoptimization
,
337 f_mapcheck
, f_addresource_texture
, g_textures
,
338 f_activationtype
, f_keys
,
339 MAPREADER
, f_selectmap
, f_savemap
, WADEDITOR
, WADSTRUCT
, MAPDEF
,
340 g_map
, f_saveminimap
, f_addresource
, CONFIG
, f_packmap
,
341 f_addresource_sound
, f_maptest
, f_choosetype
,
342 g_language
, f_selectlang
, ClipBrd
, g_resources
;
345 UNDO_DELETE_PANEL
= 1;
346 UNDO_DELETE_ITEM
= 2;
347 UNDO_DELETE_AREA
= 3;
348 UNDO_DELETE_MONSTER
= 4;
349 UNDO_DELETE_TRIGGER
= 5;
353 UNDO_ADD_MONSTER
= 9;
354 UNDO_ADD_TRIGGER
= 10;
355 UNDO_MOVE_PANEL
= 11;
358 UNDO_MOVE_MONSTER
= 14;
359 UNDO_MOVE_TRIGGER
= 15;
360 UNDO_RESIZE_PANEL
= 16;
361 UNDO_RESIZE_TRIGGER
= 17;
363 MOUSEACTION_NONE
= 0;
364 MOUSEACTION_DRAWPANEL
= 1;
365 MOUSEACTION_DRAWTRIGGER
= 2;
366 MOUSEACTION_MOVEOBJ
= 3;
367 MOUSEACTION_RESIZE
= 4;
368 MOUSEACTION_MOVEMAP
= 5;
369 MOUSEACTION_DRAWPRESS
= 6;
370 MOUSEACTION_NOACTION
= 7;
373 RESIZETYPE_VERTICAL
= 1;
374 RESIZETYPE_HORIZONTAL
= 2;
383 SELECTFLAG_TELEPORT
= 1;
385 SELECTFLAG_TEXTURE
= 3;
387 SELECTFLAG_MONSTER
= 5;
388 SELECTFLAG_SPAWNPOINT
= 6;
389 SELECTFLAG_SHOTPANEL
= 7;
390 SELECTFLAG_SELECTED
= 8;
392 RECENT_FILES_MENU_START
= 12;
394 CLIPBOARD_SIG
= 'DF:ED';
400 UNDO_DELETE_PANEL
: (Panel
: ^TPanel
);
401 UNDO_DELETE_ITEM
: (Item
: TItem
);
402 UNDO_DELETE_AREA
: (Area
: TArea
);
403 UNDO_DELETE_MONSTER
: (Monster
: TMonster
);
404 UNDO_DELETE_TRIGGER
: (Trigger
: TTrigger
);
409 UNDO_ADD_TRIGGER
: (AddID
: DWORD
);
414 UNDO_MOVE_TRIGGER
: (MoveID
: DWORD
; dX
, dY
: Integer);
416 UNDO_RESIZE_TRIGGER
: (ResizeID
: DWORD
; dW
, dH
: Integer);
423 OBJECT_PANEL
: (Panel
: ^TPanel
);
424 OBJECT_ITEM
: (Item
: TItem
);
425 OBJECT_AREA
: (Area
: TArea
);
426 OBJECT_MONSTER
: (Monster
: TMonster
);
427 OBJECT_TRIGGER
: (Trigger
: TTrigger
);
430 TCopyRecArray
= Array of TCopyRec
;
434 gDataLoaded
: Boolean = False;
435 ShowMap
: Boolean = False;
436 DrawRect
: PRect
= nil;
437 SnapToGrid
: Boolean = True;
439 MousePos
: Types
.TPoint
;
440 LastMovePoint
: Types
.TPoint
;
443 MouseLDownPos
: Types
.TPoint
;
444 MouseRDownPos
: Types
.TPoint
;
446 SelectFlag
: Byte = SELECTFLAG_NONE
;
447 MouseAction
: Byte = MOUSEACTION_NONE
;
448 ResizeType
: Byte = RESIZETYPE_NONE
;
449 ResizeDirection
: Byte = RESIZEDIR_NONE
;
451 DrawPressRect
: Boolean = False;
452 EditingProperties
: Boolean = False;
454 UndoBuffer
: Array of Array of TUndoRec
= nil;
459 //----------------------------------------
460 //Далее идут вспомогательные процедуры
461 //----------------------------------------
463 function NameToBool(Name
: String): Boolean;
465 if Name
= BoolNames
[True] then
471 function NameToDir(Name
: String): TDirection
;
473 if Name
= DirNames
[D_LEFT
] then
479 function NameToDirAdv(Name
: String): Byte;
481 if Name
= DirNamesAdv
[1] then
484 if Name
= DirNamesAdv
[2] then
487 if Name
= DirNamesAdv
[3] then
493 function ActivateToStr(ActivateType
: Byte): String;
497 if ByteBool(ACTIVATE_PLAYERCOLLIDE
and ActivateType
) then
498 Result
:= Result
+ '+PC';
499 if ByteBool(ACTIVATE_MONSTERCOLLIDE
and ActivateType
) then
500 Result
:= Result
+ '+MC';
501 if ByteBool(ACTIVATE_PLAYERPRESS
and ActivateType
) then
502 Result
:= Result
+ '+PP';
503 if ByteBool(ACTIVATE_MONSTERPRESS
and ActivateType
) then
504 Result
:= Result
+ '+MP';
505 if ByteBool(ACTIVATE_SHOT
and ActivateType
) then
506 Result
:= Result
+ '+SH';
507 if ByteBool(ACTIVATE_NOMONSTER
and ActivateType
) then
508 Result
:= Result
+ '+NM';
510 if (Result
<> '') and (Result
[1] = '+') then
511 Delete(Result
, 1, 1);
514 function StrToActivate(Str
: String): Byte;
518 if Pos('PC', Str
) > 0 then
519 Result
:= ACTIVATE_PLAYERCOLLIDE
;
520 if Pos('MC', Str
) > 0 then
521 Result
:= Result
or ACTIVATE_MONSTERCOLLIDE
;
522 if Pos('PP', Str
) > 0 then
523 Result
:= Result
or ACTIVATE_PLAYERPRESS
;
524 if Pos('MP', Str
) > 0 then
525 Result
:= Result
or ACTIVATE_MONSTERPRESS
;
526 if Pos('SH', Str
) > 0 then
527 Result
:= Result
or ACTIVATE_SHOT
;
528 if Pos('NM', Str
) > 0 then
529 Result
:= Result
or ACTIVATE_NOMONSTER
;
532 function KeyToStr(Key
: Byte): String;
536 if ByteBool(KEY_RED
and Key
) then
537 Result
:= Result
+ '+RK';
538 if ByteBool(KEY_GREEN
and Key
) then
539 Result
:= Result
+ '+GK';
540 if ByteBool(KEY_BLUE
and Key
) then
541 Result
:= Result
+ '+BK';
542 if ByteBool(KEY_REDTEAM
and Key
) then
543 Result
:= Result
+ '+RT';
544 if ByteBool(KEY_BLUETEAM
and Key
) then
545 Result
:= Result
+ '+BT';
547 if (Result
<> '') and (Result
[1] = '+') then
548 Delete(Result
, 1, 1);
551 function StrToKey(Str
: String): Byte;
555 if Pos('RK', Str
) > 0 then
557 if Pos('GK', Str
) > 0 then
558 Result
:= Result
or KEY_GREEN
;
559 if Pos('BK', Str
) > 0 then
560 Result
:= Result
or KEY_BLUE
;
561 if Pos('RT', Str
) > 0 then
562 Result
:= Result
or KEY_REDTEAM
;
563 if Pos('BT', Str
) > 0 then
564 Result
:= Result
or KEY_BLUETEAM
;
567 function EffectToStr(Effect
: Byte): String;
569 if Effect
in [EFFECT_TELEPORT
..EFFECT_FIRE
] then
570 Result
:= EffectNames
[Effect
]
572 Result
:= EffectNames
[EFFECT_NONE
];
575 function StrToEffect(Str
: String): Byte;
579 Result
:= EFFECT_NONE
;
580 for i
:= EFFECT_TELEPORT
to EFFECT_FIRE
do
581 if EffectNames
[i
] = Str
then
588 function MonsterToStr(MonType
: Byte): String;
590 if MonType
in [MONSTER_DEMON
..MONSTER_MAN
] then
591 Result
:= MonsterNames
[MonType
]
593 Result
:= MonsterNames
[MONSTER_ZOMBY
];
596 function StrToMonster(Str
: String): Byte;
600 Result
:= MONSTER_ZOMBY
;
601 for i
:= MONSTER_DEMON
to MONSTER_MAN
do
602 if MonsterNames
[i
] = Str
then
609 function ItemToStr(ItemType
: Byte): String;
611 if ItemType
in [ITEM_MEDKIT_SMALL
..ITEM_MAX
] then
612 Result
:= ItemNames
[ItemType
]
614 Result
:= ItemNames
[ITEM_AMMO_BULLETS
];
617 function StrToItem(Str
: String): Byte;
621 Result
:= ITEM_AMMO_BULLETS
;
622 for i
:= ITEM_MEDKIT_SMALL
to ITEM_MAX
do
623 if ItemNames
[i
] = Str
then
630 function ShotToStr(ShotType
: Byte): String;
632 if ShotType
in [TRIGGER_SHOT_PISTOL
..TRIGGER_SHOT_MAX
] then
633 Result
:= ShotNames
[ShotType
]
635 Result
:= ShotNames
[TRIGGER_SHOT_PISTOL
];
638 function StrToShot(Str
: String): Byte;
642 Result
:= TRIGGER_SHOT_PISTOL
;
643 for i
:= TRIGGER_SHOT_PISTOL
to TRIGGER_SHOT_MAX
do
644 if ShotNames
[i
] = Str
then
651 function SelectedObjectCount(): Word;
657 if SelectedObjects
= nil then
660 for a
:= 0 to High(SelectedObjects
) do
661 if SelectedObjects
[a
].Live
then
662 Result
:= Result
+ 1;
665 function GetFirstSelected(): Integer;
671 if SelectedObjects
= nil then
674 for a
:= 0 to High(SelectedObjects
) do
675 if SelectedObjects
[a
].Live
then
682 function Normalize16(x
: Integer): Integer;
684 Result
:= (x
div 16) * 16;
687 procedure MoveMap(X
, Y
: Integer);
689 rx
, ry
, ScaleSz
: Integer;
691 with MainForm
.RenderPanel
do
693 ScaleSz
:= 16 div Scale
;
694 // Размер видимой части карты:
695 rx
:= min(Normalize16(Width
), Normalize16(gMapInfo
.Width
)) div 2;
696 ry
:= min(Normalize16(Height
), Normalize16(gMapInfo
.Height
)) div 2;
697 // Место клика на мини-карте:
698 MapOffset
.X
:= X
- (Width
-max(gMapInfo
.Width
div ScaleSz
, 1)-1);
699 MapOffset
.Y
:= Y
- 1;
700 // Это же место на "большой" карте:
701 MapOffset
.X
:= MapOffset
.X
* ScaleSz
;
702 MapOffset
.Y
:= MapOffset
.Y
* ScaleSz
;
703 // Левый верхний угол новой видимой части карты:
704 MapOffset
.X
:= MapOffset
.X
- rx
;
705 MapOffset
.Y
:= MapOffset
.Y
- ry
;
707 if MapOffset
.X
< 0 then
709 if MapOffset
.Y
< 0 then
711 if MapOffset
.X
> MainForm
.sbHorizontal
.Max
then
712 MapOffset
.X
:= MainForm
.sbHorizontal
.Max
;
713 if MapOffset
.Y
> MainForm
.sbVertical
.Max
then
714 MapOffset
.Y
:= MainForm
.sbVertical
.Max
;
716 MapOffset
.X
:= Normalize16(MapOffset
.X
);
717 MapOffset
.Y
:= Normalize16(MapOffset
.Y
);
720 MainForm
.sbHorizontal
.Position
:= MapOffset
.X
;
721 MainForm
.sbVertical
.Position
:= MapOffset
.Y
;
723 MapOffset
.X
:= -MapOffset
.X
;
724 MapOffset
.Y
:= -MapOffset
.Y
;
729 function IsTexturedPanel(PanelType
: Word): Boolean;
731 Result
:= WordBool(PanelType
and (PANEL_WALL
or PANEL_BACK
or PANEL_FORE
or
732 PANEL_STEP
or PANEL_OPENDOOR
or PANEL_CLOSEDOOR
or
733 PANEL_WATER
or PANEL_ACID1
or PANEL_ACID2
));
736 procedure FillProperty();
741 MainForm
.vleObjectProperty
.Strings
.Clear();
742 MainForm
.RecountSelectedObjects();
744 // Отображаем свойства если выделен только один объект:
745 if SelectedObjectCount() <> 1 then
748 _id
:= GetFirstSelected();
749 if not SelectedObjects
[_id
].Live
then
752 with MainForm
.vleObjectProperty
do
753 with ItemProps
[InsertRow(_lc
[I_PROP_ID
], IntToStr(SelectedObjects
[_id
].ID
), True)] do
755 EditStyle
:= esSimple
;
759 case SelectedObjects
[0].ObjectType
of
762 with MainForm
.vleObjectProperty
,
763 gPanels
[SelectedObjects
[_id
].ID
] do
765 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
767 EditStyle
:= esSimple
;
771 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
773 EditStyle
:= esSimple
;
777 with ItemProps
[InsertRow(_lc
[I_PROP_WIDTH
], IntToStr(Width
), True)] do
779 EditStyle
:= esSimple
;
783 with ItemProps
[InsertRow(_lc
[I_PROP_HEIGHT
], IntToStr(Height
), True)] do
785 EditStyle
:= esSimple
;
789 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_TYPE
], GetPanelName(PanelType
), True)] do
791 EditStyle
:= esEllipsis
;
795 if IsTexturedPanel(PanelType
) then
796 begin // Может быть текстура
797 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_TEX
], TextureName
, True)] do
799 EditStyle
:= esEllipsis
;
803 if TextureName
<> '' then
804 begin // Есть текстура
805 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_ALPHA
], IntToStr(Alpha
), True)] do
807 EditStyle
:= esSimple
;
811 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_BLEND
], BoolNames
[Blending
], True)] do
813 EditStyle
:= esPickList
;
823 with MainForm
.vleObjectProperty
,
824 gItems
[SelectedObjects
[_id
].ID
] do
826 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
828 EditStyle
:= esSimple
;
832 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
834 EditStyle
:= esSimple
;
838 with ItemProps
[InsertRow(_lc
[I_PROP_DM_ONLY
], BoolNames
[OnlyDM
], True)] do
840 EditStyle
:= esPickList
;
844 with ItemProps
[InsertRow(_lc
[I_PROP_ITEM_FALLS
], BoolNames
[Fall
], True)] do
846 EditStyle
:= esPickList
;
854 with MainForm
.vleObjectProperty
,
855 gMonsters
[SelectedObjects
[_id
].ID
] do
857 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
859 EditStyle
:= esSimple
;
863 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
865 EditStyle
:= esSimple
;
869 with ItemProps
[InsertRow(_lc
[I_PROP_DIRECTION
], DirNames
[Direction
], True)] do
871 EditStyle
:= esPickList
;
879 with MainForm
.vleObjectProperty
,
880 gAreas
[SelectedObjects
[_id
].ID
] do
882 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
884 EditStyle
:= esSimple
;
888 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
890 EditStyle
:= esSimple
;
894 with ItemProps
[InsertRow(_lc
[I_PROP_DIRECTION
], DirNames
[Direction
], True)] do
896 EditStyle
:= esPickList
;
904 with MainForm
.vleObjectProperty
,
905 gTriggers
[SelectedObjects
[_id
].ID
] do
907 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TYPE
], GetTriggerName(TriggerType
), True)] do
909 EditStyle
:= esSimple
;
913 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
915 EditStyle
:= esSimple
;
919 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
921 EditStyle
:= esSimple
;
925 with ItemProps
[InsertRow(_lc
[I_PROP_WIDTH
], IntToStr(Width
), True)] do
927 EditStyle
:= esSimple
;
931 with ItemProps
[InsertRow(_lc
[I_PROP_HEIGHT
], IntToStr(Height
), True)] do
933 EditStyle
:= esSimple
;
937 with ItemProps
[InsertRow(_lc
[I_PROP_TR_ENABLED
], BoolNames
[Enabled
], True)] do
939 EditStyle
:= esPickList
;
943 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TEXTURE_PANEL
], IntToStr(TexturePanel
), True)] do
945 EditStyle
:= esEllipsis
;
949 with ItemProps
[InsertRow(_lc
[I_PROP_TR_ACTIVATION
], ActivateToStr(ActivateType
), True)] do
951 EditStyle
:= esEllipsis
;
955 with ItemProps
[InsertRow(_lc
[I_PROP_TR_KEYS
], KeyToStr(Key
), True)] do
957 EditStyle
:= esEllipsis
;
964 str
:= win2utf(Data
.MapName
);
965 with ItemProps
[InsertRow(_lc
[I_PROP_TR_NEXT_MAP
], str
, True)] do
967 EditStyle
:= esEllipsis
;
974 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TELEPORT_TO
], Format('(%d:%d)', [Data
.TargetPoint
.X
, Data
.TargetPoint
.Y
]), True)] do
976 EditStyle
:= esEllipsis
;
980 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_teleport
], True)] do
982 EditStyle
:= esPickList
;
986 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TELEPORT_SILENT
], BoolNames
[Data
.silent_teleport
], True)] do
988 EditStyle
:= esPickList
;
992 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TELEPORT_DIR
], DirNamesAdv
[Data
.TlpDir
], True)] do
994 EditStyle
:= esPickList
;
999 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
,
1000 TRIGGER_DOOR
, TRIGGER_DOOR5
:
1002 with ItemProps
[InsertRow(_lc
[I_PROP_TR_DOOR_PANEL
], IntToStr(Data
.PanelID
), True)] do
1004 EditStyle
:= esEllipsis
;
1008 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.NoSound
], True)] do
1010 EditStyle
:= esPickList
;
1014 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_doors
], True)] do
1016 EditStyle
:= esPickList
;
1021 TRIGGER_CLOSETRAP
, TRIGGER_TRAP
:
1023 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TRAP_PANEL
], IntToStr(Data
.PanelID
), True)] do
1025 EditStyle
:= esEllipsis
;
1029 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.NoSound
], True)] do
1031 EditStyle
:= esPickList
;
1035 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_doors
], True)] do
1037 EditStyle
:= esPickList
;
1042 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
,
1045 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_AREA
],
1046 Format('(%d:%d %d:%d)', [Data
.tX
, Data
.tY
, Data
.tWidth
, Data
.tHeight
]), True)] do
1048 EditStyle
:= esEllipsis
;
1052 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_DELAY
], IntToStr(Data
.Wait
), True)] do
1054 EditStyle
:= esSimple
;
1058 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_COUNT
], IntToStr(Data
.Count
), True)] do
1060 EditStyle
:= esSimple
;
1064 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_MONSTER
], IntToStr(Data
.MonsterID
-1), True)] do
1066 EditStyle
:= esEllipsis
;
1070 if TriggerType
= TRIGGER_PRESS
then
1071 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_RANDOM
], BoolNames
[Data
.ExtRandom
], True)] do
1073 EditStyle
:= esPickList
;
1081 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
1083 with ItemProps
[InsertRow(_lc
[I_PROP_TR_LIFT_PANEL
], IntToStr(Data
.PanelID
), True)] do
1085 EditStyle
:= esEllipsis
;
1089 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.NoSound
], True)] do
1091 EditStyle
:= esPickList
;
1095 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_doors
], True)] do
1097 EditStyle
:= esPickList
;
1104 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TEXTURE_ONCE
], BoolNames
[Data
.ActivateOnce
], True)] do
1106 EditStyle
:= esPickList
;
1110 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TEXTURE_ANIM_ONCE
], BoolNames
[Data
.AnimOnce
], True)] do
1112 EditStyle
:= esPickList
;
1119 str
:= win2utf(Data
.SoundName
);
1120 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_NAME
], str
, True)] do
1122 EditStyle
:= esEllipsis
;
1126 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_VOLUME
], IntToStr(Data
.Volume
), True)] do
1128 EditStyle
:= esSimple
;
1132 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_PAN
], IntToStr(Data
.Pan
), True)] do
1134 EditStyle
:= esSimple
;
1138 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_COUNT
], IntToStr(Data
.PlayCount
), True)] do
1140 EditStyle
:= esSimple
;
1144 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_LOCAL
], BoolNames
[Data
.Local
], True)] do
1146 EditStyle
:= esPickList
;
1150 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_SWITCH
], BoolNames
[Data
.SoundSwitch
], True)] do
1152 EditStyle
:= esPickList
;
1157 TRIGGER_SPAWNMONSTER
:
1159 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MONSTER_TYPE
], MonsterToStr(Data
.MonType
), True)] do
1161 EditStyle
:= esEllipsis
;
1165 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_TO
],
1166 Format('(%d:%d)', [Data
.MonPos
.X
, Data
.MonPos
.Y
]), True)] do
1168 EditStyle
:= esEllipsis
;
1172 with ItemProps
[InsertRow(_lc
[I_PROP_DIRECTION
], DirNames
[TDirection(Data
.MonDir
)], True)] do
1174 EditStyle
:= esPickList
;
1178 with ItemProps
[InsertRow(_lc
[I_PROP_TR_HEALTH
], IntToStr(Data
.MonHealth
), True)] do
1180 EditStyle
:= esSimple
;
1184 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MONSTER_ACTIVE
], BoolNames
[Data
.MonActive
], True)] do
1186 EditStyle
:= esPickList
;
1190 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.MonCount
), True)] do
1192 EditStyle
:= esSimple
;
1196 with ItemProps
[InsertRow(_lc
[I_PROP_TR_FX_TYPE
], EffectToStr(Data
.MonEffect
), True)] do
1198 EditStyle
:= esEllipsis
;
1202 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_MAX
], IntToStr(Data
.MonMax
), True)] do
1204 EditStyle
:= esSimple
;
1208 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_DELAY
], IntToStr(Data
.MonDelay
), True)] do
1210 EditStyle
:= esSimple
;
1214 case Data
.MonBehav
of
1215 1: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_1
];
1216 2: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_2
];
1217 3: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_3
];
1218 4: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_4
];
1219 5: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_5
];
1220 else str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_0
];
1222 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
], str
, True)] do
1224 EditStyle
:= esPickList
;
1231 with ItemProps
[InsertRow(_lc
[I_PROP_TR_ITEM_TYPE
], ItemToStr(Data
.ItemType
), True)] do
1233 EditStyle
:= esEllipsis
;
1237 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_TO
],
1238 Format('(%d:%d)', [Data
.ItemPos
.X
, Data
.ItemPos
.Y
]), True)] do
1240 EditStyle
:= esEllipsis
;
1244 with ItemProps
[InsertRow(_lc
[I_PROP_DM_ONLY
], BoolNames
[Data
.ItemOnlyDM
], True)] do
1246 EditStyle
:= esPickList
;
1250 with ItemProps
[InsertRow(_lc
[I_PROP_ITEM_FALLS
], BoolNames
[Data
.ItemFalls
], True)] do
1252 EditStyle
:= esPickList
;
1256 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.ItemCount
), True)] do
1258 EditStyle
:= esSimple
;
1262 with ItemProps
[InsertRow(_lc
[I_PROP_TR_FX_TYPE
], EffectToStr(Data
.ItemEffect
), True)] do
1264 EditStyle
:= esEllipsis
;
1268 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_MAX
], IntToStr(Data
.ItemMax
), True)] do
1270 EditStyle
:= esSimple
;
1274 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_DELAY
], IntToStr(Data
.ItemDelay
), True)] do
1276 EditStyle
:= esSimple
;
1283 str
:= win2utf(Data
.MusicName
);
1284 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MUSIC_NAME
], str
, True)] do
1286 EditStyle
:= esEllipsis
;
1290 if Data
.MusicAction
= 1 then
1291 str
:= _lc
[I_PROP_TR_MUSIC_ON
]
1293 str
:= _lc
[I_PROP_TR_MUSIC_OFF
];
1295 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MUSIC_ACT
], str
, True)] do
1297 EditStyle
:= esPickList
;
1304 with ItemProps
[InsertRow(_lc
[I_PROP_TR_PUSH_ANGLE
], IntToStr(Data
.PushAngle
), True)] do
1306 EditStyle
:= esSimple
;
1309 with ItemProps
[InsertRow(_lc
[I_PROP_TR_PUSH_FORCE
], IntToStr(Data
.PushForce
), True)] do
1311 EditStyle
:= esSimple
;
1314 with ItemProps
[InsertRow(_lc
[I_PROP_TR_PUSH_RESET
], BoolNames
[Data
.ResetVel
], True)] do
1316 EditStyle
:= esPickList
;
1323 case Data
.ScoreAction
of
1324 1: str
:= _lc
[I_PROP_TR_SCORE_ACT_1
];
1325 2: str
:= _lc
[I_PROP_TR_SCORE_ACT_2
];
1326 3: str
:= _lc
[I_PROP_TR_SCORE_ACT_3
];
1327 else str
:= _lc
[I_PROP_TR_SCORE_ACT_0
];
1329 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_ACT
], str
, True)] do
1331 EditStyle
:= esPickList
;
1334 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.ScoreCount
), True)] do
1336 EditStyle
:= esSimple
;
1339 case Data
.ScoreTeam
of
1340 1: str
:= _lc
[I_PROP_TR_SCORE_TEAM_1
];
1341 2: str
:= _lc
[I_PROP_TR_SCORE_TEAM_2
];
1342 3: str
:= _lc
[I_PROP_TR_SCORE_TEAM_3
];
1343 else str
:= _lc
[I_PROP_TR_SCORE_TEAM_0
];
1345 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_TEAM
], str
, True)] do
1347 EditStyle
:= esPickList
;
1350 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_CON
], BoolNames
[Data
.ScoreCon
], True)] do
1352 EditStyle
:= esPickList
;
1355 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_MSG
], BoolNames
[Data
.ScoreMsg
], True)] do
1357 EditStyle
:= esPickList
;
1364 case Data
.MessageKind
of
1365 1: str
:= _lc
[I_PROP_TR_MESSAGE_KIND_1
];
1366 else str
:= _lc
[I_PROP_TR_MESSAGE_KIND_0
];
1368 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_KIND
], str
, True)] do
1370 EditStyle
:= esPickList
;
1373 case Data
.MessageSendTo
of
1374 1: str
:= _lc
[I_PROP_TR_MESSAGE_TO_1
];
1375 2: str
:= _lc
[I_PROP_TR_MESSAGE_TO_2
];
1376 3: str
:= _lc
[I_PROP_TR_MESSAGE_TO_3
];
1377 4: str
:= _lc
[I_PROP_TR_MESSAGE_TO_4
];
1378 5: str
:= _lc
[I_PROP_TR_MESSAGE_TO_5
];
1379 else str
:= _lc
[I_PROP_TR_MESSAGE_TO_0
];
1381 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_TO
], str
, True)] do
1383 EditStyle
:= esPickList
;
1386 str
:= win2utf(Data
.MessageText
);
1387 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_TEXT
], str
, True)] do
1389 EditStyle
:= esSimple
;
1392 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_TIME
], IntToStr(Data
.MessageTime
), True)] do
1394 EditStyle
:= esSimple
;
1401 with ItemProps
[InsertRow(_lc
[I_PROP_TR_DAMAGE_VALUE
], IntToStr(Data
.DamageValue
), True)] do
1403 EditStyle
:= esSimple
;
1406 with ItemProps
[InsertRow(_lc
[I_PROP_TR_INTERVAL
], IntToStr(Data
.DamageInterval
), True)] do
1408 EditStyle
:= esSimple
;
1415 with ItemProps
[InsertRow(_lc
[I_PROP_TR_HEALTH
], IntToStr(Data
.HealValue
), True)] do
1417 EditStyle
:= esSimple
;
1420 with ItemProps
[InsertRow(_lc
[I_PROP_TR_INTERVAL
], IntToStr(Data
.HealInterval
), True)] do
1422 EditStyle
:= esSimple
;
1425 with ItemProps
[InsertRow(_lc
[I_PROP_TR_HEALTH_MAX
], BoolNames
[Data
.HealMax
], True)] do
1427 EditStyle
:= esPickList
;
1430 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.HealSilent
], True)] do
1432 EditStyle
:= esPickList
;
1439 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_TYPE
], ShotToStr(Data
.ShotType
), True)] do
1441 EditStyle
:= esEllipsis
;
1445 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_SOUND
], BoolNames
[Data
.ShotSound
], True)] do
1447 EditStyle
:= esPickList
;
1451 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_PANEL
], IntToStr(Data
.ShotPanelID
), True)] do
1453 EditStyle
:= esEllipsis
;
1457 case Data
.ShotTarget
of
1458 1: str
:= _lc
[I_PROP_TR_SHOT_TO_1
];
1459 2: str
:= _lc
[I_PROP_TR_SHOT_TO_2
];
1460 3: str
:= _lc
[I_PROP_TR_SHOT_TO_3
];
1461 4: str
:= _lc
[I_PROP_TR_SHOT_TO_4
];
1462 5: str
:= _lc
[I_PROP_TR_SHOT_TO_5
];
1463 6: str
:= _lc
[I_PROP_TR_SHOT_TO_6
];
1464 else str
:= _lc
[I_PROP_TR_SHOT_TO_0
];
1466 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_TO
], str
, True)] do
1468 EditStyle
:= esPickList
;
1472 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_SIGHT
], IntToStr(Data
.ShotIntSight
), True)] do
1474 EditStyle
:= esSimple
;
1478 case Data
.ShotAim
of
1479 1: str
:= _lc
[I_PROP_TR_SHOT_AIM_1
];
1480 2: str
:= _lc
[I_PROP_TR_SHOT_AIM_2
];
1481 3: str
:= _lc
[I_PROP_TR_SHOT_AIM_3
];
1482 else str
:= _lc
[I_PROP_TR_SHOT_AIM_0
];
1484 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_AIM
], str
, True)] do
1486 EditStyle
:= esPickList
;
1490 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_TO
],
1491 Format('(%d:%d)', [Data
.ShotPos
.X
, Data
.ShotPos
.Y
]), True)] do
1493 EditStyle
:= esEllipsis
;
1497 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_ANGLE
], IntToStr(Data
.ShotAngle
), True)] do
1499 EditStyle
:= esSimple
;
1503 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_DELAY
], IntToStr(Data
.ShotWait
), True)] do
1505 EditStyle
:= esSimple
;
1509 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_ACC
], IntToStr(Data
.ShotAccuracy
), True)] do
1511 EditStyle
:= esSimple
;
1515 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_AMMO
], IntToStr(Data
.ShotAmmo
), True)] do
1517 EditStyle
:= esSimple
;
1521 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_RELOAD
], IntToStr(Data
.ShotIntReload
), True)] do
1523 EditStyle
:= esSimple
;
1530 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.FXCount
), True)] do
1532 EditStyle
:= esSimple
;
1536 if Data
.FXType
= 0 then
1537 str
:= _lc
[I_PROP_TR_EFFECT_PARTICLE
]
1539 str
:= _lc
[I_PROP_TR_EFFECT_ANIMATION
];
1540 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_TYPE
], str
, True)] do
1542 EditStyle
:= esEllipsis
;
1547 if Data
.FXType
= 0 then
1548 case Data
.FXSubType
of
1549 TRIGGER_EFFECT_SLIQUID
:
1550 str
:= _lc
[I_PROP_TR_EFFECT_SLIQUID
];
1551 TRIGGER_EFFECT_LLIQUID
:
1552 str
:= _lc
[I_PROP_TR_EFFECT_LLIQUID
];
1553 TRIGGER_EFFECT_DLIQUID
:
1554 str
:= _lc
[I_PROP_TR_EFFECT_DLIQUID
];
1555 TRIGGER_EFFECT_BLOOD
:
1556 str
:= _lc
[I_PROP_TR_EFFECT_BLOOD
];
1557 TRIGGER_EFFECT_SPARK
:
1558 str
:= _lc
[I_PROP_TR_EFFECT_SPARK
];
1559 TRIGGER_EFFECT_BUBBLE
:
1560 str
:= _lc
[I_PROP_TR_EFFECT_BUBBLE
];
1562 if Data
.FXType
= 1 then
1564 if (Data
.FXSubType
= 0) or (Data
.FXSubType
> EFFECT_FIRE
) then
1565 Data
.FXSubType
:= EFFECT_TELEPORT
;
1566 str
:= EffectToStr(Data
.FXSubType
);
1568 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SUBTYPE
], str
, True)] do
1570 EditStyle
:= esEllipsis
;
1574 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_COLOR
], IntToStr(Data
.FXColorR
or (Data
.FXColorG
shl 8) or (Data
.FXColorB
shl 16)), True)] do
1576 EditStyle
:= esEllipsis
;
1580 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_CENTER
], BoolNames
[Data
.FXPos
= 0], True)] do
1582 EditStyle
:= esPickList
;
1586 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_DELAY
], IntToStr(Data
.FXWait
), True)] do
1588 EditStyle
:= esSimple
;
1592 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_VELX
], IntToStr(Data
.FXVelX
), True)] do
1594 EditStyle
:= esSimple
;
1598 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_VELY
], IntToStr(Data
.FXVelY
), True)] do
1600 EditStyle
:= esSimple
;
1604 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPL
], IntToStr(Data
.FXSpreadL
), True)] do
1606 EditStyle
:= esSimple
;
1610 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPR
], IntToStr(Data
.FXSpreadR
), True)] do
1612 EditStyle
:= esSimple
;
1616 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPU
], IntToStr(Data
.FXSpreadU
), True)] do
1618 EditStyle
:= esSimple
;
1622 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPD
], IntToStr(Data
.FXSpreadD
), True)] do
1624 EditStyle
:= esSimple
;
1628 end; //case TriggerType
1630 end; // OBJECT_TRIGGER:
1634 procedure ChangeShownProperty(Name
: String; NewValue
: String);
1638 if SelectedObjectCount() <> 1 then
1640 if not SelectedObjects
[GetFirstSelected()].Live
then
1643 // Есть ли такой ключ:
1644 if MainForm
.vleObjectProperty
.FindRow(Name
, row
) then
1646 MainForm
.vleObjectProperty
.Values
[Name
] := NewValue
;
1650 procedure SelectObject(fObjectType
: Byte; fID
: DWORD
; Multi
: Boolean);
1659 // Уже выделен - убираем:
1660 if SelectedObjects
<> nil then
1661 for a
:= 0 to High(SelectedObjects
) do
1662 with SelectedObjects
[a
] do
1663 if Live
and (ID
= fID
) and
1664 (ObjectType
= fObjectType
) then
1673 SetLength(SelectedObjects
, Length(SelectedObjects
)+1);
1675 with SelectedObjects
[High(SelectedObjects
)] do
1677 ObjectType
:= fObjectType
;
1684 SetLength(SelectedObjects
, 1);
1686 with SelectedObjects
[0] do
1688 ObjectType
:= fObjectType
;
1694 MainForm
.miCopy
.Enabled
:= True;
1695 MainForm
.miCut
.Enabled
:= True;
1697 if fObjectType
= OBJECT_PANEL
then
1699 MainForm
.miToFore
.Enabled
:= True;
1700 MainForm
.miToBack
.Enabled
:= True;
1704 procedure RemoveSelectFromObjects();
1706 SelectedObjects
:= nil;
1707 DrawPressRect
:= False;
1708 MouseLDown
:= False;
1709 MouseRDown
:= False;
1710 MouseAction
:= MOUSEACTION_NONE
;
1711 SelectFlag
:= SELECTFLAG_NONE
;
1712 ResizeType
:= RESIZETYPE_NONE
;
1713 ResizeDirection
:= RESIZEDIR_NONE
;
1715 MainForm
.vleObjectProperty
.Strings
.Clear();
1717 MainForm
.miCopy
.Enabled
:= False;
1718 MainForm
.miCut
.Enabled
:= False;
1719 MainForm
.miToFore
.Enabled
:= False;
1720 MainForm
.miToBack
.Enabled
:= False;
1723 procedure DeleteSelectedObjects();
1728 if SelectedObjects
= nil then
1734 for a
:= 0 to High(SelectedObjects
) do
1735 with SelectedObjects
[a
] do
1740 SetLength(UndoBuffer
, Length(UndoBuffer
)+1);
1741 i
:= High(UndoBuffer
);
1745 SetLength(UndoBuffer
[i
], Length(UndoBuffer
[i
])+1);
1746 ii
:= High(UndoBuffer
[i
]);
1751 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_PANEL
;
1752 New(UndoBuffer
[i
, ii
].Panel
);
1753 UndoBuffer
[i
, ii
].Panel
^ := gPanels
[ID
];
1757 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_ITEM
;
1758 UndoBuffer
[i
, ii
].Item
:= gItems
[ID
];
1762 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_AREA
;
1763 UndoBuffer
[i
, ii
].Area
:= gAreas
[ID
];
1767 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_TRIGGER
;
1768 UndoBuffer
[i
, ii
].Trigger
:= gTriggers
[ID
];
1772 RemoveObject(ID
, ObjectType
);
1775 RemoveSelectFromObjects();
1777 MainForm
.miUndo
.Enabled
:= UndoBuffer
<> nil;
1778 MainForm
.RecountSelectedObjects();
1781 procedure Undo_Add(ObjectType
: Byte; ID
: DWORD
; Group
: Boolean = False);
1785 if (not Group
) or (Length(UndoBuffer
) = 0) then
1786 SetLength(UndoBuffer
, Length(UndoBuffer
)+1);
1787 SetLength(UndoBuffer
[High(UndoBuffer
)], Length(UndoBuffer
[High(UndoBuffer
)])+1);
1788 i
:= High(UndoBuffer
);
1789 ii
:= High(UndoBuffer
[i
]);
1793 UndoBuffer
[i
, ii
].UndoType
:= UNDO_ADD_PANEL
;
1795 UndoBuffer
[i
, ii
].UndoType
:= UNDO_ADD_ITEM
;
1797 UndoBuffer
[i
, ii
].UndoType
:= UNDO_ADD_MONSTER
;
1799 UndoBuffer
[i
, ii
].UndoType
:= UNDO_ADD_AREA
;
1801 UndoBuffer
[i
, ii
].UndoType
:= UNDO_ADD_TRIGGER
;
1804 UndoBuffer
[i
, ii
].AddID
:= ID
;
1806 MainForm
.miUndo
.Enabled
:= UndoBuffer
<> nil;
1809 procedure FullClear();
1811 RemoveSelectFromObjects();
1813 LoadSky(gMapInfo
.SkyName
);
1815 slInvalidTextures
.Clear();
1816 MapCheckForm
.lbErrorList
.Clear();
1817 MapCheckForm
.mErrorDescription
.Clear();
1819 MainForm
.miUndo
.Enabled
:= False;
1820 MainForm
.sbHorizontal
.Position
:= 0;
1821 MainForm
.sbVertical
.Position
:= 0;
1822 MainForm
.FormResize(nil);
1823 MainForm
.Caption
:= FormCaption
;
1828 procedure ErrorMessageBox(str
: String);
1830 MessageBox(0, PChar(str
), PChar(_lc
[I_MSG_ERROR
]),
1831 MB_ICONINFORMATION
or MB_OK
or MB_DEFBUTTON1
);
1834 function CheckProperty(): Boolean;
1840 _id
:= GetFirstSelected();
1842 if SelectedObjects
[_id
].ObjectType
= OBJECT_PANEL
then
1843 with gPanels
[SelectedObjects
[_id
].ID
] do
1845 if TextureWidth
<> 0 then
1846 if StrToIntDef(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_WIDTH
]], 1) mod TextureWidth
<> 0 then
1848 ErrorMessageBox(Format(_lc
[I_MSG_WRONG_TEXWIDTH
],
1853 if TextureHeight
<> 0 then
1854 if StrToIntDef(Trim(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_HEIGHT
]]), 1) mod TextureHeight
<> 0 then
1856 ErrorMessageBox(Format(_lc
[I_MSG_WRONG_TEXHEIGHT
],
1861 if IsTexturedPanel(PanelType
) and (TextureName
<> '') then
1862 if not (StrToIntDef(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_ALPHA
]], -1) in [0..255]) then
1864 ErrorMessageBox(_lc
[I_MSG_WRONG_ALPHA
]);
1869 if SelectedObjects
[_id
].ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
] then
1870 if (StrToIntDef(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_WIDTH
]], 0) <= 0) or
1871 (StrToIntDef(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_HEIGHT
]], 0) <= 0) then
1873 ErrorMessageBox(_lc
[I_MSG_WRONG_SIZE
]);
1877 if (Trim(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_X
]]) = '') or
1878 (Trim(MainForm
.vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]) = '') then
1880 ErrorMessageBox(_lc
[I_MSG_WRONG_XY
]);
1887 procedure SelectTexture(ID
: Integer);
1889 MainForm
.lbTextureList
.ItemIndex
:= ID
;
1890 MainForm
.lbTextureListClick(nil);
1893 function AddTexture(aWAD
, aSection
, aTex
: String; silent
: Boolean): Boolean;
1895 a
, FrameLen
: Integer;
1898 ResourceName
: String;
1899 FullResourceName
: String;
1900 SectionName
: String;
1902 Width
, Height
: Word;
1910 if aSection
= '..' then
1913 SectionName
:= aSection
;
1916 aWAD
:= _lc
[I_WAD_SPECIAL_MAP
];
1918 if aWAD
= _lc
[I_WAD_SPECIAL_MAP
] then
1920 g_ProcessResourceStr(OpenedMap
, @fn
, nil, nil);
1921 //FileName := EditorDir+'maps\'+ExtractFileName(fn);
1923 ResourceName
:= ':'+SectionName
+'\'+aTex
;
1926 if aWAD
= _lc
[I_WAD_SPECIAL_TEXS
] then
1927 begin // Спец. текстуры
1929 ResourceName
:= aTex
;
1932 begin // Внешний WAD
1933 FileName
:= EditorDir
+'wads/'+aWAD
;
1934 ResourceName
:= aWAD
+':'+SectionName
+'\'+aTex
;
1939 // Есть ли уже такая текстура:
1940 for a
:= 0 to MainForm
.lbTextureList
.Items
.Count
-1 do
1941 if ResourceName
= MainForm
.lbTextureList
.Items
[a
] then
1944 ErrorMessageBox(Format(_lc
[I_MSG_TEXTURE_ALREADY
],
1949 // Название ресурса <= 64 символов:
1950 if Length(ResourceName
) > 64 then
1953 ErrorMessageBox(Format(_lc
[I_MSG_RES_NAME_64
],
1961 if aWAD
= _lc
[I_WAD_SPECIAL_TEXS
] then
1963 a
:= MainForm
.lbTextureList
.Items
.Add(ResourceName
);
1970 FullResourceName
:= FileName
+':'+SectionName
+'\'+aTex
;
1972 if IsAnim(FullResourceName
) then
1973 begin // Аним. текстура
1974 GetFrame(FullResourceName
, Data
, FrameLen
, Width
, Height
);
1976 if not g_CreateTextureMemorySize(Data
, FrameLen
, ResourceName
, 0, 0, Width
, Height
, 1) then
1978 a
:= MainForm
.lbTextureList
.Items
.Add(ResourceName
);
1980 else // Обычная текстура
1982 if not g_CreateTextureWAD(ResourceName
, FullResourceName
) then
1984 a
:= MainForm
.lbTextureList
.Items
.Add(ResourceName
);
1986 if (not ok
) and (slInvalidTextures
.IndexOf(ResourceName
) = -1) then
1988 slInvalidTextures
.Add(ResourceName
);
1991 if (a
> -1) and (not silent
) then
1998 procedure UpdateCaption(sMap
, sFile
, sRes
: String);
2001 if (sFile
= '') and (sRes
= '') and (sMap
= '') then
2002 Caption
:= FormCaption
2005 Caption
:= Format('%s - %s:%s', [FormCaption
, sFile
, sRes
])
2007 if (sFile
<> '') and (sRes
<> '') then
2008 Caption
:= Format('%s - %s (%s:%s)', [FormCaption
, sMap
, sFile
, sRes
])
2010 Caption
:= Format('%s - %s', [FormCaption
, sMap
]);
2013 procedure OpenMap(FileName
: String; mapN
: String);
2018 SelectMapForm
.Caption
:= _lc
[I_CAP_OPEN
];
2019 SelectMapForm
.GetMaps(FileName
);
2021 if (FileName
= OpenedWAD
) and
2022 (OpenedMap
<> '') then
2024 MapName
:= OpenedMap
;
2025 while (Pos(':\', MapName
) > 0) do
2026 Delete(MapName
, 1, Pos(':\', MapName
) + 1);
2028 idx
:= SelectMapForm
.lbMapList
.Items
.IndexOf(MapName
);
2029 SelectMapForm
.lbMapList
.ItemIndex
:= idx
;
2032 if SelectMapForm
.lbMapList
.Count
> 0 then
2033 SelectMapForm
.lbMapList
.ItemIndex
:= 0
2035 SelectMapForm
.lbMapList
.ItemIndex
:= -1;
2040 idx
:= SelectMapForm
.lbMapList
.Items
.IndexOf(mapN
);
2044 if (SelectMapForm
.ShowModal() = mrOK
) and
2045 (SelectMapForm
.lbMapList
.ItemIndex
<> -1) then
2046 idx
:= SelectMapForm
.lbMapList
.ItemIndex
2051 MapName
:= SelectMapForm
.lbMapList
.Items
[idx
];
2057 pLoadProgress
.Left
:= (RenderPanel
.Width
div 2)-(pLoadProgress
.Width
div 2);
2058 pLoadProgress
.Top
:= (RenderPanel
.Height
div 2)-(pLoadProgress
.Height
div 2);
2059 pLoadProgress
.Show();
2061 OpenedMap
:= FileName
+':\'+MapName
;
2062 OpenedWAD
:= FileName
;
2064 idx
:= RecentFiles
.IndexOf(OpenedMap
);
2065 // Такая карта уже недавно открывалась:
2067 RecentFiles
.Delete(idx
);
2068 RecentFiles
.Insert(0, OpenedMap
);
2069 RefreshRecentMenu();
2073 pLoadProgress
.Hide();
2076 lbTextureList
.Sorted
:= True;
2077 lbTextureList
.Sorted
:= False;
2079 UpdateCaption(gMapInfo
.Name
, ExtractFileName(FileName
), MapName
);
2083 procedure MoveSelectedObjects(Wall
, alt
: Boolean; dx
, dy
: Integer);
2088 if SelectedObjects
= nil then
2095 for a
:= 0 to High(SelectedObjects
) do
2096 if SelectedObjects
[a
].Live
then
2098 if ObjectCollideLevel(SelectedObjects
[a
].ID
, SelectedObjects
[a
].ObjectType
, dx
, 0) then
2101 if ObjectCollideLevel(SelectedObjects
[a
].ID
, SelectedObjects
[a
].ObjectType
, 0, dy
) then
2104 if (not okX
) or (not okY
) then
2110 for a
:= 0 to High(SelectedObjects
) do
2111 if SelectedObjects
[a
].Live
then
2114 MoveObject(SelectedObjects
[a
].ObjectType
, SelectedObjects
[a
].ID
, dx
, 0);
2117 MoveObject(SelectedObjects
[a
].ObjectType
, SelectedObjects
[a
].ID
, 0, dy
);
2119 if alt
and (SelectedObjects
[a
].ObjectType
= OBJECT_TRIGGER
) then
2121 if gTriggers
[SelectedObjects
[a
].ID
].TriggerType
in [TRIGGER_PRESS
,
2122 TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
] then
2123 begin // Двигаем зону Расширителя
2125 gTriggers
[SelectedObjects
[a
].ID
].Data
.tX
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.tX
+dx
;
2127 gTriggers
[SelectedObjects
[a
].ID
].Data
.tY
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.tY
+dy
;
2130 if gTriggers
[SelectedObjects
[a
].ID
].TriggerType
in [TRIGGER_TELEPORT
] then
2131 begin // Двигаем точку назначения Телепорта
2133 gTriggers
[SelectedObjects
[a
].ID
].Data
.TargetPoint
.X
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.TargetPoint
.X
+dx
;
2135 gTriggers
[SelectedObjects
[a
].ID
].Data
.TargetPoint
.Y
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.TargetPoint
.Y
+dy
;
2138 if gTriggers
[SelectedObjects
[a
].ID
].TriggerType
in [TRIGGER_SPAWNMONSTER
] then
2139 begin // Двигаем точку создания монстра
2141 gTriggers
[SelectedObjects
[a
].ID
].Data
.MonPos
.X
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.MonPos
.X
+dx
;
2143 gTriggers
[SelectedObjects
[a
].ID
].Data
.MonPos
.Y
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.MonPos
.Y
+dy
;
2146 if gTriggers
[SelectedObjects
[a
].ID
].TriggerType
in [TRIGGER_SPAWNITEM
] then
2147 begin // Двигаем точку создания предмета
2149 gTriggers
[SelectedObjects
[a
].ID
].Data
.ItemPos
.X
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.ItemPos
.X
+dx
;
2151 gTriggers
[SelectedObjects
[a
].ID
].Data
.ItemPos
.Y
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.ItemPos
.Y
+dy
;
2154 if gTriggers
[SelectedObjects
[a
].ID
].TriggerType
in [TRIGGER_SHOT
] then
2155 begin // Двигаем точку создания выстрела
2157 gTriggers
[SelectedObjects
[a
].ID
].Data
.ShotPos
.X
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.ShotPos
.X
+dx
;
2159 gTriggers
[SelectedObjects
[a
].ID
].Data
.ShotPos
.Y
:= gTriggers
[SelectedObjects
[a
].ID
].Data
.ShotPos
.Y
+dy
;
2164 LastMovePoint
:= MousePos
;
2168 procedure ShowLayer(Layer
: Byte; show
: Boolean);
2170 LayerEnabled
[Layer
] := show
;
2175 MainForm
.miLayer1
.Checked
:= show
;
2176 MainForm
.miLayerP1
.Checked
:= show
;
2180 MainForm
.miLayer2
.Checked
:= show
;
2181 MainForm
.miLayerP2
.Checked
:= show
;
2185 MainForm
.miLayer3
.Checked
:= show
;
2186 MainForm
.miLayerP3
.Checked
:= show
;
2190 MainForm
.miLayer4
.Checked
:= show
;
2191 MainForm
.miLayerP4
.Checked
:= show
;
2195 MainForm
.miLayer5
.Checked
:= show
;
2196 MainForm
.miLayerP5
.Checked
:= show
;
2200 MainForm
.miLayer6
.Checked
:= show
;
2201 MainForm
.miLayerP6
.Checked
:= show
;
2205 MainForm
.miLayer7
.Checked
:= show
;
2206 MainForm
.miLayerP7
.Checked
:= show
;
2210 MainForm
.miLayer8
.Checked
:= show
;
2211 MainForm
.miLayerP8
.Checked
:= show
;
2215 MainForm
.miLayer9
.Checked
:= show
;
2216 MainForm
.miLayerP9
.Checked
:= show
;
2220 RemoveSelectFromObjects();
2223 procedure SwitchLayer(Layer
: Byte);
2225 ShowLayer(Layer
, not LayerEnabled
[Layer
]);
2228 procedure SwitchMap();
2230 ShowMap
:= not ShowMap
;
2231 MainForm
.tbShowMap
.Down
:= ShowMap
;
2234 procedure ShowEdges();
2236 if drEdge
[3] < 255 then
2239 drEdge
[3] := gAlphaEdge
;
2242 function SelectedTexture(): String;
2244 if MainForm
.lbTextureList
.ItemIndex
<> -1 then
2245 Result
:= MainForm
.lbTextureList
.Items
[MainForm
.lbTextureList
.ItemIndex
]
2250 function IsSpecialTextureSel(): Boolean;
2252 Result
:= (MainForm
.lbTextureList
.ItemIndex
<> -1) and
2253 IsSpecialTexture(MainForm
.lbTextureList
.Items
[MainForm
.lbTextureList
.ItemIndex
]);
2256 function CopyBufferToString(var CopyBuf
: TCopyRecArray
): String;
2261 procedure AddInt(x
: Integer);
2263 Res
:= Res
+ IntToStr(x
) + ' ';
2269 if Length(CopyBuf
) = 0 then
2272 Res
:= CLIPBOARD_SIG
+ ' ';
2274 for i
:= 0 to High(CopyBuf
) do
2276 if (CopyBuf
[i
].ObjectType
= OBJECT_PANEL
) and
2277 (CopyBuf
[i
].Panel
= nil) then
2281 AddInt(CopyBuf
[i
].ObjectType
);
2284 // Свойства объекта:
2285 case CopyBuf
[i
].ObjectType
of
2287 with CopyBuf
[i
].Panel
^ do
2294 Res
:= Res
+ '"' + TextureName
+ '" ';
2296 AddInt(IfThen(Blending
, 1, 0));
2300 with CopyBuf
[i
].Item
do
2305 AddInt(IfThen(OnlyDM
, 1, 0));
2306 AddInt(IfThen(Fall
, 1, 0));
2310 with CopyBuf
[i
].Monster
do
2312 AddInt(MonsterType
);
2315 AddInt(IfThen(Direction
= D_LEFT
, 1, 0));
2319 with CopyBuf
[i
].Area
do
2324 AddInt(IfThen(Direction
= D_LEFT
, 1, 0));
2328 with CopyBuf
[i
].Trigger
do
2330 AddInt(TriggerType
);
2335 AddInt(ActivateType
);
2337 AddInt(IfThen(Enabled
, 1, 0));
2338 AddInt(TexturePanel
);
2340 for j
:= 0 to 127 do
2341 AddInt(Data
.Default
[j
]);
2349 procedure StringToCopyBuffer(Str
: String; var CopyBuf
: TCopyRecArray
;
2354 function GetNext(): String;
2359 if Str
[1] = '"' then
2371 Result
:= Copy(Str
, 1, p
-1);
2387 Result
:= Copy(Str
, 1, p
-1);
2397 if GetNext() <> CLIPBOARD_SIG
then
2403 t
:= StrToIntDef(GetNext(), 0);
2405 if (t
< OBJECT_PANEL
) or (t
> OBJECT_TRIGGER
) or
2406 (GetNext() <> ';') then
2407 begin // Что-то не то => пропускаем:
2415 i
:= Length(CopyBuf
);
2416 SetLength(CopyBuf
, i
+ 1);
2418 CopyBuf
[i
].ObjectType
:= t
;
2419 CopyBuf
[i
].Panel
:= nil;
2421 // Свойства объекта:
2425 New(CopyBuf
[i
].Panel
);
2427 with CopyBuf
[i
].Panel
^ do
2429 PanelType
:= StrToIntDef(GetNext(), PANEL_WALL
);
2430 X
:= StrToIntDef(GetNext(), 0);
2431 Y
:= StrToIntDef(GetNext(), 0);
2432 pmin
.X
:= Min(X
, pmin
.X
);
2433 pmin
.Y
:= Min(Y
, pmin
.Y
);
2434 Width
:= StrToIntDef(GetNext(), 16);
2435 Height
:= StrToIntDef(GetNext(), 16);
2436 TextureName
:= GetNext();
2437 Alpha
:= StrToIntDef(GetNext(), 0);
2438 Blending
:= (GetNext() = '1');
2443 with CopyBuf
[i
].Item
do
2445 ItemType
:= StrToIntDef(GetNext(), ITEM_MEDKIT_SMALL
);
2446 X
:= StrToIntDef(GetNext(), 0);
2447 Y
:= StrToIntDef(GetNext(), 0);
2448 pmin
.X
:= Min(X
, pmin
.X
);
2449 pmin
.Y
:= Min(Y
, pmin
.Y
);
2450 OnlyDM
:= (GetNext() = '1');
2451 Fall
:= (GetNext() = '1');
2455 with CopyBuf
[i
].Monster
do
2457 MonsterType
:= StrToIntDef(GetNext(), MONSTER_DEMON
);
2458 X
:= StrToIntDef(GetNext(), 0);
2459 Y
:= StrToIntDef(GetNext(), 0);
2460 pmin
.X
:= Min(X
, pmin
.X
);
2461 pmin
.Y
:= Min(Y
, pmin
.Y
);
2463 if GetNext() = '1' then
2466 Direction
:= D_RIGHT
;
2470 with CopyBuf
[i
].Area
do
2472 AreaType
:= StrToIntDef(GetNext(), AREA_PLAYERPOINT1
);
2473 X
:= StrToIntDef(GetNext(), 0);
2474 Y
:= StrToIntDef(GetNext(), 0);
2475 pmin
.X
:= Min(X
, pmin
.X
);
2476 pmin
.Y
:= Min(Y
, pmin
.Y
);
2477 if GetNext() = '1' then
2480 Direction
:= D_RIGHT
;
2484 with CopyBuf
[i
].Trigger
do
2486 TriggerType
:= StrToIntDef(GetNext(), TRIGGER_EXIT
);
2487 X
:= StrToIntDef(GetNext(), 0);
2488 Y
:= StrToIntDef(GetNext(), 0);
2489 pmin
.X
:= Min(X
, pmin
.X
);
2490 pmin
.Y
:= Min(Y
, pmin
.Y
);
2491 Width
:= StrToIntDef(GetNext(), 16);
2492 Height
:= StrToIntDef(GetNext(), 16);
2493 ActivateType
:= StrToIntDef(GetNext(), 0);
2494 Key
:= StrToIntDef(GetNext(), 0);
2495 Enabled
:= (GetNext() = '1');
2496 TexturePanel
:= StrToIntDef(GetNext(), 0);
2498 for j
:= 0 to 127 do
2499 Data
.Default
[j
] := StrToIntDef(GetNext(), 0);
2504 pmin
.X
:= Min(Data
.TargetPoint
.X
, pmin
.X
);
2505 pmin
.Y
:= Min(Data
.TargetPoint
.Y
, pmin
.Y
);
2507 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
:
2509 pmin
.X
:= Min(Data
.tX
, pmin
.X
);
2510 pmin
.Y
:= Min(Data
.tY
, pmin
.Y
);
2512 TRIGGER_SPAWNMONSTER
:
2514 pmin
.X
:= Min(Data
.MonPos
.X
, pmin
.X
);
2515 pmin
.Y
:= Min(Data
.MonPos
.Y
, pmin
.Y
);
2519 pmin
.X
:= Min(Data
.ItemPos
.X
, pmin
.X
);
2520 pmin
.Y
:= Min(Data
.ItemPos
.Y
, pmin
.Y
);
2524 pmin
.X
:= Min(Data
.ShotPos
.X
, pmin
.X
);
2525 pmin
.Y
:= Min(Data
.ShotPos
.Y
, pmin
.Y
);
2533 //----------------------------------------
2534 //Закончились вспомогательные процедуры
2535 //----------------------------------------
2537 procedure TMainForm
.RefreshRecentMenu();
2542 // Лишние запомненные карты:
2543 while RecentFiles
.Count
> RecentCount
do
2544 RecentFiles
.Delete(RecentFiles
.Count
-1);
2546 // Лишние строки меню:
2547 while MainMenu
.Items
[0].Count
> RECENT_FILES_MENU_START
do
2548 MainMenu
.Items
[0].Delete(MainMenu
.Items
[0].Count
-1);
2550 // Отделение списка карт от строки "Выход":
2551 if RecentFiles
.Count
> 0 then
2553 MI
:= TMenuItem
.Create(MainMenu
.Items
[0]);
2555 MainMenu
.Items
[0].Add(MI
);
2558 // Добавление в меню списка запомненных карт:
2559 for i
:= 0 to RecentFiles
.Count
-1 do
2561 MI
:= TMenuItem
.Create(MainMenu
.Items
[0]);
2562 MI
.Caption
:= IntToStr(i
+1) + ' ' + RecentFiles
[i
];
2563 MI
.OnClick
:= aRecentFileExecute
;
2564 MainMenu
.Items
[0].Add(MI
);
2568 procedure TMainForm
.aRecentFileExecute(Sender
: TObject
);
2574 s
:= LowerCase((Sender
as TMenuItem
).Caption
);
2575 Delete(s
, Pos('&', s
), 1);
2576 s
:= Trim(Copy(s
, 1, 2));
2577 n
:= StrToIntDef(s
, 0) - 1;
2579 if (n
< 0) or (n
>= RecentFiles
.Count
) then
2582 s
:= RecentFiles
[n
];
2583 pw
:= Pos('.wad:\', LowerCase(s
));
2587 begin // Map name included
2588 fn
:= Copy(s
, 1, pw
+ 3);
2589 Delete(s
, 1, pw
+ 5);
2590 if (FileExists(fn
)) then
2596 else // Only wad name
2597 if (FileExists(s
)) then
2603 if (not b
) and (MessageBox(0, PChar(_lc
[I_MSG_DEL_RECENT_PROMT
]),
2604 PChar(_lc
[I_MSG_DEL_RECENT
]), MB_ICONQUESTION
or MB_YESNO
) = idYes
) then
2606 RecentFiles
.Delete(n
);
2607 RefreshRecentMenu();
2611 procedure TMainForm
.aEditorOptionsExecute(Sender
: TObject
);
2613 OptionsForm
.ShowModal();
2616 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
2626 g_ReadResource(EditorDir
+ 'data/game.wad', 'FONTS', cfgres
, cfgdata
, cfglen
);
2627 if cfgdata
<> nil then
2629 if not g_CreateTextureWAD('FONT_STD', EditorDir
+ 'data/game.wad:FONTS\' + texture
) then
2630 e_WriteLog('ERROR ERROR ERROR', MSG_WARNING
);
2632 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
2633 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
2634 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
2635 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
2637 if g_GetTexture('FONT_STD', ID
) then
2638 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
- 2);
2645 e_WriteLog('Could not load FONT_STD', MSG_WARNING
)
2649 procedure TMainForm
.FormCreate(Sender
: TObject
);
2657 EditorDir
:= ExtractFilePath(Application
.ExeName
);
2659 e_InitLog(EditorDir
+'Editor.log', WM_NEWFILE
);
2661 slInvalidTextures
:= TStringList
.Create
;
2663 ShowLayer(LAYER_BACK
, True);
2664 ShowLayer(LAYER_WALLS
, True);
2665 ShowLayer(LAYER_FOREGROUND
, True);
2666 ShowLayer(LAYER_STEPS
, True);
2667 ShowLayer(LAYER_WATER
, True);
2668 ShowLayer(LAYER_ITEMS
, True);
2669 ShowLayer(LAYER_MONSTERS
, True);
2670 ShowLayer(LAYER_AREAS
, True);
2671 ShowLayer(LAYER_TRIGGERS
, True);
2675 FormCaption
:= MainForm
.Caption
;
2679 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
2681 if config
.ReadInt('Editor', 'XPos', -1) = -1 then
2682 Position
:= poDesktopCenter
2684 Left
:= config
.ReadInt('Editor', 'XPos', Left
);
2685 Top
:= config
.ReadInt('Editor', 'YPos', Top
);
2686 Width
:= config
.ReadInt('Editor', 'Width', Width
);
2687 Height
:= config
.ReadInt('Editor', 'Height', Height
);
2689 if config
.ReadBool('Editor', 'Maximize', False) then
2690 WindowState
:= wsMaximized
;
2691 ShowMap
:= config
.ReadBool('Editor', 'Minimap', False);
2692 PanelProps
.Width
:= config
.ReadInt('Editor', 'PanelProps', PanelProps
.ClientWidth
);
2693 Splitter1
.Left
:= PanelProps
.Left
;
2694 PanelObjs
.Height
:= config
.ReadInt('Editor', 'PanelObjs', PanelObjs
.ClientHeight
);
2695 Splitter2
.Top
:= PanelObjs
.Top
;
2696 StatusBar
.Top
:= PanelObjs
.BoundsRect
.Bottom
;
2697 DotEnable
:= config
.ReadBool('Editor', 'DotEnable', True);
2698 DotColor
:= config
.ReadInt('Editor', 'DotColor', $FFFFFF);
2699 DotStepOne
:= config
.ReadInt('Editor', 'DotStepOne', 16);
2700 DotStepTwo
:= config
.ReadInt('Editor', 'DotStepTwo', 8);
2701 DotStep
:= config
.ReadInt('Editor', 'DotStep', DotStepOne
);
2702 DrawTexturePanel
:= config
.ReadBool('Editor', 'DrawTexturePanel', True);
2703 DrawPanelSize
:= config
.ReadBool('Editor', 'DrawPanelSize', True);
2704 BackColor
:= config
.ReadInt('Editor', 'BackColor', $7F6040);
2705 PreviewColor
:= config
.ReadInt('Editor', 'PreviewColor', $00FF00);
2706 UseCheckerboard
:= config
.ReadBool('Editor', 'UseCheckerboard', True);
2707 gColorEdge
:= config
.ReadInt('Editor', 'EdgeColor', COLOR_EDGE
);
2708 gAlphaEdge
:= config
.ReadInt('Editor', 'EdgeAlpha', ALPHA_EDGE
);
2709 if gAlphaEdge
= 255 then
2710 gAlphaEdge
:= ALPHA_EDGE
;
2711 drEdge
[0] := GetRValue(gColorEdge
);
2712 drEdge
[1] := GetGValue(gColorEdge
);
2713 drEdge
[2] := GetBValue(gColorEdge
);
2714 if not config
.ReadBool('Editor', 'EdgeShow', True) then
2717 drEdge
[3] := gAlphaEdge
;
2718 gAlphaTriggerLine
:= config
.ReadInt('Editor', 'LineAlpha', ALPHA_LINE
);
2719 if gAlphaTriggerLine
= 255 then
2720 gAlphaTriggerLine
:= ALPHA_LINE
;
2721 gAlphaTriggerArea
:= config
.ReadInt('Editor', 'TriggerAlpha', ALPHA_AREA
);
2722 if gAlphaTriggerArea
= 255 then
2723 gAlphaTriggerArea
:= ALPHA_AREA
;
2724 gAlphaMonsterRect
:= config
.ReadInt('Editor', 'MonsterRectAlpha', 0);
2725 gAlphaAreaRect
:= config
.ReadInt('Editor', 'AreaRectAlpha', 0);
2726 if config
.ReadInt('Editor', 'Scale', 0) = 1 then
2730 if config
.ReadInt('Editor', 'DotSize', 0) = 1 then
2734 OpenDialog
.InitialDir
:= config
.ReadStr('Editor', 'LastOpenDir', EditorDir
);
2735 SaveDialog
.InitialDir
:= config
.ReadStr('Editor', 'LastSaveDir', EditorDir
);
2737 s
:= config
.ReadStr('Editor', 'Language', '');
2740 RecentCount
:= config
.ReadInt('Editor', 'RecentCount', 5);
2741 if RecentCount
> 10 then
2743 if RecentCount
< 2 then
2746 RecentFiles
:= TStringList
.Create();
2747 for i
:= 0 to RecentCount
-1 do
2749 s
:= config
.ReadStr('RecentFiles', IntToStr(i
+1), '');
2753 RefreshRecentMenu();
2757 tbShowMap
.Down
:= ShowMap
;
2758 tbGridOn
.Down
:= DotEnable
;
2759 pcObjects
.ActivePageIndex
:= 0;
2760 Application
.Title
:= _lc
[I_EDITOR_TITLE
];
2762 Application
.OnIdle
:= OnIdle
;
2765 procedure PrintBlack(X
, Y
: Integer; Text: string; FontID
: DWORD
);
2767 // NOTE: all the font printing routines assume CP1251
2768 e_TextureFontPrintEx(X
, Y
, Text, FontID
, 0, 0, 0, 1.0);
2771 procedure TMainForm
.Draw();
2776 Width
, Height
: Word;
2779 aX
, aY
, aX2
, aY2
, XX
, ScaleSz
: Integer;
2788 e_Clear(GL_COLOR_BUFFER_BIT
,
2789 GetRValue(BackColor
)/255,
2790 GetGValue(BackColor
)/255,
2791 GetBValue(BackColor
)/255);
2795 ObjCount
:= SelectedObjectCount();
2797 // Обводим выделенные объекты красной рамкой:
2798 if ObjCount
> 0 then
2800 for a
:= 0 to High(SelectedObjects
) do
2801 if SelectedObjects
[a
].Live
then
2803 Rect
:= ObjectGetRect(SelectedObjects
[a
].ObjectType
, SelectedObjects
[a
].ID
);
2807 e_DrawQuad(X
+MapOffset
.X
, Y
+MapOffset
.Y
,
2808 X
+MapOffset
.X
+Width
-1, Y
+MapOffset
.Y
+Height
-1,
2811 // Рисуем точки изменения размеров:
2812 if (ObjCount
= 1) and
2813 (SelectedObjects
[GetFirstSelected
].ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
]) then
2815 e_DrawPoint(5, X
+MapOffset
.X
, Y
+MapOffset
.Y
+(Height
div 2), 255, 255, 255);
2816 e_DrawPoint(5, X
+MapOffset
.X
+Width
-1, Y
+MapOffset
.Y
+(Height
div 2), 255, 255, 255);
2817 e_DrawPoint(5, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
, 255, 255, 255);
2818 e_DrawPoint(5, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
+Height
-1, 255, 255, 255);
2820 e_DrawPoint(3, X
+MapOffset
.X
, Y
+MapOffset
.Y
+(Height
div 2), 255, 0, 0);
2821 e_DrawPoint(3, X
+MapOffset
.X
+Width
-1, Y
+MapOffset
.Y
+(Height
div 2), 255, 0, 0);
2822 e_DrawPoint(3, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
, 255, 0, 0);
2823 e_DrawPoint(3, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
+Height
-1, 255, 0, 0);
2830 if DotEnable
and (PreviewMode
= 0) then
2837 for x
:= 0 to (RenderPanel
.Width
div DotStep
) do
2838 for y
:= 0 to (RenderPanel
.Height
div DotStep
) do
2839 e_DrawPoint(DotSize
, x
*DotStep
+ a
, y
*DotStep
+ a
,
2840 GetRValue(DotColor
),
2841 GetGValue(DotColor
),
2842 GetBValue(DotColor
));
2846 if (lbTextureList
.ItemIndex
<> -1) and (cbPreview
.Checked
) and
2847 (not IsSpecialTextureSel()) and (PreviewMode
= 0) then
2849 if not g_GetTexture(SelectedTexture(), ID
) then
2850 g_GetTexture('NOTEXTURE', ID
);
2851 g_GetTextureSizeByID(ID
, Width
, Height
);
2852 if UseCheckerboard
then
2854 if g_GetTexture('PREVIEW', PID
) then
2855 e_DrawFill(PID
, RenderPanel
.Width
-Width
, RenderPanel
.Height
-Height
, Width
div 16 + 1, Height
div 16 + 1, 0, True, False);
2857 e_DrawFillQuad(RenderPanel
.Width
-Width
-2, RenderPanel
.Height
-Height
-2,
2858 RenderPanel
.Width
-1, RenderPanel
.Height
-1,
2859 GetRValue(PreviewColor
), GetGValue(PreviewColor
), GetBValue(PreviewColor
), 0);
2860 e_Draw(ID
, RenderPanel
.Width
-Width
, RenderPanel
.Height
-Height
, 0, True, False);
2863 // Подсказка при выборе точки Телепорта:
2864 if SelectFlag
= SELECTFLAG_TELEPORT
then
2866 with gTriggers
[SelectedObjects
[GetFirstSelected()].ID
] do
2867 if Data
.d2d_teleport
then
2868 e_DrawLine(2, MousePos
.X
-16, MousePos
.Y
-1,
2869 MousePos
.X
+16, MousePos
.Y
-1,
2872 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+AreaSize
[AREA_DMPOINT
].Width
-1,
2873 MousePos
.Y
+AreaSize
[AREA_DMPOINT
].Height
-1, 255, 255, 255);
2875 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2876 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2877 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_TELEPORT
], gEditorFont
);
2880 // Подсказка при выборе точки появления:
2881 if SelectFlag
= SELECTFLAG_SPAWNPOINT
then
2883 e_DrawLine(2, MousePos
.X
-16, MousePos
.Y
-1,
2884 MousePos
.X
+16, MousePos
.Y
-1,
2886 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2887 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2888 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_SPAWN
], gEditorFont
);
2891 // Подсказка при выборе панели двери:
2892 if SelectFlag
= SELECTFLAG_DOOR
then
2894 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2895 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2896 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_DOOR
], gEditorFont
);
2899 // Подсказка при выборе панели с текстурой:
2900 if SelectFlag
= SELECTFLAG_TEXTURE
then
2902 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+196, MousePos
.Y
+18, 192, 192, 192, 127);
2903 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+196, MousePos
.Y
+18, 255, 255, 255);
2904 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_TEXTURE
], gEditorFont
);
2907 // Подсказка при выборе панели индикации выстрела:
2908 if SelectFlag
= SELECTFLAG_SHOTPANEL
then
2910 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+316, MousePos
.Y
+18, 192, 192, 192, 127);
2911 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+316, MousePos
.Y
+18, 255, 255, 255);
2912 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_SHOT
], gEditorFont
);
2915 // Подсказка при выборе панели лифта:
2916 if SelectFlag
= SELECTFLAG_LIFT
then
2918 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2919 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2920 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_LIFT
], gEditorFont
);
2923 // Подсказка при выборе монстра:
2924 if SelectFlag
= SELECTFLAG_MONSTER
then
2926 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+120, MousePos
.Y
+18, 192, 192, 192, 127);
2927 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+120, MousePos
.Y
+18, 255, 255, 255);
2928 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_MONSTER
], gEditorFont
);
2931 // Подсказка при выборе области воздействия:
2932 if DrawPressRect
then
2934 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+204, MousePos
.Y
+18, 192, 192, 192, 127);
2935 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+204, MousePos
.Y
+18, 255, 255, 255);
2936 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_EXT_AREA
], gEditorFont
);
2939 // Рисуем текстуры, если чертим панель:
2940 if (MouseAction
= MOUSEACTION_DRAWPANEL
) and (DrawTexturePanel
) and
2941 (lbTextureList
.ItemIndex
<> -1) and (DrawRect
<> nil) and
2942 (lbPanelType
.ItemIndex
in [0..8]) and not IsSpecialTextureSel() then
2944 if not g_GetTexture(SelectedTexture(), ID
) then
2945 g_GetTexture('NOTEXTURE', ID
);
2946 g_GetTextureSizeByID(ID
, Width
, Height
);
2948 if (Abs(Right
-Left
) >= Width
) and (Abs(Bottom
-Top
) >= Height
) then
2949 e_DrawFill(ID
, Min(Left
, Right
), Min(Top
, Bottom
), Abs(Right
-Left
) div Width
,
2950 Abs(Bottom
-Top
) div Height
, 64, True, False);
2953 // Прямоугольник выделения:
2954 if DrawRect
<> nil then
2956 e_DrawQuad(Left
, Top
, Right
-1, Bottom
-1, 255, 255, 255);
2958 // Чертим мышью панель/триггер или меняем мышью их размер:
2959 if (((MouseAction
in [MOUSEACTION_DRAWPANEL
, MOUSEACTION_DRAWTRIGGER
]) and
2960 not(ssCtrl
in GetKeyShiftState())) or (MouseAction
= MOUSEACTION_RESIZE
)) and
2961 (DrawPanelSize
) then
2963 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+88, MousePos
.Y
+33, 192, 192, 192, 127);
2964 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+88, MousePos
.Y
+33, 255, 255, 255);
2966 if MouseAction
in [MOUSEACTION_DRAWPANEL
, MOUSEACTION_DRAWTRIGGER
] then
2967 begin // Чертим новый
2968 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, Format(_glc
[I_HINT_WIDTH
],
2969 [Abs(MousePos
.X
-MouseLDownPos
.X
)]), gEditorFont
);
2970 PrintBlack(MousePos
.X
+2, MousePos
.Y
+16, Format(_glc
[I_HINT_HEIGHT
],
2971 [Abs(MousePos
.Y
-MouseLDownPos
.Y
)]), gEditorFont
);
2973 else // Растягиваем существующий
2974 if SelectedObjects
[GetFirstSelected
].ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
] then
2976 if SelectedObjects
[GetFirstSelected
].ObjectType
= OBJECT_PANEL
then
2978 Width
:= gPanels
[SelectedObjects
[GetFirstSelected
].ID
].Width
;
2979 Height
:= gPanels
[SelectedObjects
[GetFirstSelected
].ID
].Height
;
2983 Width
:= gTriggers
[SelectedObjects
[GetFirstSelected
].ID
].Width
;
2984 Height
:= gTriggers
[SelectedObjects
[GetFirstSelected
].ID
].Height
;
2987 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, Format(_glc
[I_HINT_WIDTH
], [Width
]),
2989 PrintBlack(MousePos
.X
+2, MousePos
.Y
+16, Format(_glc
[I_HINT_HEIGHT
], [Height
]),
2994 // Ближайшая к курсору мыши точка на сетке:
2995 e_DrawPoint(3, MousePos
.X
, MousePos
.Y
, 0, 0, 255);
3000 // Сколько пикселов карты в 1 пикселе мини-карты:
3001 ScaleSz
:= 16 div Scale
;
3002 // Размеры мини-карты:
3003 aX
:= max(gMapInfo
.Width
div ScaleSz
, 1);
3004 aY
:= max(gMapInfo
.Height
div ScaleSz
, 1);
3005 // X-координата на RenderPanel нулевой x-координаты карты:
3006 XX
:= RenderPanel
.Width
- aX
- 1;
3008 e_DrawFillQuad(XX
-1, 0, RenderPanel
.Width
-1, aY
+1, 0, 0, 0, 0);
3009 e_DrawQuad(XX
-1, 0, RenderPanel
.Width
-1, aY
+1, 197, 197, 197);
3011 if gPanels
<> nil then
3014 for a
:= 0 to High(gPanels
) do
3016 if PanelType
<> 0 then
3018 // Левый верхний угол:
3019 aX
:= XX
+ (X
div ScaleSz
);
3020 aY
:= 1 + (Y
div ScaleSz
);
3022 aX2
:= max(Width
div ScaleSz
, 1);
3023 aY2
:= max(Height
div ScaleSz
, 1);
3024 // Правый нижний угол:
3025 aX2
:= aX
+ aX2
- 1;
3026 aY2
:= aY
+ aY2
- 1;
3029 PANEL_WALL
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 208, 208, 208, 0);
3030 PANEL_WATER
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 0, 0, 192, 0);
3031 PANEL_ACID1
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 0, 176, 0, 0);
3032 PANEL_ACID2
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 176, 0, 0, 0);
3033 PANEL_STEP
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 128, 128, 128, 0);
3034 PANEL_LIFTUP
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 116, 72, 36, 0);
3035 PANEL_LIFTDOWN
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 116, 124, 96, 0);
3036 PANEL_LIFTLEFT
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 200, 80, 4, 0);
3037 PANEL_LIFTRIGHT
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 252, 140, 56, 0);
3038 PANEL_OPENDOOR
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 100, 220, 92, 0);
3039 PANEL_CLOSEDOOR
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 212, 184, 64, 0);
3040 PANEL_BLOCKMON
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 192, 0, 192, 0);
3044 // Рисуем красным выделенные панели:
3045 if SelectedObjects
<> nil then
3046 for b
:= 0 to High(SelectedObjects
) do
3047 with SelectedObjects
[b
] do
3048 if Live
and (ObjectType
= OBJECT_PANEL
) then
3049 with gPanels
[SelectedObjects
[b
].ID
] do
3050 if PanelType
and not(PANEL_BACK
or PANEL_FORE
) <> 0 then
3052 // Левый верхний угол:
3053 aX
:= XX
+ (X
div ScaleSz
);
3054 aY
:= 1 + (Y
div ScaleSz
);
3056 aX2
:= max(Width
div ScaleSz
, 1);
3057 aY2
:= max(Height
div ScaleSz
, 1);
3058 // Правый нижний угол:
3059 aX2
:= aX
+ aX2
- 1;
3060 aY2
:= aY
+ aY2
- 1;
3062 e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 255, 0, 0, 0)
3066 if (gMapInfo
.Width
> RenderPanel
.Width
) or
3067 (gMapInfo
.Height
> RenderPanel
.Height
) then
3069 // Окно, показывающее текущее положение экрана на карте:
3071 x
:= max(min(RenderPanel
.Width
, gMapInfo
.Width
) div ScaleSz
, 1);
3072 y
:= max(min(RenderPanel
.Height
, gMapInfo
.Height
) div ScaleSz
, 1);
3073 // Левый верхний угол:
3074 aX
:= XX
+ ((-MapOffset
.X
) div ScaleSz
);
3075 aY
:= 1 + ((-MapOffset
.Y
) div ScaleSz
);
3076 // Правый нижний угол:
3080 e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 127, 192, 127, 127, B_BLEND
);
3081 e_DrawQuad(aX
, aY
, aX2
, aY2
, 255, 0, 0);
3086 RenderPanel
.SwapBuffers();
3089 procedure TMainForm
.FormResize(Sender
: TObject
);
3091 e_SetViewPort(0, 0, RenderPanel
.Width
, RenderPanel
.Height
);
3093 if gMapInfo
.Width
>= RenderPanel
.Width
then
3094 sbHorizontal
.Max
:= Normalize16(gMapInfo
.Width
-RenderPanel
.Width
+16)
3096 sbHorizontal
.Max
:= 0;
3098 if gMapInfo
.Height
>= RenderPanel
.Height
then
3099 sbVertical
.Max
:= Normalize16(gMapInfo
.Height
-RenderPanel
.Height
+16)
3101 sbVertical
.Max
:= 0;
3103 MapOffset
.X
:= -Normalize16(sbHorizontal
.Position
);
3104 MapOffset
.Y
:= -Normalize16(sbVertical
.Position
);
3107 procedure SelectNextObject(X
, Y
: Integer; ObjectType
: Byte; ID
: DWORD
);
3112 j_max
:= 0; // shut up compiler
3116 res
:= (gPanels
<> nil) and
3117 PanelInShownLayer(gPanels
[ID
].PanelType
) and
3118 g_CollidePoint(X
, Y
, gPanels
[ID
].X
, gPanels
[ID
].Y
,
3120 gPanels
[ID
].Height
);
3121 j_max
:= Length(gPanels
) - 1;
3126 res
:= (gItems
<> nil) and
3127 LayerEnabled
[LAYER_ITEMS
] and
3128 g_CollidePoint(X
, Y
, gItems
[ID
].X
, gItems
[ID
].Y
,
3129 ItemSize
[gItems
[ID
].ItemType
][0],
3130 ItemSize
[gItems
[ID
].ItemType
][1]);
3131 j_max
:= Length(gItems
) - 1;
3136 res
:= (gMonsters
<> nil) and
3137 LayerEnabled
[LAYER_MONSTERS
] and
3138 g_CollidePoint(X
, Y
, gMonsters
[ID
].X
, gMonsters
[ID
].Y
,
3139 MonsterSize
[gMonsters
[ID
].MonsterType
].Width
,
3140 MonsterSize
[gMonsters
[ID
].MonsterType
].Height
);
3141 j_max
:= Length(gMonsters
) - 1;
3146 res
:= (gAreas
<> nil) and
3147 LayerEnabled
[LAYER_AREAS
] and
3148 g_CollidePoint(X
, Y
, gAreas
[ID
].X
, gAreas
[ID
].Y
,
3149 AreaSize
[gAreas
[ID
].AreaType
].Width
,
3150 AreaSize
[gAreas
[ID
].AreaType
].Height
);
3151 j_max
:= Length(gAreas
) - 1;
3156 res
:= (gTriggers
<> nil) and
3157 LayerEnabled
[LAYER_TRIGGERS
] and
3158 g_CollidePoint(X
, Y
, gTriggers
[ID
].X
, gTriggers
[ID
].Y
,
3159 gTriggers
[ID
].Width
,
3160 gTriggers
[ID
].Height
);
3161 j_max
:= Length(gTriggers
) - 1;
3171 // Перебор ID: от ID-1 до 0; потом от High до ID+1:
3180 if j
= Integer(ID
) then
3185 res
:= PanelInShownLayer(gPanels
[j
].PanelType
) and
3186 g_CollidePoint(X
, Y
, gPanels
[j
].X
, gPanels
[j
].Y
,
3190 res
:= (gItems
[j
].ItemType
<> ITEM_NONE
) and
3191 g_CollidePoint(X
, Y
, gItems
[j
].X
, gItems
[j
].Y
,
3192 ItemSize
[gItems
[j
].ItemType
][0],
3193 ItemSize
[gItems
[j
].ItemType
][1]);
3195 res
:= (gMonsters
[j
].MonsterType
<> MONSTER_NONE
) and
3196 g_CollidePoint(X
, Y
, gMonsters
[j
].X
, gMonsters
[j
].Y
,
3197 MonsterSize
[gMonsters
[j
].MonsterType
].Width
,
3198 MonsterSize
[gMonsters
[j
].MonsterType
].Height
);
3200 res
:= (gAreas
[j
].AreaType
<> AREA_NONE
) and
3201 g_CollidePoint(X
, Y
, gAreas
[j
].X
, gAreas
[j
].Y
,
3202 AreaSize
[gAreas
[j
].AreaType
].Width
,
3203 AreaSize
[gAreas
[j
].AreaType
].Height
);
3205 res
:= (gTriggers
[j
].TriggerType
<> TRIGGER_NONE
) and
3206 g_CollidePoint(X
, Y
, gTriggers
[j
].X
, gTriggers
[j
].Y
,
3208 gTriggers
[j
].Height
);
3215 SetLength(SelectedObjects
, 1);
3217 SelectedObjects
[0].ObjectType
:= ObjectType
;
3218 SelectedObjects
[0].ID
:= j
;
3219 SelectedObjects
[0].Live
:= True;
3227 procedure TMainForm
.RenderPanelMouseDown(Sender
: TObject
;
3228 Button
: TMouseButton
; Shift
: TShiftState
; X
, Y
: Integer);
3232 c1
, c2
, c3
, c4
: Boolean;
3238 MainForm
.ActiveControl
:= RenderPanel
;
3239 RenderPanel
.SetFocus();
3241 RenderPanelMouseMove(RenderPanel
, Shift
, X
, Y
);
3243 if Button
= mbLeft
then // Left Mouse Button
3245 // Двигаем карту с помощью мыши и мини-карты:
3247 g_CollidePoint(X
, Y
,
3248 RenderPanel
.Width
-max(gMapInfo
.Width
div (16 div Scale
), 1)-1,
3250 max(gMapInfo
.Width
div (16 div Scale
), 1),
3251 max(gMapInfo
.Height
div (16 div Scale
), 1) ) then
3254 MouseAction
:= MOUSEACTION_MOVEMAP
;
3256 else // Ставим предмет/монстра/область:
3257 if (pcObjects
.ActivePageIndex
in [1, 2, 3]) and
3258 (not (ssShift
in Shift
)) then
3260 case pcObjects
.ActivePageIndex
of
3262 if lbItemList
.ItemIndex
= -1 then
3263 ErrorMessageBox(_lc
[I_MSG_CHOOSE_ITEM
])
3266 item
.ItemType
:= lbItemList
.ItemIndex
+ ITEM_MEDKIT_SMALL
;
3267 if item
.ItemType
>= ITEM_WEAPON_KASTET
then
3268 item
.ItemType
:= item
.ItemType
+ 2;
3269 item
.X
:= MousePos
.X
-MapOffset
.X
;
3270 item
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3272 if not (ssCtrl
in Shift
) then
3274 item
.X
:= item
.X
- (ItemSize
[item
.ItemType
][0] div 2);
3275 item
.Y
:= item
.Y
- ItemSize
[item
.ItemType
][1];
3278 item
.OnlyDM
:= cbOnlyDM
.Checked
;
3279 item
.Fall
:= cbFall
.Checked
;
3280 Undo_Add(OBJECT_ITEM
, AddItem(item
));
3283 if lbMonsterList
.ItemIndex
= -1 then
3284 ErrorMessageBox(_lc
[I_MSG_CHOOSE_MONSTER
])
3287 monster
.MonsterType
:= lbMonsterList
.ItemIndex
+ MONSTER_DEMON
;
3288 monster
.X
:= MousePos
.X
-MapOffset
.X
;
3289 monster
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3291 if not (ssCtrl
in Shift
) then
3293 monster
.X
:= monster
.X
- (MonsterSize
[monster
.MonsterType
].Width
div 2);
3294 monster
.Y
:= monster
.Y
- MonsterSize
[monster
.MonsterType
].Height
;
3297 if rbMonsterLeft
.Checked
then
3298 monster
.Direction
:= D_LEFT
3300 monster
.Direction
:= D_RIGHT
;
3301 Undo_Add(OBJECT_MONSTER
, AddMonster(monster
));
3304 if lbAreasList
.ItemIndex
= -1 then
3305 ErrorMessageBox(_lc
[I_MSG_CHOOSE_AREA
])
3307 if (lbAreasList
.ItemIndex
+ 1) <> AREA_DOMFLAG
then
3309 area
.AreaType
:= lbAreasList
.ItemIndex
+ AREA_PLAYERPOINT1
;
3310 area
.X
:= MousePos
.X
-MapOffset
.X
;
3311 area
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3313 if not (ssCtrl
in Shift
) then
3315 area
.X
:= area
.X
- (AreaSize
[area
.AreaType
].Width
div 2);
3316 area
.Y
:= area
.Y
- AreaSize
[area
.AreaType
].Height
;
3319 if rbAreaLeft
.Checked
then
3320 area
.Direction
:= D_LEFT
3322 area
.Direction
:= D_RIGHT
;
3323 Undo_Add(OBJECT_AREA
, AddArea(area
));
3329 i
:= GetFirstSelected();
3331 // Выбираем объект под текущим:
3332 if (SelectedObjects
<> nil) and
3333 (ssShift
in Shift
) and (i
>= 0) and
3334 (SelectedObjects
[i
].Live
) then
3336 if SelectedObjectCount() = 1 then
3337 SelectNextObject(X
-MapOffset
.X
, Y
-MapOffset
.Y
,
3338 SelectedObjects
[i
].ObjectType
,
3339 SelectedObjects
[i
].ID
);
3343 // Рисуем область триггера "Расширитель":
3344 if DrawPressRect
and (i
>= 0) and
3345 (SelectedObjects
[i
].ObjectType
= OBJECT_TRIGGER
) and
3346 (gTriggers
[SelectedObjects
[i
].ID
].TriggerType
in
3347 [TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
]) then
3348 MouseAction
:= MOUSEACTION_DRAWPRESS
3349 else // Рисуем панель:
3350 if pcObjects
.ActivePageIndex
= 0 then
3352 if (lbPanelType
.ItemIndex
>= 0) then
3353 MouseAction
:= MOUSEACTION_DRAWPANEL
3355 else // Рисуем триггер:
3356 if (lbTriggersList
.ItemIndex
>= 0) then
3358 MouseAction
:= MOUSEACTION_DRAWTRIGGER
;
3362 end; // if Button = mbLeft
3364 if Button
= mbRight
then // Right Mouse Button
3366 // Клик по мини-карте:
3368 g_CollidePoint(X
, Y
,
3369 RenderPanel
.Width
-max(gMapInfo
.Width
div (16 div Scale
), 1)-1,
3371 max(gMapInfo
.Width
div (16 div Scale
), 1),
3372 max(gMapInfo
.Height
div (16 div Scale
), 1) ) then
3374 MouseAction
:= MOUSEACTION_NOACTION
;
3376 else // Нужно что-то выбрать мышью:
3377 if SelectFlag
<> SELECTFLAG_NONE
then
3380 SELECTFLAG_TELEPORT
:
3381 // Точку назначения телепортации:
3382 with gTriggers
[SelectedObjects
[
3383 GetFirstSelected() ].ID
].Data
.TargetPoint
do
3385 X
:= MousePos
.X
-MapOffset
.X
;
3386 Y
:= MousePos
.Y
-MapOffset
.Y
;
3389 SELECTFLAG_SPAWNPOINT
:
3390 // Точку создания монстра:
3391 with gTriggers
[SelectedObjects
[GetFirstSelected()].ID
] do
3392 if TriggerType
= TRIGGER_SPAWNMONSTER
then
3394 Data
.MonPos
.X
:= MousePos
.X
-MapOffset
.X
;
3395 Data
.MonPos
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3397 else if TriggerType
= TRIGGER_SPAWNITEM
then
3398 begin // Точка создания предмета:
3399 Data
.ItemPos
.X
:= MousePos
.X
-MapOffset
.X
;
3400 Data
.ItemPos
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3402 else if TriggerType
= TRIGGER_SHOT
then
3403 begin // Точка создания выстрела:
3404 Data
.ShotPos
.X
:= MousePos
.X
-MapOffset
.X
;
3405 Data
.ShotPos
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3411 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3413 2, 2, OBJECT_PANEL
, True);
3414 if IDArray
<> nil then
3416 for i
:= 0 to High(IDArray
) do
3417 if (gPanels
[IDArray
[i
]].PanelType
= PANEL_OPENDOOR
) or
3418 (gPanels
[IDArray
[i
]].PanelType
= PANEL_CLOSEDOOR
) then
3420 gTriggers
[SelectedObjects
[
3421 GetFirstSelected() ].ID
].Data
.PanelID
:= IDArray
[i
];
3426 gTriggers
[SelectedObjects
[
3427 GetFirstSelected() ].ID
].Data
.PanelID
:= -1;
3431 // Панель с текстурой:
3433 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3435 2, 2, OBJECT_PANEL
, True);
3436 if IDArray
<> nil then
3438 for i
:= 0 to High(IDArray
) do
3439 if ((gPanels
[IDArray
[i
]].PanelType
in
3440 [PANEL_WALL
, PANEL_BACK
, PANEL_FORE
,
3441 PANEL_WATER
, PANEL_ACID1
, PANEL_ACID2
,
3443 (gPanels
[IDArray
[i
]].PanelType
= PANEL_OPENDOOR
) or
3444 (gPanels
[IDArray
[i
]].PanelType
= PANEL_CLOSEDOOR
)) and
3445 (gPanels
[IDArray
[i
]].TextureName
<> '') then
3447 gTriggers
[SelectedObjects
[
3448 GetFirstSelected() ].ID
].TexturePanel
:= IDArray
[i
];
3453 gTriggers
[SelectedObjects
[
3454 GetFirstSelected() ].ID
].TexturePanel
:= -1;
3460 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3462 2, 2, OBJECT_PANEL
, True);
3463 if IDArray
<> nil then
3465 for i
:= 0 to High(IDArray
) do
3466 if (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTUP
) or
3467 (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTDOWN
) or
3468 (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTLEFT
) or
3469 (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTRIGHT
) then
3471 gTriggers
[SelectedObjects
[
3472 GetFirstSelected() ].ID
].Data
.PanelID
:= IDArray
[i
];
3477 gTriggers
[SelectedObjects
[
3478 GetFirstSelected() ].ID
].Data
.PanelID
:= -1;
3484 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3486 2, 2, OBJECT_MONSTER
, False);
3487 if IDArray
<> nil then
3488 gTriggers
[SelectedObjects
[
3489 GetFirstSelected() ].ID
].Data
.MonsterID
:= IDArray
[0]+1
3491 gTriggers
[SelectedObjects
[
3492 GetFirstSelected() ].ID
].Data
.MonsterID
:= 0;
3495 SELECTFLAG_SHOTPANEL
:
3496 // Панель индикации выстрела:
3498 if gTriggers
[SelectedObjects
[
3499 GetFirstSelected() ].ID
].TriggerType
= TRIGGER_SHOT
then
3501 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3503 2, 2, OBJECT_PANEL
, True);
3504 if IDArray
<> nil then
3506 for i
:= 0 to High(IDArray
) do
3507 if ((gPanels
[IDArray
[i
]].PanelType
in
3508 [PANEL_WALL
, PANEL_BACK
, PANEL_FORE
,
3509 PANEL_WATER
, PANEL_ACID1
, PANEL_ACID2
,
3511 (gPanels
[IDArray
[i
]].PanelType
= PANEL_OPENDOOR
) or
3512 (gPanels
[IDArray
[i
]].PanelType
= PANEL_CLOSEDOOR
)) and
3513 (gPanels
[IDArray
[i
]].TextureName
<> '') then
3515 gTriggers
[SelectedObjects
[
3516 GetFirstSelected() ].ID
].Data
.ShotPanelID
:= IDArray
[i
];
3521 gTriggers
[SelectedObjects
[
3522 GetFirstSelected() ].ID
].Data
.ShotPanelID
:= -1;
3527 SelectFlag
:= SELECTFLAG_SELECTED
;
3529 else // if SelectFlag <> SELECTFLAG_NONE...
3531 // Что уже выбрано и не нажат Ctrl:
3532 if (SelectedObjects
<> nil) and
3533 (not (ssCtrl
in Shift
)) then
3534 for i
:= 0 to High(SelectedObjects
) do
3535 with SelectedObjects
[i
] do
3538 if (ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
]) and
3539 (SelectedObjectCount() = 1) then
3541 Rect
:= ObjectGetRect(ObjectType
, ID
);
3543 c1
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3544 Rect
.X
-2, Rect
.Y
+(Rect
.Height
div 2)-2, 4, 4);
3545 c2
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3546 Rect
.X
+Rect
.Width
-3, Rect
.Y
+(Rect
.Height
div 2)-2, 4, 4);
3547 c3
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3548 Rect
.X
+(Rect
.Width
div 2)-2, Rect
.Y
-2, 4, 4);
3549 c4
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3550 Rect
.X
+(Rect
.Width
div 2)-2, Rect
.Y
+Rect
.Height
-3, 4, 4);
3552 // Меняем размер панели или триггера:
3553 if c1
or c2
or c3
or c4
then
3555 MouseAction
:= MOUSEACTION_RESIZE
;
3556 LastMovePoint
:= MousePos
;
3560 ResizeType
:= RESIZETYPE_HORIZONTAL
;
3562 ResizeDirection
:= RESIZEDIR_LEFT
3564 ResizeDirection
:= RESIZEDIR_RIGHT
;
3565 RenderPanel
.Cursor
:= crSizeWE
;
3569 ResizeType
:= RESIZETYPE_VERTICAL
;
3571 ResizeDirection
:= RESIZEDIR_UP
3573 ResizeDirection
:= RESIZEDIR_DOWN
;
3574 RenderPanel
.Cursor
:= crSizeNS
;
3581 // Перемещаем панель или триггер:
3582 if ObjectCollide(ObjectType
, ID
,
3584 Y
-MapOffset
.Y
-1, 2, 2) then
3586 MouseAction
:= MOUSEACTION_MOVEOBJ
;
3587 LastMovePoint
:= MousePos
;
3593 end; // if Button = mbRight
3595 MouseRDown
:= Button
= mbRight
;
3597 MouseRDownPos
:= MousePos
;
3599 MouseLDown
:= Button
= mbLeft
;
3601 MouseLDownPos
:= MousePos
;
3604 procedure TMainForm
.RenderPanelMouseUp(Sender
: TObject
;
3605 Button
: TMouseButton
; Shift
: TShiftState
; X
, Y
: Integer);
3610 rSelectRect
: Boolean;
3611 wWidth
, wHeight
: Word;
3614 procedure SelectObjects(ObjectType
: Byte);
3619 IDArray
:= ObjectInRect(rRect
.X
, rRect
.Y
,
3620 rRect
.Width
, rRect
.Height
,
3621 ObjectType
, rSelectRect
);
3623 if IDArray
<> nil then
3624 for i
:= 0 to High(IDArray
) do
3625 SelectObject(ObjectType
, IDArray
[i
], (ssCtrl
in Shift
) or rSelectRect
);
3628 if Button
= mbLeft
then
3629 MouseLDown
:= False;
3630 if Button
= mbRight
then
3631 MouseRDown
:= False;
3634 ResizeType
:= RESIZETYPE_NONE
;
3637 if Button
= mbLeft
then // Left Mouse Button
3639 if MouseAction
<> MOUSEACTION_NONE
then
3640 begin // Было действие мышью
3641 // Мышь сдвинулась во время удержания клавиши,
3642 // либо активирован режим быстрого рисования:
3643 if ((MousePos
.X
<> MouseLDownPos
.X
) and
3644 (MousePos
.Y
<> MouseLDownPos
.Y
)) or
3645 ((MouseAction
in [MOUSEACTION_DRAWPANEL
, MOUSEACTION_DRAWTRIGGER
]) and
3646 (ssCtrl
in Shift
)) then
3649 MOUSEACTION_DRAWPANEL
:
3651 // Фон или передний план без текстуры - ошибка:
3652 if (lbPanelType
.ItemIndex
in [1, 2]) and
3653 (lbTextureList
.ItemIndex
= -1) then
3654 ErrorMessageBox(_lc
[I_MSG_CHOOSE_TEXTURE
])
3655 else // Назначаем параметры панели:
3657 case lbPanelType
.ItemIndex
of
3658 0: Panel
.PanelType
:= PANEL_WALL
;
3659 1: Panel
.PanelType
:= PANEL_BACK
;
3660 2: Panel
.PanelType
:= PANEL_FORE
;
3661 3: Panel
.PanelType
:= PANEL_OPENDOOR
;
3662 4: Panel
.PanelType
:= PANEL_CLOSEDOOR
;
3663 5: Panel
.PanelType
:= PANEL_STEP
;
3664 6: Panel
.PanelType
:= PANEL_WATER
;
3665 7: Panel
.PanelType
:= PANEL_ACID1
;
3666 8: Panel
.PanelType
:= PANEL_ACID2
;
3667 9: Panel
.PanelType
:= PANEL_LIFTUP
;
3668 10: Panel
.PanelType
:= PANEL_LIFTDOWN
;
3669 11: Panel
.PanelType
:= PANEL_LIFTLEFT
;
3670 12: Panel
.PanelType
:= PANEL_LIFTRIGHT
;
3671 13: Panel
.PanelType
:= PANEL_BLOCKMON
;
3674 Panel
.X
:= Min(MousePos
.X
-MapOffset
.X
, MouseLDownPos
.X
-MapOffset
.X
);
3675 Panel
.Y
:= Min(MousePos
.Y
-MapOffset
.Y
, MouseLDownPos
.Y
-MapOffset
.Y
);
3676 if ssCtrl
in Shift
then
3680 if (lbTextureList
.ItemIndex
<> -1) and
3681 (not IsSpecialTextureSel()) then
3683 if not g_GetTexture(SelectedTexture(), TextureID
) then
3684 g_GetTexture('NOTEXTURE', TextureID
);
3685 g_GetTextureSizeByID(TextureID
, wWidth
, wHeight
);
3687 Panel
.Width
:= wWidth
;
3688 Panel
.Height
:= wHeight
;
3692 Panel
.Width
:= Abs(MousePos
.X
-MouseLDownPos
.X
);
3693 Panel
.Height
:= Abs(MousePos
.Y
-MouseLDownPos
.Y
);
3696 // Лифты, блокМон или отсутствие текстуры - пустая текстура:
3697 if (lbPanelType
.ItemIndex
in [9, 10, 11, 12, 13]) or
3698 (lbTextureList
.ItemIndex
= -1) then
3700 Panel
.TextureHeight
:= 1;
3701 Panel
.TextureWidth
:= 1;
3702 Panel
.TextureName
:= '';
3703 Panel
.TextureID
:= TEXTURE_SPECIAL_NONE
;
3705 else // Есть текстура:
3707 Panel
.TextureName
:= SelectedTexture();
3709 // Обычная текстура:
3710 if not IsSpecialTextureSel() then
3712 g_GetTextureSizeByName(Panel
.TextureName
,
3713 Panel
.TextureWidth
, Panel
.TextureHeight
);
3714 g_GetTexture(Panel
.TextureName
, Panel
.TextureID
);
3716 else // Спец.текстура:
3718 Panel
.TextureHeight
:= 1;
3719 Panel
.TextureWidth
:= 1;
3720 Panel
.TextureID
:= SpecialTextureID(SelectedTexture());
3725 Panel
.Blending
:= False;
3727 Undo_Add(OBJECT_PANEL
, AddPanel(Panel
));
3731 // Рисовали триггер:
3732 MOUSEACTION_DRAWTRIGGER
:
3734 trigger
.X
:= Min(MousePos
.X
-MapOffset
.X
, MouseLDownPos
.X
-MapOffset
.X
);
3735 trigger
.Y
:= Min(MousePos
.Y
-MapOffset
.Y
, MouseLDownPos
.Y
-MapOffset
.Y
);
3736 if ssCtrl
in Shift
then
3740 trigger
.Width
:= wWidth
;
3741 trigger
.Height
:= wHeight
;
3745 trigger
.Width
:= Abs(MousePos
.X
-MouseLDownPos
.X
);
3746 trigger
.Height
:= Abs(MousePos
.Y
-MouseLDownPos
.Y
);
3749 trigger
.Enabled
:= True;
3750 trigger
.TriggerType
:= lbTriggersList
.ItemIndex
+1;
3751 trigger
.TexturePanel
:= -1;
3754 trigger
.ActivateType
:= 0;
3756 if clbActivationType
.Checked
[0] then
3757 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_PLAYERCOLLIDE
;
3758 if clbActivationType
.Checked
[1] then
3759 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_MONSTERCOLLIDE
;
3760 if clbActivationType
.Checked
[2] then
3761 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_PLAYERPRESS
;
3762 if clbActivationType
.Checked
[3] then
3763 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_MONSTERPRESS
;
3764 if clbActivationType
.Checked
[4] then
3765 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_SHOT
;
3766 if clbActivationType
.Checked
[5] then
3767 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_NOMONSTER
;
3769 // Необходимые для активации ключи:
3772 if clbKeys
.Checked
[0] then
3773 trigger
.Key
:= Trigger
.Key
or KEY_RED
;
3774 if clbKeys
.Checked
[1] then
3775 trigger
.Key
:= Trigger
.Key
or KEY_GREEN
;
3776 if clbKeys
.Checked
[2] then
3777 trigger
.Key
:= Trigger
.Key
or KEY_BLUE
;
3778 if clbKeys
.Checked
[3] then
3779 trigger
.Key
:= Trigger
.Key
or KEY_REDTEAM
;
3780 if clbKeys
.Checked
[4] then
3781 trigger
.Key
:= Trigger
.Key
or KEY_BLUETEAM
;
3783 // Параметры триггера:
3784 FillByte(trigger
.Data
.Default
[0], 128, 0);
3786 case trigger
.TriggerType
of
3787 // Переключаемая панель:
3788 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
3789 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
3790 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
3792 Trigger
.Data
.PanelID
:= -1;
3798 trigger
.Data
.TargetPoint
.X
:= trigger
.X
-64;
3799 trigger
.Data
.TargetPoint
.Y
:= trigger
.Y
-64;
3800 trigger
.Data
.d2d_teleport
:= True;
3801 trigger
.Data
.TlpDir
:= 0;
3804 // Изменение других триггеров:
3805 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
,
3808 trigger
.Data
.Count
:= 1;
3814 trigger
.Data
.Volume
:= 255;
3815 trigger
.Data
.Pan
:= 127;
3816 trigger
.Data
.PlayCount
:= 1;
3817 trigger
.Data
.Local
:= True;
3818 trigger
.Data
.SoundSwitch
:= False;
3824 trigger
.Data
.MusicAction
:= 1;
3827 // Создание монстра:
3828 TRIGGER_SPAWNMONSTER
:
3830 trigger
.Data
.MonType
:= MONSTER_ZOMBY
;
3831 trigger
.Data
.MonPos
.X
:= trigger
.X
-64;
3832 trigger
.Data
.MonPos
.Y
:= trigger
.Y
-64;
3833 trigger
.Data
.MonHealth
:= 0;
3834 trigger
.Data
.MonActive
:= False;
3835 trigger
.Data
.MonCount
:= 1;
3838 // Создание предмета:
3841 trigger
.Data
.ItemType
:= ITEM_AMMO_BULLETS
;
3842 trigger
.Data
.ItemPos
.X
:= trigger
.X
-64;
3843 trigger
.Data
.ItemPos
.Y
:= trigger
.Y
-64;
3844 trigger
.Data
.ItemOnlyDM
:= False;
3845 trigger
.Data
.ItemFalls
:= False;
3846 trigger
.Data
.ItemCount
:= 1;
3847 trigger
.Data
.ItemMax
:= 0;
3848 trigger
.Data
.ItemDelay
:= 0;
3854 trigger
.Data
.PushAngle
:= 90;
3855 trigger
.Data
.PushForce
:= 10;
3856 trigger
.Data
.ResetVel
:= True;
3861 trigger
.Data
.ScoreCount
:= 1;
3862 trigger
.Data
.ScoreCon
:= True;
3863 trigger
.Data
.ScoreMsg
:= True;
3868 trigger
.Data
.MessageKind
:= 0;
3869 trigger
.Data
.MessageSendTo
:= 0;
3870 trigger
.Data
.MessageText
:= '';
3871 trigger
.Data
.MessageTime
:= 144;
3876 trigger
.Data
.DamageValue
:= 5;
3877 trigger
.Data
.DamageInterval
:= 12;
3882 trigger
.Data
.HealValue
:= 5;
3883 trigger
.Data
.HealInterval
:= 36;
3888 trigger
.Data
.ShotType
:= TRIGGER_SHOT_BULLET
;
3889 trigger
.Data
.ShotSound
:= True;
3890 trigger
.Data
.ShotPanelID
:= -1;
3891 trigger
.Data
.ShotTarget
:= 0;
3892 trigger
.Data
.ShotIntSight
:= 0;
3893 trigger
.Data
.ShotAim
:= TRIGGER_SHOT_AIM_DEFAULT
;
3894 trigger
.Data
.ShotPos
.X
:= trigger
.X
-64;
3895 trigger
.Data
.ShotPos
.Y
:= trigger
.Y
-64;
3896 trigger
.Data
.ShotAngle
:= 0;
3897 trigger
.Data
.ShotWait
:= 18;
3898 trigger
.Data
.ShotAccuracy
:= 0;
3899 trigger
.Data
.ShotAmmo
:= 0;
3900 trigger
.Data
.ShotIntReload
:= 0;
3905 trigger
.Data
.FXCount
:= 1;
3906 trigger
.Data
.FXType
:= TRIGGER_EFFECT_PARTICLE
;
3907 trigger
.Data
.FXSubType
:= TRIGGER_EFFECT_SLIQUID
;
3908 trigger
.Data
.FXColorR
:= 0;
3909 trigger
.Data
.FXColorG
:= 0;
3910 trigger
.Data
.FXColorB
:= 255;
3911 trigger
.Data
.FXPos
:= TRIGGER_EFFECT_POS_CENTER
;
3912 trigger
.Data
.FXWait
:= 1;
3913 trigger
.Data
.FXVelX
:= 0;
3914 trigger
.Data
.FXVelY
:= -20;
3915 trigger
.Data
.FXSpreadL
:= 5;
3916 trigger
.Data
.FXSpreadR
:= 5;
3917 trigger
.Data
.FXSpreadU
:= 4;
3918 trigger
.Data
.FXSpreadD
:= 0;
3922 Undo_Add(OBJECT_TRIGGER
, AddTrigger(trigger
));
3925 // Рисовали область триггера "Расширитель":
3926 MOUSEACTION_DRAWPRESS
:
3927 with gTriggers
[SelectedObjects
[GetFirstSelected
].ID
] do
3929 Data
.tX
:= Min(MousePos
.X
-MapOffset
.X
, MouseLDownPos
.X
-MapOffset
.X
);
3930 Data
.tY
:= Min(MousePos
.Y
-MapOffset
.Y
, MouseLDownPos
.Y
-MapOffset
.Y
);
3931 Data
.tWidth
:= Abs(MousePos
.X
-MouseLDownPos
.X
);
3932 Data
.tHeight
:= Abs(MousePos
.Y
-MouseLDownPos
.Y
);
3934 DrawPressRect
:= False;
3938 MouseAction
:= MOUSEACTION_NONE
;
3940 end // if Button = mbLeft...
3941 else // Right Mouse Button:
3943 if MouseAction
= MOUSEACTION_NOACTION
then
3945 MouseAction
:= MOUSEACTION_NONE
;
3949 // Объект передвинут или изменен в размере:
3950 if MouseAction
in [MOUSEACTION_MOVEOBJ
, MOUSEACTION_RESIZE
] then
3952 MouseAction
:= MOUSEACTION_NONE
;
3957 // Еще не все выбрали:
3958 if SelectFlag
<> SELECTFLAG_NONE
then
3960 if SelectFlag
= SELECTFLAG_SELECTED
then
3961 SelectFlag
:= SELECTFLAG_NONE
;
3966 // Мышь сдвинулась во время удержания клавиши:
3967 if (MousePos
.X
<> MouseRDownPos
.X
) and
3968 (MousePos
.Y
<> MouseRDownPos
.Y
) then
3970 rSelectRect
:= True;
3972 rRect
.X
:= Min(MousePos
.X
, MouseRDownPos
.X
)-MapOffset
.X
;
3973 rRect
.Y
:= Min(MousePos
.Y
, MouseRDownPos
.Y
)-MapOffset
.Y
;
3974 rRect
.Width
:= Abs(MousePos
.X
-MouseRDownPos
.X
);
3975 rRect
.Height
:= Abs(MousePos
.Y
-MouseRDownPos
.Y
);
3977 else // Мышь не сдвинулась - нет прямоугольника:
3979 rSelectRect
:= False;
3981 rRect
.X
:= X
-MapOffset
.X
-1;
3982 rRect
.Y
:= Y
-MapOffset
.Y
-1;
3987 // Если зажат Ctrl - выделять еще, иначе только один выделенный объект:
3988 if not (ssCtrl
in Shift
) then
3989 RemoveSelectFromObjects();
3991 // Выделяем всё в выбранном прямоугольнике:
3992 if (ssCtrl
in Shift
) and (ssAlt
in Shift
) then
3994 SelectObjects(OBJECT_PANEL
);
3995 SelectObjects(OBJECT_ITEM
);
3996 SelectObjects(OBJECT_MONSTER
);
3997 SelectObjects(OBJECT_AREA
);
3998 SelectObjects(OBJECT_TRIGGER
);
4001 SelectObjects(pcObjects
.ActivePageIndex
+1);
4007 procedure TMainForm
.RenderPanelPaint(Sender
: TObject
);
4012 function TMainForm
.RenderMousePos(): Types
.TPoint
;
4014 Result
:= RenderPanel
.ScreenToClient(Mouse
.CursorPos
);
4017 procedure TMainForm
.RecountSelectedObjects();
4019 if SelectedObjectCount() = 0 then
4020 StatusBar
.Panels
[0].Text := ''
4022 StatusBar
.Panels
[0].Text := Format(_lc
[I_CAP_STAT_SELECTED
], [SelectedObjectCount()]);
4025 procedure TMainForm
.RenderPanelMouseMove(Sender
: TObject
;
4026 Shift
: TShiftState
; X
, Y
: Integer);
4029 dWidth
, dHeight
: Integer;
4032 wWidth
, wHeight
: Word;
4034 _id
:= GetFirstSelected();
4037 // Рисуем панель с текстурой, сетка - размеры текстуры:
4038 if (MouseAction
= MOUSEACTION_DRAWPANEL
) and
4039 (lbPanelType
.ItemIndex
in [0..8]) and
4040 (lbTextureList
.ItemIndex
<> -1) and
4041 (not IsSpecialTextureSel()) then
4043 sX
:= StrToIntDef(lTextureWidth
.Caption
, DotStep
);
4044 sY
:= StrToIntDef(lTextureHeight
.Caption
, DotStep
);
4047 // Меняем размер панели с текстурой, сетка - размеры текстуры:
4048 if (MouseAction
= MOUSEACTION_RESIZE
) and
4049 ( (SelectedObjects
[_id
].ObjectType
= OBJECT_PANEL
) and
4050 IsTexturedPanel(gPanels
[SelectedObjects
[_id
].ID
].PanelType
) and
4051 (gPanels
[SelectedObjects
[_id
].ID
].TextureName
<> '') and
4052 (not IsSpecialTexture(gPanels
[SelectedObjects
[_id
].ID
].TextureName
)) ) then
4054 sX
:= gPanels
[SelectedObjects
[_id
].ID
].TextureWidth
;
4055 sY
:= gPanels
[SelectedObjects
[_id
].ID
].TextureHeight
;
4058 // Выравнивание по сетке:
4064 else // Нет выравнивания по сетке:
4070 // Новая позиция мыши:
4072 begin // Зажата левая кнопка мыши
4073 MousePos
.X
:= (Round((X
-MouseLDownPos
.X
)/sX
)*sX
)+MouseLDownPos
.X
;
4074 MousePos
.Y
:= (Round((Y
-MouseLDownPos
.Y
)/sY
)*sY
)+MouseLDownPos
.Y
;
4078 begin // Зажата правая кнопка мыши
4079 MousePos
.X
:= (Round((X
-MouseRDownPos
.X
)/sX
)*sX
)+MouseRDownPos
.X
;
4080 MousePos
.Y
:= (Round((Y
-MouseRDownPos
.Y
)/sY
)*sY
)+MouseRDownPos
.Y
;
4083 begin // Кнопки мыши не зажаты
4084 MousePos
.X
:= (Round(X
/sX
)*sX
);
4085 MousePos
.Y
:= (Round(Y
/sY
)*sY
);
4088 // Изменение размера закончилось - ставим обычный курсор:
4089 if ResizeType
= RESIZETYPE_NONE
then
4090 RenderPanel
.Cursor
:= crDefault
;
4092 // Зажата только правая кнопка мыши:
4093 if (not MouseLDown
) and (MouseRDown
) then
4095 // Рисуем прямоугольник выделения:
4096 if MouseAction
= MOUSEACTION_NONE
then
4098 if DrawRect
= nil then
4100 DrawRect
.Top
:= MouseRDownPos
.y
;
4101 DrawRect
.Left
:= MouseRDownPos
.x
;
4102 DrawRect
.Bottom
:= MousePos
.y
;
4103 DrawRect
.Right
:= MousePos
.x
;
4106 // Двигаем выделенные объекты:
4107 if MouseAction
= MOUSEACTION_MOVEOBJ
then
4109 MoveSelectedObjects(ssShift
in Shift
, ssCtrl
in Shift
,
4110 MousePos
.X
-LastMovePoint
.X
,
4111 MousePos
.Y
-LastMovePoint
.Y
);
4114 // Меняем размер выделенного объекта:
4115 if MouseAction
= MOUSEACTION_RESIZE
then
4117 if (SelectedObjectCount
= 1) and
4118 (SelectedObjects
[GetFirstSelected
].Live
) then
4120 dWidth
:= MousePos
.X
-LastMovePoint
.X
;
4121 dHeight
:= MousePos
.Y
-LastMovePoint
.Y
;
4124 RESIZETYPE_VERTICAL
: dWidth
:= 0;
4125 RESIZETYPE_HORIZONTAL
: dHeight
:= 0;
4128 case ResizeDirection
of
4129 RESIZEDIR_UP
: dHeight
:= -dHeight
;
4130 RESIZEDIR_LEFT
: dWidth
:= -dWidth
;
4133 if ResizeObject(SelectedObjects
[GetFirstSelected
].ObjectType
,
4134 SelectedObjects
[GetFirstSelected
].ID
,
4135 dWidth
, dHeight
, ResizeDirection
) then
4136 LastMovePoint
:= MousePos
;
4141 // Зажата только левая кнопка мыши:
4142 if (not MouseRDown
) and (MouseLDown
) then
4144 // Рисуем прямоугольник планирования панели:
4145 if MouseAction
in [MOUSEACTION_DRAWPANEL
,
4146 MOUSEACTION_DRAWTRIGGER
,
4147 MOUSEACTION_DRAWPRESS
] then
4149 if DrawRect
= nil then
4151 if ssCtrl
in Shift
then
4155 if (lbTextureList
.ItemIndex
<> -1) and (not IsSpecialTextureSel()) and
4156 (MouseAction
= MOUSEACTION_DRAWPANEL
) then
4158 if not g_GetTexture(SelectedTexture(), TextureID
) then
4159 g_GetTexture('NOTEXTURE', TextureID
);
4160 g_GetTextureSizeByID(TextureID
, wWidth
, wHeight
);
4162 DrawRect
.Top
:= MouseLDownPos
.y
;
4163 DrawRect
.Left
:= MouseLDownPos
.x
;
4164 DrawRect
.Bottom
:= DrawRect
.Top
+ wHeight
;
4165 DrawRect
.Right
:= DrawRect
.Left
+ wWidth
;
4169 DrawRect
.Top
:= MouseLDownPos
.y
;
4170 DrawRect
.Left
:= MouseLDownPos
.x
;
4171 DrawRect
.Bottom
:= MousePos
.y
;
4172 DrawRect
.Right
:= MousePos
.x
;
4175 else // Двигаем карту:
4176 if MouseAction
= MOUSEACTION_MOVEMAP
then
4182 // Клавиши мыши не зажаты:
4183 if (not MouseRDown
) and (not MouseLDown
) then
4186 // Строка состояния - координаты мыши:
4187 StatusBar
.Panels
[1].Text := Format('(%d:%d)',
4188 [MousePos
.X
-MapOffset
.X
, MousePos
.Y
-MapOffset
.Y
]);
4191 procedure TMainForm
.FormCloseQuery(Sender
: TObject
; var CanClose
: Boolean);
4193 CanClose
:= MessageBox(0, PChar(_lc
[I_MSG_EXIT_PROMT
]),
4194 PChar(_lc
[I_MSG_EXIT
]),
4195 MB_ICONQUESTION
or MB_YESNO
or
4196 MB_DEFBUTTON1
) = idYes
;
4199 procedure TMainForm
.aExitExecute(Sender
: TObject
);
4204 procedure TMainForm
.FormDestroy(Sender
: TObject
);
4209 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
4211 if WindowState
<> wsMaximized
then
4213 config
.WriteInt('Editor', 'XPos', Left
);
4214 config
.WriteInt('Editor', 'YPos', Top
);
4215 config
.WriteInt('Editor', 'Width', Width
);
4216 config
.WriteInt('Editor', 'Height', Height
);
4220 config
.WriteInt('Editor', 'XPos', RestoredLeft
);
4221 config
.WriteInt('Editor', 'YPos', RestoredTop
);
4222 config
.WriteInt('Editor', 'Width', RestoredWidth
);
4223 config
.WriteInt('Editor', 'Height', RestoredHeight
);
4225 config
.WriteBool('Editor', 'Maximize', WindowState
= wsMaximized
);
4226 config
.WriteBool('Editor', 'Minimap', ShowMap
);
4227 config
.WriteInt('Editor', 'PanelProps', PanelProps
.ClientWidth
);
4228 config
.WriteInt('Editor', 'PanelObjs', PanelObjs
.ClientHeight
);
4229 config
.WriteBool('Editor', 'DotEnable', DotEnable
);
4230 config
.WriteInt('Editor', 'DotStep', DotStep
);
4231 config
.WriteStr('Editor', 'LastOpenDir', OpenDialog
.InitialDir
);
4232 config
.WriteStr('Editor', 'LastSaveDir', SaveDialog
.InitialDir
);
4233 config
.WriteBool('Editor', 'EdgeShow', drEdge
[3] < 255);
4234 config
.WriteInt('Editor', 'EdgeColor', gColorEdge
);
4235 config
.WriteInt('Editor', 'EdgeAlpha', gAlphaEdge
);
4236 config
.WriteInt('Editor', 'LineAlpha', gAlphaTriggerLine
);
4237 config
.WriteInt('Editor', 'TriggerAlpha', gAlphaTriggerArea
);
4238 config
.WriteInt('Editor', 'MonsterRectAlpha', gAlphaMonsterRect
);
4239 config
.WriteInt('Editor', 'AreaRectAlpha', gAlphaAreaRect
);
4241 for i
:= 0 to RecentCount
-1 do
4242 if i
< RecentFiles
.Count
then
4243 config
.WriteStr('RecentFiles', IntToStr(i
+1), RecentFiles
[i
])
4245 config
.WriteStr('RecentFiles', IntToStr(i
+1), '');
4248 config
.SaveFile(EditorDir
+'Editor.cfg');
4251 slInvalidTextures
.Free
;
4254 procedure TMainForm
.FormDropFiles(Sender
: TObject
;
4255 const FileNames
: array of String);
4257 if Length(FileNames
) <> 1 then
4260 OpenMapFile(FileNames
[0]);
4263 procedure TMainForm
.RenderPanelResize(Sender
: TObject
);
4265 if MainForm
.Visible
then
4269 procedure TMainForm
.Splitter1Moved(Sender
: TObject
);
4274 procedure TMainForm
.aMapOptionsExecute(Sender
: TObject
);
4278 MapOptionsForm
.ShowModal();
4280 ResName
:= OpenedMap
;
4281 while (Pos(':\', ResName
) > 0) do
4282 Delete(ResName
, 1, Pos(':\', ResName
) + 1);
4284 UpdateCaption(gMapInfo
.Name
, ExtractFileName(OpenedWAD
), ResName
);
4287 procedure TMainForm
.aAboutExecute(Sender
: TObject
);
4289 AboutForm
.ShowModal();
4292 procedure TMainForm
.FormKeyDown(Sender
: TObject
; var Key
: Word;
4293 Shift
: TShiftState
);
4298 if (not EditingProperties
) then
4300 if Key
= Ord('1') then
4301 SwitchLayer(LAYER_BACK
);
4302 if Key
= Ord('2') then
4303 SwitchLayer(LAYER_WALLS
);
4304 if Key
= Ord('3') then
4305 SwitchLayer(LAYER_FOREGROUND
);
4306 if Key
= Ord('4') then
4307 SwitchLayer(LAYER_STEPS
);
4308 if Key
= Ord('5') then
4309 SwitchLayer(LAYER_WATER
);
4310 if Key
= Ord('6') then
4311 SwitchLayer(LAYER_ITEMS
);
4312 if Key
= Ord('7') then
4313 SwitchLayer(LAYER_MONSTERS
);
4314 if Key
= Ord('8') then
4315 SwitchLayer(LAYER_AREAS
);
4316 if Key
= Ord('9') then
4317 SwitchLayer(LAYER_TRIGGERS
);
4318 if Key
= Ord('0') then
4319 tbShowClick(tbShow
);
4321 if Key
= Ord('V') then
4322 begin // Поворот монстров и областей:
4323 if (SelectedObjects
<> nil) then
4325 for i
:= 0 to High(SelectedObjects
) do
4326 if (SelectedObjects
[i
].Live
) then
4328 if (SelectedObjects
[i
].ObjectType
= OBJECT_MONSTER
) then
4330 g_ChangeDir(gMonsters
[SelectedObjects
[i
].ID
].Direction
);
4333 if (SelectedObjects
[i
].ObjectType
= OBJECT_AREA
) then
4335 g_ChangeDir(gAreas
[SelectedObjects
[i
].ID
].Direction
);
4341 if pcObjects
.ActivePage
= tsMonsters
then
4343 if rbMonsterLeft
.Checked
then
4344 rbMonsterRight
.Checked
:= True
4346 rbMonsterLeft
.Checked
:= True;
4348 if pcObjects
.ActivePage
= tsAreas
then
4350 if rbAreaLeft
.Checked
then
4351 rbAreaRight
.Checked
:= True
4353 rbAreaLeft
.Checked
:= True;
4358 if not (ssCtrl
in Shift
) then
4360 // Быстрое превью карты:
4361 if Key
= Ord('E') then
4363 if PreviewMode
= 0 then
4367 // Вертикальный скролл карты:
4370 if Key
= Ord('W') then
4372 if (MouseLDown
or MouseRDown
) and (Position
>= DotStep
) then
4374 if DrawRect
<> nil then
4376 Inc(MouseLDownPos
.y
, DotStep
);
4377 Inc(MouseRDownPos
.y
, DotStep
);
4379 Inc(LastMovePoint
.Y
, DotStep
);
4380 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4382 Position
:= IfThen(Position
> DotStep
, Position
-DotStep
, 0);
4383 MapOffset
.Y
:= -Round(Position
/16) * 16;
4386 if Key
= Ord('S') then
4388 if (MouseLDown
or MouseRDown
) and (Position
+DotStep
<= Max
) then
4390 if DrawRect
<> nil then
4392 Dec(MouseLDownPos
.y
, DotStep
);
4393 Dec(MouseRDownPos
.y
, DotStep
);
4395 Dec(LastMovePoint
.Y
, DotStep
);
4396 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4398 Position
:= IfThen(Position
+DotStep
< Max
, Position
+DotStep
, Max
);
4399 MapOffset
.Y
:= -Round(Position
/16) * 16;
4403 // Горизонтальный скролл карты:
4404 with sbHorizontal
do
4406 if Key
= Ord('A') then
4408 if (MouseLDown
or MouseRDown
) and (Position
>= DotStep
) then
4410 if DrawRect
<> nil then
4412 Inc(MouseLDownPos
.x
, DotStep
);
4413 Inc(MouseRDownPos
.x
, DotStep
);
4415 Inc(LastMovePoint
.X
, DotStep
);
4416 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4418 Position
:= IfThen(Position
> DotStep
, Position
-DotStep
, 0);
4419 MapOffset
.X
:= -Round(Position
/16) * 16;
4422 if Key
= Ord('D') then
4424 if (MouseLDown
or MouseRDown
) and (Position
+DotStep
<= Max
) then
4426 if DrawRect
<> nil then
4428 Dec(MouseLDownPos
.x
, DotStep
);
4429 Dec(MouseRDownPos
.x
, DotStep
);
4431 Dec(LastMovePoint
.X
, DotStep
);
4432 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4434 Position
:= IfThen(Position
+DotStep
< Max
, Position
+DotStep
, Max
);
4435 MapOffset
.X
:= -Round(Position
/16) * 16;
4439 else // ssCtrl in Shift
4441 if ssShift
in Shift
then
4443 // Вставка по абсолютному смещению:
4444 if Key
= Ord('V') then
4445 aPasteObjectExecute(Sender
);
4447 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4451 // Удалить выделенные объекты:
4452 if (Key
= VK_DELETE
) and (SelectedObjects
<> nil) and
4453 RenderPanel
.Focused() then
4454 DeleteSelectedObjects();
4457 if (Key
= VK_ESCAPE
) and (SelectedObjects
<> nil) then
4458 RemoveSelectFromObjects();
4460 // Передвинуть объекты:
4461 if MainForm
.ActiveControl
= RenderPanel
then
4466 if Key
= VK_NUMPAD4
then
4467 dx
:= IfThen(ssAlt
in Shift
, -1, -DotStep
);
4468 if Key
= VK_NUMPAD6
then
4469 dx
:= IfThen(ssAlt
in Shift
, 1, DotStep
);
4470 if Key
= VK_NUMPAD8
then
4471 dy
:= IfThen(ssAlt
in Shift
, -1, -DotStep
);
4472 if Key
= VK_NUMPAD5
then
4473 dy
:= IfThen(ssAlt
in Shift
, 1, DotStep
);
4475 if (dx
<> 0) or (dy
<> 0) then
4477 MoveSelectedObjects(ssShift
in Shift
, ssCtrl
in Shift
, dx
, dy
);
4482 if ssCtrl
in Shift
then
4484 // Выбор панели с текстурой для триггера
4485 if Key
= Ord('T') then
4487 DrawPressRect
:= False;
4488 if SelectFlag
= SELECTFLAG_TEXTURE
then
4490 SelectFlag
:= SELECTFLAG_NONE
;
4493 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_TEXTURE_PANEL
], i
);
4495 SelectFlag
:= SELECTFLAG_TEXTURE
;
4498 if Key
= Ord('D') then
4500 SelectFlag
:= SELECTFLAG_NONE
;
4501 if DrawPressRect
then
4503 DrawPressRect
:= False;
4508 // Выбор области воздействия, в зависимости от типа триггера
4509 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_EX_AREA
], i
);
4512 DrawPressRect
:= True;
4515 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_DOOR_PANEL
], i
);
4517 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_TRAP_PANEL
], i
);
4520 SelectFlag
:= SELECTFLAG_DOOR
;
4523 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_LIFT_PANEL
], i
);
4526 SelectFlag
:= SELECTFLAG_LIFT
;
4529 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_TELEPORT_TO
], i
);
4532 SelectFlag
:= SELECTFLAG_TELEPORT
;
4535 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_SPAWN_TO
], i
);
4538 SelectFlag
:= SELECTFLAG_SPAWNPOINT
;
4542 // Выбор основного параметра, в зависимости от типа триггера
4543 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_NEXT_MAP
], i
);
4546 g_ProcessResourceStr(OpenedMap
, @FileName
, nil, nil);
4547 SelectMapForm
.Caption
:= _lc
[I_CAP_SELECT
];
4548 SelectMapForm
.GetMaps(FileName
);
4550 if SelectMapForm
.ShowModal() = mrOK
then
4552 vleObjectProperty
.Cells
[1, i
] := SelectMapForm
.lbMapList
.Items
[SelectMapForm
.lbMapList
.ItemIndex
];
4553 bApplyProperty
.Click();
4557 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_SOUND_NAME
], i
);
4559 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_MUSIC_NAME
], i
);
4562 AddSoundForm
.OKFunction
:= nil;
4563 AddSoundForm
.lbResourcesList
.MultiSelect
:= False;
4564 AddSoundForm
.SetResource
:= vleObjectProperty
.Cells
[1, i
];
4566 if (AddSoundForm
.ShowModal() = mrOk
) then
4568 vleObjectProperty
.Cells
[1, i
] := AddSoundForm
.ResourceName
;
4569 bApplyProperty
.Click();
4573 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_PUSH_ANGLE
], i
);
4575 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_MESSAGE_TEXT
], i
);
4578 vleObjectProperty
.Row
:= i
;
4579 vleObjectProperty
.SetFocus();
4586 procedure TMainForm
.aOptimizeExecute(Sender
: TObject
);
4588 RemoveSelectFromObjects();
4589 MapOptimizationForm
.ShowModal();
4592 procedure TMainForm
.aCheckMapExecute(Sender
: TObject
);
4594 MapCheckForm
.ShowModal();
4597 procedure TMainForm
.bbAddTextureClick(Sender
: TObject
);
4599 AddTextureForm
.lbResourcesList
.MultiSelect
:= True;
4600 AddTextureForm
.ShowModal();
4603 procedure TMainForm
.lbTextureListClick(Sender
: TObject
);
4606 TextureWidth
, TextureHeight
: Word;
4611 if (lbTextureList
.ItemIndex
<> -1) and
4612 (not IsSpecialTextureSel()) then
4614 if g_GetTexture(SelectedTexture(), TextureID
) then
4616 g_GetTextureSizeByID(TextureID
, TextureWidth
, TextureHeight
);
4618 lTextureWidth
.Caption
:= IntToStr(TextureWidth
);
4619 lTextureHeight
.Caption
:= IntToStr(TextureHeight
);
4622 lTextureWidth
.Caption
:= _lc
[I_NOT_ACCESSIBLE
];
4623 lTextureHeight
.Caption
:= _lc
[I_NOT_ACCESSIBLE
];
4628 lTextureWidth
.Caption
:= '';
4629 lTextureHeight
.Caption
:= '';
4633 procedure TMainForm
.lbTextureListDrawItem(Control
: TWinControl
; Index
: Integer;
4634 ARect
: TRect
; State
: TOwnerDrawState
);
4636 with Control
as TListBox
do
4638 if LCLType
.odSelected
in State
then
4640 Canvas
.Brush
.Color
:= clHighlight
;
4641 Canvas
.Font
.Color
:= clHighlightText
;
4643 if (Items
<> nil) and (Index
>= 0) then
4644 if slInvalidTextures
.IndexOf(Items
[Index
]) > -1 then
4646 Canvas
.Brush
.Color
:= clRed
;
4647 Canvas
.Font
.Color
:= clWhite
;
4649 Canvas
.FillRect(ARect
);
4650 Canvas
.TextRect(ARect
, ARect
.Left
, ARect
.Top
, Items
[Index
]);
4654 procedure TMainForm
.miReopenMapClick(Sender
: TObject
);
4656 FileName
, Resource
: String;
4658 if OpenedMap
= '' then
4661 if MessageBox(0, PChar(_lc
[I_MSG_REOPEN_MAP_PROMT
]),
4662 PChar(_lc
[I_MENU_FILE_REOPEN
]), MB_ICONQUESTION
or MB_YESNO
) <> idYes
then
4665 g_ProcessResourceStr(OpenedMap
, @FileName
, nil, @Resource
);
4666 OpenMap(FileName
, Resource
);
4669 procedure TMainForm
.vleObjectPropertyGetPickList(Sender
: TObject
;
4670 const KeyName
: String; Values
: TStrings
);
4672 if vleObjectProperty
.ItemProps
[KeyName
].EditStyle
= esPickList
then
4674 if KeyName
= _lc
[I_PROP_DIRECTION
] then
4676 Values
.Add(DirNames
[D_LEFT
]);
4677 Values
.Add(DirNames
[D_RIGHT
]);
4679 else if KeyName
= _lc
[I_PROP_TR_TELEPORT_DIR
] then
4681 Values
.Add(DirNamesAdv
[0]);
4682 Values
.Add(DirNamesAdv
[1]);
4683 Values
.Add(DirNamesAdv
[2]);
4684 Values
.Add(DirNamesAdv
[3]);
4686 else if KeyName
= _lc
[I_PROP_TR_MUSIC_ACT
] then
4688 Values
.Add(_lc
[I_PROP_TR_MUSIC_ON
]);
4689 Values
.Add(_lc
[I_PROP_TR_MUSIC_OFF
]);
4691 else if KeyName
= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR
] then
4693 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_0
]);
4694 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_1
]);
4695 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_2
]);
4696 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_3
]);
4697 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_4
]);
4698 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_5
]);
4700 else if KeyName
= _lc
[I_PROP_TR_SCORE_ACT
] then
4702 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_0
]);
4703 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_1
]);
4704 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_2
]);
4705 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_3
]);
4707 else if KeyName
= _lc
[I_PROP_TR_SCORE_TEAM
] then
4709 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_0
]);
4710 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_1
]);
4711 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_2
]);
4712 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_3
]);
4714 else if KeyName
= _lc
[I_PROP_TR_MESSAGE_KIND
] then
4716 Values
.Add(_lc
[I_PROP_TR_MESSAGE_KIND_0
]);
4717 Values
.Add(_lc
[I_PROP_TR_MESSAGE_KIND_1
]);
4719 else if KeyName
= _lc
[I_PROP_TR_MESSAGE_TO
] then
4721 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_0
]);
4722 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_1
]);
4723 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_2
]);
4724 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_3
]);
4725 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_4
]);
4726 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_5
]);
4728 else if KeyName
= _lc
[I_PROP_TR_SHOT_TO
] then
4730 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_0
]);
4731 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_1
]);
4732 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_2
]);
4733 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_3
]);
4734 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_4
]);
4735 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_5
]);
4736 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_6
]);
4738 else if KeyName
= _lc
[I_PROP_TR_SHOT_AIM
] then
4740 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_0
]);
4741 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_1
]);
4742 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_2
]);
4743 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_3
]);
4745 else if (KeyName
= _lc
[I_PROP_PANEL_BLEND
]) or
4746 (KeyName
= _lc
[I_PROP_DM_ONLY
]) or
4747 (KeyName
= _lc
[I_PROP_ITEM_FALLS
]) or
4748 (KeyName
= _lc
[I_PROP_TR_ENABLED
]) or
4749 (KeyName
= _lc
[I_PROP_TR_D2D
]) or
4750 (KeyName
= _lc
[I_PROP_TR_SILENT
]) or
4751 (KeyName
= _lc
[I_PROP_TR_TELEPORT_SILENT
]) or
4752 (KeyName
= _lc
[I_PROP_TR_EX_RANDOM
]) or
4753 (KeyName
= _lc
[I_PROP_TR_TEXTURE_ONCE
]) or
4754 (KeyName
= _lc
[I_PROP_TR_TEXTURE_ANIM_ONCE
]) or
4755 (KeyName
= _lc
[I_PROP_TR_SOUND_LOCAL
]) or
4756 (KeyName
= _lc
[I_PROP_TR_SOUND_SWITCH
]) or
4757 (KeyName
= _lc
[I_PROP_TR_MONSTER_ACTIVE
]) or
4758 (KeyName
= _lc
[I_PROP_TR_PUSH_RESET
]) or
4759 (KeyName
= _lc
[I_PROP_TR_SCORE_CON
]) or
4760 (KeyName
= _lc
[I_PROP_TR_SCORE_MSG
]) or
4761 (KeyName
= _lc
[I_PROP_TR_HEALTH_MAX
]) or
4762 (KeyName
= _lc
[I_PROP_TR_SHOT_SOUND
]) or
4763 (KeyName
= _lc
[I_PROP_TR_EFFECT_CENTER
]) then
4765 Values
.Add(BoolNames
[True]);
4766 Values
.Add(BoolNames
[False]);
4771 procedure TMainForm
.bApplyPropertyClick(Sender
: TObject
);
4773 _id
, a
, r
, c
: Integer;
4783 if SelectedObjectCount() <> 1 then
4785 if not SelectedObjects
[GetFirstSelected()].Live
then
4789 if not CheckProperty() then
4795 _id
:= GetFirstSelected();
4797 r
:= vleObjectProperty
.Row
;
4798 c
:= vleObjectProperty
.Col
;
4800 case SelectedObjects
[_id
].ObjectType
of
4803 with gPanels
[SelectedObjects
[_id
].ID
] do
4805 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4806 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4807 Width
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_WIDTH
]]));
4808 Height
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_HEIGHT
]]));
4810 PanelType
:= GetPanelType(vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_TYPE
]]);
4812 // Сброс ссылки на триггеры смены текстуры:
4813 if not WordBool(PanelType
and (PANEL_WALL
or PANEL_FORE
or PANEL_BACK
)) then
4814 if gTriggers
<> nil then
4815 for a
:= 0 to High(gTriggers
) do
4817 if (gTriggers
[a
].TriggerType
<> 0) and
4818 (gTriggers
[a
].TexturePanel
= Integer(SelectedObjects
[_id
].ID
)) then
4819 gTriggers
[a
].TexturePanel
:= -1;
4820 if (gTriggers
[a
].TriggerType
= TRIGGER_SHOT
) and
4821 (gTriggers
[a
].Data
.ShotPanelID
= Integer(SelectedObjects
[_id
].ID
)) then
4822 gTriggers
[a
].Data
.ShotPanelID
:= -1;
4825 // Сброс ссылки на триггеры лифта:
4826 if not WordBool(PanelType
and (PANEL_LIFTUP
or PANEL_LIFTDOWN
or PANEL_LIFTLEFT
or PANEL_LIFTRIGHT
)) then
4827 if gTriggers
<> nil then
4828 for a
:= 0 to High(gTriggers
) do
4829 if (gTriggers
[a
].TriggerType
in [TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
]) and
4830 (gTriggers
[a
].Data
.PanelID
= Integer(SelectedObjects
[_id
].ID
)) then
4831 gTriggers
[a
].Data
.PanelID
:= -1;
4833 // Сброс ссылки на триггеры двери:
4834 if not WordBool(PanelType
and (PANEL_OPENDOOR
or PANEL_CLOSEDOOR
)) then
4835 if gTriggers
<> nil then
4836 for a
:= 0 to High(gTriggers
) do
4837 if (gTriggers
[a
].TriggerType
in [TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
4838 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
]) and
4839 (gTriggers
[a
].Data
.PanelID
= Integer(SelectedObjects
[_id
].ID
)) then
4840 gTriggers
[a
].Data
.PanelID
:= -1;
4842 if IsTexturedPanel(PanelType
) then
4843 begin // Может быть текстура
4844 if TextureName
<> '' then
4845 begin // Была текстура
4846 Alpha
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_ALPHA
]]));
4847 Blending
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_BLEND
]]);
4856 TextureName
:= vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_TEX
]];
4858 if TextureName
<> '' then
4859 begin // Есть текстура
4860 // Обычная текстура:
4861 if not IsSpecialTexture(TextureName
) then
4863 g_GetTextureSizeByName(TextureName
,
4864 TextureWidth
, TextureHeight
);
4866 // Проверка кратности размеров панели:
4868 if TextureWidth
<> 0 then
4869 if gPanels
[SelectedObjects
[_id
].ID
].Width
mod TextureWidth
<> 0 then
4871 ErrorMessageBox(Format(_lc
[I_MSG_WRONG_TEXWIDTH
],
4875 if Res
and (TextureHeight
<> 0) then
4876 if gPanels
[SelectedObjects
[_id
].ID
].Height
mod TextureHeight
<> 0 then
4878 ErrorMessageBox(Format(_lc
[I_MSG_WRONG_TEXHEIGHT
],
4885 if not g_GetTexture(TextureName
, TextureID
) then
4886 // Не удалось загрузить текстуру, рисуем NOTEXTURE
4887 if g_GetTexture('NOTEXTURE', NoTextureID
) then
4889 TextureID
:= TEXTURE_SPECIAL_NOTEXTURE
;
4890 g_GetTextureSizeByID(NoTextureID
, NW
, NH
);
4892 TextureHeight
:= NH
;
4895 TextureID
:= TEXTURE_SPECIAL_NONE
;
4905 TextureID
:= TEXTURE_SPECIAL_NONE
;
4908 else // Спец.текстура
4912 TextureID
:= SpecialTextureID(TextureName
);
4915 else // Нет текстуры
4919 TextureID
:= TEXTURE_SPECIAL_NONE
;
4922 else // Не может быть текстуры
4929 TextureID
:= TEXTURE_SPECIAL_NONE
;
4936 with gItems
[SelectedObjects
[_id
].ID
] do
4938 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4939 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4940 OnlyDM
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_DM_ONLY
]]);
4941 Fall
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_ITEM_FALLS
]]);
4947 with gMonsters
[SelectedObjects
[_id
].ID
] do
4949 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4950 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4951 Direction
:= NameToDir(vleObjectProperty
.Values
[_lc
[I_PROP_DIRECTION
]]);
4957 with gAreas
[SelectedObjects
[_id
].ID
] do
4959 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4960 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4961 Direction
:= NameToDir(vleObjectProperty
.Values
[_lc
[I_PROP_DIRECTION
]]);
4967 with gTriggers
[SelectedObjects
[_id
].ID
] do
4969 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4970 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4971 Width
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_WIDTH
]]));
4972 Height
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_HEIGHT
]]));
4973 Enabled
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_ENABLED
]]);
4974 ActivateType
:= StrToActivate(vleObjectProperty
.Values
[_lc
[I_PROP_TR_ACTIVATION
]]);
4975 Key
:= StrToKey(vleObjectProperty
.Values
[_lc
[I_PROP_TR_KEYS
]]);
4980 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_NEXT_MAP
]]);
4981 FillByte(Data
.MapName
[0], 16, 0);
4983 Move(s
[1], Data
.MapName
[0], Min(Length(s
), 16));
4988 Data
.ActivateOnce
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TEXTURE_ONCE
]]);
4989 Data
.AnimOnce
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TEXTURE_ANIM_ONCE
]]);
4992 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
:
4994 Data
.Wait
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_DELAY
]], 0), 65535);
4995 Data
.Count
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_COUNT
]], 0), 65535);
4996 if Data
.Count
< 1 then
4998 if TriggerType
= TRIGGER_PRESS
then
4999 Data
.ExtRandom
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_RANDOM
]]);
5002 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
, TRIGGER_DOOR5
,
5003 TRIGGER_CLOSETRAP
, TRIGGER_TRAP
, TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
,
5006 Data
.NoSound
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SILENT
]]);
5007 Data
.d2d_doors
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_D2D
]]);
5012 Data
.d2d_teleport
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_D2D
]]);
5013 Data
.silent_teleport
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TELEPORT_SILENT
]]);
5014 Data
.TlpDir
:= NameToDirAdv(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TELEPORT_DIR
]]);
5019 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_NAME
]]);
5020 FillByte(Data
.SoundName
[0], 64, 0);
5022 Move(s
[1], Data
.SoundName
[0], Min(Length(s
), 64));
5024 Data
.Volume
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_VOLUME
]], 0), 255);
5025 Data
.Pan
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_PAN
]], 0), 255);
5026 Data
.PlayCount
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_COUNT
]], 0), 255);
5027 Data
.Local
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_LOCAL
]]);
5028 Data
.SoundSwitch
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_SWITCH
]]);
5031 TRIGGER_SPAWNMONSTER
:
5033 Data
.MonType
:= StrToMonster(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_TYPE
]]);
5034 Data
.MonDir
:= Byte(NameToDir(vleObjectProperty
.Values
[_lc
[I_PROP_DIRECTION
]]));
5035 Data
.MonHealth
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_HEALTH
]], 0), 1000000);
5036 if Data
.MonHealth
< 0 then
5037 Data
.MonHealth
:= 0;
5038 Data
.MonActive
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_ACTIVE
]]);
5039 Data
.MonCount
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 64);
5040 if Data
.MonCount
< 1 then
5042 Data
.MonEffect
:= StrToEffect(vleObjectProperty
.Values
[_lc
[I_PROP_TR_FX_TYPE
]]);
5043 Data
.MonMax
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_MAX
]], 0), 65535);
5044 Data
.MonDelay
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_DELAY
]], 0), 65535);
5046 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_1
] then
5048 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_2
] then
5050 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_3
] then
5052 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_4
] then
5054 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_5
] then
5060 Data
.ItemType
:= StrToItem(vleObjectProperty
.Values
[_lc
[I_PROP_TR_ITEM_TYPE
]]);
5061 Data
.ItemOnlyDM
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_DM_ONLY
]]);
5062 Data
.ItemFalls
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_ITEM_FALLS
]]);
5063 Data
.ItemCount
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 64);
5064 if Data
.ItemCount
< 1 then
5065 Data
.ItemCount
:= 1;
5066 Data
.ItemEffect
:= StrToEffect(vleObjectProperty
.Values
[_lc
[I_PROP_TR_FX_TYPE
]]);
5067 Data
.ItemMax
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_MAX
]], 0), 65535);
5068 Data
.ItemDelay
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_DELAY
]], 0), 65535);
5073 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MUSIC_NAME
]]);
5074 FillByte(Data
.MusicName
[0], 64, 0);
5076 Move(s
[1], Data
.MusicName
[0], Min(Length(s
), 64));
5078 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MUSIC_ACT
]] = _lc
[I_PROP_TR_MUSIC_ON
] then
5079 Data
.MusicAction
:= 1
5081 Data
.MusicAction
:= 2;
5086 Data
.PushAngle
:= Min(
5087 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_PUSH_ANGLE
]], 0), 360);
5088 Data
.PushForce
:= Min(
5089 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_PUSH_FORCE
]], 0), 255);
5090 Data
.ResetVel
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_PUSH_RESET
]]);
5095 Data
.ScoreAction
:= 0;
5096 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_ACT
]] = _lc
[I_PROP_TR_SCORE_ACT_1
] then
5097 Data
.ScoreAction
:= 1
5098 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_ACT
]] = _lc
[I_PROP_TR_SCORE_ACT_2
] then
5099 Data
.ScoreAction
:= 2
5100 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_ACT
]] = _lc
[I_PROP_TR_SCORE_ACT_3
] then
5101 Data
.ScoreAction
:= 3;
5102 Data
.ScoreCount
:= Min(Max(
5103 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 0), 255);
5104 Data
.ScoreTeam
:= 0;
5105 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_TEAM
]] = _lc
[I_PROP_TR_SCORE_TEAM_1
] then
5107 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_TEAM
]] = _lc
[I_PROP_TR_SCORE_TEAM_2
] then
5109 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_TEAM
]] = _lc
[I_PROP_TR_SCORE_TEAM_3
] then
5110 Data
.ScoreTeam
:= 3;
5111 Data
.ScoreCon
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_CON
]]);
5112 Data
.ScoreMsg
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_MSG
]]);
5117 Data
.MessageKind
:= 0;
5118 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_KIND
]] = _lc
[I_PROP_TR_MESSAGE_KIND_1
] then
5119 Data
.MessageKind
:= 1;
5121 Data
.MessageSendTo
:= 0;
5122 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_1
] then
5123 Data
.MessageSendTo
:= 1
5124 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_2
] then
5125 Data
.MessageSendTo
:= 2
5126 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_3
] then
5127 Data
.MessageSendTo
:= 3
5128 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_4
] then
5129 Data
.MessageSendTo
:= 4
5130 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_5
] then
5131 Data
.MessageSendTo
:= 5;
5133 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TEXT
]]);
5134 FillByte(Data
.MessageText
[0], 100, 0);
5136 Move(s
[1], Data
.MessageText
[0], Min(Length(s
), 100));
5138 Data
.MessageTime
:= Min(Max(
5139 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TIME
]], 0), 0), 65535);
5144 Data
.DamageValue
:= Min(Max(
5145 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_DAMAGE_VALUE
]], 0), 0), 65535);
5146 Data
.DamageInterval
:= Min(Max(
5147 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_INTERVAL
]], 0), 0), 65535);
5152 Data
.HealValue
:= Min(Max(
5153 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_HEALTH
]], 0), 0), 65535);
5154 Data
.HealInterval
:= Min(Max(
5155 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_INTERVAL
]], 0), 0), 65535);
5156 Data
.HealMax
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_HEALTH_MAX
]]);
5157 Data
.HealSilent
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SILENT
]]);
5162 Data
.ShotType
:= StrToShot(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TYPE
]]);
5163 Data
.ShotSound
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_SOUND
]]);
5164 Data
.ShotTarget
:= 0;
5165 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_1
] then
5166 Data
.ShotTarget
:= 1
5167 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_2
] then
5168 Data
.ShotTarget
:= 2
5169 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_3
] then
5170 Data
.ShotTarget
:= 3
5171 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_4
] then
5172 Data
.ShotTarget
:= 4
5173 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_5
] then
5174 Data
.ShotTarget
:= 5
5175 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_6
] then
5176 Data
.ShotTarget
:= 6;
5177 Data
.ShotIntSight
:= Min(Max(
5178 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_SIGHT
]], 0), 0), 65535);
5180 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AIM
]] = _lc
[I_PROP_TR_SHOT_AIM_1
] then
5182 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AIM
]] = _lc
[I_PROP_TR_SHOT_AIM_2
] then
5184 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AIM
]] = _lc
[I_PROP_TR_SHOT_AIM_3
] then
5186 Data
.ShotAngle
:= Min(
5187 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_ANGLE
]], 0), 360);
5188 Data
.ShotWait
:= Min(Max(
5189 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_DELAY
]], 0), 0), 65535);
5190 Data
.ShotAccuracy
:= Min(Max(
5191 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_ACC
]], 0), 0), 65535);
5192 Data
.ShotAmmo
:= Min(Max(
5193 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AMMO
]], 0), 0), 65535);
5194 Data
.ShotIntReload
:= Min(Max(
5195 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_RELOAD
]], 0), 0), 65535);
5200 Data
.FXCount
:= Min(Max(
5201 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 0), 255);
5202 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_TYPE
]] = _lc
[I_PROP_TR_EFFECT_PARTICLE
] then
5204 Data
.FXType
:= TRIGGER_EFFECT_PARTICLE
;
5205 Data
.FXSubType
:= TRIGGER_EFFECT_SLIQUID
;
5206 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_SLIQUID
] then
5207 Data
.FXSubType
:= TRIGGER_EFFECT_SLIQUID
5208 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_LLIQUID
] then
5209 Data
.FXSubType
:= TRIGGER_EFFECT_LLIQUID
5210 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_DLIQUID
] then
5211 Data
.FXSubType
:= TRIGGER_EFFECT_DLIQUID
5212 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_BLOOD
] then
5213 Data
.FXSubType
:= TRIGGER_EFFECT_BLOOD
5214 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_SPARK
] then
5215 Data
.FXSubType
:= TRIGGER_EFFECT_SPARK
5216 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_BUBBLE
] then
5217 Data
.FXSubType
:= TRIGGER_EFFECT_BUBBLE
;
5220 Data
.FXType
:= TRIGGER_EFFECT_ANIMATION
;
5221 Data
.FXSubType
:= StrToEffect(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]]);
5224 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_COLOR
]], 0), 0), $FFFFFF);
5225 Data
.FXColorR
:= a
and $FF;
5226 Data
.FXColorG
:= (a
shr 8) and $FF;
5227 Data
.FXColorB
:= (a
shr 16) and $FF;
5228 if NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_CENTER
]]) then
5232 Data
.FXWait
:= Min(Max(
5233 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_DELAY
]], 0), 0), 65535);
5234 Data
.FXVelX
:= Min(Max(
5235 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_VELX
]], 0), -128), 127);
5236 Data
.FXVelY
:= Min(Max(
5237 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_VELY
]], 0), -128), 127);
5238 Data
.FXSpreadL
:= Min(Max(
5239 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPL
]], 0), 0), 255);
5240 Data
.FXSpreadR
:= Min(Max(
5241 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPR
]], 0), 0), 255);
5242 Data
.FXSpreadU
:= Min(Max(
5243 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPU
]], 0), 0), 255);
5244 Data
.FXSpreadD
:= Min(Max(
5245 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPD
]], 0), 0), 255);
5254 vleObjectProperty
.Row
:= r
;
5255 vleObjectProperty
.Col
:= c
;
5258 procedure TMainForm
.bbRemoveTextureClick(Sender
: TObject
);
5262 i
:= lbTextureList
.ItemIndex
;
5266 if MessageBox(0, PChar(Format(_lc
[I_MSG_DEL_TEXTURE_PROMT
],
5267 [SelectedTexture()])),
5268 PChar(_lc
[I_MSG_DEL_TEXTURE
]),
5269 MB_ICONQUESTION
or MB_YESNO
or
5270 MB_DEFBUTTON1
) <> idYes
then
5273 if gPanels
<> nil then
5274 for a
:= 0 to High(gPanels
) do
5275 if (gPanels
[a
].PanelType
<> 0) and
5276 (gPanels
[a
].TextureName
= SelectedTexture()) then
5278 ErrorMessageBox(_lc
[I_MSG_DEL_TEXTURE_CANT
]);
5282 g_DeleteTexture(SelectedTexture());
5283 i
:= slInvalidTextures
.IndexOf(lbTextureList
.Items
[i
]);
5285 slInvalidTextures
.Delete(i
);
5286 if lbTextureList
.ItemIndex
> -1 then
5287 lbTextureList
.Items
.Delete(lbTextureList
.ItemIndex
)
5290 procedure TMainForm
.aNewMapExecute(Sender
: TObject
);
5292 if (MessageBox(0, PChar(_lc
[I_MSG_CLEAR_MAP_PROMT
]),
5293 PChar(_lc
[I_MSG_CLEAR_MAP
]),
5294 MB_ICONQUESTION
or MB_YESNO
or
5295 MB_DEFBUTTON1
) = mrYes
) then
5299 procedure TMainForm
.aUndoExecute(Sender
: TObject
);
5303 if UndoBuffer
= nil then
5305 if UndoBuffer
[High(UndoBuffer
)] = nil then
5308 for a
:= 0 to High(UndoBuffer
[High(UndoBuffer
)]) do
5309 with UndoBuffer
[High(UndoBuffer
)][a
] do
5317 UNDO_DELETE_ITEM
: AddItem(Item
);
5318 UNDO_DELETE_AREA
: AddArea(Area
);
5319 UNDO_DELETE_MONSTER
: AddMonster(Monster
);
5320 UNDO_DELETE_TRIGGER
: AddTrigger(Trigger
);
5321 UNDO_ADD_PANEL
: RemoveObject(AddID
, OBJECT_PANEL
);
5322 UNDO_ADD_ITEM
: RemoveObject(AddID
, OBJECT_ITEM
);
5323 UNDO_ADD_AREA
: RemoveObject(AddID
, OBJECT_AREA
);
5324 UNDO_ADD_MONSTER
: RemoveObject(AddID
, OBJECT_MONSTER
);
5325 UNDO_ADD_TRIGGER
: RemoveObject(AddID
, OBJECT_TRIGGER
);
5329 SetLength(UndoBuffer
, Length(UndoBuffer
)-1);
5331 RemoveSelectFromObjects();
5333 miUndo
.Enabled
:= UndoBuffer
<> nil;
5337 procedure TMainForm
.aCopyObjectExecute(Sender
: TObject
);
5340 CopyBuffer
: TCopyRecArray
;
5344 function CB_Compare(I1
, I2
: TCopyRec
): Integer;
5346 Result
:= Integer(I1
.ObjectType
) - Integer(I2
.ObjectType
);
5348 if Result
= 0 then // Одного типа
5349 Result
:= Integer(I1
.ID
) - Integer(I2
.ID
);
5352 procedure QuickSortCopyBuffer(L
, R
: Integer);
5360 P
:= CopyBuffer
[(L
+ R
) shr 1];
5363 while CB_Compare(CopyBuffer
[I
], P
) < 0 do
5365 while CB_Compare(CopyBuffer
[J
], P
) > 0 do
5371 CopyBuffer
[I
] := CopyBuffer
[J
];
5379 QuickSortCopyBuffer(L
, J
);
5386 if SelectedObjects
= nil then
5392 // Копируем объекты:
5393 for a
:= 0 to High(SelectedObjects
) do
5394 if SelectedObjects
[a
].Live
then
5395 with SelectedObjects
[a
] do
5397 SetLength(CopyBuffer
, Length(CopyBuffer
)+1);
5398 b
:= High(CopyBuffer
);
5399 CopyBuffer
[b
].ID
:= ID
;
5400 CopyBuffer
[b
].Panel
:= nil;
5405 CopyBuffer
[b
].ObjectType
:= OBJECT_PANEL
;
5406 New(CopyBuffer
[b
].Panel
);
5407 CopyBuffer
[b
].Panel
^ := gPanels
[ID
];
5412 CopyBuffer
[b
].ObjectType
:= OBJECT_ITEM
;
5413 CopyBuffer
[b
].Item
:= gItems
[ID
];
5418 CopyBuffer
[b
].ObjectType
:= OBJECT_MONSTER
;
5419 CopyBuffer
[b
].Monster
:= gMonsters
[ID
];
5424 CopyBuffer
[b
].ObjectType
:= OBJECT_AREA
;
5425 CopyBuffer
[b
].Area
:= gAreas
[ID
];
5430 CopyBuffer
[b
].ObjectType
:= OBJECT_TRIGGER
;
5431 CopyBuffer
[b
].Trigger
:= gTriggers
[ID
];
5436 // Сортировка по ID:
5437 if CopyBuffer
<> nil then
5439 QuickSortCopyBuffer(0, b
);
5442 // Пестановка ссылок триггеров:
5443 for a
:= 0 to Length(CopyBuffer
)-1 do
5444 if CopyBuffer
[a
].ObjectType
= OBJECT_TRIGGER
then
5446 case CopyBuffer
[a
].Trigger
.TriggerType
of
5447 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
5448 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
5449 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
5450 if CopyBuffer
[a
].Trigger
.Data
.PanelID
<> -1 then
5454 for b
:= 0 to Length(CopyBuffer
)-1 do
5455 if (CopyBuffer
[b
].ObjectType
= OBJECT_PANEL
) and
5456 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.Data
.PanelID
) then
5458 CopyBuffer
[a
].Trigger
.Data
.PanelID
:= b
;
5463 // Этих панелей нет среди копируемых:
5465 CopyBuffer
[a
].Trigger
.Data
.PanelID
:= -1;
5468 TRIGGER_PRESS
, TRIGGER_ON
,
5469 TRIGGER_OFF
, TRIGGER_ONOFF
:
5470 if CopyBuffer
[a
].Trigger
.Data
.MonsterID
<> 0 then
5474 for b
:= 0 to Length(CopyBuffer
)-1 do
5475 if (CopyBuffer
[b
].ObjectType
= OBJECT_MONSTER
) and
5476 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.Data
.MonsterID
-1) then
5478 CopyBuffer
[a
].Trigger
.Data
.MonsterID
:= b
+1;
5483 // Этих монстров нет среди копируемых:
5485 CopyBuffer
[a
].Trigger
.Data
.MonsterID
:= 0;
5489 if CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
<> -1 then
5493 for b
:= 0 to Length(CopyBuffer
)-1 do
5494 if (CopyBuffer
[b
].ObjectType
= OBJECT_PANEL
) and
5495 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
) then
5497 CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
:= b
;
5502 // Этих панелей нет среди копируемых:
5504 CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
:= -1;
5508 if CopyBuffer
[a
].Trigger
.TexturePanel
<> -1 then
5512 for b
:= 0 to Length(CopyBuffer
)-1 do
5513 if (CopyBuffer
[b
].ObjectType
= OBJECT_PANEL
) and
5514 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.TexturePanel
) then
5516 CopyBuffer
[a
].Trigger
.TexturePanel
:= b
;
5521 // Этих панелей нет среди копируемых:
5523 CopyBuffer
[a
].Trigger
.TexturePanel
:= -1;
5528 str
:= CopyBufferToString(CopyBuffer
);
5529 ClipBoard
.AsText
:= str
;
5531 for a
:= 0 to Length(CopyBuffer
)-1 do
5532 if (CopyBuffer
[a
].ObjectType
= OBJECT_PANEL
) and
5533 (CopyBuffer
[a
].Panel
<> nil) then
5534 Dispose(CopyBuffer
[a
].Panel
);
5539 procedure TMainForm
.aPasteObjectExecute(Sender
: TObject
);
5542 CopyBuffer
: TCopyRecArray
;
5544 swad
, ssec
, sres
: String;
5550 pmin
.X
:= High(pmin
.X
);
5551 pmin
.Y
:= High(pmin
.Y
);
5553 StringToCopyBuffer(ClipBoard
.AsText
, CopyBuffer
, pmin
);
5554 rel
:= not(ssShift
in GetKeyShiftState());
5556 if CopyBuffer
= nil then
5559 RemoveSelectFromObjects();
5561 h
:= High(CopyBuffer
);
5563 with CopyBuffer
[a
] do
5567 if Panel
<> nil then
5571 Panel
^.X
:= Panel
^.X
- pmin
.X
- MapOffset
.X
+ 32;
5572 Panel
^.Y
:= Panel
^.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5575 Panel
^.TextureID
:= TEXTURE_SPECIAL_NONE
;
5576 Panel
^.TextureWidth
:= 1;
5577 Panel
^.TextureHeight
:= 1;
5579 if (Panel
^.PanelType
= PANEL_LIFTUP
) or
5580 (Panel
^.PanelType
= PANEL_LIFTDOWN
) or
5581 (Panel
^.PanelType
= PANEL_LIFTLEFT
) or
5582 (Panel
^.PanelType
= PANEL_LIFTRIGHT
) or
5583 (Panel
^.PanelType
= PANEL_BLOCKMON
) or
5584 (Panel
^.TextureName
= '') then
5585 begin // Нет или не может быть текстуры:
5587 else // Есть текстура:
5589 // Обычная текстура:
5590 if not IsSpecialTexture(Panel
^.TextureName
) then
5592 res
:= g_GetTexture(Panel
^.TextureName
, Panel
^.TextureID
);
5596 g_ProcessResourceStr(Panel
^.TextureName
, swad
, ssec
, sres
);
5597 AddTexture(swad
, ssec
, sres
, True);
5598 res
:= g_GetTexture(Panel
^.TextureName
, Panel
^.TextureID
);
5602 g_GetTextureSizeByName(Panel
^.TextureName
,
5603 Panel
^.TextureWidth
, Panel
^.TextureHeight
)
5605 if g_GetTexture('NOTEXTURE', NoTextureID
) then
5607 Panel
^.TextureID
:= TEXTURE_SPECIAL_NOTEXTURE
;
5608 g_GetTextureSizeByID(NoTextureID
, Panel
^.TextureWidth
, Panel
^.TextureHeight
);
5611 else // Спец.текстура:
5613 Panel
^.TextureID
:= SpecialTextureID(Panel
^.TextureName
);
5614 with MainForm
.lbTextureList
.Items
do
5615 if IndexOf(Panel
^.TextureName
) = -1 then
5616 Add(Panel
^.TextureName
);
5620 ID
:= AddPanel(Panel
^);
5622 Undo_Add(OBJECT_PANEL
, ID
, a
> 0);
5623 SelectObject(OBJECT_PANEL
, ID
, True);
5630 Item
.X
:= Item
.X
- pmin
.X
- MapOffset
.X
+ 32;
5631 Item
.Y
:= Item
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5634 ID
:= AddItem(Item
);
5635 Undo_Add(OBJECT_ITEM
, ID
, a
> 0);
5636 SelectObject(OBJECT_ITEM
, ID
, True);
5643 Monster
.X
:= Monster
.X
- pmin
.X
- MapOffset
.X
+ 32;
5644 Monster
.Y
:= Monster
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5647 ID
:= AddMonster(Monster
);
5648 Undo_Add(OBJECT_MONSTER
, ID
, a
> 0);
5649 SelectObject(OBJECT_MONSTER
, ID
, True);
5656 Area
.X
:= Area
.X
- pmin
.X
- MapOffset
.X
+ 32;
5657 Area
.Y
:= Area
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5660 ID
:= AddArea(Area
);
5661 Undo_Add(OBJECT_AREA
, ID
, a
> 0);
5662 SelectObject(OBJECT_AREA
, ID
, True);
5670 X
:= X
- pmin
.X
- MapOffset
.X
+ 32;
5671 Y
:= Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5676 Data
.TargetPoint
.X
:=
5677 Data
.TargetPoint
.X
- pmin
.X
- MapOffset
.X
+ 32;
5678 Data
.TargetPoint
.Y
:=
5679 Data
.TargetPoint
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5681 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
:
5683 Data
.tX
:= Data
.tX
- pmin
.X
- MapOffset
.X
+ 32;
5684 Data
.tY
:= Data
.tY
- pmin
.Y
- MapOffset
.Y
+ 32;
5686 TRIGGER_SPAWNMONSTER
:
5689 Data
.MonPos
.X
- pmin
.X
- MapOffset
.X
+ 32;
5691 Data
.MonPos
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5696 Data
.ItemPos
.X
- pmin
.X
- MapOffset
.X
+ 32;
5698 Data
.ItemPos
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5703 Data
.ShotPos
.X
- pmin
.X
- MapOffset
.X
+ 32;
5705 Data
.ShotPos
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5710 ID
:= AddTrigger(Trigger
);
5711 Undo_Add(OBJECT_TRIGGER
, ID
, a
> 0);
5712 SelectObject(OBJECT_TRIGGER
, ID
, True);
5717 // Переставляем ссылки триггеров:
5718 for a
:= 0 to High(CopyBuffer
) do
5719 if CopyBuffer
[a
].ObjectType
= OBJECT_TRIGGER
then
5721 case CopyBuffer
[a
].Trigger
.TriggerType
of
5722 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
5723 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
5724 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
5725 if CopyBuffer
[a
].Trigger
.Data
.PanelID
<> -1 then
5726 gTriggers
[CopyBuffer
[a
].ID
].Data
.PanelID
:=
5727 CopyBuffer
[CopyBuffer
[a
].Trigger
.Data
.PanelID
].ID
;
5729 TRIGGER_PRESS
, TRIGGER_ON
,
5730 TRIGGER_OFF
, TRIGGER_ONOFF
:
5731 if CopyBuffer
[a
].Trigger
.Data
.MonsterID
<> 0 then
5732 gTriggers
[CopyBuffer
[a
].ID
].Data
.MonsterID
:=
5733 CopyBuffer
[CopyBuffer
[a
].Trigger
.Data
.MonsterID
-1].ID
+1;
5736 if CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
<> -1 then
5737 gTriggers
[CopyBuffer
[a
].ID
].Data
.ShotPanelID
:=
5738 CopyBuffer
[CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
].ID
;
5741 if CopyBuffer
[a
].Trigger
.TexturePanel
<> -1 then
5742 gTriggers
[CopyBuffer
[a
].ID
].TexturePanel
:=
5743 CopyBuffer
[CopyBuffer
[a
].Trigger
.TexturePanel
].ID
;
5752 procedure TMainForm
.aCutObjectExecute(Sender
: TObject
);
5755 DeleteSelectedObjects();
5758 procedure TMainForm
.vleObjectPropertyEditButtonClick(Sender
: TObject
);
5760 Key
, FileName
: String;
5763 Key
:= vleObjectProperty
.Keys
[vleObjectProperty
.Row
];
5765 if Key
= _lc
[I_PROP_PANEL_TYPE
] then
5767 with ChooseTypeForm
, vleObjectProperty
do
5768 begin // Выбор типа панели:
5769 Caption
:= _lc
[I_PROP_PANEL_TYPE
];
5770 lbTypeSelect
.Items
.Clear();
5772 for b
:= 0 to High(PANELNAMES
) do
5774 lbTypeSelect
.Items
.Add(PANELNAMES
[b
]);
5775 if Values
[Key
] = PANELNAMES
[b
] then
5776 lbTypeSelect
.ItemIndex
:= b
;
5779 if ShowModal() = mrOK
then
5781 b
:= lbTypeSelect
.ItemIndex
;
5782 Values
[Key
] := PANELNAMES
[b
];
5783 vleObjectPropertyApply(Sender
);
5787 else if Key
= _lc
[I_PROP_TR_TELEPORT_TO
] then
5788 SelectFlag
:= SELECTFLAG_TELEPORT
5789 else if Key
= _lc
[I_PROP_TR_SPAWN_TO
] then
5790 SelectFlag
:= SELECTFLAG_SPAWNPOINT
5791 else if (Key
= _lc
[I_PROP_TR_DOOR_PANEL
]) or
5792 (Key
= _lc
[I_PROP_TR_TRAP_PANEL
]) then
5793 SelectFlag
:= SELECTFLAG_DOOR
5794 else if Key
= _lc
[I_PROP_TR_TEXTURE_PANEL
] then
5796 DrawPressRect
:= False;
5797 SelectFlag
:= SELECTFLAG_TEXTURE
;
5799 else if Key
= _lc
[I_PROP_TR_SHOT_PANEL
] then
5800 SelectFlag
:= SELECTFLAG_SHOTPANEL
5801 else if Key
= _lc
[I_PROP_TR_LIFT_PANEL
] then
5802 SelectFlag
:= SELECTFLAG_LIFT
5803 else if key
= _lc
[I_PROP_TR_EX_MONSTER
] then
5804 SelectFlag
:= SELECTFLAG_MONSTER
5805 else if Key
= _lc
[I_PROP_TR_EX_AREA
] then
5807 SelectFlag
:= SELECTFLAG_NONE
;
5808 DrawPressRect
:= True;
5810 else if Key
= _lc
[I_PROP_TR_NEXT_MAP
] then
5811 begin // Выбор следующей карты:
5812 g_ProcessResourceStr(OpenedMap
, @FileName
, nil, nil);
5813 SelectMapForm
.Caption
:= _lc
[I_CAP_SELECT
];
5814 SelectMapForm
.GetMaps(FileName
);
5816 if SelectMapForm
.ShowModal() = mrOK
then
5818 vleObjectProperty
.Values
[Key
] := SelectMapForm
.lbMapList
.Items
[SelectMapForm
.lbMapList
.ItemIndex
];
5819 vleObjectPropertyApply(Sender
);
5822 else if (Key
= _lc
[I_PROP_TR_SOUND_NAME
]) or
5823 (Key
= _lc
[I_PROP_TR_MUSIC_NAME
]) then
5824 begin // Выбор файла звука/музыки:
5825 AddSoundForm
.OKFunction
:= nil;
5826 AddSoundForm
.lbResourcesList
.MultiSelect
:= False;
5827 AddSoundForm
.SetResource
:= vleObjectProperty
.Values
[Key
];
5829 if (AddSoundForm
.ShowModal() = mrOk
) then
5831 vleObjectProperty
.Values
[Key
] := AddSoundForm
.ResourceName
;
5832 vleObjectPropertyApply(Sender
);
5835 else if Key
= _lc
[I_PROP_TR_ACTIVATION
] then
5836 with ActivationTypeForm
, vleObjectProperty
do
5837 begin // Выбор типов активации:
5838 cbPlayerCollide
.Checked
:= Pos('PC', Values
[Key
]) > 0;
5839 cbMonsterCollide
.Checked
:= Pos('MC', Values
[Key
]) > 0;
5840 cbPlayerPress
.Checked
:= Pos('PP', Values
[Key
]) > 0;
5841 cbMonsterPress
.Checked
:= Pos('MP', Values
[Key
]) > 0;
5842 cbShot
.Checked
:= Pos('SH', Values
[Key
]) > 0;
5843 cbNoMonster
.Checked
:= Pos('NM', Values
[Key
]) > 0;
5845 if ShowModal() = mrOK
then
5848 if cbPlayerCollide
.Checked
then
5849 b
:= ACTIVATE_PLAYERCOLLIDE
;
5850 if cbMonsterCollide
.Checked
then
5851 b
:= b
or ACTIVATE_MONSTERCOLLIDE
;
5852 if cbPlayerPress
.Checked
then
5853 b
:= b
or ACTIVATE_PLAYERPRESS
;
5854 if cbMonsterPress
.Checked
then
5855 b
:= b
or ACTIVATE_MONSTERPRESS
;
5856 if cbShot
.Checked
then
5857 b
:= b
or ACTIVATE_SHOT
;
5858 if cbNoMonster
.Checked
then
5859 b
:= b
or ACTIVATE_NOMONSTER
;
5861 Values
[Key
] := ActivateToStr(b
);
5862 vleObjectPropertyApply(Sender
);
5865 else if Key
= _lc
[I_PROP_TR_KEYS
] then
5866 with KeysForm
, vleObjectProperty
do
5867 begin // Выбор необходимых ключей:
5868 cbRedKey
.Checked
:= Pos('RK', Values
[Key
]) > 0;
5869 cbGreenKey
.Checked
:= Pos('GK', Values
[Key
]) > 0;
5870 cbBlueKey
.Checked
:= Pos('BK', Values
[Key
]) > 0;
5871 cbRedTeam
.Checked
:= Pos('RT', Values
[Key
]) > 0;
5872 cbBlueTeam
.Checked
:= Pos('BT', Values
[Key
]) > 0;
5874 if ShowModal() = mrOK
then
5877 if cbRedKey
.Checked
then
5879 if cbGreenKey
.Checked
then
5880 b
:= b
or KEY_GREEN
;
5881 if cbBlueKey
.Checked
then
5883 if cbRedTeam
.Checked
then
5884 b
:= b
or KEY_REDTEAM
;
5885 if cbBlueTeam
.Checked
then
5886 b
:= b
or KEY_BLUETEAM
;
5888 Values
[Key
] := KeyToStr(b
);
5889 vleObjectPropertyApply(Sender
);
5892 else if Key
= _lc
[I_PROP_TR_FX_TYPE
] then
5893 with ChooseTypeForm
, vleObjectProperty
do
5894 begin // Выбор типа эффекта:
5895 Caption
:= _lc
[I_CAP_FX_TYPE
];
5896 lbTypeSelect
.Items
.Clear();
5898 for b
:= EFFECT_NONE
to EFFECT_FIRE
do
5899 lbTypeSelect
.Items
.Add(EffectToStr(b
));
5901 lbTypeSelect
.ItemIndex
:= StrToEffect(Values
[Key
]);
5903 if ShowModal() = mrOK
then
5905 b
:= lbTypeSelect
.ItemIndex
;
5906 Values
[Key
] := EffectToStr(b
);
5907 vleObjectPropertyApply(Sender
);
5910 else if Key
= _lc
[I_PROP_TR_MONSTER_TYPE
] then
5911 with ChooseTypeForm
, vleObjectProperty
do
5912 begin // Выбор типа монстра:
5913 Caption
:= _lc
[I_CAP_MONSTER_TYPE
];
5914 lbTypeSelect
.Items
.Clear();
5916 for b
:= MONSTER_DEMON
to MONSTER_MAN
do
5917 lbTypeSelect
.Items
.Add(MonsterToStr(b
));
5919 lbTypeSelect
.ItemIndex
:= StrToMonster(Values
[Key
]) - MONSTER_DEMON
;
5921 if ShowModal() = mrOK
then
5923 b
:= lbTypeSelect
.ItemIndex
+ MONSTER_DEMON
;
5924 Values
[Key
] := MonsterToStr(b
);
5925 vleObjectPropertyApply(Sender
);
5928 else if Key
= _lc
[I_PROP_TR_ITEM_TYPE
] then
5929 with ChooseTypeForm
, vleObjectProperty
do
5930 begin // Выбор типа предмета:
5931 Caption
:= _lc
[I_CAP_ITEM_TYPE
];
5932 lbTypeSelect
.Items
.Clear();
5934 for b
:= ITEM_MEDKIT_SMALL
to ITEM_KEY_BLUE
do
5935 lbTypeSelect
.Items
.Add(ItemToStr(b
));
5936 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_BOTTLE
));
5937 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_HELMET
));
5938 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_JETPACK
));
5939 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_INVIS
));
5940 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_WEAPON_FLAMETHROWER
));
5941 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_AMMO_FUELCAN
));
5943 b
:= StrToItem(Values
[Key
]);
5944 if b
>= ITEM_BOTTLE
then
5946 lbTypeSelect
.ItemIndex
:= b
- ITEM_MEDKIT_SMALL
;
5948 if ShowModal() = mrOK
then
5950 b
:= lbTypeSelect
.ItemIndex
+ ITEM_MEDKIT_SMALL
;
5951 if b
>= ITEM_WEAPON_KASTET
then
5953 Values
[Key
] := ItemToStr(b
);
5954 vleObjectPropertyApply(Sender
);
5957 else if Key
= _lc
[I_PROP_TR_SHOT_TYPE
] then
5958 with ChooseTypeForm
, vleObjectProperty
do
5959 begin // Выбор типа предмета:
5960 Caption
:= _lc
[I_PROP_TR_SHOT_TYPE
];
5961 lbTypeSelect
.Items
.Clear();
5963 for b
:= TRIGGER_SHOT_PISTOL
to TRIGGER_SHOT_MAX
do
5964 lbTypeSelect
.Items
.Add(ShotToStr(b
));
5966 lbTypeSelect
.ItemIndex
:= StrToShot(Values
[Key
]);
5968 if ShowModal() = mrOK
then
5970 b
:= lbTypeSelect
.ItemIndex
;
5971 Values
[Key
] := ShotToStr(b
);
5972 vleObjectPropertyApply(Sender
);
5975 else if Key
= _lc
[I_PROP_TR_EFFECT_TYPE
] then
5976 with ChooseTypeForm
, vleObjectProperty
do
5977 begin // Выбор типа эффекта:
5978 Caption
:= _lc
[I_CAP_FX_TYPE
];
5979 lbTypeSelect
.Items
.Clear();
5981 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_PARTICLE
]);
5982 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_ANIMATION
]);
5983 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_ANIMATION
] then
5984 lbTypeSelect
.ItemIndex
:= 1
5986 lbTypeSelect
.ItemIndex
:= 0;
5988 if ShowModal() = mrOK
then
5990 b
:= lbTypeSelect
.ItemIndex
;
5992 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_PARTICLE
]
5994 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_ANIMATION
];
5995 vleObjectPropertyApply(Sender
);
5998 else if Key
= _lc
[I_PROP_TR_EFFECT_SUBTYPE
] then
5999 with ChooseTypeForm
, vleObjectProperty
do
6000 begin // Выбор подтипа эффекта:
6001 Caption
:= _lc
[I_CAP_FX_TYPE
];
6002 lbTypeSelect
.Items
.Clear();
6004 if Values
[_lc
[I_PROP_TR_EFFECT_TYPE
]] = _lc
[I_PROP_TR_EFFECT_ANIMATION
] then
6006 for b
:= EFFECT_TELEPORT
to EFFECT_FIRE
do
6007 lbTypeSelect
.Items
.Add(EffectToStr(b
));
6009 lbTypeSelect
.ItemIndex
:= StrToEffect(Values
[Key
]) - 1;
6012 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_SLIQUID
]);
6013 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_LLIQUID
]);
6014 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_DLIQUID
]);
6015 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_BLOOD
]);
6016 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_SPARK
]);
6017 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_BUBBLE
]);
6018 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_SLIQUID
;
6019 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_LLIQUID
] then
6020 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_LLIQUID
;
6021 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_DLIQUID
] then
6022 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_DLIQUID
;
6023 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_BLOOD
] then
6024 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_BLOOD
;
6025 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_SPARK
] then
6026 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_SPARK
;
6027 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_BUBBLE
] then
6028 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_BUBBLE
;
6031 if ShowModal() = mrOK
then
6033 b
:= lbTypeSelect
.ItemIndex
;
6035 if Values
[_lc
[I_PROP_TR_EFFECT_TYPE
]] = _lc
[I_PROP_TR_EFFECT_ANIMATION
] then
6036 Values
[Key
] := EffectToStr(b
+ 1)
6038 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_SLIQUID
];
6039 if b
= TRIGGER_EFFECT_LLIQUID
then
6040 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_LLIQUID
];
6041 if b
= TRIGGER_EFFECT_DLIQUID
then
6042 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_DLIQUID
];
6043 if b
= TRIGGER_EFFECT_BLOOD
then
6044 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_BLOOD
];
6045 if b
= TRIGGER_EFFECT_SPARK
then
6046 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_SPARK
];
6047 if b
= TRIGGER_EFFECT_BUBBLE
then
6048 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_BUBBLE
];
6051 vleObjectPropertyApply(Sender
);
6054 else if Key
= _lc
[I_PROP_TR_EFFECT_COLOR
] then
6055 with vleObjectProperty
do
6056 begin // Выбор цвета эффекта:
6057 ColorDialog
.Color
:= StrToIntDef(Values
[Key
], 0);
6058 if ColorDialog
.Execute
then
6060 Values
[Key
] := IntToStr(ColorDialog
.Color
);
6061 vleObjectPropertyApply(Sender
);
6064 else if Key
= _lc
[I_PROP_PANEL_TEX
] then
6065 begin // Смена текстуры:
6066 vleObjectProperty
.Values
[Key
] := SelectedTexture();
6067 vleObjectPropertyApply(Sender
);
6071 procedure TMainForm
.vleObjectPropertyApply(Sender
: TObject
);
6073 // hack to prevent empty ID in list
6074 RenderPanel
.SetFocus();
6075 bApplyProperty
.Click();
6076 vleObjectProperty
.SetFocus();
6079 procedure TMainForm
.aSaveMapExecute(Sender
: TObject
);
6081 FileName
, Section
, Res
: String;
6083 if OpenedMap
= '' then
6085 aSaveMapAsExecute(nil);
6089 g_ProcessResourceStr(OpenedMap
, FileName
, Section
, Res
);
6091 SaveMap(FileName
+':\'+Res
);
6094 procedure TMainForm
.aOpenMapExecute(Sender
: TObject
);
6096 OpenDialog
.Filter
:= _lc
[I_FILE_FILTER_ALL
];
6098 if OpenDialog
.Execute() then
6100 OpenMapFile(OpenDialog
.FileName
);
6101 OpenDialog
.InitialDir
:= ExtractFileDir(OpenDialog
.FileName
);
6105 procedure TMainForm
.OpenMapFile(FileName
: String);
6107 if (Pos('.ini', LowerCase(ExtractFileName(FileName
))) > 0) then
6111 pLoadProgress
.Left
:= (RenderPanel
.Width
div 2)-(pLoadProgress
.Width
div 2);
6112 pLoadProgress
.Top
:= (RenderPanel
.Height
div 2)-(pLoadProgress
.Height
div 2);
6113 pLoadProgress
.Show();
6118 LoadMapOld(FileName
);
6120 MainForm
.Caption
:= Format('%s - %s', [FormCaption
, ExtractFileName(FileName
)]);
6122 pLoadProgress
.Hide();
6123 MainForm
.FormResize(Self
);
6125 else // Карты из WAD:
6127 OpenMap(FileName
, '');
6131 procedure TMainForm
.FormActivate(Sender
: TObject
);
6136 MainForm
.ActiveControl
:= RenderPanel
;
6139 if gLanguage
= '' then
6141 lang
:= SelectLanguageForm
.ShowModal();
6143 1: gLanguage
:= LANGUAGE_ENGLISH
;
6144 else gLanguage
:= LANGUAGE_RUSSIAN
;
6147 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
6148 config
.WriteStr('Editor', 'Language', gLanguage
);
6149 config
.SaveFile(EditorDir
+'Editor.cfg');
6153 //e_WriteLog('Read language file', MSG_NOTIFY);
6154 //g_Language_Load(EditorDir+'\data\'+gLanguage+LANGUAGE_FILE_NAME);
6155 g_Language_Set(gLanguage
);
6158 procedure TMainForm
.aDeleteMap(Sender
: TObject
);
6166 OpenDialog
.Filter
:= _lc
[I_FILE_FILTER_WAD
];
6168 if not OpenDialog
.Execute() then
6171 WAD
:= TWADEditor_1
.Create();
6173 if not WAD
.ReadFile(OpenDialog
.FileName
) then
6181 MapList
:= WAD
.GetResourcesList('');
6183 SelectMapForm
.Caption
:= _lc
[I_CAP_REMOVE
];
6184 SelectMapForm
.lbMapList
.Items
.Clear();
6186 if MapList
<> nil then
6187 for a
:= 0 to High(MapList
) do
6188 SelectMapForm
.lbMapList
.Items
.Add(win2utf(MapList
[a
]));
6190 if (SelectMapForm
.ShowModal() = mrOK
) then
6192 str
:= SelectMapForm
.lbMapList
.Items
[SelectMapForm
.lbMapList
.ItemIndex
];
6194 Move(str
[1], MapName
[0], Min(16, Length(str
)));
6196 if MessageBox(0, PChar(Format(_lc
[I_MSG_DELETE_MAP_PROMT
],
6197 [MapName
, OpenDialog
.FileName
])),
6198 PChar(_lc
[I_MSG_DELETE_MAP
]),
6199 MB_ICONQUESTION
or MB_YESNO
or
6200 MB_DEFBUTTON2
) <> mrYes
then
6203 WAD
.RemoveResource('', utf2win(MapName
));
6205 MessageBox(0, PChar(Format(_lc
[I_MSG_MAP_DELETED_PROMT
],
6207 PChar(_lc
[I_MSG_MAP_DELETED
]),
6208 MB_ICONINFORMATION
or MB_OK
or
6211 WAD
.SaveTo(OpenDialog
.FileName
);
6213 // Удалили текущую карту - сохранять по старому ее нельзя:
6214 if OpenedMap
= (OpenDialog
.FileName
+':\'+MapName
) then
6218 MainForm
.Caption
:= FormCaption
;
6225 procedure TMainForm
.vleObjectPropertyKeyDown(Sender
: TObject
;
6226 var Key
: Word; Shift
: TShiftState
);
6228 if Key
= VK_RETURN
then
6229 vleObjectPropertyApply(Sender
);
6232 procedure MovePanel(var ID
: DWORD
; MoveType
: Byte);
6237 if (ID
= 0) and (MoveType
= 0) then
6239 if (ID
= DWORD(High(gPanels
))) and (MoveType
<> 0) then
6241 if (ID
> DWORD(High(gPanels
))) then
6246 if MoveType
= 0 then // to Back
6248 if gTriggers
<> nil then
6249 for a
:= 0 to High(gTriggers
) do
6250 with gTriggers
[a
] do
6252 if TriggerType
= TRIGGER_NONE
then
6255 if TexturePanel
= _id
then
6258 if (TexturePanel
>= 0) and (TexturePanel
< _id
) then
6262 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
6263 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
6264 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
6265 if Data
.PanelID
= _id
then
6268 if (Data
.PanelID
>= 0) and (Data
.PanelID
< _id
) then
6272 if Data
.ShotPanelID
= _id
then
6273 Data
.ShotPanelID
:= 0
6275 if (Data
.ShotPanelID
>= 0) and (Data
.ShotPanelID
< _id
) then
6276 Inc(Data
.ShotPanelID
);
6280 tmp
:= gPanels
[_id
];
6282 for a
:= _id
downto 1 do
6283 gPanels
[a
] := gPanels
[a
-1];
6291 if gTriggers
<> nil then
6292 for a
:= 0 to High(gTriggers
) do
6293 with gTriggers
[a
] do
6295 if TriggerType
= TRIGGER_NONE
then
6298 if TexturePanel
= _id
then
6299 TexturePanel
:= High(gPanels
)
6301 if TexturePanel
> _id
then
6305 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
6306 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
6307 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
6308 if Data
.PanelID
= _id
then
6309 Data
.PanelID
:= High(gPanels
)
6311 if Data
.PanelID
> _id
then
6315 if Data
.ShotPanelID
= _id
then
6316 Data
.ShotPanelID
:= High(gPanels
)
6318 if Data
.ShotPanelID
> _id
then
6319 Dec(Data
.ShotPanelID
);
6323 tmp
:= gPanels
[_id
];
6325 for a
:= _id
to High(gPanels
)-1 do
6326 gPanels
[a
] := gPanels
[a
+1];
6328 gPanels
[High(gPanels
)] := tmp
;
6330 ID
:= High(gPanels
);
6334 procedure TMainForm
.aMoveToBack(Sender
: TObject
);
6338 if SelectedObjects
= nil then
6341 for a
:= 0 to High(SelectedObjects
) do
6342 with SelectedObjects
[a
] do
6343 if Live
and (ObjectType
= OBJECT_PANEL
) then
6345 SelectedObjects
[0] := SelectedObjects
[a
];
6346 SetLength(SelectedObjects
, 1);
6353 procedure TMainForm
.aMoveToFore(Sender
: TObject
);
6357 if SelectedObjects
= nil then
6360 for a
:= 0 to High(SelectedObjects
) do
6361 with SelectedObjects
[a
] do
6362 if Live
and (ObjectType
= OBJECT_PANEL
) then
6364 SelectedObjects
[0] := SelectedObjects
[a
];
6365 SetLength(SelectedObjects
, 1);
6372 procedure TMainForm
.aSaveMapAsExecute(Sender
: TObject
);
6376 SaveDialog
.Filter
:= _lc
[I_FILE_FILTER_WAD
];
6378 if not SaveDialog
.Execute() then
6381 SaveMapForm
.GetMaps(SaveDialog
.FileName
, True);
6383 if SaveMapForm
.ShowModal() <> mrOK
then
6386 SaveDialog
.InitialDir
:= ExtractFileDir(SaveDialog
.FileName
);
6387 OpenedMap
:= SaveDialog
.FileName
+':\'+SaveMapForm
.eMapName
.Text;
6388 OpenedWAD
:= SaveDialog
.FileName
;
6390 idx
:= RecentFiles
.IndexOf(OpenedMap
);
6391 // Такая карта уже недавно открывалась:
6393 RecentFiles
.Delete(idx
);
6394 RecentFiles
.Insert(0, OpenedMap
);
6399 gMapInfo
.FileName
:= SaveDialog
.FileName
;
6400 gMapInfo
.MapName
:= SaveMapForm
.eMapName
.Text;
6401 UpdateCaption(gMapInfo
.Name
, ExtractFileName(gMapInfo
.FileName
), gMapInfo
.MapName
);
6404 procedure TMainForm
.aSelectAllExecute(Sender
: TObject
);
6408 RemoveSelectFromObjects();
6410 case pcObjects
.ActivePageIndex
+1 of
6412 if gPanels
<> nil then
6413 for a
:= 0 to High(gPanels
) do
6414 if gPanels
[a
].PanelType
<> PANEL_NONE
then
6415 SelectObject(OBJECT_PANEL
, a
, True);
6417 if gItems
<> nil then
6418 for a
:= 0 to High(gItems
) do
6419 if gItems
[a
].ItemType
<> ITEM_NONE
then
6420 SelectObject(OBJECT_ITEM
, a
, True);
6422 if gMonsters
<> nil then
6423 for a
:= 0 to High(gMonsters
) do
6424 if gMonsters
[a
].MonsterType
<> MONSTER_NONE
then
6425 SelectObject(OBJECT_MONSTER
, a
, True);
6427 if gAreas
<> nil then
6428 for a
:= 0 to High(gAreas
) do
6429 if gAreas
[a
].AreaType
<> AREA_NONE
then
6430 SelectObject(OBJECT_AREA
, a
, True);
6432 if gTriggers
<> nil then
6433 for a
:= 0 to High(gTriggers
) do
6434 if gTriggers
[a
].TriggerType
<> TRIGGER_NONE
then
6435 SelectObject(OBJECT_TRIGGER
, a
, True);
6438 RecountSelectedObjects();
6441 procedure TMainForm
.tbGridOnClick(Sender
: TObject
);
6443 DotEnable
:= not DotEnable
;
6444 (Sender
as TToolButton
).Down
:= DotEnable
;
6447 procedure TMainForm
.OnIdle(Sender
: TObject
; var Done
: Boolean);
6449 // FIXME: this is a shitty hack
6450 if not gDataLoaded
then
6452 e_WriteLog('Init OpenGL', MSG_NOTIFY
);
6454 e_WriteLog('Loading data', MSG_NOTIFY
);
6455 LoadStdFont('STDTXT', 'STDFONT', gEditorFont
);
6456 e_WriteLog('Loading more data', MSG_NOTIFY
);
6458 e_WriteLog('Loading even more data', MSG_NOTIFY
);
6459 gDataLoaded
:= True;
6460 MainForm
.FormResize(nil);
6465 procedure TMainForm
.miMapPreviewClick(Sender
: TObject
);
6467 if PreviewMode
= 2 then
6470 if PreviewMode
= 0 then
6472 Splitter2
.Visible
:= False;
6473 Splitter1
.Visible
:= False;
6474 StatusBar
.Visible
:= False;
6475 PanelObjs
.Visible
:= False;
6476 PanelProps
.Visible
:= False;
6477 MainToolBar
.Visible
:= False;
6478 sbHorizontal
.Visible
:= False;
6479 sbVertical
.Visible
:= False;
6483 StatusBar
.Visible
:= True;
6484 PanelObjs
.Visible
:= True;
6485 PanelProps
.Visible
:= True;
6486 Splitter2
.Visible
:= True;
6487 Splitter1
.Visible
:= True;
6488 MainToolBar
.Visible
:= True;
6489 sbHorizontal
.Visible
:= True;
6490 sbVertical
.Visible
:= True;
6493 PreviewMode
:= PreviewMode
xor 1;
6494 (Sender
as TMenuItem
).Checked
:= PreviewMode
> 0;
6499 procedure TMainForm
.miLayer1Click(Sender
: TObject
);
6501 SwitchLayer(LAYER_BACK
);
6504 procedure TMainForm
.miLayer2Click(Sender
: TObject
);
6506 SwitchLayer(LAYER_WALLS
);
6509 procedure TMainForm
.miLayer3Click(Sender
: TObject
);
6511 SwitchLayer(LAYER_FOREGROUND
);
6514 procedure TMainForm
.miLayer4Click(Sender
: TObject
);
6516 SwitchLayer(LAYER_STEPS
);
6519 procedure TMainForm
.miLayer5Click(Sender
: TObject
);
6521 SwitchLayer(LAYER_WATER
);
6524 procedure TMainForm
.miLayer6Click(Sender
: TObject
);
6526 SwitchLayer(LAYER_ITEMS
);
6529 procedure TMainForm
.miLayer7Click(Sender
: TObject
);
6531 SwitchLayer(LAYER_MONSTERS
);
6534 procedure TMainForm
.miLayer8Click(Sender
: TObject
);
6536 SwitchLayer(LAYER_AREAS
);
6539 procedure TMainForm
.miLayer9Click(Sender
: TObject
);
6541 SwitchLayer(LAYER_TRIGGERS
);
6544 procedure TMainForm
.tbShowClick(Sender
: TObject
);
6550 for a
:= 0 to High(LayerEnabled
) do
6551 b
:= b
and LayerEnabled
[a
];
6555 ShowLayer(LAYER_BACK
, b
);
6556 ShowLayer(LAYER_WALLS
, b
);
6557 ShowLayer(LAYER_FOREGROUND
, b
);
6558 ShowLayer(LAYER_STEPS
, b
);
6559 ShowLayer(LAYER_WATER
, b
);
6560 ShowLayer(LAYER_ITEMS
, b
);
6561 ShowLayer(LAYER_MONSTERS
, b
);
6562 ShowLayer(LAYER_AREAS
, b
);
6563 ShowLayer(LAYER_TRIGGERS
, b
);
6566 procedure TMainForm
.miMiniMapClick(Sender
: TObject
);
6571 procedure TMainForm
.miSwitchGridClick(Sender
: TObject
);
6573 if DotStep
= DotStepOne
then
6574 DotStep
:= DotStepTwo
6576 DotStep
:= DotStepOne
;
6578 MousePos
.X
:= (MousePos
.X
div DotStep
) * DotStep
;
6579 MousePos
.Y
:= (MousePos
.Y
div DotStep
) * DotStep
;
6582 procedure TMainForm
.miShowEdgesClick(Sender
: TObject
);
6587 procedure TMainForm
.miSnapToGridClick(Sender
: TObject
);
6589 SnapToGrid
:= not SnapToGrid
;
6591 MousePos
.X
:= (MousePos
.X
div DotStep
) * DotStep
;
6592 MousePos
.Y
:= (MousePos
.Y
div DotStep
) * DotStep
;
6594 miSnapToGrid
.Checked
:= SnapToGrid
;
6597 procedure TMainForm
.minexttabClick(Sender
: TObject
);
6599 if pcObjects
.ActivePageIndex
< pcObjects
.PageCount
-1 then
6600 pcObjects
.ActivePageIndex
:= pcObjects
.ActivePageIndex
+1
6602 pcObjects
.ActivePageIndex
:= 0;
6605 procedure TMainForm
.miSaveMiniMapClick(Sender
: TObject
);
6607 SaveMiniMapForm
.ShowModal();
6610 procedure TMainForm
.bClearTextureClick(Sender
: TObject
);
6612 lbTextureList
.ItemIndex
:= -1;
6613 lTextureWidth
.Caption
:= '';
6614 lTextureHeight
.Caption
:= '';
6617 procedure TMainForm
.miPackMapClick(Sender
: TObject
);
6619 PackMapForm
.ShowModal();
6622 procedure TMainForm
.miMapTestSettingsClick(Sender
: TObject
);
6624 MapTestForm
.ShowModal();
6627 procedure TMainForm
.miTestMapClick(Sender
: TObject
);
6629 cmd
, mapWAD
, mapToRun
, tempWAD
: String;
6636 if OpenedMap
<> '' then
6638 // Указываем текущую карту для теста:
6639 g_ProcessResourceStr(OpenedMap
, @mapWAD
, nil, @mapToRun
);
6640 mapToRun
:= mapWAD
+ ':\' + mapToRun
;
6641 mapToRun
:= ExtractRelativePath(ExtractFilePath(TestD2dExe
) + 'maps/', mapToRun
);
6643 // Сохраняем временную карту:
6646 mapWAD
:= ExtractFilePath(TestD2dExe
) + Format('maps/temp%.4d.wad', [time
]);
6648 until not FileExists(mapWAD
);
6649 tempWAD
:= mapWAD
+ ':\' + TEST_MAP_NAME
;
6652 tempWAD
:= ExtractRelativePath(ExtractFilePath(TestD2dExe
) + 'maps/', tempWAD
);
6653 // Если карта не была открыта, указываем временную в качестве текущей:
6654 if mapToRun
= '' then
6655 mapToRun
:= tempWAD
;
6659 if TestOptionsTwoPlayers
then
6661 if TestOptionsTeamDamage
then
6663 if TestOptionsAllowExit
then
6665 if TestOptionsWeaponStay
then
6667 if TestOptionsMonstersDM
then
6670 // Составляем командную строку:
6671 cmd
:= '-map "' + mapToRun
+ '"';
6672 cmd
:= cmd
+ ' -testmap "' + tempWAD
+ '"';
6673 cmd
:= cmd
+ ' -gm ' + TestGameMode
;
6674 cmd
:= cmd
+ ' -limt ' + TestLimTime
;
6675 cmd
:= cmd
+ ' -lims ' + TestLimScore
;
6676 cmd
:= cmd
+ ' -opt ' + IntToStr(opt
);
6679 cmd
:= cmd
+ ' --close';
6681 cmd
:= cmd
+ ' --debug';
6684 proc
:= TProcessUTF8
.Create(nil);
6685 proc
.Executable
:= TestD2dExe
;
6686 proc
.Parameters
.Add(cmd
);
6695 Application
.Minimize();
6698 if (not res
) or (proc
.ExitCode
< 0) then
6700 MessageBox(0, 'FIXME',
6701 PChar(_lc
[I_MSG_EXEC_ERROR
]),
6702 MB_OK
or MB_ICONERROR
);
6706 SysUtils
.DeleteFile(mapWAD
);
6707 Application
.Restore();
6710 procedure TMainForm
.sbVerticalScroll(Sender
: TObject
;
6711 ScrollCode
: TScrollCode
; var ScrollPos
: Integer);
6713 MapOffset
.Y
:= -Normalize16(sbVertical
.Position
);
6716 procedure TMainForm
.sbHorizontalScroll(Sender
: TObject
;
6717 ScrollCode
: TScrollCode
; var ScrollPos
: Integer);
6719 MapOffset
.X
:= -Normalize16(sbHorizontal
.Position
);
6722 procedure TMainForm
.miOpenWadMapClick(Sender
: TObject
);
6724 if OpenedWAD
<> '' then
6726 OpenMap(OpenedWAD
, '');
6730 procedure TMainForm
.selectall1Click(Sender
: TObject
);
6734 RemoveSelectFromObjects();
6736 if gPanels
<> nil then
6737 for a
:= 0 to High(gPanels
) do
6738 if gPanels
[a
].PanelType
<> PANEL_NONE
then
6739 SelectObject(OBJECT_PANEL
, a
, True);
6741 if gItems
<> nil then
6742 for a
:= 0 to High(gItems
) do
6743 if gItems
[a
].ItemType
<> ITEM_NONE
then
6744 SelectObject(OBJECT_ITEM
, a
, True);
6746 if gMonsters
<> nil then
6747 for a
:= 0 to High(gMonsters
) do
6748 if gMonsters
[a
].MonsterType
<> MONSTER_NONE
then
6749 SelectObject(OBJECT_MONSTER
, a
, True);
6751 if gAreas
<> nil then
6752 for a
:= 0 to High(gAreas
) do
6753 if gAreas
[a
].AreaType
<> AREA_NONE
then
6754 SelectObject(OBJECT_AREA
, a
, True);
6756 if gTriggers
<> nil then
6757 for a
:= 0 to High(gTriggers
) do
6758 if gTriggers
[a
].TriggerType
<> TRIGGER_NONE
then
6759 SelectObject(OBJECT_TRIGGER
, a
, True);
6761 RecountSelectedObjects();
6764 procedure TMainForm
.Splitter1CanResize(Sender
: TObject
;
6765 var NewSize
: Integer; var Accept
: Boolean);
6767 Accept
:= (NewSize
> 140);
6770 procedure TMainForm
.Splitter2CanResize(Sender
: TObject
;
6771 var NewSize
: Integer; var Accept
: Boolean);
6773 Accept
:= (NewSize
> 110);
6776 procedure TMainForm
.vleObjectPropertyEnter(Sender
: TObject
);
6778 EditingProperties
:= True;
6781 procedure TMainForm
.vleObjectPropertyExit(Sender
: TObject
);
6783 EditingProperties
:= False;
6786 procedure TMainForm
.FormKeyUp(Sender
: TObject
; var Key
: Word;
6787 Shift
: TShiftState
);
6789 // Объекты передвигались:
6790 if MainForm
.ActiveControl
= RenderPanel
then
6792 if (Key
= VK_NUMPAD4
) or
6793 (Key
= VK_NUMPAD6
) or
6794 (Key
= VK_NUMPAD8
) or
6795 (Key
= VK_NUMPAD5
) or
6796 (Key
= Ord('V')) then
6799 // Быстрое превью карты:
6800 if Key
= Ord('E') then
6802 if PreviewMode
= 2 then
6805 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);