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
;
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
;
447 SelectFlag
: Byte = SELECTFLAG_NONE
;
448 MouseAction
: Byte = MOUSEACTION_NONE
;
449 ResizeType
: Byte = RESIZETYPE_NONE
;
450 ResizeDirection
: Byte = RESIZEDIR_NONE
;
452 DrawPressRect
: Boolean = False;
453 EditingProperties
: Boolean = False;
455 UndoBuffer
: Array of Array of TUndoRec
= nil;
460 //----------------------------------------
461 //Далее идут вспомогательные процедуры
462 //----------------------------------------
464 function NameToBool(Name
: String): Boolean;
466 if Name
= BoolNames
[True] then
472 function NameToDir(Name
: String): TDirection
;
474 if Name
= DirNames
[D_LEFT
] then
480 function NameToDirAdv(Name
: String): Byte;
482 if Name
= DirNamesAdv
[1] then
485 if Name
= DirNamesAdv
[2] then
488 if Name
= DirNamesAdv
[3] then
494 function ActivateToStr(ActivateType
: Byte): String;
498 if ByteBool(ACTIVATE_PLAYERCOLLIDE
and ActivateType
) then
499 Result
:= Result
+ '+PC';
500 if ByteBool(ACTIVATE_MONSTERCOLLIDE
and ActivateType
) then
501 Result
:= Result
+ '+MC';
502 if ByteBool(ACTIVATE_PLAYERPRESS
and ActivateType
) then
503 Result
:= Result
+ '+PP';
504 if ByteBool(ACTIVATE_MONSTERPRESS
and ActivateType
) then
505 Result
:= Result
+ '+MP';
506 if ByteBool(ACTIVATE_SHOT
and ActivateType
) then
507 Result
:= Result
+ '+SH';
508 if ByteBool(ACTIVATE_NOMONSTER
and ActivateType
) then
509 Result
:= Result
+ '+NM';
511 if (Result
<> '') and (Result
[1] = '+') then
512 Delete(Result
, 1, 1);
515 function StrToActivate(Str
: String): Byte;
519 if Pos('PC', Str
) > 0 then
520 Result
:= ACTIVATE_PLAYERCOLLIDE
;
521 if Pos('MC', Str
) > 0 then
522 Result
:= Result
or ACTIVATE_MONSTERCOLLIDE
;
523 if Pos('PP', Str
) > 0 then
524 Result
:= Result
or ACTIVATE_PLAYERPRESS
;
525 if Pos('MP', Str
) > 0 then
526 Result
:= Result
or ACTIVATE_MONSTERPRESS
;
527 if Pos('SH', Str
) > 0 then
528 Result
:= Result
or ACTIVATE_SHOT
;
529 if Pos('NM', Str
) > 0 then
530 Result
:= Result
or ACTIVATE_NOMONSTER
;
533 function KeyToStr(Key
: Byte): String;
537 if ByteBool(KEY_RED
and Key
) then
538 Result
:= Result
+ '+RK';
539 if ByteBool(KEY_GREEN
and Key
) then
540 Result
:= Result
+ '+GK';
541 if ByteBool(KEY_BLUE
and Key
) then
542 Result
:= Result
+ '+BK';
543 if ByteBool(KEY_REDTEAM
and Key
) then
544 Result
:= Result
+ '+RT';
545 if ByteBool(KEY_BLUETEAM
and Key
) then
546 Result
:= Result
+ '+BT';
548 if (Result
<> '') and (Result
[1] = '+') then
549 Delete(Result
, 1, 1);
552 function StrToKey(Str
: String): Byte;
556 if Pos('RK', Str
) > 0 then
558 if Pos('GK', Str
) > 0 then
559 Result
:= Result
or KEY_GREEN
;
560 if Pos('BK', Str
) > 0 then
561 Result
:= Result
or KEY_BLUE
;
562 if Pos('RT', Str
) > 0 then
563 Result
:= Result
or KEY_REDTEAM
;
564 if Pos('BT', Str
) > 0 then
565 Result
:= Result
or KEY_BLUETEAM
;
568 function EffectToStr(Effect
: Byte): String;
570 if Effect
in [EFFECT_TELEPORT
..EFFECT_FIRE
] then
571 Result
:= EffectNames
[Effect
]
573 Result
:= EffectNames
[EFFECT_NONE
];
576 function StrToEffect(Str
: String): Byte;
580 Result
:= EFFECT_NONE
;
581 for i
:= EFFECT_TELEPORT
to EFFECT_FIRE
do
582 if EffectNames
[i
] = Str
then
589 function MonsterToStr(MonType
: Byte): String;
591 if MonType
in [MONSTER_DEMON
..MONSTER_MAN
] then
592 Result
:= MonsterNames
[MonType
]
594 Result
:= MonsterNames
[MONSTER_ZOMBY
];
597 function StrToMonster(Str
: String): Byte;
601 Result
:= MONSTER_ZOMBY
;
602 for i
:= MONSTER_DEMON
to MONSTER_MAN
do
603 if MonsterNames
[i
] = Str
then
610 function ItemToStr(ItemType
: Byte): String;
612 if ItemType
in [ITEM_MEDKIT_SMALL
..ITEM_MAX
] then
613 Result
:= ItemNames
[ItemType
]
615 Result
:= ItemNames
[ITEM_AMMO_BULLETS
];
618 function StrToItem(Str
: String): Byte;
622 Result
:= ITEM_AMMO_BULLETS
;
623 for i
:= ITEM_MEDKIT_SMALL
to ITEM_MAX
do
624 if ItemNames
[i
] = Str
then
631 function ShotToStr(ShotType
: Byte): String;
633 if ShotType
in [TRIGGER_SHOT_PISTOL
..TRIGGER_SHOT_MAX
] then
634 Result
:= ShotNames
[ShotType
]
636 Result
:= ShotNames
[TRIGGER_SHOT_PISTOL
];
639 function StrToShot(Str
: String): Byte;
643 Result
:= TRIGGER_SHOT_PISTOL
;
644 for i
:= TRIGGER_SHOT_PISTOL
to TRIGGER_SHOT_MAX
do
645 if ShotNames
[i
] = Str
then
652 function SelectedObjectCount(): Word;
658 if SelectedObjects
= nil then
661 for a
:= 0 to High(SelectedObjects
) do
662 if SelectedObjects
[a
].Live
then
663 Result
:= Result
+ 1;
666 function GetFirstSelected(): Integer;
672 if SelectedObjects
= nil then
675 for a
:= 0 to High(SelectedObjects
) do
676 if SelectedObjects
[a
].Live
then
683 function Normalize16(x
: Integer): Integer;
685 Result
:= (x
div 16) * 16;
688 procedure MoveMap(X
, Y
: Integer);
690 rx
, ry
, ScaleSz
: Integer;
692 with MainForm
.RenderPanel
do
694 ScaleSz
:= 16 div Scale
;
695 // Размер видимой части карты:
696 rx
:= min(Normalize16(Width
), Normalize16(gMapInfo
.Width
)) div 2;
697 ry
:= min(Normalize16(Height
), Normalize16(gMapInfo
.Height
)) div 2;
698 // Место клика на мини-карте:
699 MapOffset
.X
:= X
- (Width
-max(gMapInfo
.Width
div ScaleSz
, 1)-1);
700 MapOffset
.Y
:= Y
- 1;
701 // Это же место на "большой" карте:
702 MapOffset
.X
:= MapOffset
.X
* ScaleSz
;
703 MapOffset
.Y
:= MapOffset
.Y
* ScaleSz
;
704 // Левый верхний угол новой видимой части карты:
705 MapOffset
.X
:= MapOffset
.X
- rx
;
706 MapOffset
.Y
:= MapOffset
.Y
- ry
;
708 if MapOffset
.X
< 0 then
710 if MapOffset
.Y
< 0 then
712 if MapOffset
.X
> MainForm
.sbHorizontal
.Max
then
713 MapOffset
.X
:= MainForm
.sbHorizontal
.Max
;
714 if MapOffset
.Y
> MainForm
.sbVertical
.Max
then
715 MapOffset
.Y
:= MainForm
.sbVertical
.Max
;
717 MapOffset
.X
:= Normalize16(MapOffset
.X
);
718 MapOffset
.Y
:= Normalize16(MapOffset
.Y
);
721 MainForm
.sbHorizontal
.Position
:= MapOffset
.X
;
722 MainForm
.sbVertical
.Position
:= MapOffset
.Y
;
724 MapOffset
.X
:= -MapOffset
.X
;
725 MapOffset
.Y
:= -MapOffset
.Y
;
730 function IsTexturedPanel(PanelType
: Word): Boolean;
732 Result
:= WordBool(PanelType
and (PANEL_WALL
or PANEL_BACK
or PANEL_FORE
or
733 PANEL_STEP
or PANEL_OPENDOOR
or PANEL_CLOSEDOOR
or
734 PANEL_WATER
or PANEL_ACID1
or PANEL_ACID2
));
737 procedure FillProperty();
742 MainForm
.vleObjectProperty
.Strings
.Clear();
743 MainForm
.RecountSelectedObjects();
745 // Отображаем свойства если выделен только один объект:
746 if SelectedObjectCount() <> 1 then
749 _id
:= GetFirstSelected();
750 if not SelectedObjects
[_id
].Live
then
753 with MainForm
.vleObjectProperty
do
754 with ItemProps
[InsertRow(_lc
[I_PROP_ID
], IntToStr(SelectedObjects
[_id
].ID
), True)] do
756 EditStyle
:= esSimple
;
760 case SelectedObjects
[0].ObjectType
of
763 with MainForm
.vleObjectProperty
,
764 gPanels
[SelectedObjects
[_id
].ID
] do
766 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
768 EditStyle
:= esSimple
;
772 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
774 EditStyle
:= esSimple
;
778 with ItemProps
[InsertRow(_lc
[I_PROP_WIDTH
], IntToStr(Width
), True)] do
780 EditStyle
:= esSimple
;
784 with ItemProps
[InsertRow(_lc
[I_PROP_HEIGHT
], IntToStr(Height
), True)] do
786 EditStyle
:= esSimple
;
790 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_TYPE
], GetPanelName(PanelType
), True)] do
792 EditStyle
:= esEllipsis
;
796 if IsTexturedPanel(PanelType
) then
797 begin // Может быть текстура
798 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_TEX
], TextureName
, True)] do
800 EditStyle
:= esEllipsis
;
804 if TextureName
<> '' then
805 begin // Есть текстура
806 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_ALPHA
], IntToStr(Alpha
), True)] do
808 EditStyle
:= esSimple
;
812 with ItemProps
[InsertRow(_lc
[I_PROP_PANEL_BLEND
], BoolNames
[Blending
], True)] do
814 EditStyle
:= esPickList
;
824 with MainForm
.vleObjectProperty
,
825 gItems
[SelectedObjects
[_id
].ID
] do
827 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
829 EditStyle
:= esSimple
;
833 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
835 EditStyle
:= esSimple
;
839 with ItemProps
[InsertRow(_lc
[I_PROP_DM_ONLY
], BoolNames
[OnlyDM
], True)] do
841 EditStyle
:= esPickList
;
845 with ItemProps
[InsertRow(_lc
[I_PROP_ITEM_FALLS
], BoolNames
[Fall
], True)] do
847 EditStyle
:= esPickList
;
855 with MainForm
.vleObjectProperty
,
856 gMonsters
[SelectedObjects
[_id
].ID
] do
858 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
860 EditStyle
:= esSimple
;
864 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
866 EditStyle
:= esSimple
;
870 with ItemProps
[InsertRow(_lc
[I_PROP_DIRECTION
], DirNames
[Direction
], True)] do
872 EditStyle
:= esPickList
;
880 with MainForm
.vleObjectProperty
,
881 gAreas
[SelectedObjects
[_id
].ID
] do
883 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
885 EditStyle
:= esSimple
;
889 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
891 EditStyle
:= esSimple
;
895 with ItemProps
[InsertRow(_lc
[I_PROP_DIRECTION
], DirNames
[Direction
], True)] do
897 EditStyle
:= esPickList
;
905 with MainForm
.vleObjectProperty
,
906 gTriggers
[SelectedObjects
[_id
].ID
] do
908 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TYPE
], GetTriggerName(TriggerType
), True)] do
910 EditStyle
:= esSimple
;
914 with ItemProps
[InsertRow(_lc
[I_PROP_X
], IntToStr(X
), True)] do
916 EditStyle
:= esSimple
;
920 with ItemProps
[InsertRow(_lc
[I_PROP_Y
], IntToStr(Y
), True)] do
922 EditStyle
:= esSimple
;
926 with ItemProps
[InsertRow(_lc
[I_PROP_WIDTH
], IntToStr(Width
), True)] do
928 EditStyle
:= esSimple
;
932 with ItemProps
[InsertRow(_lc
[I_PROP_HEIGHT
], IntToStr(Height
), True)] do
934 EditStyle
:= esSimple
;
938 with ItemProps
[InsertRow(_lc
[I_PROP_TR_ENABLED
], BoolNames
[Enabled
], True)] do
940 EditStyle
:= esPickList
;
944 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TEXTURE_PANEL
], IntToStr(TexturePanel
), True)] do
946 EditStyle
:= esEllipsis
;
950 with ItemProps
[InsertRow(_lc
[I_PROP_TR_ACTIVATION
], ActivateToStr(ActivateType
), True)] do
952 EditStyle
:= esEllipsis
;
956 with ItemProps
[InsertRow(_lc
[I_PROP_TR_KEYS
], KeyToStr(Key
), True)] do
958 EditStyle
:= esEllipsis
;
965 str
:= win2utf(Data
.MapName
);
966 with ItemProps
[InsertRow(_lc
[I_PROP_TR_NEXT_MAP
], str
, True)] do
968 EditStyle
:= esEllipsis
;
975 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TELEPORT_TO
], Format('(%d:%d)', [Data
.TargetPoint
.X
, Data
.TargetPoint
.Y
]), True)] do
977 EditStyle
:= esEllipsis
;
981 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_teleport
], True)] do
983 EditStyle
:= esPickList
;
987 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TELEPORT_SILENT
], BoolNames
[Data
.silent_teleport
], True)] do
989 EditStyle
:= esPickList
;
993 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TELEPORT_DIR
], DirNamesAdv
[Data
.TlpDir
], True)] do
995 EditStyle
:= esPickList
;
1000 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
,
1001 TRIGGER_DOOR
, TRIGGER_DOOR5
:
1003 with ItemProps
[InsertRow(_lc
[I_PROP_TR_DOOR_PANEL
], IntToStr(Data
.PanelID
), True)] do
1005 EditStyle
:= esEllipsis
;
1009 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.NoSound
], True)] do
1011 EditStyle
:= esPickList
;
1015 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_doors
], True)] do
1017 EditStyle
:= esPickList
;
1022 TRIGGER_CLOSETRAP
, TRIGGER_TRAP
:
1024 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TRAP_PANEL
], IntToStr(Data
.PanelID
), True)] do
1026 EditStyle
:= esEllipsis
;
1030 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.NoSound
], True)] do
1032 EditStyle
:= esPickList
;
1036 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_doors
], True)] do
1038 EditStyle
:= esPickList
;
1043 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
,
1046 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_AREA
],
1047 Format('(%d:%d %d:%d)', [Data
.tX
, Data
.tY
, Data
.tWidth
, Data
.tHeight
]), True)] do
1049 EditStyle
:= esEllipsis
;
1053 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_DELAY
], IntToStr(Data
.Wait
), True)] do
1055 EditStyle
:= esSimple
;
1059 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_COUNT
], IntToStr(Data
.Count
), True)] do
1061 EditStyle
:= esSimple
;
1065 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_MONSTER
], IntToStr(Data
.MonsterID
-1), True)] do
1067 EditStyle
:= esEllipsis
;
1071 if TriggerType
= TRIGGER_PRESS
then
1072 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_RANDOM
], BoolNames
[Data
.ExtRandom
], True)] do
1074 EditStyle
:= esPickList
;
1082 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
1084 with ItemProps
[InsertRow(_lc
[I_PROP_TR_LIFT_PANEL
], IntToStr(Data
.PanelID
), True)] do
1086 EditStyle
:= esEllipsis
;
1090 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.NoSound
], True)] do
1092 EditStyle
:= esPickList
;
1096 with ItemProps
[InsertRow(_lc
[I_PROP_TR_D2D
], BoolNames
[Data
.d2d_doors
], True)] do
1098 EditStyle
:= esPickList
;
1105 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TEXTURE_ONCE
], BoolNames
[Data
.ActivateOnce
], True)] do
1107 EditStyle
:= esPickList
;
1111 with ItemProps
[InsertRow(_lc
[I_PROP_TR_TEXTURE_ANIM_ONCE
], BoolNames
[Data
.AnimOnce
], True)] do
1113 EditStyle
:= esPickList
;
1120 str
:= win2utf(Data
.SoundName
);
1121 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_NAME
], str
, True)] do
1123 EditStyle
:= esEllipsis
;
1127 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_VOLUME
], IntToStr(Data
.Volume
), True)] do
1129 EditStyle
:= esSimple
;
1133 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_PAN
], IntToStr(Data
.Pan
), True)] do
1135 EditStyle
:= esSimple
;
1139 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_COUNT
], IntToStr(Data
.PlayCount
), True)] do
1141 EditStyle
:= esSimple
;
1145 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_LOCAL
], BoolNames
[Data
.Local
], True)] do
1147 EditStyle
:= esPickList
;
1151 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SOUND_SWITCH
], BoolNames
[Data
.SoundSwitch
], True)] do
1153 EditStyle
:= esPickList
;
1158 TRIGGER_SPAWNMONSTER
:
1160 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MONSTER_TYPE
], MonsterToStr(Data
.MonType
), True)] do
1162 EditStyle
:= esEllipsis
;
1166 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_TO
],
1167 Format('(%d:%d)', [Data
.MonPos
.X
, Data
.MonPos
.Y
]), True)] do
1169 EditStyle
:= esEllipsis
;
1173 with ItemProps
[InsertRow(_lc
[I_PROP_DIRECTION
], DirNames
[TDirection(Data
.MonDir
)], True)] do
1175 EditStyle
:= esPickList
;
1179 with ItemProps
[InsertRow(_lc
[I_PROP_TR_HEALTH
], IntToStr(Data
.MonHealth
), True)] do
1181 EditStyle
:= esSimple
;
1185 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MONSTER_ACTIVE
], BoolNames
[Data
.MonActive
], True)] do
1187 EditStyle
:= esPickList
;
1191 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.MonCount
), True)] do
1193 EditStyle
:= esSimple
;
1197 with ItemProps
[InsertRow(_lc
[I_PROP_TR_FX_TYPE
], EffectToStr(Data
.MonEffect
), True)] do
1199 EditStyle
:= esEllipsis
;
1203 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_MAX
], IntToStr(Data
.MonMax
), True)] do
1205 EditStyle
:= esSimple
;
1209 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_DELAY
], IntToStr(Data
.MonDelay
), True)] do
1211 EditStyle
:= esSimple
;
1215 case Data
.MonBehav
of
1216 1: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_1
];
1217 2: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_2
];
1218 3: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_3
];
1219 4: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_4
];
1220 5: str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_5
];
1221 else str
:= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_0
];
1223 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
], str
, True)] do
1225 EditStyle
:= esPickList
;
1232 with ItemProps
[InsertRow(_lc
[I_PROP_TR_ITEM_TYPE
], ItemToStr(Data
.ItemType
), True)] do
1234 EditStyle
:= esEllipsis
;
1238 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_TO
],
1239 Format('(%d:%d)', [Data
.ItemPos
.X
, Data
.ItemPos
.Y
]), True)] do
1241 EditStyle
:= esEllipsis
;
1245 with ItemProps
[InsertRow(_lc
[I_PROP_DM_ONLY
], BoolNames
[Data
.ItemOnlyDM
], True)] do
1247 EditStyle
:= esPickList
;
1251 with ItemProps
[InsertRow(_lc
[I_PROP_ITEM_FALLS
], BoolNames
[Data
.ItemFalls
], True)] do
1253 EditStyle
:= esPickList
;
1257 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.ItemCount
), True)] do
1259 EditStyle
:= esSimple
;
1263 with ItemProps
[InsertRow(_lc
[I_PROP_TR_FX_TYPE
], EffectToStr(Data
.ItemEffect
), True)] do
1265 EditStyle
:= esEllipsis
;
1269 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_MAX
], IntToStr(Data
.ItemMax
), True)] do
1271 EditStyle
:= esSimple
;
1275 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_DELAY
], IntToStr(Data
.ItemDelay
), True)] do
1277 EditStyle
:= esSimple
;
1284 str
:= win2utf(Data
.MusicName
);
1285 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MUSIC_NAME
], str
, True)] do
1287 EditStyle
:= esEllipsis
;
1291 if Data
.MusicAction
= 1 then
1292 str
:= _lc
[I_PROP_TR_MUSIC_ON
]
1294 str
:= _lc
[I_PROP_TR_MUSIC_OFF
];
1296 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MUSIC_ACT
], str
, True)] do
1298 EditStyle
:= esPickList
;
1305 with ItemProps
[InsertRow(_lc
[I_PROP_TR_PUSH_ANGLE
], IntToStr(Data
.PushAngle
), True)] do
1307 EditStyle
:= esSimple
;
1310 with ItemProps
[InsertRow(_lc
[I_PROP_TR_PUSH_FORCE
], IntToStr(Data
.PushForce
), True)] do
1312 EditStyle
:= esSimple
;
1315 with ItemProps
[InsertRow(_lc
[I_PROP_TR_PUSH_RESET
], BoolNames
[Data
.ResetVel
], True)] do
1317 EditStyle
:= esPickList
;
1324 case Data
.ScoreAction
of
1325 1: str
:= _lc
[I_PROP_TR_SCORE_ACT_1
];
1326 2: str
:= _lc
[I_PROP_TR_SCORE_ACT_2
];
1327 3: str
:= _lc
[I_PROP_TR_SCORE_ACT_3
];
1328 else str
:= _lc
[I_PROP_TR_SCORE_ACT_0
];
1330 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_ACT
], str
, True)] do
1332 EditStyle
:= esPickList
;
1335 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.ScoreCount
), True)] do
1337 EditStyle
:= esSimple
;
1340 case Data
.ScoreTeam
of
1341 1: str
:= _lc
[I_PROP_TR_SCORE_TEAM_1
];
1342 2: str
:= _lc
[I_PROP_TR_SCORE_TEAM_2
];
1343 3: str
:= _lc
[I_PROP_TR_SCORE_TEAM_3
];
1344 else str
:= _lc
[I_PROP_TR_SCORE_TEAM_0
];
1346 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_TEAM
], str
, True)] do
1348 EditStyle
:= esPickList
;
1351 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_CON
], BoolNames
[Data
.ScoreCon
], True)] do
1353 EditStyle
:= esPickList
;
1356 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SCORE_MSG
], BoolNames
[Data
.ScoreMsg
], True)] do
1358 EditStyle
:= esPickList
;
1365 case Data
.MessageKind
of
1366 1: str
:= _lc
[I_PROP_TR_MESSAGE_KIND_1
];
1367 else str
:= _lc
[I_PROP_TR_MESSAGE_KIND_0
];
1369 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_KIND
], str
, True)] do
1371 EditStyle
:= esPickList
;
1374 case Data
.MessageSendTo
of
1375 1: str
:= _lc
[I_PROP_TR_MESSAGE_TO_1
];
1376 2: str
:= _lc
[I_PROP_TR_MESSAGE_TO_2
];
1377 3: str
:= _lc
[I_PROP_TR_MESSAGE_TO_3
];
1378 4: str
:= _lc
[I_PROP_TR_MESSAGE_TO_4
];
1379 5: str
:= _lc
[I_PROP_TR_MESSAGE_TO_5
];
1380 else str
:= _lc
[I_PROP_TR_MESSAGE_TO_0
];
1382 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_TO
], str
, True)] do
1384 EditStyle
:= esPickList
;
1387 str
:= win2utf(Data
.MessageText
);
1388 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_TEXT
], str
, True)] do
1390 EditStyle
:= esSimple
;
1393 with ItemProps
[InsertRow(_lc
[I_PROP_TR_MESSAGE_TIME
], IntToStr(Data
.MessageTime
), True)] do
1395 EditStyle
:= esSimple
;
1402 with ItemProps
[InsertRow(_lc
[I_PROP_TR_DAMAGE_VALUE
], IntToStr(Data
.DamageValue
), True)] do
1404 EditStyle
:= esSimple
;
1407 with ItemProps
[InsertRow(_lc
[I_PROP_TR_INTERVAL
], IntToStr(Data
.DamageInterval
), True)] do
1409 EditStyle
:= esSimple
;
1416 with ItemProps
[InsertRow(_lc
[I_PROP_TR_HEALTH
], IntToStr(Data
.HealValue
), True)] do
1418 EditStyle
:= esSimple
;
1421 with ItemProps
[InsertRow(_lc
[I_PROP_TR_INTERVAL
], IntToStr(Data
.HealInterval
), True)] do
1423 EditStyle
:= esSimple
;
1426 with ItemProps
[InsertRow(_lc
[I_PROP_TR_HEALTH_MAX
], BoolNames
[Data
.HealMax
], True)] do
1428 EditStyle
:= esPickList
;
1431 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SILENT
], BoolNames
[Data
.HealSilent
], True)] do
1433 EditStyle
:= esPickList
;
1440 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_TYPE
], ShotToStr(Data
.ShotType
), True)] do
1442 EditStyle
:= esEllipsis
;
1446 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_SOUND
], BoolNames
[Data
.ShotSound
], True)] do
1448 EditStyle
:= esPickList
;
1452 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_PANEL
], IntToStr(Data
.ShotPanelID
), True)] do
1454 EditStyle
:= esEllipsis
;
1458 case Data
.ShotTarget
of
1459 1: str
:= _lc
[I_PROP_TR_SHOT_TO_1
];
1460 2: str
:= _lc
[I_PROP_TR_SHOT_TO_2
];
1461 3: str
:= _lc
[I_PROP_TR_SHOT_TO_3
];
1462 4: str
:= _lc
[I_PROP_TR_SHOT_TO_4
];
1463 5: str
:= _lc
[I_PROP_TR_SHOT_TO_5
];
1464 6: str
:= _lc
[I_PROP_TR_SHOT_TO_6
];
1465 else str
:= _lc
[I_PROP_TR_SHOT_TO_0
];
1467 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_TO
], str
, True)] do
1469 EditStyle
:= esPickList
;
1473 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_SIGHT
], IntToStr(Data
.ShotIntSight
), True)] do
1475 EditStyle
:= esSimple
;
1479 case Data
.ShotAim
of
1480 1: str
:= _lc
[I_PROP_TR_SHOT_AIM_1
];
1481 2: str
:= _lc
[I_PROP_TR_SHOT_AIM_2
];
1482 3: str
:= _lc
[I_PROP_TR_SHOT_AIM_3
];
1483 else str
:= _lc
[I_PROP_TR_SHOT_AIM_0
];
1485 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_AIM
], str
, True)-1] do
1487 EditStyle
:= esPickList
;
1491 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SPAWN_TO
],
1492 Format('(%d:%d)', [Data
.ShotPos
.X
, Data
.ShotPos
.Y
]), True)] do
1494 EditStyle
:= esEllipsis
;
1498 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_ANGLE
], IntToStr(Data
.ShotAngle
), True)] do
1500 EditStyle
:= esSimple
;
1504 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_DELAY
], IntToStr(Data
.ShotWait
), True)] do
1506 EditStyle
:= esSimple
;
1510 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_ACC
], IntToStr(Data
.ShotAccuracy
), True)] do
1512 EditStyle
:= esSimple
;
1516 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_AMMO
], IntToStr(Data
.ShotAmmo
), True)] do
1518 EditStyle
:= esSimple
;
1522 with ItemProps
[InsertRow(_lc
[I_PROP_TR_SHOT_RELOAD
], IntToStr(Data
.ShotIntReload
), True)] do
1524 EditStyle
:= esSimple
;
1531 with ItemProps
[InsertRow(_lc
[I_PROP_TR_COUNT
], IntToStr(Data
.FXCount
), True)] do
1533 EditStyle
:= esSimple
;
1537 if Data
.FXType
= 0 then
1538 str
:= _lc
[I_PROP_TR_EFFECT_PARTICLE
]
1540 str
:= _lc
[I_PROP_TR_EFFECT_ANIMATION
];
1541 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_TYPE
], str
, True)] do
1543 EditStyle
:= esEllipsis
;
1548 if Data
.FXType
= 0 then
1549 case Data
.FXSubType
of
1550 TRIGGER_EFFECT_SLIQUID
:
1551 str
:= _lc
[I_PROP_TR_EFFECT_SLIQUID
];
1552 TRIGGER_EFFECT_LLIQUID
:
1553 str
:= _lc
[I_PROP_TR_EFFECT_LLIQUID
];
1554 TRIGGER_EFFECT_DLIQUID
:
1555 str
:= _lc
[I_PROP_TR_EFFECT_DLIQUID
];
1556 TRIGGER_EFFECT_BLOOD
:
1557 str
:= _lc
[I_PROP_TR_EFFECT_BLOOD
];
1558 TRIGGER_EFFECT_SPARK
:
1559 str
:= _lc
[I_PROP_TR_EFFECT_SPARK
];
1560 TRIGGER_EFFECT_BUBBLE
:
1561 str
:= _lc
[I_PROP_TR_EFFECT_BUBBLE
];
1563 if Data
.FXType
= 1 then
1565 if (Data
.FXSubType
= 0) or (Data
.FXSubType
> EFFECT_FIRE
) then
1566 Data
.FXSubType
:= EFFECT_TELEPORT
;
1567 str
:= EffectToStr(Data
.FXSubType
);
1569 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SUBTYPE
], str
, True)] do
1571 EditStyle
:= esEllipsis
;
1575 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_COLOR
], IntToStr(Data
.FXColorR
or (Data
.FXColorG
shl 8) or (Data
.FXColorB
shl 16)), True)] do
1577 EditStyle
:= esEllipsis
;
1581 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_CENTER
], BoolNames
[Data
.FXPos
= 0], True)] do
1583 EditStyle
:= esPickList
;
1587 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EX_DELAY
], IntToStr(Data
.FXWait
), True)] do
1589 EditStyle
:= esSimple
;
1593 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_VELX
], IntToStr(Data
.FXVelX
), True)] do
1595 EditStyle
:= esSimple
;
1599 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_VELY
], IntToStr(Data
.FXVelY
), True)] do
1601 EditStyle
:= esSimple
;
1605 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPL
], IntToStr(Data
.FXSpreadL
), True)] do
1607 EditStyle
:= esSimple
;
1611 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPR
], IntToStr(Data
.FXSpreadR
), True)] do
1613 EditStyle
:= esSimple
;
1617 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPU
], IntToStr(Data
.FXSpreadU
), True)] do
1619 EditStyle
:= esSimple
;
1623 with ItemProps
[InsertRow(_lc
[I_PROP_TR_EFFECT_SPD
], IntToStr(Data
.FXSpreadD
), True)] do
1625 EditStyle
:= esSimple
;
1629 end; //case TriggerType
1631 end; // OBJECT_TRIGGER:
1635 procedure ChangeShownProperty(Name
: String; NewValue
: String);
1639 if SelectedObjectCount() <> 1 then
1641 if not SelectedObjects
[GetFirstSelected()].Live
then
1644 // Есть ли такой ключ:
1645 if MainForm
.vleObjectProperty
.FindRow(Name
, row
) then
1647 MainForm
.vleObjectProperty
.Values
[Name
] := NewValue
;
1651 procedure SelectObject(fObjectType
: Byte; fID
: DWORD
; Multi
: Boolean);
1660 // Уже выделен - убираем:
1661 if SelectedObjects
<> nil then
1662 for a
:= 0 to High(SelectedObjects
) do
1663 with SelectedObjects
[a
] do
1664 if Live
and (ID
= fID
) and
1665 (ObjectType
= fObjectType
) then
1674 SetLength(SelectedObjects
, Length(SelectedObjects
)+1);
1676 with SelectedObjects
[High(SelectedObjects
)] do
1678 ObjectType
:= fObjectType
;
1685 SetLength(SelectedObjects
, 1);
1687 with SelectedObjects
[0] do
1689 ObjectType
:= fObjectType
;
1695 MainForm
.miCopy
.Enabled
:= True;
1696 MainForm
.miCut
.Enabled
:= True;
1698 if fObjectType
= OBJECT_PANEL
then
1700 MainForm
.miToFore
.Enabled
:= True;
1701 MainForm
.miToBack
.Enabled
:= True;
1705 procedure RemoveSelectFromObjects();
1707 SelectedObjects
:= nil;
1708 DrawPressRect
:= False;
1709 MouseLDown
:= False;
1710 MouseRDown
:= False;
1711 MouseAction
:= MOUSEACTION_NONE
;
1712 SelectFlag
:= SELECTFLAG_NONE
;
1713 ResizeType
:= RESIZETYPE_NONE
;
1714 ResizeDirection
:= RESIZEDIR_NONE
;
1716 MainForm
.vleObjectProperty
.Strings
.Clear();
1718 MainForm
.miCopy
.Enabled
:= False;
1719 MainForm
.miCut
.Enabled
:= False;
1720 MainForm
.miToFore
.Enabled
:= False;
1721 MainForm
.miToBack
.Enabled
:= False;
1724 procedure DeleteSelectedObjects();
1729 if SelectedObjects
= nil then
1735 for a
:= 0 to High(SelectedObjects
) do
1736 with SelectedObjects
[a
] do
1741 SetLength(UndoBuffer
, Length(UndoBuffer
)+1);
1742 i
:= High(UndoBuffer
);
1746 SetLength(UndoBuffer
[i
], Length(UndoBuffer
[i
])+1);
1747 ii
:= High(UndoBuffer
[i
]);
1752 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_PANEL
;
1753 New(UndoBuffer
[i
, ii
].Panel
);
1754 UndoBuffer
[i
, ii
].Panel
^ := gPanels
[ID
];
1758 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_ITEM
;
1759 UndoBuffer
[i
, ii
].Item
:= gItems
[ID
];
1763 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_AREA
;
1764 UndoBuffer
[i
, ii
].Area
:= gAreas
[ID
];
1768 UndoBuffer
[i
, ii
].UndoType
:= UNDO_DELETE_TRIGGER
;
1769 UndoBuffer
[i
, ii
].Trigger
:= gTriggers
[ID
];
1773 RemoveObject(ID
, ObjectType
);
1776 RemoveSelectFromObjects();
1778 MainForm
.miUndo
.Enabled
:= UndoBuffer
<> nil;
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
);
2630 wad
:= TWADEditor_1
.Create
;
2631 if wad
.ReadFile(EditorDir
+'data/Game.wad') then
2632 wad
.GetResource('FONTS', cfgres
, cfgdata
, cfglen
);
2637 if not g_CreateTextureWAD('FONT_STD', EditorDir
+'data/Game.wad:FONTS\'+texture
) then
2638 e_WriteLog('ERROR ERROR ERROR', MSG_WARNING
);
2640 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
2641 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
2642 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
2643 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
2645 if g_GetTexture('FONT_STD', ID
) then
2646 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
-2);
2651 e_WriteLog('Could not load FONT_STD', MSG_WARNING
);
2653 if cfglen
<> 0 then FreeMem(cfgdata
);
2656 procedure TMainForm
.FormCreate(Sender
: TObject
);
2664 EditorDir
:= ExtractFilePath(Application
.ExeName
);
2666 e_InitLog(EditorDir
+'Editor.log', WM_NEWFILE
);
2668 slInvalidTextures
:= TStringList
.Create
;
2670 ShowLayer(LAYER_BACK
, True);
2671 ShowLayer(LAYER_WALLS
, True);
2672 ShowLayer(LAYER_FOREGROUND
, True);
2673 ShowLayer(LAYER_STEPS
, True);
2674 ShowLayer(LAYER_WATER
, True);
2675 ShowLayer(LAYER_ITEMS
, True);
2676 ShowLayer(LAYER_MONSTERS
, True);
2677 ShowLayer(LAYER_AREAS
, True);
2678 ShowLayer(LAYER_TRIGGERS
, True);
2682 FormCaption
:= MainForm
.Caption
;
2686 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
2688 if config
.ReadInt('Editor', 'XPos', -1) = -1 then
2689 Position
:= poDesktopCenter
2691 Left
:= config
.ReadInt('Editor', 'XPos', Left
);
2692 Top
:= config
.ReadInt('Editor', 'YPos', Top
);
2693 Width
:= config
.ReadInt('Editor', 'Width', Width
);
2694 Height
:= config
.ReadInt('Editor', 'Height', Height
);
2696 if config
.ReadBool('Editor', 'Maximize', False) then
2697 WindowState
:= wsMaximized
;
2698 ShowMap
:= config
.ReadBool('Editor', 'Minimap', False);
2699 PanelProps
.Width
:= config
.ReadInt('Editor', 'PanelProps', PanelProps
.ClientWidth
);
2700 Splitter1
.Left
:= PanelProps
.Left
;
2701 PanelObjs
.Height
:= config
.ReadInt('Editor', 'PanelObjs', PanelObjs
.ClientHeight
);
2702 Splitter2
.Top
:= PanelObjs
.Top
;
2703 StatusBar
.Top
:= PanelObjs
.BoundsRect
.Bottom
;
2704 DotEnable
:= config
.ReadBool('Editor', 'DotEnable', True);
2705 DotColor
:= config
.ReadInt('Editor', 'DotColor', $FFFFFF);
2706 DotStepOne
:= config
.ReadInt('Editor', 'DotStepOne', 16);
2707 DotStepTwo
:= config
.ReadInt('Editor', 'DotStepTwo', 8);
2708 DotStep
:= config
.ReadInt('Editor', 'DotStep', DotStepOne
);
2709 DrawTexturePanel
:= config
.ReadBool('Editor', 'DrawTexturePanel', True);
2710 DrawPanelSize
:= config
.ReadBool('Editor', 'DrawPanelSize', True);
2711 BackColor
:= config
.ReadInt('Editor', 'BackColor', $7F6040);
2712 PreviewColor
:= config
.ReadInt('Editor', 'PreviewColor', $00FF00);
2713 UseCheckerboard
:= config
.ReadBool('Editor', 'UseCheckerboard', True);
2714 gColorEdge
:= config
.ReadInt('Editor', 'EdgeColor', COLOR_EDGE
);
2715 gAlphaEdge
:= config
.ReadInt('Editor', 'EdgeAlpha', ALPHA_EDGE
);
2716 if gAlphaEdge
= 255 then
2717 gAlphaEdge
:= ALPHA_EDGE
;
2718 drEdge
[0] := GetRValue(gColorEdge
);
2719 drEdge
[1] := GetGValue(gColorEdge
);
2720 drEdge
[2] := GetBValue(gColorEdge
);
2721 if not config
.ReadBool('Editor', 'EdgeShow', True) then
2724 drEdge
[3] := gAlphaEdge
;
2725 gAlphaTriggerLine
:= config
.ReadInt('Editor', 'LineAlpha', ALPHA_LINE
);
2726 if gAlphaTriggerLine
= 255 then
2727 gAlphaTriggerLine
:= ALPHA_LINE
;
2728 gAlphaTriggerArea
:= config
.ReadInt('Editor', 'TriggerAlpha', ALPHA_AREA
);
2729 if gAlphaTriggerArea
= 255 then
2730 gAlphaTriggerArea
:= ALPHA_AREA
;
2731 gAlphaMonsterRect
:= config
.ReadInt('Editor', 'MonsterRectAlpha', 0);
2732 gAlphaAreaRect
:= config
.ReadInt('Editor', 'AreaRectAlpha', 0);
2733 if config
.ReadInt('Editor', 'Scale', 0) = 1 then
2737 if config
.ReadInt('Editor', 'DotSize', 0) = 1 then
2741 OpenDialog
.InitialDir
:= config
.ReadStr('Editor', 'LastOpenDir', EditorDir
);
2742 SaveDialog
.InitialDir
:= config
.ReadStr('Editor', 'LastSaveDir', EditorDir
);
2744 s
:= config
.ReadStr('Editor', 'Language', '');
2747 RecentCount
:= config
.ReadInt('Editor', 'RecentCount', 5);
2748 if RecentCount
> 10 then
2750 if RecentCount
< 2 then
2753 RecentFiles
:= TStringList
.Create();
2754 for i
:= 0 to RecentCount
-1 do
2756 s
:= config
.ReadStr('RecentFiles', IntToStr(i
+1), '');
2760 RefreshRecentMenu();
2764 tbShowMap
.Down
:= ShowMap
;
2765 tbGridOn
.Down
:= DotEnable
;
2766 pcObjects
.ActivePageIndex
:= 0;
2767 Application
.Title
:= _lc
[I_EDITOR_TITLE
];
2769 Application
.OnIdle
:= OnIdle
;
2772 procedure PrintBlack(X
, Y
: Integer; Text: string; FontID
: DWORD
);
2774 // NOTE: all the font printing routines assume CP1251
2775 e_TextureFontPrintEx(X
, Y
, Text, FontID
, 0, 0, 0, 1.0);
2778 procedure TMainForm
.Draw();
2783 Width
, Height
: Word;
2786 aX
, aY
, aX2
, aY2
, XX
, ScaleSz
: Integer;
2795 e_Clear(GL_COLOR_BUFFER_BIT
,
2796 GetRValue(BackColor
)/255,
2797 GetGValue(BackColor
)/255,
2798 GetBValue(BackColor
)/255);
2802 ObjCount
:= SelectedObjectCount();
2804 // Обводим выделенные объекты красной рамкой:
2805 if ObjCount
> 0 then
2807 for a
:= 0 to High(SelectedObjects
) do
2808 if SelectedObjects
[a
].Live
then
2810 Rect
:= ObjectGetRect(SelectedObjects
[a
].ObjectType
, SelectedObjects
[a
].ID
);
2814 e_DrawQuad(X
+MapOffset
.X
, Y
+MapOffset
.Y
,
2815 X
+MapOffset
.X
+Width
-1, Y
+MapOffset
.Y
+Height
-1,
2818 // Рисуем точки изменения размеров:
2819 if (ObjCount
= 1) and
2820 (SelectedObjects
[GetFirstSelected
].ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
]) then
2822 e_DrawPoint(5, X
+MapOffset
.X
, Y
+MapOffset
.Y
+(Height
div 2), 255, 255, 255);
2823 e_DrawPoint(5, X
+MapOffset
.X
+Width
-1, Y
+MapOffset
.Y
+(Height
div 2), 255, 255, 255);
2824 e_DrawPoint(5, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
, 255, 255, 255);
2825 e_DrawPoint(5, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
+Height
-1, 255, 255, 255);
2827 e_DrawPoint(3, X
+MapOffset
.X
, Y
+MapOffset
.Y
+(Height
div 2), 255, 0, 0);
2828 e_DrawPoint(3, X
+MapOffset
.X
+Width
-1, Y
+MapOffset
.Y
+(Height
div 2), 255, 0, 0);
2829 e_DrawPoint(3, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
, 255, 0, 0);
2830 e_DrawPoint(3, X
+MapOffset
.X
+(Width
div 2), Y
+MapOffset
.Y
+Height
-1, 255, 0, 0);
2837 if DotEnable
and (PreviewMode
= 0) then
2844 for x
:= 0 to (RenderPanel
.Width
div DotStep
) do
2845 for y
:= 0 to (RenderPanel
.Height
div DotStep
) do
2846 e_DrawPoint(DotSize
, x
*DotStep
+ a
, y
*DotStep
+ a
,
2847 GetRValue(DotColor
),
2848 GetGValue(DotColor
),
2849 GetBValue(DotColor
));
2853 if (lbTextureList
.ItemIndex
<> -1) and (cbPreview
.Checked
) and
2854 (not IsSpecialTextureSel()) and (PreviewMode
= 0) then
2856 if not g_GetTexture(SelectedTexture(), ID
) then
2857 g_GetTexture('NOTEXTURE', ID
);
2858 g_GetTextureSizeByID(ID
, Width
, Height
);
2859 if UseCheckerboard
then
2861 if g_GetTexture('PREVIEW', PID
) then
2862 e_DrawFill(PID
, RenderPanel
.Width
-Width
, RenderPanel
.Height
-Height
, Width
div 16 + 1, Height
div 16 + 1, 0, True, False);
2864 e_DrawFillQuad(RenderPanel
.Width
-Width
-2, RenderPanel
.Height
-Height
-2,
2865 RenderPanel
.Width
-1, RenderPanel
.Height
-1,
2866 GetRValue(PreviewColor
), GetGValue(PreviewColor
), GetBValue(PreviewColor
), 0);
2867 e_Draw(ID
, RenderPanel
.Width
-Width
, RenderPanel
.Height
-Height
, 0, True, False);
2870 // Подсказка при выборе точки Телепорта:
2871 if SelectFlag
= SELECTFLAG_TELEPORT
then
2873 with gTriggers
[SelectedObjects
[GetFirstSelected()].ID
] do
2874 if Data
.d2d_teleport
then
2875 e_DrawLine(2, MousePos
.X
-16, MousePos
.Y
-1,
2876 MousePos
.X
+16, MousePos
.Y
-1,
2879 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+AreaSize
[AREA_DMPOINT
].Width
-1,
2880 MousePos
.Y
+AreaSize
[AREA_DMPOINT
].Height
-1, 255, 255, 255);
2882 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2883 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2884 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_TELEPORT
], gEditorFont
);
2887 // Подсказка при выборе точки появления:
2888 if SelectFlag
= SELECTFLAG_SPAWNPOINT
then
2890 e_DrawLine(2, MousePos
.X
-16, MousePos
.Y
-1,
2891 MousePos
.X
+16, MousePos
.Y
-1,
2893 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2894 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2895 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_SPAWN
], gEditorFont
);
2898 // Подсказка при выборе панели двери:
2899 if SelectFlag
= SELECTFLAG_DOOR
then
2901 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2902 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2903 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_DOOR
], gEditorFont
);
2906 // Подсказка при выборе панели с текстурой:
2907 if SelectFlag
= SELECTFLAG_TEXTURE
then
2909 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+196, MousePos
.Y
+18, 192, 192, 192, 127);
2910 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+196, MousePos
.Y
+18, 255, 255, 255);
2911 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_TEXTURE
], gEditorFont
);
2914 // Подсказка при выборе панели индикации выстрела:
2915 if SelectFlag
= SELECTFLAG_SHOTPANEL
then
2917 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+316, MousePos
.Y
+18, 192, 192, 192, 127);
2918 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+316, MousePos
.Y
+18, 255, 255, 255);
2919 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_SHOT
], gEditorFont
);
2922 // Подсказка при выборе панели лифта:
2923 if SelectFlag
= SELECTFLAG_LIFT
then
2925 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 192, 192, 192, 127);
2926 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+180, MousePos
.Y
+18, 255, 255, 255);
2927 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_PANEL_LIFT
], gEditorFont
);
2930 // Подсказка при выборе монстра:
2931 if SelectFlag
= SELECTFLAG_MONSTER
then
2933 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+120, MousePos
.Y
+18, 192, 192, 192, 127);
2934 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+120, MousePos
.Y
+18, 255, 255, 255);
2935 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_MONSTER
], gEditorFont
);
2938 // Подсказка при выборе области воздействия:
2939 if DrawPressRect
then
2941 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+204, MousePos
.Y
+18, 192, 192, 192, 127);
2942 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+204, MousePos
.Y
+18, 255, 255, 255);
2943 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, _glc
[I_HINT_EXT_AREA
], gEditorFont
);
2946 // Рисуем текстуры, если чертим панель:
2947 if (MouseAction
= MOUSEACTION_DRAWPANEL
) and (DrawTexturePanel
) and
2948 (lbTextureList
.ItemIndex
<> -1) and (DrawRect
<> nil) and
2949 (lbPanelType
.ItemIndex
in [0..8]) and not IsSpecialTextureSel() then
2951 if not g_GetTexture(SelectedTexture(), ID
) then
2952 g_GetTexture('NOTEXTURE', ID
);
2953 g_GetTextureSizeByID(ID
, Width
, Height
);
2955 if (Abs(Right
-Left
) >= Width
) and (Abs(Bottom
-Top
) >= Height
) then
2956 e_DrawFill(ID
, Min(Left
, Right
), Min(Top
, Bottom
), Abs(Right
-Left
) div Width
,
2957 Abs(Bottom
-Top
) div Height
, 64, True, False);
2960 // Прямоугольник выделения:
2961 if DrawRect
<> nil then
2963 e_DrawQuad(Left
, Top
, Right
-1, Bottom
-1, 255, 255, 255);
2965 // Чертим мышью панель/триггер или меняем мышью их размер:
2966 if (((MouseAction
in [MOUSEACTION_DRAWPANEL
, MOUSEACTION_DRAWTRIGGER
]) and
2967 not(ssCtrl
in GetKeyShiftState())) or (MouseAction
= MOUSEACTION_RESIZE
)) and
2968 (DrawPanelSize
) then
2970 e_DrawFillQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+88, MousePos
.Y
+33, 192, 192, 192, 127);
2971 e_DrawQuad(MousePos
.X
, MousePos
.Y
, MousePos
.X
+88, MousePos
.Y
+33, 255, 255, 255);
2973 if MouseAction
in [MOUSEACTION_DRAWPANEL
, MOUSEACTION_DRAWTRIGGER
] then
2974 begin // Чертим новый
2975 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, Format(_glc
[I_HINT_WIDTH
],
2976 [Abs(MousePos
.X
-MouseLDownPos
.X
)]), gEditorFont
);
2977 PrintBlack(MousePos
.X
+2, MousePos
.Y
+16, Format(_glc
[I_HINT_HEIGHT
],
2978 [Abs(MousePos
.Y
-MouseLDownPos
.Y
)]), gEditorFont
);
2980 else // Растягиваем существующий
2981 if SelectedObjects
[GetFirstSelected
].ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
] then
2983 if SelectedObjects
[GetFirstSelected
].ObjectType
= OBJECT_PANEL
then
2985 Width
:= gPanels
[SelectedObjects
[GetFirstSelected
].ID
].Width
;
2986 Height
:= gPanels
[SelectedObjects
[GetFirstSelected
].ID
].Height
;
2990 Width
:= gTriggers
[SelectedObjects
[GetFirstSelected
].ID
].Width
;
2991 Height
:= gTriggers
[SelectedObjects
[GetFirstSelected
].ID
].Height
;
2994 PrintBlack(MousePos
.X
+2, MousePos
.Y
+2, Format(_glc
[I_HINT_WIDTH
], [Width
]),
2996 PrintBlack(MousePos
.X
+2, MousePos
.Y
+16, Format(_glc
[I_HINT_HEIGHT
], [Height
]),
3001 // Ближайшая к курсору мыши точка на сетке:
3002 e_DrawPoint(3, MousePos
.X
, MousePos
.Y
, 0, 0, 255);
3007 // Сколько пикселов карты в 1 пикселе мини-карты:
3008 ScaleSz
:= 16 div Scale
;
3009 // Размеры мини-карты:
3010 aX
:= max(gMapInfo
.Width
div ScaleSz
, 1);
3011 aY
:= max(gMapInfo
.Height
div ScaleSz
, 1);
3012 // X-координата на RenderPanel нулевой x-координаты карты:
3013 XX
:= RenderPanel
.Width
- aX
- 1;
3015 e_DrawFillQuad(XX
-1, 0, RenderPanel
.Width
-1, aY
+1, 0, 0, 0, 0);
3016 e_DrawQuad(XX
-1, 0, RenderPanel
.Width
-1, aY
+1, 197, 197, 197);
3018 if gPanels
<> nil then
3021 for a
:= 0 to High(gPanels
) do
3023 if PanelType
<> 0 then
3025 // Левый верхний угол:
3026 aX
:= XX
+ (X
div ScaleSz
);
3027 aY
:= 1 + (Y
div ScaleSz
);
3029 aX2
:= max(Width
div ScaleSz
, 1);
3030 aY2
:= max(Height
div ScaleSz
, 1);
3031 // Правый нижний угол:
3032 aX2
:= aX
+ aX2
- 1;
3033 aY2
:= aY
+ aY2
- 1;
3036 PANEL_WALL
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 208, 208, 208, 0);
3037 PANEL_WATER
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 0, 0, 192, 0);
3038 PANEL_ACID1
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 0, 176, 0, 0);
3039 PANEL_ACID2
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 176, 0, 0, 0);
3040 PANEL_STEP
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 128, 128, 128, 0);
3041 PANEL_LIFTUP
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 116, 72, 36, 0);
3042 PANEL_LIFTDOWN
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 116, 124, 96, 0);
3043 PANEL_LIFTLEFT
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 200, 80, 4, 0);
3044 PANEL_LIFTRIGHT
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 252, 140, 56, 0);
3045 PANEL_OPENDOOR
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 100, 220, 92, 0);
3046 PANEL_CLOSEDOOR
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 212, 184, 64, 0);
3047 PANEL_BLOCKMON
: e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 192, 0, 192, 0);
3051 // Рисуем красным выделенные панели:
3052 if SelectedObjects
<> nil then
3053 for b
:= 0 to High(SelectedObjects
) do
3054 with SelectedObjects
[b
] do
3055 if Live
and (ObjectType
= OBJECT_PANEL
) then
3056 with gPanels
[SelectedObjects
[b
].ID
] do
3057 if PanelType
and not(PANEL_BACK
or PANEL_FORE
) <> 0 then
3059 // Левый верхний угол:
3060 aX
:= XX
+ (X
div ScaleSz
);
3061 aY
:= 1 + (Y
div ScaleSz
);
3063 aX2
:= max(Width
div ScaleSz
, 1);
3064 aY2
:= max(Height
div ScaleSz
, 1);
3065 // Правый нижний угол:
3066 aX2
:= aX
+ aX2
- 1;
3067 aY2
:= aY
+ aY2
- 1;
3069 e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 255, 0, 0, 0)
3073 if (gMapInfo
.Width
> RenderPanel
.Width
) or
3074 (gMapInfo
.Height
> RenderPanel
.Height
) then
3076 // Окно, показывающее текущее положение экрана на карте:
3078 x
:= max(min(RenderPanel
.Width
, gMapInfo
.Width
) div ScaleSz
, 1);
3079 y
:= max(min(RenderPanel
.Height
, gMapInfo
.Height
) div ScaleSz
, 1);
3080 // Левый верхний угол:
3081 aX
:= XX
+ ((-MapOffset
.X
) div ScaleSz
);
3082 aY
:= 1 + ((-MapOffset
.Y
) div ScaleSz
);
3083 // Правый нижний угол:
3087 e_DrawFillQuad(aX
, aY
, aX2
, aY2
, 127, 192, 127, 127, B_BLEND
);
3088 e_DrawQuad(aX
, aY
, aX2
, aY2
, 255, 0, 0);
3093 RenderPanel
.SwapBuffers();
3096 procedure TMainForm
.FormResize(Sender
: TObject
);
3098 e_SetViewPort(0, 0, RenderPanel
.Width
, RenderPanel
.Height
);
3100 if gMapInfo
.Width
>= RenderPanel
.Width
then
3101 sbHorizontal
.Max
:= Normalize16(gMapInfo
.Width
-RenderPanel
.Width
+16)
3103 sbHorizontal
.Max
:= 0;
3105 if gMapInfo
.Height
>= RenderPanel
.Height
then
3106 sbVertical
.Max
:= Normalize16(gMapInfo
.Height
-RenderPanel
.Height
+16)
3108 sbVertical
.Max
:= 0;
3110 MapOffset
.X
:= -Normalize16(sbHorizontal
.Position
);
3111 MapOffset
.Y
:= -Normalize16(sbVertical
.Position
);
3114 procedure SelectNextObject(X
, Y
: Integer; ObjectType
: Byte; ID
: DWORD
);
3119 j_max
:= 0; // shut up compiler
3123 res
:= (gPanels
<> nil) and
3124 PanelInShownLayer(gPanels
[ID
].PanelType
) and
3125 g_CollidePoint(X
, Y
, gPanels
[ID
].X
, gPanels
[ID
].Y
,
3127 gPanels
[ID
].Height
);
3128 j_max
:= Length(gPanels
) - 1;
3133 res
:= (gItems
<> nil) and
3134 LayerEnabled
[LAYER_ITEMS
] and
3135 g_CollidePoint(X
, Y
, gItems
[ID
].X
, gItems
[ID
].Y
,
3136 ItemSize
[gItems
[ID
].ItemType
][0],
3137 ItemSize
[gItems
[ID
].ItemType
][1]);
3138 j_max
:= Length(gItems
) - 1;
3143 res
:= (gMonsters
<> nil) and
3144 LayerEnabled
[LAYER_MONSTERS
] and
3145 g_CollidePoint(X
, Y
, gMonsters
[ID
].X
, gMonsters
[ID
].Y
,
3146 MonsterSize
[gMonsters
[ID
].MonsterType
].Width
,
3147 MonsterSize
[gMonsters
[ID
].MonsterType
].Height
);
3148 j_max
:= Length(gMonsters
) - 1;
3153 res
:= (gAreas
<> nil) and
3154 LayerEnabled
[LAYER_AREAS
] and
3155 g_CollidePoint(X
, Y
, gAreas
[ID
].X
, gAreas
[ID
].Y
,
3156 AreaSize
[gAreas
[ID
].AreaType
].Width
,
3157 AreaSize
[gAreas
[ID
].AreaType
].Height
);
3158 j_max
:= Length(gAreas
) - 1;
3163 res
:= (gTriggers
<> nil) and
3164 LayerEnabled
[LAYER_TRIGGERS
] and
3165 g_CollidePoint(X
, Y
, gTriggers
[ID
].X
, gTriggers
[ID
].Y
,
3166 gTriggers
[ID
].Width
,
3167 gTriggers
[ID
].Height
);
3168 j_max
:= Length(gTriggers
) - 1;
3178 // Перебор ID: от ID-1 до 0; потом от High до ID+1:
3187 if j
= Integer(ID
) then
3192 res
:= PanelInShownLayer(gPanels
[j
].PanelType
) and
3193 g_CollidePoint(X
, Y
, gPanels
[j
].X
, gPanels
[j
].Y
,
3197 res
:= (gItems
[j
].ItemType
<> ITEM_NONE
) and
3198 g_CollidePoint(X
, Y
, gItems
[j
].X
, gItems
[j
].Y
,
3199 ItemSize
[gItems
[j
].ItemType
][0],
3200 ItemSize
[gItems
[j
].ItemType
][1]);
3202 res
:= (gMonsters
[j
].MonsterType
<> MONSTER_NONE
) and
3203 g_CollidePoint(X
, Y
, gMonsters
[j
].X
, gMonsters
[j
].Y
,
3204 MonsterSize
[gMonsters
[j
].MonsterType
].Width
,
3205 MonsterSize
[gMonsters
[j
].MonsterType
].Height
);
3207 res
:= (gAreas
[j
].AreaType
<> AREA_NONE
) and
3208 g_CollidePoint(X
, Y
, gAreas
[j
].X
, gAreas
[j
].Y
,
3209 AreaSize
[gAreas
[j
].AreaType
].Width
,
3210 AreaSize
[gAreas
[j
].AreaType
].Height
);
3212 res
:= (gTriggers
[j
].TriggerType
<> TRIGGER_NONE
) and
3213 g_CollidePoint(X
, Y
, gTriggers
[j
].X
, gTriggers
[j
].Y
,
3215 gTriggers
[j
].Height
);
3222 SetLength(SelectedObjects
, 1);
3224 SelectedObjects
[0].ObjectType
:= ObjectType
;
3225 SelectedObjects
[0].ID
:= j
;
3226 SelectedObjects
[0].Live
:= True;
3234 procedure TMainForm
.RenderPanelMouseDown(Sender
: TObject
;
3235 Button
: TMouseButton
; Shift
: TShiftState
; X
, Y
: Integer);
3239 c1
, c2
, c3
, c4
: Boolean;
3245 MainForm
.ActiveControl
:= RenderPanel
;
3246 RenderPanel
.SetFocus();
3248 RenderPanelMouseMove(RenderPanel
, Shift
, X
, Y
);
3250 if Button
= mbLeft
then // Left Mouse Button
3252 // Двигаем карту с помощью мыши и мини-карты:
3254 g_CollidePoint(X
, Y
,
3255 RenderPanel
.Width
-max(gMapInfo
.Width
div (16 div Scale
), 1)-1,
3257 max(gMapInfo
.Width
div (16 div Scale
), 1),
3258 max(gMapInfo
.Height
div (16 div Scale
), 1) ) then
3261 MouseAction
:= MOUSEACTION_MOVEMAP
;
3263 else // Ставим предмет/монстра/область:
3264 if (pcObjects
.ActivePageIndex
in [1, 2, 3]) and
3265 (not (ssShift
in Shift
)) then
3267 case pcObjects
.ActivePageIndex
of
3269 if lbItemList
.ItemIndex
= -1 then
3270 ErrorMessageBox(_lc
[I_MSG_CHOOSE_ITEM
])
3273 item
.ItemType
:= lbItemList
.ItemIndex
+ ITEM_MEDKIT_SMALL
;
3274 if item
.ItemType
>= ITEM_WEAPON_KASTET
then
3275 item
.ItemType
:= item
.ItemType
+ 2;
3276 item
.X
:= MousePos
.X
-MapOffset
.X
;
3277 item
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3279 if not (ssCtrl
in Shift
) then
3281 item
.X
:= item
.X
- (ItemSize
[item
.ItemType
][0] div 2);
3282 item
.Y
:= item
.Y
- ItemSize
[item
.ItemType
][1];
3285 item
.OnlyDM
:= cbOnlyDM
.Checked
;
3286 item
.Fall
:= cbFall
.Checked
;
3287 Undo_Add(OBJECT_ITEM
, AddItem(item
));
3290 if lbMonsterList
.ItemIndex
= -1 then
3291 ErrorMessageBox(_lc
[I_MSG_CHOOSE_MONSTER
])
3294 monster
.MonsterType
:= lbMonsterList
.ItemIndex
+ MONSTER_DEMON
;
3295 monster
.X
:= MousePos
.X
-MapOffset
.X
;
3296 monster
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3298 if not (ssCtrl
in Shift
) then
3300 monster
.X
:= monster
.X
- (MonsterSize
[monster
.MonsterType
].Width
div 2);
3301 monster
.Y
:= monster
.Y
- MonsterSize
[monster
.MonsterType
].Height
;
3304 if rbMonsterLeft
.Checked
then
3305 monster
.Direction
:= D_LEFT
3307 monster
.Direction
:= D_RIGHT
;
3308 Undo_Add(OBJECT_MONSTER
, AddMonster(monster
));
3311 if lbAreasList
.ItemIndex
= -1 then
3312 ErrorMessageBox(_lc
[I_MSG_CHOOSE_AREA
])
3314 if (lbAreasList
.ItemIndex
+ 1) <> AREA_DOMFLAG
then
3316 area
.AreaType
:= lbAreasList
.ItemIndex
+ AREA_PLAYERPOINT1
;
3317 area
.X
:= MousePos
.X
-MapOffset
.X
;
3318 area
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3320 if not (ssCtrl
in Shift
) then
3322 area
.X
:= area
.X
- (AreaSize
[area
.AreaType
].Width
div 2);
3323 area
.Y
:= area
.Y
- AreaSize
[area
.AreaType
].Height
;
3326 if rbAreaLeft
.Checked
then
3327 area
.Direction
:= D_LEFT
3329 area
.Direction
:= D_RIGHT
;
3330 Undo_Add(OBJECT_AREA
, AddArea(area
));
3336 i
:= GetFirstSelected();
3338 // Выбираем объект под текущим:
3339 if (SelectedObjects
<> nil) and
3340 (ssShift
in Shift
) and (i
>= 0) and
3341 (SelectedObjects
[i
].Live
) then
3343 if SelectedObjectCount() = 1 then
3344 SelectNextObject(X
-MapOffset
.X
, Y
-MapOffset
.Y
,
3345 SelectedObjects
[i
].ObjectType
,
3346 SelectedObjects
[i
].ID
);
3350 // Рисуем область триггера "Расширитель":
3351 if DrawPressRect
and (i
>= 0) and
3352 (SelectedObjects
[i
].ObjectType
= OBJECT_TRIGGER
) and
3353 (gTriggers
[SelectedObjects
[i
].ID
].TriggerType
in
3354 [TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
]) then
3355 MouseAction
:= MOUSEACTION_DRAWPRESS
3356 else // Рисуем панель:
3357 if pcObjects
.ActivePageIndex
= 0 then
3359 if (lbPanelType
.ItemIndex
>= 0) then
3360 MouseAction
:= MOUSEACTION_DRAWPANEL
3362 else // Рисуем триггер:
3363 if (lbTriggersList
.ItemIndex
>= 0) then
3365 MouseAction
:= MOUSEACTION_DRAWTRIGGER
;
3369 end; // if Button = mbLeft
3371 if Button
= mbRight
then // Right Mouse Button
3373 // Клик по мини-карте:
3375 g_CollidePoint(X
, Y
,
3376 RenderPanel
.Width
-max(gMapInfo
.Width
div (16 div Scale
), 1)-1,
3378 max(gMapInfo
.Width
div (16 div Scale
), 1),
3379 max(gMapInfo
.Height
div (16 div Scale
), 1) ) then
3381 MouseAction
:= MOUSEACTION_NOACTION
;
3383 else // Нужно что-то выбрать мышью:
3384 if SelectFlag
<> SELECTFLAG_NONE
then
3387 SELECTFLAG_TELEPORT
:
3388 // Точку назначения телепортации:
3389 with gTriggers
[SelectedObjects
[
3390 GetFirstSelected() ].ID
].Data
.TargetPoint
do
3392 X
:= MousePos
.X
-MapOffset
.X
;
3393 Y
:= MousePos
.Y
-MapOffset
.Y
;
3396 SELECTFLAG_SPAWNPOINT
:
3397 // Точку создания монстра:
3398 with gTriggers
[SelectedObjects
[GetFirstSelected()].ID
] do
3399 if TriggerType
= TRIGGER_SPAWNMONSTER
then
3401 Data
.MonPos
.X
:= MousePos
.X
-MapOffset
.X
;
3402 Data
.MonPos
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3404 else if TriggerType
= TRIGGER_SPAWNITEM
then
3405 begin // Точка создания предмета:
3406 Data
.ItemPos
.X
:= MousePos
.X
-MapOffset
.X
;
3407 Data
.ItemPos
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3409 else if TriggerType
= TRIGGER_SHOT
then
3410 begin // Точка создания выстрела:
3411 Data
.ShotPos
.X
:= MousePos
.X
-MapOffset
.X
;
3412 Data
.ShotPos
.Y
:= MousePos
.Y
-MapOffset
.Y
;
3418 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3420 2, 2, OBJECT_PANEL
, True);
3421 if IDArray
<> nil then
3423 for i
:= 0 to High(IDArray
) do
3424 if (gPanels
[IDArray
[i
]].PanelType
= PANEL_OPENDOOR
) or
3425 (gPanels
[IDArray
[i
]].PanelType
= PANEL_CLOSEDOOR
) then
3427 gTriggers
[SelectedObjects
[
3428 GetFirstSelected() ].ID
].Data
.PanelID
:= IDArray
[i
];
3433 gTriggers
[SelectedObjects
[
3434 GetFirstSelected() ].ID
].Data
.PanelID
:= -1;
3438 // Панель с текстурой:
3440 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3442 2, 2, OBJECT_PANEL
, True);
3443 if IDArray
<> nil then
3445 for i
:= 0 to High(IDArray
) do
3446 if ((gPanels
[IDArray
[i
]].PanelType
in
3447 [PANEL_WALL
, PANEL_BACK
, PANEL_FORE
,
3448 PANEL_WATER
, PANEL_ACID1
, PANEL_ACID2
,
3450 (gPanels
[IDArray
[i
]].PanelType
= PANEL_OPENDOOR
) or
3451 (gPanels
[IDArray
[i
]].PanelType
= PANEL_CLOSEDOOR
)) and
3452 (gPanels
[IDArray
[i
]].TextureName
<> '') then
3454 gTriggers
[SelectedObjects
[
3455 GetFirstSelected() ].ID
].TexturePanel
:= IDArray
[i
];
3460 gTriggers
[SelectedObjects
[
3461 GetFirstSelected() ].ID
].TexturePanel
:= -1;
3467 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3469 2, 2, OBJECT_PANEL
, True);
3470 if IDArray
<> nil then
3472 for i
:= 0 to High(IDArray
) do
3473 if (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTUP
) or
3474 (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTDOWN
) or
3475 (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTLEFT
) or
3476 (gPanels
[IDArray
[i
]].PanelType
= PANEL_LIFTRIGHT
) then
3478 gTriggers
[SelectedObjects
[
3479 GetFirstSelected() ].ID
].Data
.PanelID
:= IDArray
[i
];
3484 gTriggers
[SelectedObjects
[
3485 GetFirstSelected() ].ID
].Data
.PanelID
:= -1;
3491 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3493 2, 2, OBJECT_MONSTER
, False);
3494 if IDArray
<> nil then
3495 gTriggers
[SelectedObjects
[
3496 GetFirstSelected() ].ID
].Data
.MonsterID
:= IDArray
[0]+1
3498 gTriggers
[SelectedObjects
[
3499 GetFirstSelected() ].ID
].Data
.MonsterID
:= 0;
3502 SELECTFLAG_SHOTPANEL
:
3503 // Панель индикации выстрела:
3505 if gTriggers
[SelectedObjects
[
3506 GetFirstSelected() ].ID
].TriggerType
= TRIGGER_SHOT
then
3508 IDArray
:= ObjectInRect(X
-MapOffset
.X
,
3510 2, 2, OBJECT_PANEL
, True);
3511 if IDArray
<> nil then
3513 for i
:= 0 to High(IDArray
) do
3514 if ((gPanels
[IDArray
[i
]].PanelType
in
3515 [PANEL_WALL
, PANEL_BACK
, PANEL_FORE
,
3516 PANEL_WATER
, PANEL_ACID1
, PANEL_ACID2
,
3518 (gPanels
[IDArray
[i
]].PanelType
= PANEL_OPENDOOR
) or
3519 (gPanels
[IDArray
[i
]].PanelType
= PANEL_CLOSEDOOR
)) and
3520 (gPanels
[IDArray
[i
]].TextureName
<> '') then
3522 gTriggers
[SelectedObjects
[
3523 GetFirstSelected() ].ID
].Data
.ShotPanelID
:= IDArray
[i
];
3528 gTriggers
[SelectedObjects
[
3529 GetFirstSelected() ].ID
].Data
.ShotPanelID
:= -1;
3534 SelectFlag
:= SELECTFLAG_SELECTED
;
3536 else // if SelectFlag <> SELECTFLAG_NONE...
3538 // Что уже выбрано и не нажат Ctrl:
3539 if (SelectedObjects
<> nil) and
3540 (not (ssCtrl
in Shift
)) then
3541 for i
:= 0 to High(SelectedObjects
) do
3542 with SelectedObjects
[i
] do
3545 if (ObjectType
in [OBJECT_PANEL
, OBJECT_TRIGGER
]) and
3546 (SelectedObjectCount() = 1) then
3548 Rect
:= ObjectGetRect(ObjectType
, ID
);
3550 c1
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3551 Rect
.X
-2, Rect
.Y
+(Rect
.Height
div 2)-2, 4, 4);
3552 c2
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3553 Rect
.X
+Rect
.Width
-3, Rect
.Y
+(Rect
.Height
div 2)-2, 4, 4);
3554 c3
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3555 Rect
.X
+(Rect
.Width
div 2)-2, Rect
.Y
-2, 4, 4);
3556 c4
:= g_Collide(X
-MapOffset
.X
-1, Y
-MapOffset
.Y
-1, 2, 2,
3557 Rect
.X
+(Rect
.Width
div 2)-2, Rect
.Y
+Rect
.Height
-3, 4, 4);
3559 // Меняем размер панели или триггера:
3560 if c1
or c2
or c3
or c4
then
3562 MouseAction
:= MOUSEACTION_RESIZE
;
3563 LastMovePoint
:= MousePos
;
3567 ResizeType
:= RESIZETYPE_HORIZONTAL
;
3569 ResizeDirection
:= RESIZEDIR_LEFT
3571 ResizeDirection
:= RESIZEDIR_RIGHT
;
3572 RenderPanel
.Cursor
:= crSizeWE
;
3576 ResizeType
:= RESIZETYPE_VERTICAL
;
3578 ResizeDirection
:= RESIZEDIR_UP
3580 ResizeDirection
:= RESIZEDIR_DOWN
;
3581 RenderPanel
.Cursor
:= crSizeNS
;
3588 // Перемещаем панель или триггер:
3589 if ObjectCollide(ObjectType
, ID
,
3591 Y
-MapOffset
.Y
-1, 2, 2) then
3593 MouseAction
:= MOUSEACTION_MOVEOBJ
;
3594 LastMovePoint
:= MousePos
;
3600 end; // if Button = mbRight
3602 MouseRDown
:= Button
= mbRight
;
3604 MouseRDownPos
:= MousePos
;
3606 MouseLDown
:= Button
= mbLeft
;
3608 MouseLDownPos
:= MousePos
;
3611 procedure TMainForm
.RenderPanelMouseUp(Sender
: TObject
;
3612 Button
: TMouseButton
; Shift
: TShiftState
; X
, Y
: Integer);
3617 rSelectRect
: Boolean;
3618 wWidth
, wHeight
: Word;
3621 procedure SelectObjects(ObjectType
: Byte);
3626 IDArray
:= ObjectInRect(rRect
.X
, rRect
.Y
,
3627 rRect
.Width
, rRect
.Height
,
3628 ObjectType
, rSelectRect
);
3630 if IDArray
<> nil then
3631 for i
:= 0 to High(IDArray
) do
3632 SelectObject(ObjectType
, IDArray
[i
], (ssCtrl
in Shift
) or rSelectRect
);
3635 if Button
= mbLeft
then
3636 MouseLDown
:= False;
3637 if Button
= mbRight
then
3638 MouseRDown
:= False;
3641 ResizeType
:= RESIZETYPE_NONE
;
3644 if Button
= mbLeft
then // Left Mouse Button
3646 if MouseAction
<> MOUSEACTION_NONE
then
3647 begin // Было действие мышью
3648 // Мышь сдвинулась во время удержания клавиши,
3649 // либо активирован режим быстрого рисования:
3650 if ((MousePos
.X
<> MouseLDownPos
.X
) and
3651 (MousePos
.Y
<> MouseLDownPos
.Y
)) or
3652 ((MouseAction
in [MOUSEACTION_DRAWPANEL
, MOUSEACTION_DRAWTRIGGER
]) and
3653 (ssCtrl
in Shift
)) then
3656 MOUSEACTION_DRAWPANEL
:
3658 // Фон или передний план без текстуры - ошибка:
3659 if (lbPanelType
.ItemIndex
in [1, 2]) and
3660 (lbTextureList
.ItemIndex
= -1) then
3661 ErrorMessageBox(_lc
[I_MSG_CHOOSE_TEXTURE
])
3662 else // Назначаем параметры панели:
3664 case lbPanelType
.ItemIndex
of
3665 0: Panel
.PanelType
:= PANEL_WALL
;
3666 1: Panel
.PanelType
:= PANEL_BACK
;
3667 2: Panel
.PanelType
:= PANEL_FORE
;
3668 3: Panel
.PanelType
:= PANEL_OPENDOOR
;
3669 4: Panel
.PanelType
:= PANEL_CLOSEDOOR
;
3670 5: Panel
.PanelType
:= PANEL_STEP
;
3671 6: Panel
.PanelType
:= PANEL_WATER
;
3672 7: Panel
.PanelType
:= PANEL_ACID1
;
3673 8: Panel
.PanelType
:= PANEL_ACID2
;
3674 9: Panel
.PanelType
:= PANEL_LIFTUP
;
3675 10: Panel
.PanelType
:= PANEL_LIFTDOWN
;
3676 11: Panel
.PanelType
:= PANEL_LIFTLEFT
;
3677 12: Panel
.PanelType
:= PANEL_LIFTRIGHT
;
3678 13: Panel
.PanelType
:= PANEL_BLOCKMON
;
3681 Panel
.X
:= Min(MousePos
.X
-MapOffset
.X
, MouseLDownPos
.X
-MapOffset
.X
);
3682 Panel
.Y
:= Min(MousePos
.Y
-MapOffset
.Y
, MouseLDownPos
.Y
-MapOffset
.Y
);
3683 if ssCtrl
in Shift
then
3687 if (lbTextureList
.ItemIndex
<> -1) and
3688 (not IsSpecialTextureSel()) then
3690 if not g_GetTexture(SelectedTexture(), TextureID
) then
3691 g_GetTexture('NOTEXTURE', TextureID
);
3692 g_GetTextureSizeByID(TextureID
, wWidth
, wHeight
);
3694 Panel
.Width
:= wWidth
;
3695 Panel
.Height
:= wHeight
;
3699 Panel
.Width
:= Abs(MousePos
.X
-MouseLDownPos
.X
);
3700 Panel
.Height
:= Abs(MousePos
.Y
-MouseLDownPos
.Y
);
3703 // Лифты, блокМон или отсутствие текстуры - пустая текстура:
3704 if (lbPanelType
.ItemIndex
in [9, 10, 11, 12, 13]) or
3705 (lbTextureList
.ItemIndex
= -1) then
3707 Panel
.TextureHeight
:= 1;
3708 Panel
.TextureWidth
:= 1;
3709 Panel
.TextureName
:= '';
3710 Panel
.TextureID
:= TEXTURE_SPECIAL_NONE
;
3712 else // Есть текстура:
3714 Panel
.TextureName
:= SelectedTexture();
3716 // Обычная текстура:
3717 if not IsSpecialTextureSel() then
3719 g_GetTextureSizeByName(Panel
.TextureName
,
3720 Panel
.TextureWidth
, Panel
.TextureHeight
);
3721 g_GetTexture(Panel
.TextureName
, Panel
.TextureID
);
3723 else // Спец.текстура:
3725 Panel
.TextureHeight
:= 1;
3726 Panel
.TextureWidth
:= 1;
3727 Panel
.TextureID
:= SpecialTextureID(SelectedTexture());
3732 Panel
.Blending
:= False;
3734 Undo_Add(OBJECT_PANEL
, AddPanel(Panel
));
3738 // Рисовали триггер:
3739 MOUSEACTION_DRAWTRIGGER
:
3741 trigger
.X
:= Min(MousePos
.X
-MapOffset
.X
, MouseLDownPos
.X
-MapOffset
.X
);
3742 trigger
.Y
:= Min(MousePos
.Y
-MapOffset
.Y
, MouseLDownPos
.Y
-MapOffset
.Y
);
3743 if ssCtrl
in Shift
then
3747 trigger
.Width
:= wWidth
;
3748 trigger
.Height
:= wHeight
;
3752 trigger
.Width
:= Abs(MousePos
.X
-MouseLDownPos
.X
);
3753 trigger
.Height
:= Abs(MousePos
.Y
-MouseLDownPos
.Y
);
3756 trigger
.Enabled
:= True;
3757 trigger
.TriggerType
:= lbTriggersList
.ItemIndex
+1;
3758 trigger
.TexturePanel
:= -1;
3761 trigger
.ActivateType
:= 0;
3763 if clbActivationType
.Checked
[0] then
3764 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_PLAYERCOLLIDE
;
3765 if clbActivationType
.Checked
[1] then
3766 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_MONSTERCOLLIDE
;
3767 if clbActivationType
.Checked
[2] then
3768 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_PLAYERPRESS
;
3769 if clbActivationType
.Checked
[3] then
3770 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_MONSTERPRESS
;
3771 if clbActivationType
.Checked
[4] then
3772 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_SHOT
;
3773 if clbActivationType
.Checked
[5] then
3774 trigger
.ActivateType
:= Trigger
.ActivateType
or ACTIVATE_NOMONSTER
;
3776 // Необходимые для активации ключи:
3779 if clbKeys
.Checked
[0] then
3780 trigger
.Key
:= Trigger
.Key
or KEY_RED
;
3781 if clbKeys
.Checked
[1] then
3782 trigger
.Key
:= Trigger
.Key
or KEY_GREEN
;
3783 if clbKeys
.Checked
[2] then
3784 trigger
.Key
:= Trigger
.Key
or KEY_BLUE
;
3785 if clbKeys
.Checked
[3] then
3786 trigger
.Key
:= Trigger
.Key
or KEY_REDTEAM
;
3787 if clbKeys
.Checked
[4] then
3788 trigger
.Key
:= Trigger
.Key
or KEY_BLUETEAM
;
3790 // Параметры триггера:
3791 FillByte(trigger
.Data
.Default
[0], 128, 0);
3793 case trigger
.TriggerType
of
3794 // Переключаемая панель:
3795 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
3796 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
3797 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
3799 Trigger
.Data
.PanelID
:= -1;
3805 trigger
.Data
.TargetPoint
.X
:= trigger
.X
-64;
3806 trigger
.Data
.TargetPoint
.Y
:= trigger
.Y
-64;
3807 trigger
.Data
.d2d_teleport
:= True;
3808 trigger
.Data
.TlpDir
:= 0;
3811 // Изменение других триггеров:
3812 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
,
3815 trigger
.Data
.Count
:= 1;
3821 trigger
.Data
.Volume
:= 255;
3822 trigger
.Data
.Pan
:= 127;
3823 trigger
.Data
.PlayCount
:= 1;
3824 trigger
.Data
.Local
:= True;
3825 trigger
.Data
.SoundSwitch
:= False;
3831 trigger
.Data
.MusicAction
:= 1;
3834 // Создание монстра:
3835 TRIGGER_SPAWNMONSTER
:
3837 trigger
.Data
.MonType
:= MONSTER_ZOMBY
;
3838 trigger
.Data
.MonPos
.X
:= trigger
.X
-64;
3839 trigger
.Data
.MonPos
.Y
:= trigger
.Y
-64;
3840 trigger
.Data
.MonHealth
:= 0;
3841 trigger
.Data
.MonActive
:= False;
3842 trigger
.Data
.MonCount
:= 1;
3845 // Создание предмета:
3848 trigger
.Data
.ItemType
:= ITEM_AMMO_BULLETS
;
3849 trigger
.Data
.ItemPos
.X
:= trigger
.X
-64;
3850 trigger
.Data
.ItemPos
.Y
:= trigger
.Y
-64;
3851 trigger
.Data
.ItemOnlyDM
:= False;
3852 trigger
.Data
.ItemFalls
:= False;
3853 trigger
.Data
.ItemCount
:= 1;
3854 trigger
.Data
.ItemMax
:= 0;
3855 trigger
.Data
.ItemDelay
:= 0;
3861 trigger
.Data
.PushAngle
:= 90;
3862 trigger
.Data
.PushForce
:= 10;
3863 trigger
.Data
.ResetVel
:= True;
3868 trigger
.Data
.ScoreCount
:= 1;
3869 trigger
.Data
.ScoreCon
:= True;
3870 trigger
.Data
.ScoreMsg
:= True;
3875 trigger
.Data
.MessageKind
:= 0;
3876 trigger
.Data
.MessageSendTo
:= 0;
3877 trigger
.Data
.MessageText
:= '';
3878 trigger
.Data
.MessageTime
:= 144;
3883 trigger
.Data
.DamageValue
:= 5;
3884 trigger
.Data
.DamageInterval
:= 12;
3889 trigger
.Data
.HealValue
:= 5;
3890 trigger
.Data
.HealInterval
:= 36;
3895 trigger
.Data
.ShotType
:= TRIGGER_SHOT_BULLET
;
3896 trigger
.Data
.ShotSound
:= True;
3897 trigger
.Data
.ShotPanelID
:= -1;
3898 trigger
.Data
.ShotTarget
:= 0;
3899 trigger
.Data
.ShotIntSight
:= 0;
3900 trigger
.Data
.ShotAim
:= TRIGGER_SHOT_AIM_DEFAULT
;
3901 trigger
.Data
.ShotPos
.X
:= trigger
.X
-64;
3902 trigger
.Data
.ShotPos
.Y
:= trigger
.Y
-64;
3903 trigger
.Data
.ShotAngle
:= 0;
3904 trigger
.Data
.ShotWait
:= 18;
3905 trigger
.Data
.ShotAccuracy
:= 0;
3906 trigger
.Data
.ShotAmmo
:= 0;
3907 trigger
.Data
.ShotIntReload
:= 0;
3912 trigger
.Data
.FXCount
:= 1;
3913 trigger
.Data
.FXType
:= TRIGGER_EFFECT_PARTICLE
;
3914 trigger
.Data
.FXSubType
:= TRIGGER_EFFECT_SLIQUID
;
3915 trigger
.Data
.FXColorR
:= 0;
3916 trigger
.Data
.FXColorG
:= 0;
3917 trigger
.Data
.FXColorB
:= 255;
3918 trigger
.Data
.FXPos
:= TRIGGER_EFFECT_POS_CENTER
;
3919 trigger
.Data
.FXWait
:= 1;
3920 trigger
.Data
.FXVelX
:= 0;
3921 trigger
.Data
.FXVelY
:= -20;
3922 trigger
.Data
.FXSpreadL
:= 5;
3923 trigger
.Data
.FXSpreadR
:= 5;
3924 trigger
.Data
.FXSpreadU
:= 4;
3925 trigger
.Data
.FXSpreadD
:= 0;
3929 Undo_Add(OBJECT_TRIGGER
, AddTrigger(trigger
));
3932 // Рисовали область триггера "Расширитель":
3933 MOUSEACTION_DRAWPRESS
:
3934 with gTriggers
[SelectedObjects
[GetFirstSelected
].ID
] do
3936 Data
.tX
:= Min(MousePos
.X
-MapOffset
.X
, MouseLDownPos
.X
-MapOffset
.X
);
3937 Data
.tY
:= Min(MousePos
.Y
-MapOffset
.Y
, MouseLDownPos
.Y
-MapOffset
.Y
);
3938 Data
.tWidth
:= Abs(MousePos
.X
-MouseLDownPos
.X
);
3939 Data
.tHeight
:= Abs(MousePos
.Y
-MouseLDownPos
.Y
);
3941 DrawPressRect
:= False;
3945 MouseAction
:= MOUSEACTION_NONE
;
3947 end // if Button = mbLeft...
3948 else // Right Mouse Button:
3950 if MouseAction
= MOUSEACTION_NOACTION
then
3952 MouseAction
:= MOUSEACTION_NONE
;
3956 // Объект передвинут или изменен в размере:
3957 if MouseAction
in [MOUSEACTION_MOVEOBJ
, MOUSEACTION_RESIZE
] then
3959 MouseAction
:= MOUSEACTION_NONE
;
3964 // Еще не все выбрали:
3965 if SelectFlag
<> SELECTFLAG_NONE
then
3967 if SelectFlag
= SELECTFLAG_SELECTED
then
3968 SelectFlag
:= SELECTFLAG_NONE
;
3973 // Мышь сдвинулась во время удержания клавиши:
3974 if (MousePos
.X
<> MouseRDownPos
.X
) and
3975 (MousePos
.Y
<> MouseRDownPos
.Y
) then
3977 rSelectRect
:= True;
3979 rRect
.X
:= Min(MousePos
.X
, MouseRDownPos
.X
)-MapOffset
.X
;
3980 rRect
.Y
:= Min(MousePos
.Y
, MouseRDownPos
.Y
)-MapOffset
.Y
;
3981 rRect
.Width
:= Abs(MousePos
.X
-MouseRDownPos
.X
);
3982 rRect
.Height
:= Abs(MousePos
.Y
-MouseRDownPos
.Y
);
3984 else // Мышь не сдвинулась - нет прямоугольника:
3986 rSelectRect
:= False;
3988 rRect
.X
:= X
-MapOffset
.X
-1;
3989 rRect
.Y
:= Y
-MapOffset
.Y
-1;
3994 // Если зажат Ctrl - выделять еще, иначе только один выделенный объект:
3995 if not (ssCtrl
in Shift
) then
3996 RemoveSelectFromObjects();
3998 // Выделяем всё в выбранном прямоугольнике:
3999 if (ssCtrl
in Shift
) and (ssAlt
in Shift
) then
4001 SelectObjects(OBJECT_PANEL
);
4002 SelectObjects(OBJECT_ITEM
);
4003 SelectObjects(OBJECT_MONSTER
);
4004 SelectObjects(OBJECT_AREA
);
4005 SelectObjects(OBJECT_TRIGGER
);
4008 SelectObjects(pcObjects
.ActivePageIndex
+1);
4014 procedure TMainForm
.RenderPanelPaint(Sender
: TObject
);
4019 function TMainForm
.RenderMousePos(): Types
.TPoint
;
4021 Result
:= RenderPanel
.ScreenToClient(Mouse
.CursorPos
);
4024 procedure TMainForm
.RecountSelectedObjects();
4026 if SelectedObjectCount() = 0 then
4027 StatusBar
.Panels
[0].Text := ''
4029 StatusBar
.Panels
[0].Text := Format(_lc
[I_CAP_STAT_SELECTED
], [SelectedObjectCount()]);
4032 procedure TMainForm
.RenderPanelMouseMove(Sender
: TObject
;
4033 Shift
: TShiftState
; X
, Y
: Integer);
4036 dWidth
, dHeight
: Integer;
4039 wWidth
, wHeight
: Word;
4041 _id
:= GetFirstSelected();
4044 // Рисуем панель с текстурой, сетка - размеры текстуры:
4045 if (MouseAction
= MOUSEACTION_DRAWPANEL
) and
4046 (lbPanelType
.ItemIndex
in [0..8]) and
4047 (lbTextureList
.ItemIndex
<> -1) and
4048 (not IsSpecialTextureSel()) then
4050 sX
:= StrToIntDef(lTextureWidth
.Caption
, DotStep
);
4051 sY
:= StrToIntDef(lTextureHeight
.Caption
, DotStep
);
4054 // Меняем размер панели с текстурой, сетка - размеры текстуры:
4055 if (MouseAction
= MOUSEACTION_RESIZE
) and
4056 ( (SelectedObjects
[_id
].ObjectType
= OBJECT_PANEL
) and
4057 IsTexturedPanel(gPanels
[SelectedObjects
[_id
].ID
].PanelType
) and
4058 (gPanels
[SelectedObjects
[_id
].ID
].TextureName
<> '') and
4059 (not IsSpecialTexture(gPanels
[SelectedObjects
[_id
].ID
].TextureName
)) ) then
4061 sX
:= gPanels
[SelectedObjects
[_id
].ID
].TextureWidth
;
4062 sY
:= gPanels
[SelectedObjects
[_id
].ID
].TextureHeight
;
4065 // Выравнивание по сетке:
4071 else // Нет выравнивания по сетке:
4077 // Новая позиция мыши:
4079 begin // Зажата левая кнопка мыши
4080 MousePos
.X
:= (Round((X
-MouseLDownPos
.X
)/sX
)*sX
)+MouseLDownPos
.X
;
4081 MousePos
.Y
:= (Round((Y
-MouseLDownPos
.Y
)/sY
)*sY
)+MouseLDownPos
.Y
;
4085 begin // Зажата правая кнопка мыши
4086 MousePos
.X
:= (Round((X
-MouseRDownPos
.X
)/sX
)*sX
)+MouseRDownPos
.X
;
4087 MousePos
.Y
:= (Round((Y
-MouseRDownPos
.Y
)/sY
)*sY
)+MouseRDownPos
.Y
;
4090 begin // Кнопки мыши не зажаты
4091 MousePos
.X
:= (Round(X
/sX
)*sX
);
4092 MousePos
.Y
:= (Round(Y
/sY
)*sY
);
4095 // Изменение размера закончилось - ставим обычный курсор:
4096 if ResizeType
= RESIZETYPE_NONE
then
4097 RenderPanel
.Cursor
:= crDefault
;
4099 // Зажата только правая кнопка мыши:
4100 if (not MouseLDown
) and (MouseRDown
) then
4102 // Рисуем прямоугольник выделения:
4103 if MouseAction
= MOUSEACTION_NONE
then
4105 if DrawRect
= nil then
4107 DrawRect
.Top
:= MouseRDownPos
.y
;
4108 DrawRect
.Left
:= MouseRDownPos
.x
;
4109 DrawRect
.Bottom
:= MousePos
.y
;
4110 DrawRect
.Right
:= MousePos
.x
;
4113 // Двигаем выделенные объекты:
4114 if MouseAction
= MOUSEACTION_MOVEOBJ
then
4116 MoveSelectedObjects(ssShift
in Shift
, ssCtrl
in Shift
,
4117 MousePos
.X
-LastMovePoint
.X
+WASDOffset
.X
,
4118 MousePos
.Y
-LastMovePoint
.Y
+WASDOffset
.Y
);
4123 // Меняем размер выделенного объекта:
4124 if MouseAction
= MOUSEACTION_RESIZE
then
4126 if (SelectedObjectCount
= 1) and
4127 (SelectedObjects
[GetFirstSelected
].Live
) then
4129 dWidth
:= MousePos
.X
-LastMovePoint
.X
+WASDOffset
.X
;
4130 dHeight
:= MousePos
.Y
-LastMovePoint
.Y
+WASDOffset
.Y
;
4135 RESIZETYPE_VERTICAL
: dWidth
:= 0;
4136 RESIZETYPE_HORIZONTAL
: dHeight
:= 0;
4139 case ResizeDirection
of
4140 RESIZEDIR_UP
: dHeight
:= -dHeight
;
4141 RESIZEDIR_LEFT
: dWidth
:= -dWidth
;
4144 ResizeObject(SelectedObjects
[GetFirstSelected
].ObjectType
,
4145 SelectedObjects
[GetFirstSelected
].ID
,
4146 dWidth
, dHeight
, ResizeDirection
);
4148 LastMovePoint
:= MousePos
;
4153 // Зажата только левая кнопка мыши:
4154 if (not MouseRDown
) and (MouseLDown
) then
4156 // Рисуем прямоугольник планирования панели:
4157 if MouseAction
in [MOUSEACTION_DRAWPANEL
,
4158 MOUSEACTION_DRAWTRIGGER
,
4159 MOUSEACTION_DRAWPRESS
] then
4161 if DrawRect
= nil then
4163 if ssCtrl
in Shift
then
4167 if (lbTextureList
.ItemIndex
<> -1) and (not IsSpecialTextureSel()) and
4168 (MouseAction
= MOUSEACTION_DRAWPANEL
) then
4170 if not g_GetTexture(SelectedTexture(), TextureID
) then
4171 g_GetTexture('NOTEXTURE', TextureID
);
4172 g_GetTextureSizeByID(TextureID
, wWidth
, wHeight
);
4174 DrawRect
.Top
:= MouseLDownPos
.y
;
4175 DrawRect
.Left
:= MouseLDownPos
.x
;
4176 DrawRect
.Bottom
:= DrawRect
.Top
+ wHeight
;
4177 DrawRect
.Right
:= DrawRect
.Left
+ wWidth
;
4181 DrawRect
.Top
:= MouseLDownPos
.y
;
4182 DrawRect
.Left
:= MouseLDownPos
.x
;
4183 DrawRect
.Bottom
:= MousePos
.y
;
4184 DrawRect
.Right
:= MousePos
.x
;
4187 else // Двигаем карту:
4188 if MouseAction
= MOUSEACTION_MOVEMAP
then
4194 // Клавиши мыши не зажаты:
4195 if (not MouseRDown
) and (not MouseLDown
) then
4198 // Строка состояния - координаты мыши:
4199 StatusBar
.Panels
[1].Text := Format('(%d:%d)',
4200 [MousePos
.X
-MapOffset
.X
, MousePos
.Y
-MapOffset
.Y
]);
4203 procedure TMainForm
.FormCloseQuery(Sender
: TObject
; var CanClose
: Boolean);
4205 CanClose
:= MessageBox(0, PChar(_lc
[I_MSG_EXIT_PROMT
]),
4206 PChar(_lc
[I_MSG_EXIT
]),
4207 MB_ICONQUESTION
or MB_YESNO
or
4208 MB_DEFBUTTON1
) = idYes
;
4211 procedure TMainForm
.aExitExecute(Sender
: TObject
);
4216 procedure TMainForm
.FormDestroy(Sender
: TObject
);
4221 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
4223 if WindowState
<> wsMaximized
then
4225 config
.WriteInt('Editor', 'XPos', Left
);
4226 config
.WriteInt('Editor', 'YPos', Top
);
4227 config
.WriteInt('Editor', 'Width', Width
);
4228 config
.WriteInt('Editor', 'Height', Height
);
4232 config
.WriteInt('Editor', 'XPos', RestoredLeft
);
4233 config
.WriteInt('Editor', 'YPos', RestoredTop
);
4234 config
.WriteInt('Editor', 'Width', RestoredWidth
);
4235 config
.WriteInt('Editor', 'Height', RestoredHeight
);
4237 config
.WriteBool('Editor', 'Maximize', WindowState
= wsMaximized
);
4238 config
.WriteBool('Editor', 'Minimap', ShowMap
);
4239 config
.WriteInt('Editor', 'PanelProps', PanelProps
.ClientWidth
);
4240 config
.WriteInt('Editor', 'PanelObjs', PanelObjs
.ClientHeight
);
4241 config
.WriteBool('Editor', 'DotEnable', DotEnable
);
4242 config
.WriteInt('Editor', 'DotStep', DotStep
);
4243 config
.WriteStr('Editor', 'LastOpenDir', OpenDialog
.InitialDir
);
4244 config
.WriteStr('Editor', 'LastSaveDir', SaveDialog
.InitialDir
);
4245 config
.WriteBool('Editor', 'EdgeShow', drEdge
[3] < 255);
4246 config
.WriteInt('Editor', 'EdgeColor', gColorEdge
);
4247 config
.WriteInt('Editor', 'EdgeAlpha', gAlphaEdge
);
4248 config
.WriteInt('Editor', 'LineAlpha', gAlphaTriggerLine
);
4249 config
.WriteInt('Editor', 'TriggerAlpha', gAlphaTriggerArea
);
4250 config
.WriteInt('Editor', 'MonsterRectAlpha', gAlphaMonsterRect
);
4251 config
.WriteInt('Editor', 'AreaRectAlpha', gAlphaAreaRect
);
4253 for i
:= 0 to RecentCount
-1 do
4254 if i
< RecentFiles
.Count
then
4255 config
.WriteStr('RecentFiles', IntToStr(i
+1), RecentFiles
[i
])
4257 config
.WriteStr('RecentFiles', IntToStr(i
+1), '');
4260 config
.SaveFile(EditorDir
+'Editor.cfg');
4263 slInvalidTextures
.Free
;
4266 procedure TMainForm
.FormDropFiles(Sender
: TObject
;
4267 const FileNames
: array of String);
4269 if Length(FileNames
) <> 1 then
4272 OpenMapFile(FileNames
[0]);
4275 procedure TMainForm
.RenderPanelResize(Sender
: TObject
);
4277 if MainForm
.Visible
then
4281 procedure TMainForm
.Splitter1Moved(Sender
: TObject
);
4286 procedure TMainForm
.aMapOptionsExecute(Sender
: TObject
);
4290 MapOptionsForm
.ShowModal();
4292 ResName
:= OpenedMap
;
4293 while (Pos(':\', ResName
) > 0) do
4294 Delete(ResName
, 1, Pos(':\', ResName
) + 1);
4296 UpdateCaption(gMapInfo
.Name
, ExtractFileName(OpenedWAD
), ResName
);
4299 procedure TMainForm
.aAboutExecute(Sender
: TObject
);
4301 AboutForm
.ShowModal();
4304 procedure TMainForm
.FormKeyDown(Sender
: TObject
; var Key
: Word;
4305 Shift
: TShiftState
);
4310 if (not EditingProperties
) then
4312 if Key
= Ord('1') then
4313 SwitchLayer(LAYER_BACK
);
4314 if Key
= Ord('2') then
4315 SwitchLayer(LAYER_WALLS
);
4316 if Key
= Ord('3') then
4317 SwitchLayer(LAYER_FOREGROUND
);
4318 if Key
= Ord('4') then
4319 SwitchLayer(LAYER_STEPS
);
4320 if Key
= Ord('5') then
4321 SwitchLayer(LAYER_WATER
);
4322 if Key
= Ord('6') then
4323 SwitchLayer(LAYER_ITEMS
);
4324 if Key
= Ord('7') then
4325 SwitchLayer(LAYER_MONSTERS
);
4326 if Key
= Ord('8') then
4327 SwitchLayer(LAYER_AREAS
);
4328 if Key
= Ord('9') then
4329 SwitchLayer(LAYER_TRIGGERS
);
4330 if Key
= Ord('0') then
4331 tbShowClick(tbShow
);
4333 if Key
= Ord('V') then
4334 begin // Поворот монстров и областей:
4335 if (SelectedObjects
<> nil) then
4337 for i
:= 0 to High(SelectedObjects
) do
4338 if (SelectedObjects
[i
].Live
) then
4340 if (SelectedObjects
[i
].ObjectType
= OBJECT_MONSTER
) then
4342 g_ChangeDir(gMonsters
[SelectedObjects
[i
].ID
].Direction
);
4345 if (SelectedObjects
[i
].ObjectType
= OBJECT_AREA
) then
4347 g_ChangeDir(gAreas
[SelectedObjects
[i
].ID
].Direction
);
4353 if pcObjects
.ActivePage
= tsMonsters
then
4355 if rbMonsterLeft
.Checked
then
4356 rbMonsterRight
.Checked
:= True
4358 rbMonsterLeft
.Checked
:= True;
4360 if pcObjects
.ActivePage
= tsAreas
then
4362 if rbAreaLeft
.Checked
then
4363 rbAreaRight
.Checked
:= True
4365 rbAreaLeft
.Checked
:= True;
4370 if not (ssCtrl
in Shift
) then
4372 // Быстрое превью карты:
4373 if Key
= Ord('E') then
4375 if PreviewMode
= 0 then
4379 // Вертикальный скролл карты:
4382 if Key
= Ord('W') then
4384 if (MouseLDown
or MouseRDown
) and (Position
>= DotStep
) then
4386 Dec(WASDOffset
.Y
, DotStep
);
4387 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4389 Position
:= IfThen(Position
> DotStep
, Position
-DotStep
, 0);
4390 MapOffset
.Y
:= -Round(Position
/16) * 16;
4393 if Key
= Ord('S') then
4395 if (MouseLDown
or MouseRDown
) and (Position
+DotStep
<= Max
) then
4397 Inc(WASDOffset
.Y
, DotStep
);
4398 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4400 Position
:= IfThen(Position
+DotStep
< Max
, Position
+DotStep
, Max
);
4401 MapOffset
.Y
:= -Round(Position
/16) * 16;
4405 // Горизонтальный скролл карты:
4406 with sbHorizontal
do
4408 if Key
= Ord('A') then
4410 if (MouseLDown
or MouseRDown
) and (Position
>= DotStep
) then
4412 Dec(WASDOffset
.X
, DotStep
);
4413 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4415 Position
:= IfThen(Position
> DotStep
, Position
-DotStep
, 0);
4416 MapOffset
.X
:= -Round(Position
/16) * 16;
4419 if Key
= Ord('D') then
4421 if (MouseLDown
or MouseRDown
) and (Position
+DotStep
<= Max
) then
4423 Inc(WASDOffset
.X
, DotStep
);
4424 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4426 Position
:= IfThen(Position
+DotStep
< Max
, Position
+DotStep
, Max
);
4427 MapOffset
.X
:= -Round(Position
/16) * 16;
4431 else // ssCtrl in Shift
4433 if ssShift
in Shift
then
4435 // Вставка по абсолютному смещению:
4436 if Key
= Ord('V') then
4437 aPasteObjectExecute(Sender
);
4439 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);
4443 // Удалить выделенные объекты:
4444 if (Key
= VK_DELETE
) and (SelectedObjects
<> nil) and
4445 RenderPanel
.Focused() then
4446 DeleteSelectedObjects();
4449 if (Key
= VK_ESCAPE
) and (SelectedObjects
<> nil) then
4450 RemoveSelectFromObjects();
4452 // Передвинуть объекты:
4453 if MainForm
.ActiveControl
= RenderPanel
then
4458 if Key
= VK_NUMPAD4
then
4459 dx
:= IfThen(ssAlt
in Shift
, -1, -DotStep
);
4460 if Key
= VK_NUMPAD6
then
4461 dx
:= IfThen(ssAlt
in Shift
, 1, DotStep
);
4462 if Key
= VK_NUMPAD8
then
4463 dy
:= IfThen(ssAlt
in Shift
, -1, -DotStep
);
4464 if Key
= VK_NUMPAD5
then
4465 dy
:= IfThen(ssAlt
in Shift
, 1, DotStep
);
4467 if (dx
<> 0) or (dy
<> 0) then
4469 MoveSelectedObjects(ssShift
in Shift
, ssCtrl
in Shift
, dx
, dy
);
4474 if ssCtrl
in Shift
then
4476 // Выбор панели с текстурой для триггера
4477 if Key
= Ord('T') then
4479 DrawPressRect
:= False;
4480 if SelectFlag
= SELECTFLAG_TEXTURE
then
4482 SelectFlag
:= SELECTFLAG_NONE
;
4485 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_TEXTURE_PANEL
], i
);
4487 SelectFlag
:= SELECTFLAG_TEXTURE
;
4490 if Key
= Ord('D') then
4492 SelectFlag
:= SELECTFLAG_NONE
;
4493 if DrawPressRect
then
4495 DrawPressRect
:= False;
4500 // Выбор области воздействия, в зависимости от типа триггера
4501 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_EX_AREA
], i
);
4504 DrawPressRect
:= True;
4507 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_DOOR_PANEL
], i
);
4509 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_TRAP_PANEL
], i
);
4512 SelectFlag
:= SELECTFLAG_DOOR
;
4515 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_LIFT_PANEL
], i
);
4518 SelectFlag
:= SELECTFLAG_LIFT
;
4521 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_TELEPORT_TO
], i
);
4524 SelectFlag
:= SELECTFLAG_TELEPORT
;
4527 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_SPAWN_TO
], i
);
4530 SelectFlag
:= SELECTFLAG_SPAWNPOINT
;
4534 // Выбор основного параметра, в зависимости от типа триггера
4535 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_NEXT_MAP
], i
);
4538 g_ProcessResourceStr(OpenedMap
, @FileName
, nil, nil);
4539 SelectMapForm
.Caption
:= _lc
[I_CAP_SELECT
];
4540 SelectMapForm
.GetMaps(FileName
);
4542 if SelectMapForm
.ShowModal() = mrOK
then
4544 vleObjectProperty
.Cells
[1, i
] := SelectMapForm
.lbMapList
.Items
[SelectMapForm
.lbMapList
.ItemIndex
];
4545 bApplyProperty
.Click();
4549 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_SOUND_NAME
], i
);
4551 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_MUSIC_NAME
], i
);
4554 AddSoundForm
.OKFunction
:= nil;
4555 AddSoundForm
.lbResourcesList
.MultiSelect
:= False;
4556 AddSoundForm
.SetResource
:= vleObjectProperty
.Cells
[1, i
];
4558 if (AddSoundForm
.ShowModal() = mrOk
) then
4560 vleObjectProperty
.Cells
[1, i
] := AddSoundForm
.ResourceName
;
4561 bApplyProperty
.Click();
4565 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_PUSH_ANGLE
], i
);
4567 vleObjectProperty
.FindRow(_lc
[I_PROP_TR_MESSAGE_TEXT
], i
);
4570 vleObjectProperty
.Row
:= i
;
4571 vleObjectProperty
.SetFocus();
4578 procedure TMainForm
.aOptimizeExecute(Sender
: TObject
);
4580 RemoveSelectFromObjects();
4581 MapOptimizationForm
.ShowModal();
4584 procedure TMainForm
.aCheckMapExecute(Sender
: TObject
);
4586 MapCheckForm
.ShowModal();
4589 procedure TMainForm
.bbAddTextureClick(Sender
: TObject
);
4591 AddTextureForm
.lbResourcesList
.MultiSelect
:= True;
4592 AddTextureForm
.ShowModal();
4595 procedure TMainForm
.lbTextureListClick(Sender
: TObject
);
4598 TextureWidth
, TextureHeight
: Word;
4603 if (lbTextureList
.ItemIndex
<> -1) and
4604 (not IsSpecialTextureSel()) then
4606 if g_GetTexture(SelectedTexture(), TextureID
) then
4608 g_GetTextureSizeByID(TextureID
, TextureWidth
, TextureHeight
);
4610 lTextureWidth
.Caption
:= IntToStr(TextureWidth
);
4611 lTextureHeight
.Caption
:= IntToStr(TextureHeight
);
4614 lTextureWidth
.Caption
:= _lc
[I_NOT_ACCESSIBLE
];
4615 lTextureHeight
.Caption
:= _lc
[I_NOT_ACCESSIBLE
];
4620 lTextureWidth
.Caption
:= '';
4621 lTextureHeight
.Caption
:= '';
4625 procedure TMainForm
.lbTextureListDrawItem(Control
: TWinControl
; Index
: Integer;
4626 ARect
: TRect
; State
: TOwnerDrawState
);
4628 with Control
as TListBox
do
4630 if LCLType
.odSelected
in State
then
4632 Canvas
.Brush
.Color
:= clHighlight
;
4633 Canvas
.Font
.Color
:= clHighlightText
;
4635 if (Items
<> nil) and (Index
>= 0) then
4636 if slInvalidTextures
.IndexOf(Items
[Index
]) > -1 then
4638 Canvas
.Brush
.Color
:= clRed
;
4639 Canvas
.Font
.Color
:= clWhite
;
4641 Canvas
.FillRect(ARect
);
4642 Canvas
.TextRect(ARect
, ARect
.Left
, ARect
.Top
, Items
[Index
]);
4646 procedure TMainForm
.miReopenMapClick(Sender
: TObject
);
4648 FileName
, Resource
: String;
4650 if OpenedMap
= '' then
4653 if MessageBox(0, PChar(_lc
[I_MSG_REOPEN_MAP_PROMT
]),
4654 PChar(_lc
[I_MENU_FILE_REOPEN
]), MB_ICONQUESTION
or MB_YESNO
) <> idYes
then
4657 g_ProcessResourceStr(OpenedMap
, @FileName
, nil, @Resource
);
4658 OpenMap(FileName
, Resource
);
4661 procedure TMainForm
.vleObjectPropertyGetPickList(Sender
: TObject
;
4662 const KeyName
: String; Values
: TStrings
);
4664 if vleObjectProperty
.ItemProps
[KeyName
].EditStyle
= esPickList
then
4666 if KeyName
= _lc
[I_PROP_DIRECTION
] then
4668 Values
.Add(DirNames
[D_LEFT
]);
4669 Values
.Add(DirNames
[D_RIGHT
]);
4671 else if KeyName
= _lc
[I_PROP_TR_TELEPORT_DIR
] then
4673 Values
.Add(DirNamesAdv
[0]);
4674 Values
.Add(DirNamesAdv
[1]);
4675 Values
.Add(DirNamesAdv
[2]);
4676 Values
.Add(DirNamesAdv
[3]);
4678 else if KeyName
= _lc
[I_PROP_TR_MUSIC_ACT
] then
4680 Values
.Add(_lc
[I_PROP_TR_MUSIC_ON
]);
4681 Values
.Add(_lc
[I_PROP_TR_MUSIC_OFF
]);
4683 else if KeyName
= _lc
[I_PROP_TR_MONSTER_BEHAVIOUR
] then
4685 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_0
]);
4686 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_1
]);
4687 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_2
]);
4688 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_3
]);
4689 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_4
]);
4690 Values
.Add(_lc
[I_PROP_TR_MONSTER_BEHAVIOUR_5
]);
4692 else if KeyName
= _lc
[I_PROP_TR_SCORE_ACT
] then
4694 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_0
]);
4695 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_1
]);
4696 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_2
]);
4697 Values
.Add(_lc
[I_PROP_TR_SCORE_ACT_3
]);
4699 else if KeyName
= _lc
[I_PROP_TR_SCORE_TEAM
] then
4701 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_0
]);
4702 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_1
]);
4703 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_2
]);
4704 Values
.Add(_lc
[I_PROP_TR_SCORE_TEAM_3
]);
4706 else if KeyName
= _lc
[I_PROP_TR_MESSAGE_KIND
] then
4708 Values
.Add(_lc
[I_PROP_TR_MESSAGE_KIND_0
]);
4709 Values
.Add(_lc
[I_PROP_TR_MESSAGE_KIND_1
]);
4711 else if KeyName
= _lc
[I_PROP_TR_MESSAGE_TO
] then
4713 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_0
]);
4714 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_1
]);
4715 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_2
]);
4716 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_3
]);
4717 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_4
]);
4718 Values
.Add(_lc
[I_PROP_TR_MESSAGE_TO_5
]);
4720 else if KeyName
= _lc
[I_PROP_TR_SHOT_TO
] then
4722 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_0
]);
4723 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_1
]);
4724 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_2
]);
4725 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_3
]);
4726 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_4
]);
4727 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_5
]);
4728 Values
.Add(_lc
[I_PROP_TR_SHOT_TO_6
]);
4730 else if KeyName
= _lc
[I_PROP_TR_SHOT_AIM
] then
4732 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_0
]);
4733 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_1
]);
4734 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_2
]);
4735 Values
.Add(_lc
[I_PROP_TR_SHOT_AIM_3
]);
4737 else if (KeyName
= _lc
[I_PROP_PANEL_BLEND
]) or
4738 (KeyName
= _lc
[I_PROP_DM_ONLY
]) or
4739 (KeyName
= _lc
[I_PROP_ITEM_FALLS
]) or
4740 (KeyName
= _lc
[I_PROP_TR_ENABLED
]) or
4741 (KeyName
= _lc
[I_PROP_TR_D2D
]) or
4742 (KeyName
= _lc
[I_PROP_TR_SILENT
]) or
4743 (KeyName
= _lc
[I_PROP_TR_TELEPORT_SILENT
]) or
4744 (KeyName
= _lc
[I_PROP_TR_EX_RANDOM
]) or
4745 (KeyName
= _lc
[I_PROP_TR_TEXTURE_ONCE
]) or
4746 (KeyName
= _lc
[I_PROP_TR_TEXTURE_ANIM_ONCE
]) or
4747 (KeyName
= _lc
[I_PROP_TR_SOUND_LOCAL
]) or
4748 (KeyName
= _lc
[I_PROP_TR_SOUND_SWITCH
]) or
4749 (KeyName
= _lc
[I_PROP_TR_MONSTER_ACTIVE
]) or
4750 (KeyName
= _lc
[I_PROP_TR_PUSH_RESET
]) or
4751 (KeyName
= _lc
[I_PROP_TR_SCORE_CON
]) or
4752 (KeyName
= _lc
[I_PROP_TR_SCORE_MSG
]) or
4753 (KeyName
= _lc
[I_PROP_TR_HEALTH_MAX
]) or
4754 (KeyName
= _lc
[I_PROP_TR_SHOT_SOUND
]) or
4755 (KeyName
= _lc
[I_PROP_TR_EFFECT_CENTER
]) then
4757 Values
.Add(BoolNames
[True]);
4758 Values
.Add(BoolNames
[False]);
4763 procedure TMainForm
.bApplyPropertyClick(Sender
: TObject
);
4765 _id
, a
, r
, c
: Integer;
4775 if SelectedObjectCount() <> 1 then
4777 if not SelectedObjects
[GetFirstSelected()].Live
then
4781 if not CheckProperty() then
4787 _id
:= GetFirstSelected();
4789 r
:= vleObjectProperty
.Row
;
4790 c
:= vleObjectProperty
.Col
;
4792 case SelectedObjects
[_id
].ObjectType
of
4795 with gPanels
[SelectedObjects
[_id
].ID
] do
4797 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4798 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4799 Width
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_WIDTH
]]));
4800 Height
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_HEIGHT
]]));
4802 PanelType
:= GetPanelType(vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_TYPE
]]);
4804 // Сброс ссылки на триггеры смены текстуры:
4805 if not WordBool(PanelType
and (PANEL_WALL
or PANEL_FORE
or PANEL_BACK
)) then
4806 if gTriggers
<> nil then
4807 for a
:= 0 to High(gTriggers
) do
4809 if (gTriggers
[a
].TriggerType
<> 0) and
4810 (gTriggers
[a
].TexturePanel
= Integer(SelectedObjects
[_id
].ID
)) then
4811 gTriggers
[a
].TexturePanel
:= -1;
4812 if (gTriggers
[a
].TriggerType
= TRIGGER_SHOT
) and
4813 (gTriggers
[a
].Data
.ShotPanelID
= Integer(SelectedObjects
[_id
].ID
)) then
4814 gTriggers
[a
].Data
.ShotPanelID
:= -1;
4817 // Сброс ссылки на триггеры лифта:
4818 if not WordBool(PanelType
and (PANEL_LIFTUP
or PANEL_LIFTDOWN
or PANEL_LIFTLEFT
or PANEL_LIFTRIGHT
)) then
4819 if gTriggers
<> nil then
4820 for a
:= 0 to High(gTriggers
) do
4821 if (gTriggers
[a
].TriggerType
in [TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
]) and
4822 (gTriggers
[a
].Data
.PanelID
= Integer(SelectedObjects
[_id
].ID
)) then
4823 gTriggers
[a
].Data
.PanelID
:= -1;
4825 // Сброс ссылки на триггеры двери:
4826 if not WordBool(PanelType
and (PANEL_OPENDOOR
or PANEL_CLOSEDOOR
)) then
4827 if gTriggers
<> nil then
4828 for a
:= 0 to High(gTriggers
) do
4829 if (gTriggers
[a
].TriggerType
in [TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
4830 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
]) and
4831 (gTriggers
[a
].Data
.PanelID
= Integer(SelectedObjects
[_id
].ID
)) then
4832 gTriggers
[a
].Data
.PanelID
:= -1;
4834 if IsTexturedPanel(PanelType
) then
4835 begin // Может быть текстура
4836 if TextureName
<> '' then
4837 begin // Была текстура
4838 Alpha
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_ALPHA
]]));
4839 Blending
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_BLEND
]]);
4848 TextureName
:= vleObjectProperty
.Values
[_lc
[I_PROP_PANEL_TEX
]];
4850 if TextureName
<> '' then
4851 begin // Есть текстура
4852 // Обычная текстура:
4853 if not IsSpecialTexture(TextureName
) then
4855 g_GetTextureSizeByName(TextureName
,
4856 TextureWidth
, TextureHeight
);
4858 // Проверка кратности размеров панели:
4860 if TextureWidth
<> 0 then
4861 if gPanels
[SelectedObjects
[_id
].ID
].Width
mod TextureWidth
<> 0 then
4863 ErrorMessageBox(Format(_lc
[I_MSG_WRONG_TEXWIDTH
],
4867 if Res
and (TextureHeight
<> 0) then
4868 if gPanels
[SelectedObjects
[_id
].ID
].Height
mod TextureHeight
<> 0 then
4870 ErrorMessageBox(Format(_lc
[I_MSG_WRONG_TEXHEIGHT
],
4877 if not g_GetTexture(TextureName
, TextureID
) then
4878 // Не удалось загрузить текстуру, рисуем NOTEXTURE
4879 if g_GetTexture('NOTEXTURE', NoTextureID
) then
4881 TextureID
:= TEXTURE_SPECIAL_NOTEXTURE
;
4882 g_GetTextureSizeByID(NoTextureID
, NW
, NH
);
4884 TextureHeight
:= NH
;
4887 TextureID
:= TEXTURE_SPECIAL_NONE
;
4897 TextureID
:= TEXTURE_SPECIAL_NONE
;
4900 else // Спец.текстура
4904 TextureID
:= SpecialTextureID(TextureName
);
4907 else // Нет текстуры
4911 TextureID
:= TEXTURE_SPECIAL_NONE
;
4914 else // Не может быть текстуры
4921 TextureID
:= TEXTURE_SPECIAL_NONE
;
4928 with gItems
[SelectedObjects
[_id
].ID
] do
4930 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4931 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4932 OnlyDM
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_DM_ONLY
]]);
4933 Fall
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_ITEM_FALLS
]]);
4939 with gMonsters
[SelectedObjects
[_id
].ID
] do
4941 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4942 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4943 Direction
:= NameToDir(vleObjectProperty
.Values
[_lc
[I_PROP_DIRECTION
]]);
4949 with gAreas
[SelectedObjects
[_id
].ID
] do
4951 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4952 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4953 Direction
:= NameToDir(vleObjectProperty
.Values
[_lc
[I_PROP_DIRECTION
]]);
4959 with gTriggers
[SelectedObjects
[_id
].ID
] do
4961 X
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_X
]]));
4962 Y
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_Y
]]));
4963 Width
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_WIDTH
]]));
4964 Height
:= StrToInt(Trim(vleObjectProperty
.Values
[_lc
[I_PROP_HEIGHT
]]));
4965 Enabled
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_ENABLED
]]);
4966 ActivateType
:= StrToActivate(vleObjectProperty
.Values
[_lc
[I_PROP_TR_ACTIVATION
]]);
4967 Key
:= StrToKey(vleObjectProperty
.Values
[_lc
[I_PROP_TR_KEYS
]]);
4972 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_NEXT_MAP
]]);
4973 FillByte(Data
.MapName
[0], 16, 0);
4975 Move(s
[1], Data
.MapName
[0], Min(Length(s
), 16));
4980 Data
.ActivateOnce
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TEXTURE_ONCE
]]);
4981 Data
.AnimOnce
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TEXTURE_ANIM_ONCE
]]);
4984 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
:
4986 Data
.Wait
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_DELAY
]], 0), 65535);
4987 Data
.Count
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_COUNT
]], 0), 65535);
4988 if Data
.Count
< 1 then
4990 if TriggerType
= TRIGGER_PRESS
then
4991 Data
.ExtRandom
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_RANDOM
]]);
4994 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
, TRIGGER_DOOR5
,
4995 TRIGGER_CLOSETRAP
, TRIGGER_TRAP
, TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
,
4998 Data
.NoSound
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SILENT
]]);
4999 Data
.d2d_doors
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_D2D
]]);
5004 Data
.d2d_teleport
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_D2D
]]);
5005 Data
.silent_teleport
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TELEPORT_SILENT
]]);
5006 Data
.TlpDir
:= NameToDirAdv(vleObjectProperty
.Values
[_lc
[I_PROP_TR_TELEPORT_DIR
]]);
5011 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_NAME
]]);
5012 FillByte(Data
.SoundName
[0], 64, 0);
5014 Move(s
[1], Data
.SoundName
[0], Min(Length(s
), 64));
5016 Data
.Volume
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_VOLUME
]], 0), 255);
5017 Data
.Pan
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_PAN
]], 0), 255);
5018 Data
.PlayCount
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_COUNT
]], 0), 255);
5019 Data
.Local
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_LOCAL
]]);
5020 Data
.SoundSwitch
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SOUND_SWITCH
]]);
5023 TRIGGER_SPAWNMONSTER
:
5025 Data
.MonType
:= StrToMonster(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_TYPE
]]);
5026 Data
.MonDir
:= Byte(NameToDir(vleObjectProperty
.Values
[_lc
[I_PROP_DIRECTION
]]));
5027 Data
.MonHealth
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_HEALTH
]], 0), 1000000);
5028 if Data
.MonHealth
< 0 then
5029 Data
.MonHealth
:= 0;
5030 Data
.MonActive
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_ACTIVE
]]);
5031 Data
.MonCount
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 64);
5032 if Data
.MonCount
< 1 then
5034 Data
.MonEffect
:= StrToEffect(vleObjectProperty
.Values
[_lc
[I_PROP_TR_FX_TYPE
]]);
5035 Data
.MonMax
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_MAX
]], 0), 65535);
5036 Data
.MonDelay
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_DELAY
]], 0), 65535);
5038 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_1
] then
5040 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_2
] then
5042 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_3
] then
5044 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_4
] then
5046 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MONSTER_BEHAVIOUR
]] = _lc
[I_PROP_TR_MONSTER_BEHAVIOUR_5
] then
5052 Data
.ItemType
:= StrToItem(vleObjectProperty
.Values
[_lc
[I_PROP_TR_ITEM_TYPE
]]);
5053 Data
.ItemOnlyDM
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_DM_ONLY
]]);
5054 Data
.ItemFalls
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_ITEM_FALLS
]]);
5055 Data
.ItemCount
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 64);
5056 if Data
.ItemCount
< 1 then
5057 Data
.ItemCount
:= 1;
5058 Data
.ItemEffect
:= StrToEffect(vleObjectProperty
.Values
[_lc
[I_PROP_TR_FX_TYPE
]]);
5059 Data
.ItemMax
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_MAX
]], 0), 65535);
5060 Data
.ItemDelay
:= Min(StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SPAWN_DELAY
]], 0), 65535);
5065 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MUSIC_NAME
]]);
5066 FillByte(Data
.MusicName
[0], 64, 0);
5068 Move(s
[1], Data
.MusicName
[0], Min(Length(s
), 64));
5070 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MUSIC_ACT
]] = _lc
[I_PROP_TR_MUSIC_ON
] then
5071 Data
.MusicAction
:= 1
5073 Data
.MusicAction
:= 2;
5078 Data
.PushAngle
:= Min(
5079 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_PUSH_ANGLE
]], 0), 360);
5080 Data
.PushForce
:= Min(
5081 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_PUSH_FORCE
]], 0), 255);
5082 Data
.ResetVel
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_PUSH_RESET
]]);
5087 Data
.ScoreAction
:= 0;
5088 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_ACT
]] = _lc
[I_PROP_TR_SCORE_ACT_1
] then
5089 Data
.ScoreAction
:= 1
5090 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_ACT
]] = _lc
[I_PROP_TR_SCORE_ACT_2
] then
5091 Data
.ScoreAction
:= 2
5092 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_ACT
]] = _lc
[I_PROP_TR_SCORE_ACT_3
] then
5093 Data
.ScoreAction
:= 3;
5094 Data
.ScoreCount
:= Min(Max(
5095 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 0), 255);
5096 Data
.ScoreTeam
:= 0;
5097 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_TEAM
]] = _lc
[I_PROP_TR_SCORE_TEAM_1
] then
5099 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_TEAM
]] = _lc
[I_PROP_TR_SCORE_TEAM_2
] then
5101 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_TEAM
]] = _lc
[I_PROP_TR_SCORE_TEAM_3
] then
5102 Data
.ScoreTeam
:= 3;
5103 Data
.ScoreCon
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_CON
]]);
5104 Data
.ScoreMsg
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SCORE_MSG
]]);
5109 Data
.MessageKind
:= 0;
5110 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_KIND
]] = _lc
[I_PROP_TR_MESSAGE_KIND_1
] then
5111 Data
.MessageKind
:= 1;
5113 Data
.MessageSendTo
:= 0;
5114 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_1
] then
5115 Data
.MessageSendTo
:= 1
5116 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_2
] then
5117 Data
.MessageSendTo
:= 2
5118 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_3
] then
5119 Data
.MessageSendTo
:= 3
5120 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_4
] then
5121 Data
.MessageSendTo
:= 4
5122 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TO
]] = _lc
[I_PROP_TR_MESSAGE_TO_5
] then
5123 Data
.MessageSendTo
:= 5;
5125 s
:= utf2win(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TEXT
]]);
5126 FillByte(Data
.MessageText
[0], 100, 0);
5128 Move(s
[1], Data
.MessageText
[0], Min(Length(s
), 100));
5130 Data
.MessageTime
:= Min(Max(
5131 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_MESSAGE_TIME
]], 0), 0), 65535);
5136 Data
.DamageValue
:= Min(Max(
5137 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_DAMAGE_VALUE
]], 0), 0), 65535);
5138 Data
.DamageInterval
:= Min(Max(
5139 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_INTERVAL
]], 0), 0), 65535);
5144 Data
.HealValue
:= Min(Max(
5145 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_HEALTH
]], 0), 0), 65535);
5146 Data
.HealInterval
:= Min(Max(
5147 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_INTERVAL
]], 0), 0), 65535);
5148 Data
.HealMax
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_HEALTH_MAX
]]);
5149 Data
.HealSilent
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SILENT
]]);
5154 Data
.ShotType
:= StrToShot(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TYPE
]]);
5155 Data
.ShotSound
:= NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_SOUND
]]);
5156 Data
.ShotTarget
:= 0;
5157 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_1
] then
5158 Data
.ShotTarget
:= 1
5159 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_2
] then
5160 Data
.ShotTarget
:= 2
5161 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_3
] then
5162 Data
.ShotTarget
:= 3
5163 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_4
] then
5164 Data
.ShotTarget
:= 4
5165 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_5
] then
5166 Data
.ShotTarget
:= 5
5167 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_TO
]] = _lc
[I_PROP_TR_SHOT_TO_6
] then
5168 Data
.ShotTarget
:= 6;
5169 Data
.ShotIntSight
:= Min(Max(
5170 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_SIGHT
]], 0), 0), 65535);
5172 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AIM
]] = _lc
[I_PROP_TR_SHOT_AIM_1
] then
5174 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AIM
]] = _lc
[I_PROP_TR_SHOT_AIM_2
] then
5176 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AIM
]] = _lc
[I_PROP_TR_SHOT_AIM_3
] then
5178 Data
.ShotAngle
:= Min(
5179 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_ANGLE
]], 0), 360);
5180 Data
.ShotWait
:= Min(Max(
5181 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_DELAY
]], 0), 0), 65535);
5182 Data
.ShotAccuracy
:= Min(Max(
5183 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_ACC
]], 0), 0), 65535);
5184 Data
.ShotAmmo
:= Min(Max(
5185 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_AMMO
]], 0), 0), 65535);
5186 Data
.ShotIntReload
:= Min(Max(
5187 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_SHOT_RELOAD
]], 0), 0), 65535);
5192 Data
.FXCount
:= Min(Max(
5193 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_COUNT
]], 0), 0), 255);
5194 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_TYPE
]] = _lc
[I_PROP_TR_EFFECT_PARTICLE
] then
5196 Data
.FXType
:= TRIGGER_EFFECT_PARTICLE
;
5197 Data
.FXSubType
:= TRIGGER_EFFECT_SLIQUID
;
5198 if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_SLIQUID
] then
5199 Data
.FXSubType
:= TRIGGER_EFFECT_SLIQUID
5200 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_LLIQUID
] then
5201 Data
.FXSubType
:= TRIGGER_EFFECT_LLIQUID
5202 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_DLIQUID
] then
5203 Data
.FXSubType
:= TRIGGER_EFFECT_DLIQUID
5204 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_BLOOD
] then
5205 Data
.FXSubType
:= TRIGGER_EFFECT_BLOOD
5206 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_SPARK
] then
5207 Data
.FXSubType
:= TRIGGER_EFFECT_SPARK
5208 else if vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]] = _lc
[I_PROP_TR_EFFECT_BUBBLE
] then
5209 Data
.FXSubType
:= TRIGGER_EFFECT_BUBBLE
;
5212 Data
.FXType
:= TRIGGER_EFFECT_ANIMATION
;
5213 Data
.FXSubType
:= StrToEffect(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SUBTYPE
]]);
5216 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_COLOR
]], 0), 0), $FFFFFF);
5217 Data
.FXColorR
:= a
and $FF;
5218 Data
.FXColorG
:= (a
shr 8) and $FF;
5219 Data
.FXColorB
:= (a
shr 16) and $FF;
5220 if NameToBool(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_CENTER
]]) then
5224 Data
.FXWait
:= Min(Max(
5225 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EX_DELAY
]], 0), 0), 65535);
5226 Data
.FXVelX
:= Min(Max(
5227 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_VELX
]], 0), -128), 127);
5228 Data
.FXVelY
:= Min(Max(
5229 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_VELY
]], 0), -128), 127);
5230 Data
.FXSpreadL
:= Min(Max(
5231 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPL
]], 0), 0), 255);
5232 Data
.FXSpreadR
:= Min(Max(
5233 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPR
]], 0), 0), 255);
5234 Data
.FXSpreadU
:= Min(Max(
5235 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPU
]], 0), 0), 255);
5236 Data
.FXSpreadD
:= Min(Max(
5237 StrToIntDef(vleObjectProperty
.Values
[_lc
[I_PROP_TR_EFFECT_SPD
]], 0), 0), 255);
5246 vleObjectProperty
.Row
:= r
;
5247 vleObjectProperty
.Col
:= c
;
5250 procedure TMainForm
.bbRemoveTextureClick(Sender
: TObject
);
5254 i
:= lbTextureList
.ItemIndex
;
5258 if MessageBox(0, PChar(Format(_lc
[I_MSG_DEL_TEXTURE_PROMT
],
5259 [SelectedTexture()])),
5260 PChar(_lc
[I_MSG_DEL_TEXTURE
]),
5261 MB_ICONQUESTION
or MB_YESNO
or
5262 MB_DEFBUTTON1
) <> idYes
then
5265 if gPanels
<> nil then
5266 for a
:= 0 to High(gPanels
) do
5267 if (gPanels
[a
].PanelType
<> 0) and
5268 (gPanels
[a
].TextureName
= SelectedTexture()) then
5270 ErrorMessageBox(_lc
[I_MSG_DEL_TEXTURE_CANT
]);
5274 g_DeleteTexture(SelectedTexture());
5275 i
:= slInvalidTextures
.IndexOf(lbTextureList
.Items
[i
]);
5277 slInvalidTextures
.Delete(i
);
5278 if lbTextureList
.ItemIndex
> -1 then
5279 lbTextureList
.Items
.Delete(lbTextureList
.ItemIndex
)
5282 procedure TMainForm
.aNewMapExecute(Sender
: TObject
);
5284 if (MessageBox(0, PChar(_lc
[I_MSG_CLEAR_MAP_PROMT
]),
5285 PChar(_lc
[I_MSG_CLEAR_MAP
]),
5286 MB_ICONQUESTION
or MB_YESNO
or
5287 MB_DEFBUTTON1
) = mrYes
) then
5291 procedure TMainForm
.aUndoExecute(Sender
: TObject
);
5295 if UndoBuffer
= nil then
5297 if UndoBuffer
[High(UndoBuffer
)] = nil then
5300 for a
:= 0 to High(UndoBuffer
[High(UndoBuffer
)]) do
5301 with UndoBuffer
[High(UndoBuffer
)][a
] do
5309 UNDO_DELETE_ITEM
: AddItem(Item
);
5310 UNDO_DELETE_AREA
: AddArea(Area
);
5311 UNDO_DELETE_MONSTER
: AddMonster(Monster
);
5312 UNDO_DELETE_TRIGGER
: AddTrigger(Trigger
);
5313 UNDO_ADD_PANEL
: RemoveObject(AddID
, OBJECT_PANEL
);
5314 UNDO_ADD_ITEM
: RemoveObject(AddID
, OBJECT_ITEM
);
5315 UNDO_ADD_AREA
: RemoveObject(AddID
, OBJECT_AREA
);
5316 UNDO_ADD_MONSTER
: RemoveObject(AddID
, OBJECT_MONSTER
);
5317 UNDO_ADD_TRIGGER
: RemoveObject(AddID
, OBJECT_TRIGGER
);
5321 SetLength(UndoBuffer
, Length(UndoBuffer
)-1);
5323 RemoveSelectFromObjects();
5325 miUndo
.Enabled
:= UndoBuffer
<> nil;
5329 procedure TMainForm
.aCopyObjectExecute(Sender
: TObject
);
5332 CopyBuffer
: TCopyRecArray
;
5336 function CB_Compare(I1
, I2
: TCopyRec
): Integer;
5338 Result
:= Integer(I1
.ObjectType
) - Integer(I2
.ObjectType
);
5340 if Result
= 0 then // Одного типа
5341 Result
:= Integer(I1
.ID
) - Integer(I2
.ID
);
5344 procedure QuickSortCopyBuffer(L
, R
: Integer);
5352 P
:= CopyBuffer
[(L
+ R
) shr 1];
5355 while CB_Compare(CopyBuffer
[I
], P
) < 0 do
5357 while CB_Compare(CopyBuffer
[J
], P
) > 0 do
5363 CopyBuffer
[I
] := CopyBuffer
[J
];
5371 QuickSortCopyBuffer(L
, J
);
5378 if SelectedObjects
= nil then
5384 // Копируем объекты:
5385 for a
:= 0 to High(SelectedObjects
) do
5386 if SelectedObjects
[a
].Live
then
5387 with SelectedObjects
[a
] do
5389 SetLength(CopyBuffer
, Length(CopyBuffer
)+1);
5390 b
:= High(CopyBuffer
);
5391 CopyBuffer
[b
].ID
:= ID
;
5392 CopyBuffer
[b
].Panel
:= nil;
5397 CopyBuffer
[b
].ObjectType
:= OBJECT_PANEL
;
5398 New(CopyBuffer
[b
].Panel
);
5399 CopyBuffer
[b
].Panel
^ := gPanels
[ID
];
5404 CopyBuffer
[b
].ObjectType
:= OBJECT_ITEM
;
5405 CopyBuffer
[b
].Item
:= gItems
[ID
];
5410 CopyBuffer
[b
].ObjectType
:= OBJECT_MONSTER
;
5411 CopyBuffer
[b
].Monster
:= gMonsters
[ID
];
5416 CopyBuffer
[b
].ObjectType
:= OBJECT_AREA
;
5417 CopyBuffer
[b
].Area
:= gAreas
[ID
];
5422 CopyBuffer
[b
].ObjectType
:= OBJECT_TRIGGER
;
5423 CopyBuffer
[b
].Trigger
:= gTriggers
[ID
];
5428 // Сортировка по ID:
5429 if CopyBuffer
<> nil then
5431 QuickSortCopyBuffer(0, b
);
5434 // Пестановка ссылок триггеров:
5435 for a
:= 0 to Length(CopyBuffer
)-1 do
5436 if CopyBuffer
[a
].ObjectType
= OBJECT_TRIGGER
then
5438 case CopyBuffer
[a
].Trigger
.TriggerType
of
5439 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
5440 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
5441 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
5442 if CopyBuffer
[a
].Trigger
.Data
.PanelID
<> -1 then
5446 for b
:= 0 to Length(CopyBuffer
)-1 do
5447 if (CopyBuffer
[b
].ObjectType
= OBJECT_PANEL
) and
5448 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.Data
.PanelID
) then
5450 CopyBuffer
[a
].Trigger
.Data
.PanelID
:= b
;
5455 // Этих панелей нет среди копируемых:
5457 CopyBuffer
[a
].Trigger
.Data
.PanelID
:= -1;
5460 TRIGGER_PRESS
, TRIGGER_ON
,
5461 TRIGGER_OFF
, TRIGGER_ONOFF
:
5462 if CopyBuffer
[a
].Trigger
.Data
.MonsterID
<> 0 then
5466 for b
:= 0 to Length(CopyBuffer
)-1 do
5467 if (CopyBuffer
[b
].ObjectType
= OBJECT_MONSTER
) and
5468 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.Data
.MonsterID
-1) then
5470 CopyBuffer
[a
].Trigger
.Data
.MonsterID
:= b
+1;
5475 // Этих монстров нет среди копируемых:
5477 CopyBuffer
[a
].Trigger
.Data
.MonsterID
:= 0;
5481 if CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
<> -1 then
5485 for b
:= 0 to Length(CopyBuffer
)-1 do
5486 if (CopyBuffer
[b
].ObjectType
= OBJECT_PANEL
) and
5487 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
) then
5489 CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
:= b
;
5494 // Этих панелей нет среди копируемых:
5496 CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
:= -1;
5500 if CopyBuffer
[a
].Trigger
.TexturePanel
<> -1 then
5504 for b
:= 0 to Length(CopyBuffer
)-1 do
5505 if (CopyBuffer
[b
].ObjectType
= OBJECT_PANEL
) and
5506 (Integer(CopyBuffer
[b
].ID
) = CopyBuffer
[a
].Trigger
.TexturePanel
) then
5508 CopyBuffer
[a
].Trigger
.TexturePanel
:= b
;
5513 // Этих панелей нет среди копируемых:
5515 CopyBuffer
[a
].Trigger
.TexturePanel
:= -1;
5520 str
:= CopyBufferToString(CopyBuffer
);
5521 ClipBoard
.AsText
:= str
;
5523 for a
:= 0 to Length(CopyBuffer
)-1 do
5524 if (CopyBuffer
[a
].ObjectType
= OBJECT_PANEL
) and
5525 (CopyBuffer
[a
].Panel
<> nil) then
5526 Dispose(CopyBuffer
[a
].Panel
);
5531 procedure TMainForm
.aPasteObjectExecute(Sender
: TObject
);
5534 CopyBuffer
: TCopyRecArray
;
5536 swad
, ssec
, sres
: String;
5542 pmin
.X
:= High(pmin
.X
);
5543 pmin
.Y
:= High(pmin
.Y
);
5545 StringToCopyBuffer(ClipBoard
.AsText
, CopyBuffer
, pmin
);
5546 rel
:= not(ssShift
in GetKeyShiftState());
5548 if CopyBuffer
= nil then
5551 RemoveSelectFromObjects();
5553 h
:= High(CopyBuffer
);
5555 with CopyBuffer
[a
] do
5559 if Panel
<> nil then
5563 Panel
^.X
:= Panel
^.X
- pmin
.X
- MapOffset
.X
+ 32;
5564 Panel
^.Y
:= Panel
^.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5567 Panel
^.TextureID
:= TEXTURE_SPECIAL_NONE
;
5568 Panel
^.TextureWidth
:= 1;
5569 Panel
^.TextureHeight
:= 1;
5571 if (Panel
^.PanelType
= PANEL_LIFTUP
) or
5572 (Panel
^.PanelType
= PANEL_LIFTDOWN
) or
5573 (Panel
^.PanelType
= PANEL_LIFTLEFT
) or
5574 (Panel
^.PanelType
= PANEL_LIFTRIGHT
) or
5575 (Panel
^.PanelType
= PANEL_BLOCKMON
) or
5576 (Panel
^.TextureName
= '') then
5577 begin // Нет или не может быть текстуры:
5579 else // Есть текстура:
5581 // Обычная текстура:
5582 if not IsSpecialTexture(Panel
^.TextureName
) then
5584 res
:= g_GetTexture(Panel
^.TextureName
, Panel
^.TextureID
);
5588 g_ProcessResourceStr(Panel
^.TextureName
, swad
, ssec
, sres
);
5589 AddTexture(swad
, ssec
, sres
, True);
5590 res
:= g_GetTexture(Panel
^.TextureName
, Panel
^.TextureID
);
5594 g_GetTextureSizeByName(Panel
^.TextureName
,
5595 Panel
^.TextureWidth
, Panel
^.TextureHeight
)
5597 if g_GetTexture('NOTEXTURE', NoTextureID
) then
5599 Panel
^.TextureID
:= TEXTURE_SPECIAL_NOTEXTURE
;
5600 g_GetTextureSizeByID(NoTextureID
, Panel
^.TextureWidth
, Panel
^.TextureHeight
);
5603 else // Спец.текстура:
5605 Panel
^.TextureID
:= SpecialTextureID(Panel
^.TextureName
);
5606 with MainForm
.lbTextureList
.Items
do
5607 if IndexOf(Panel
^.TextureName
) = -1 then
5608 Add(Panel
^.TextureName
);
5612 ID
:= AddPanel(Panel
^);
5614 Undo_Add(OBJECT_PANEL
, ID
, a
> 0);
5615 SelectObject(OBJECT_PANEL
, ID
, True);
5622 Item
.X
:= Item
.X
- pmin
.X
- MapOffset
.X
+ 32;
5623 Item
.Y
:= Item
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5626 ID
:= AddItem(Item
);
5627 Undo_Add(OBJECT_ITEM
, ID
, a
> 0);
5628 SelectObject(OBJECT_ITEM
, ID
, True);
5635 Monster
.X
:= Monster
.X
- pmin
.X
- MapOffset
.X
+ 32;
5636 Monster
.Y
:= Monster
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5639 ID
:= AddMonster(Monster
);
5640 Undo_Add(OBJECT_MONSTER
, ID
, a
> 0);
5641 SelectObject(OBJECT_MONSTER
, ID
, True);
5648 Area
.X
:= Area
.X
- pmin
.X
- MapOffset
.X
+ 32;
5649 Area
.Y
:= Area
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5652 ID
:= AddArea(Area
);
5653 Undo_Add(OBJECT_AREA
, ID
, a
> 0);
5654 SelectObject(OBJECT_AREA
, ID
, True);
5662 X
:= X
- pmin
.X
- MapOffset
.X
+ 32;
5663 Y
:= Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5668 Data
.TargetPoint
.X
:=
5669 Data
.TargetPoint
.X
- pmin
.X
- MapOffset
.X
+ 32;
5670 Data
.TargetPoint
.Y
:=
5671 Data
.TargetPoint
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5673 TRIGGER_PRESS
, TRIGGER_ON
, TRIGGER_OFF
, TRIGGER_ONOFF
:
5675 Data
.tX
:= Data
.tX
- pmin
.X
- MapOffset
.X
+ 32;
5676 Data
.tY
:= Data
.tY
- pmin
.Y
- MapOffset
.Y
+ 32;
5678 TRIGGER_SPAWNMONSTER
:
5681 Data
.MonPos
.X
- pmin
.X
- MapOffset
.X
+ 32;
5683 Data
.MonPos
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5688 Data
.ItemPos
.X
- pmin
.X
- MapOffset
.X
+ 32;
5690 Data
.ItemPos
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5695 Data
.ShotPos
.X
- pmin
.X
- MapOffset
.X
+ 32;
5697 Data
.ShotPos
.Y
- pmin
.Y
- MapOffset
.Y
+ 32;
5702 ID
:= AddTrigger(Trigger
);
5703 Undo_Add(OBJECT_TRIGGER
, ID
, a
> 0);
5704 SelectObject(OBJECT_TRIGGER
, ID
, True);
5709 // Переставляем ссылки триггеров:
5710 for a
:= 0 to High(CopyBuffer
) do
5711 if CopyBuffer
[a
].ObjectType
= OBJECT_TRIGGER
then
5713 case CopyBuffer
[a
].Trigger
.TriggerType
of
5714 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
5715 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
5716 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
5717 if CopyBuffer
[a
].Trigger
.Data
.PanelID
<> -1 then
5718 gTriggers
[CopyBuffer
[a
].ID
].Data
.PanelID
:=
5719 CopyBuffer
[CopyBuffer
[a
].Trigger
.Data
.PanelID
].ID
;
5721 TRIGGER_PRESS
, TRIGGER_ON
,
5722 TRIGGER_OFF
, TRIGGER_ONOFF
:
5723 if CopyBuffer
[a
].Trigger
.Data
.MonsterID
<> 0 then
5724 gTriggers
[CopyBuffer
[a
].ID
].Data
.MonsterID
:=
5725 CopyBuffer
[CopyBuffer
[a
].Trigger
.Data
.MonsterID
-1].ID
+1;
5728 if CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
<> -1 then
5729 gTriggers
[CopyBuffer
[a
].ID
].Data
.ShotPanelID
:=
5730 CopyBuffer
[CopyBuffer
[a
].Trigger
.Data
.ShotPanelID
].ID
;
5733 if CopyBuffer
[a
].Trigger
.TexturePanel
<> -1 then
5734 gTriggers
[CopyBuffer
[a
].ID
].TexturePanel
:=
5735 CopyBuffer
[CopyBuffer
[a
].Trigger
.TexturePanel
].ID
;
5744 procedure TMainForm
.aCutObjectExecute(Sender
: TObject
);
5747 DeleteSelectedObjects();
5750 procedure TMainForm
.vleObjectPropertyEditButtonClick(Sender
: TObject
);
5752 Key
, FileName
: String;
5755 Key
:= vleObjectProperty
.Keys
[vleObjectProperty
.Row
];
5757 if Key
= _lc
[I_PROP_PANEL_TYPE
] then
5759 with ChooseTypeForm
, vleObjectProperty
do
5760 begin // Выбор типа панели:
5761 Caption
:= _lc
[I_PROP_PANEL_TYPE
];
5762 lbTypeSelect
.Items
.Clear();
5764 for b
:= 0 to High(PANELNAMES
) do
5766 lbTypeSelect
.Items
.Add(PANELNAMES
[b
]);
5767 if Values
[Key
] = PANELNAMES
[b
] then
5768 lbTypeSelect
.ItemIndex
:= b
;
5771 if ShowModal() = mrOK
then
5773 b
:= lbTypeSelect
.ItemIndex
;
5774 Values
[Key
] := PANELNAMES
[b
];
5775 vleObjectPropertyApply(Sender
);
5779 else if Key
= _lc
[I_PROP_TR_TELEPORT_TO
] then
5780 SelectFlag
:= SELECTFLAG_TELEPORT
5781 else if Key
= _lc
[I_PROP_TR_SPAWN_TO
] then
5782 SelectFlag
:= SELECTFLAG_SPAWNPOINT
5783 else if (Key
= _lc
[I_PROP_TR_DOOR_PANEL
]) or
5784 (Key
= _lc
[I_PROP_TR_TRAP_PANEL
]) then
5785 SelectFlag
:= SELECTFLAG_DOOR
5786 else if Key
= _lc
[I_PROP_TR_TEXTURE_PANEL
] then
5788 DrawPressRect
:= False;
5789 SelectFlag
:= SELECTFLAG_TEXTURE
;
5791 else if Key
= _lc
[I_PROP_TR_SHOT_PANEL
] then
5792 SelectFlag
:= SELECTFLAG_SHOTPANEL
5793 else if Key
= _lc
[I_PROP_TR_LIFT_PANEL
] then
5794 SelectFlag
:= SELECTFLAG_LIFT
5795 else if key
= _lc
[I_PROP_TR_EX_MONSTER
] then
5796 SelectFlag
:= SELECTFLAG_MONSTER
5797 else if Key
= _lc
[I_PROP_TR_EX_AREA
] then
5799 SelectFlag
:= SELECTFLAG_NONE
;
5800 DrawPressRect
:= True;
5802 else if Key
= _lc
[I_PROP_TR_NEXT_MAP
] then
5803 begin // Выбор следующей карты:
5804 g_ProcessResourceStr(OpenedMap
, @FileName
, nil, nil);
5805 SelectMapForm
.Caption
:= _lc
[I_CAP_SELECT
];
5806 SelectMapForm
.GetMaps(FileName
);
5808 if SelectMapForm
.ShowModal() = mrOK
then
5810 vleObjectProperty
.Values
[Key
] := SelectMapForm
.lbMapList
.Items
[SelectMapForm
.lbMapList
.ItemIndex
];
5811 vleObjectPropertyApply(Sender
);
5814 else if (Key
= _lc
[I_PROP_TR_SOUND_NAME
]) or
5815 (Key
= _lc
[I_PROP_TR_MUSIC_NAME
]) then
5816 begin // Выбор файла звука/музыки:
5817 AddSoundForm
.OKFunction
:= nil;
5818 AddSoundForm
.lbResourcesList
.MultiSelect
:= False;
5819 AddSoundForm
.SetResource
:= vleObjectProperty
.Values
[Key
];
5821 if (AddSoundForm
.ShowModal() = mrOk
) then
5823 vleObjectProperty
.Values
[Key
] := AddSoundForm
.ResourceName
;
5824 vleObjectPropertyApply(Sender
);
5827 else if Key
= _lc
[I_PROP_TR_ACTIVATION
] then
5828 with ActivationTypeForm
, vleObjectProperty
do
5829 begin // Выбор типов активации:
5830 cbPlayerCollide
.Checked
:= Pos('PC', Values
[Key
]) > 0;
5831 cbMonsterCollide
.Checked
:= Pos('MC', Values
[Key
]) > 0;
5832 cbPlayerPress
.Checked
:= Pos('PP', Values
[Key
]) > 0;
5833 cbMonsterPress
.Checked
:= Pos('MP', Values
[Key
]) > 0;
5834 cbShot
.Checked
:= Pos('SH', Values
[Key
]) > 0;
5835 cbNoMonster
.Checked
:= Pos('NM', Values
[Key
]) > 0;
5837 if ShowModal() = mrOK
then
5840 if cbPlayerCollide
.Checked
then
5841 b
:= ACTIVATE_PLAYERCOLLIDE
;
5842 if cbMonsterCollide
.Checked
then
5843 b
:= b
or ACTIVATE_MONSTERCOLLIDE
;
5844 if cbPlayerPress
.Checked
then
5845 b
:= b
or ACTIVATE_PLAYERPRESS
;
5846 if cbMonsterPress
.Checked
then
5847 b
:= b
or ACTIVATE_MONSTERPRESS
;
5848 if cbShot
.Checked
then
5849 b
:= b
or ACTIVATE_SHOT
;
5850 if cbNoMonster
.Checked
then
5851 b
:= b
or ACTIVATE_NOMONSTER
;
5853 Values
[Key
] := ActivateToStr(b
);
5854 vleObjectPropertyApply(Sender
);
5857 else if Key
= _lc
[I_PROP_TR_KEYS
] then
5858 with KeysForm
, vleObjectProperty
do
5859 begin // Выбор необходимых ключей:
5860 cbRedKey
.Checked
:= Pos('RK', Values
[Key
]) > 0;
5861 cbGreenKey
.Checked
:= Pos('GK', Values
[Key
]) > 0;
5862 cbBlueKey
.Checked
:= Pos('BK', Values
[Key
]) > 0;
5863 cbRedTeam
.Checked
:= Pos('RT', Values
[Key
]) > 0;
5864 cbBlueTeam
.Checked
:= Pos('BT', Values
[Key
]) > 0;
5866 if ShowModal() = mrOK
then
5869 if cbRedKey
.Checked
then
5871 if cbGreenKey
.Checked
then
5872 b
:= b
or KEY_GREEN
;
5873 if cbBlueKey
.Checked
then
5875 if cbRedTeam
.Checked
then
5876 b
:= b
or KEY_REDTEAM
;
5877 if cbBlueTeam
.Checked
then
5878 b
:= b
or KEY_BLUETEAM
;
5880 Values
[Key
] := KeyToStr(b
);
5881 vleObjectPropertyApply(Sender
);
5884 else if Key
= _lc
[I_PROP_TR_FX_TYPE
] then
5885 with ChooseTypeForm
, vleObjectProperty
do
5886 begin // Выбор типа эффекта:
5887 Caption
:= _lc
[I_CAP_FX_TYPE
];
5888 lbTypeSelect
.Items
.Clear();
5890 for b
:= EFFECT_NONE
to EFFECT_FIRE
do
5891 lbTypeSelect
.Items
.Add(EffectToStr(b
));
5893 lbTypeSelect
.ItemIndex
:= StrToEffect(Values
[Key
]);
5895 if ShowModal() = mrOK
then
5897 b
:= lbTypeSelect
.ItemIndex
;
5898 Values
[Key
] := EffectToStr(b
);
5899 vleObjectPropertyApply(Sender
);
5902 else if Key
= _lc
[I_PROP_TR_MONSTER_TYPE
] then
5903 with ChooseTypeForm
, vleObjectProperty
do
5904 begin // Выбор типа монстра:
5905 Caption
:= _lc
[I_CAP_MONSTER_TYPE
];
5906 lbTypeSelect
.Items
.Clear();
5908 for b
:= MONSTER_DEMON
to MONSTER_MAN
do
5909 lbTypeSelect
.Items
.Add(MonsterToStr(b
));
5911 lbTypeSelect
.ItemIndex
:= StrToMonster(Values
[Key
]) - MONSTER_DEMON
;
5913 if ShowModal() = mrOK
then
5915 b
:= lbTypeSelect
.ItemIndex
+ MONSTER_DEMON
;
5916 Values
[Key
] := MonsterToStr(b
);
5917 vleObjectPropertyApply(Sender
);
5920 else if Key
= _lc
[I_PROP_TR_ITEM_TYPE
] then
5921 with ChooseTypeForm
, vleObjectProperty
do
5922 begin // Выбор типа предмета:
5923 Caption
:= _lc
[I_CAP_ITEM_TYPE
];
5924 lbTypeSelect
.Items
.Clear();
5926 for b
:= ITEM_MEDKIT_SMALL
to ITEM_KEY_BLUE
do
5927 lbTypeSelect
.Items
.Add(ItemToStr(b
));
5928 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_BOTTLE
));
5929 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_HELMET
));
5930 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_JETPACK
));
5931 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_INVIS
));
5932 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_WEAPON_FLAMETHROWER
));
5933 lbTypeSelect
.Items
.Add(ItemToStr(ITEM_AMMO_FUELCAN
));
5935 b
:= StrToItem(Values
[Key
]);
5936 if b
>= ITEM_BOTTLE
then
5938 lbTypeSelect
.ItemIndex
:= b
- ITEM_MEDKIT_SMALL
;
5940 if ShowModal() = mrOK
then
5942 b
:= lbTypeSelect
.ItemIndex
+ ITEM_MEDKIT_SMALL
;
5943 if b
>= ITEM_WEAPON_KASTET
then
5945 Values
[Key
] := ItemToStr(b
);
5946 vleObjectPropertyApply(Sender
);
5949 else if Key
= _lc
[I_PROP_TR_SHOT_TYPE
] then
5950 with ChooseTypeForm
, vleObjectProperty
do
5951 begin // Выбор типа предмета:
5952 Caption
:= _lc
[I_PROP_TR_SHOT_TYPE
];
5953 lbTypeSelect
.Items
.Clear();
5955 for b
:= TRIGGER_SHOT_PISTOL
to TRIGGER_SHOT_MAX
do
5956 lbTypeSelect
.Items
.Add(ShotToStr(b
));
5958 lbTypeSelect
.ItemIndex
:= StrToShot(Values
[Key
]);
5960 if ShowModal() = mrOK
then
5962 b
:= lbTypeSelect
.ItemIndex
;
5963 Values
[Key
] := ShotToStr(b
);
5964 vleObjectPropertyApply(Sender
);
5967 else if Key
= _lc
[I_PROP_TR_EFFECT_TYPE
] then
5968 with ChooseTypeForm
, vleObjectProperty
do
5969 begin // Выбор типа эффекта:
5970 Caption
:= _lc
[I_CAP_FX_TYPE
];
5971 lbTypeSelect
.Items
.Clear();
5973 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_PARTICLE
]);
5974 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_ANIMATION
]);
5975 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_ANIMATION
] then
5976 lbTypeSelect
.ItemIndex
:= 1
5978 lbTypeSelect
.ItemIndex
:= 0;
5980 if ShowModal() = mrOK
then
5982 b
:= lbTypeSelect
.ItemIndex
;
5984 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_PARTICLE
]
5986 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_ANIMATION
];
5987 vleObjectPropertyApply(Sender
);
5990 else if Key
= _lc
[I_PROP_TR_EFFECT_SUBTYPE
] then
5991 with ChooseTypeForm
, vleObjectProperty
do
5992 begin // Выбор подтипа эффекта:
5993 Caption
:= _lc
[I_CAP_FX_TYPE
];
5994 lbTypeSelect
.Items
.Clear();
5996 if Values
[_lc
[I_PROP_TR_EFFECT_TYPE
]] = _lc
[I_PROP_TR_EFFECT_ANIMATION
] then
5998 for b
:= EFFECT_TELEPORT
to EFFECT_FIRE
do
5999 lbTypeSelect
.Items
.Add(EffectToStr(b
));
6001 lbTypeSelect
.ItemIndex
:= StrToEffect(Values
[Key
]) - 1;
6004 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_SLIQUID
]);
6005 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_LLIQUID
]);
6006 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_DLIQUID
]);
6007 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_BLOOD
]);
6008 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_SPARK
]);
6009 lbTypeSelect
.Items
.Add(_lc
[I_PROP_TR_EFFECT_BUBBLE
]);
6010 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_SLIQUID
;
6011 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_LLIQUID
] then
6012 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_LLIQUID
;
6013 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_DLIQUID
] then
6014 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_DLIQUID
;
6015 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_BLOOD
] then
6016 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_BLOOD
;
6017 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_SPARK
] then
6018 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_SPARK
;
6019 if Values
[Key
] = _lc
[I_PROP_TR_EFFECT_BUBBLE
] then
6020 lbTypeSelect
.ItemIndex
:= TRIGGER_EFFECT_BUBBLE
;
6023 if ShowModal() = mrOK
then
6025 b
:= lbTypeSelect
.ItemIndex
;
6027 if Values
[_lc
[I_PROP_TR_EFFECT_TYPE
]] = _lc
[I_PROP_TR_EFFECT_ANIMATION
] then
6028 Values
[Key
] := EffectToStr(b
+ 1)
6030 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_SLIQUID
];
6031 if b
= TRIGGER_EFFECT_LLIQUID
then
6032 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_LLIQUID
];
6033 if b
= TRIGGER_EFFECT_DLIQUID
then
6034 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_DLIQUID
];
6035 if b
= TRIGGER_EFFECT_BLOOD
then
6036 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_BLOOD
];
6037 if b
= TRIGGER_EFFECT_SPARK
then
6038 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_SPARK
];
6039 if b
= TRIGGER_EFFECT_BUBBLE
then
6040 Values
[Key
] := _lc
[I_PROP_TR_EFFECT_BUBBLE
];
6043 vleObjectPropertyApply(Sender
);
6046 else if Key
= _lc
[I_PROP_TR_EFFECT_COLOR
] then
6047 with vleObjectProperty
do
6048 begin // Выбор цвета эффекта:
6049 ColorDialog
.Color
:= StrToIntDef(Values
[Key
], 0);
6050 if ColorDialog
.Execute
then
6052 Values
[Key
] := IntToStr(ColorDialog
.Color
);
6053 vleObjectPropertyApply(Sender
);
6056 else if Key
= _lc
[I_PROP_PANEL_TEX
] then
6057 begin // Смена текстуры:
6058 vleObjectProperty
.Values
[Key
] := SelectedTexture();
6059 vleObjectPropertyApply(Sender
);
6063 procedure TMainForm
.vleObjectPropertyApply(Sender
: TObject
);
6065 // hack to prevent empty ID in list
6066 RenderPanel
.SetFocus();
6067 bApplyProperty
.Click();
6068 vleObjectProperty
.SetFocus();
6071 procedure TMainForm
.aSaveMapExecute(Sender
: TObject
);
6073 FileName
, Section
, Res
: String;
6075 if OpenedMap
= '' then
6077 aSaveMapAsExecute(nil);
6081 g_ProcessResourceStr(OpenedMap
, FileName
, Section
, Res
);
6083 SaveMap(FileName
+':\'+Res
);
6086 procedure TMainForm
.aOpenMapExecute(Sender
: TObject
);
6088 OpenDialog
.Filter
:= _lc
[I_FILE_FILTER_ALL
];
6090 if OpenDialog
.Execute() then
6092 OpenMapFile(OpenDialog
.FileName
);
6093 OpenDialog
.InitialDir
:= ExtractFileDir(OpenDialog
.FileName
);
6097 procedure TMainForm
.OpenMapFile(FileName
: String);
6099 if (Pos('.ini', LowerCase(ExtractFileName(FileName
))) > 0) then
6103 pLoadProgress
.Left
:= (RenderPanel
.Width
div 2)-(pLoadProgress
.Width
div 2);
6104 pLoadProgress
.Top
:= (RenderPanel
.Height
div 2)-(pLoadProgress
.Height
div 2);
6105 pLoadProgress
.Show();
6110 LoadMapOld(FileName
);
6112 MainForm
.Caption
:= Format('%s - %s', [FormCaption
, ExtractFileName(FileName
)]);
6114 pLoadProgress
.Hide();
6115 MainForm
.FormResize(Self
);
6117 else // Карты из WAD:
6119 OpenMap(FileName
, '');
6123 procedure TMainForm
.FormActivate(Sender
: TObject
);
6128 MainForm
.ActiveControl
:= RenderPanel
;
6131 if gLanguage
= '' then
6133 lang
:= SelectLanguageForm
.ShowModal();
6135 1: gLanguage
:= LANGUAGE_ENGLISH
;
6136 else gLanguage
:= LANGUAGE_RUSSIAN
;
6139 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
6140 config
.WriteStr('Editor', 'Language', gLanguage
);
6141 config
.SaveFile(EditorDir
+'Editor.cfg');
6145 //e_WriteLog('Read language file', MSG_NOTIFY);
6146 //g_Language_Load(EditorDir+'\data\'+gLanguage+LANGUAGE_FILE_NAME);
6147 g_Language_Set(gLanguage
);
6150 procedure TMainForm
.aDeleteMap(Sender
: TObject
);
6158 OpenDialog
.Filter
:= _lc
[I_FILE_FILTER_WAD
];
6160 if not OpenDialog
.Execute() then
6163 WAD
:= TWADEditor_1
.Create();
6165 if not WAD
.ReadFile(OpenDialog
.FileName
) then
6173 MapList
:= WAD
.GetResourcesList('');
6175 SelectMapForm
.Caption
:= _lc
[I_CAP_REMOVE
];
6176 SelectMapForm
.lbMapList
.Items
.Clear();
6178 if MapList
<> nil then
6179 for a
:= 0 to High(MapList
) do
6180 SelectMapForm
.lbMapList
.Items
.Add(win2utf(MapList
[a
]));
6182 if (SelectMapForm
.ShowModal() = mrOK
) then
6184 str
:= SelectMapForm
.lbMapList
.Items
[SelectMapForm
.lbMapList
.ItemIndex
];
6186 Move(str
[1], MapName
[0], Min(16, Length(str
)));
6188 if MessageBox(0, PChar(Format(_lc
[I_MSG_DELETE_MAP_PROMT
],
6189 [MapName
, OpenDialog
.FileName
])),
6190 PChar(_lc
[I_MSG_DELETE_MAP
]),
6191 MB_ICONQUESTION
or MB_YESNO
or
6192 MB_DEFBUTTON2
) <> mrYes
then
6195 WAD
.RemoveResource('', utf2win(MapName
));
6197 MessageBox(0, PChar(Format(_lc
[I_MSG_MAP_DELETED_PROMT
],
6199 PChar(_lc
[I_MSG_MAP_DELETED
]),
6200 MB_ICONINFORMATION
or MB_OK
or
6203 WAD
.SaveTo(OpenDialog
.FileName
);
6205 // Удалили текущую карту - сохранять по старому ее нельзя:
6206 if OpenedMap
= (OpenDialog
.FileName
+':\'+MapName
) then
6210 MainForm
.Caption
:= FormCaption
;
6217 procedure TMainForm
.vleObjectPropertyKeyDown(Sender
: TObject
;
6218 var Key
: Word; Shift
: TShiftState
);
6220 if Key
= VK_RETURN
then
6221 vleObjectPropertyApply(Sender
);
6224 procedure MovePanel(var ID
: DWORD
; MoveType
: Byte);
6229 if (ID
= 0) and (MoveType
= 0) then
6231 if (ID
= DWORD(High(gPanels
))) and (MoveType
<> 0) then
6233 if (ID
> DWORD(High(gPanels
))) then
6238 if MoveType
= 0 then // to Back
6240 if gTriggers
<> nil then
6241 for a
:= 0 to High(gTriggers
) do
6242 with gTriggers
[a
] do
6244 if TriggerType
= TRIGGER_NONE
then
6247 if TexturePanel
= _id
then
6250 if (TexturePanel
>= 0) and (TexturePanel
< _id
) then
6254 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
6255 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
6256 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
6257 if Data
.PanelID
= _id
then
6260 if (Data
.PanelID
>= 0) and (Data
.PanelID
< _id
) then
6264 if Data
.ShotPanelID
= _id
then
6265 Data
.ShotPanelID
:= 0
6267 if (Data
.ShotPanelID
>= 0) and (Data
.ShotPanelID
< _id
) then
6268 Inc(Data
.ShotPanelID
);
6272 tmp
:= gPanels
[_id
];
6274 for a
:= _id
downto 1 do
6275 gPanels
[a
] := gPanels
[a
-1];
6283 if gTriggers
<> nil then
6284 for a
:= 0 to High(gTriggers
) do
6285 with gTriggers
[a
] do
6287 if TriggerType
= TRIGGER_NONE
then
6290 if TexturePanel
= _id
then
6291 TexturePanel
:= High(gPanels
)
6293 if TexturePanel
> _id
then
6297 TRIGGER_OPENDOOR
, TRIGGER_CLOSEDOOR
, TRIGGER_DOOR
,
6298 TRIGGER_DOOR5
, TRIGGER_CLOSETRAP
, TRIGGER_TRAP
,
6299 TRIGGER_LIFTUP
, TRIGGER_LIFTDOWN
, TRIGGER_LIFT
:
6300 if Data
.PanelID
= _id
then
6301 Data
.PanelID
:= High(gPanels
)
6303 if Data
.PanelID
> _id
then
6307 if Data
.ShotPanelID
= _id
then
6308 Data
.ShotPanelID
:= High(gPanels
)
6310 if Data
.ShotPanelID
> _id
then
6311 Dec(Data
.ShotPanelID
);
6315 tmp
:= gPanels
[_id
];
6317 for a
:= _id
to High(gPanels
)-1 do
6318 gPanels
[a
] := gPanels
[a
+1];
6320 gPanels
[High(gPanels
)] := tmp
;
6322 ID
:= High(gPanels
);
6326 procedure TMainForm
.aMoveToBack(Sender
: TObject
);
6330 if SelectedObjects
= nil then
6333 for a
:= 0 to High(SelectedObjects
) do
6334 with SelectedObjects
[a
] do
6335 if Live
and (ObjectType
= OBJECT_PANEL
) then
6337 SelectedObjects
[0] := SelectedObjects
[a
];
6338 SetLength(SelectedObjects
, 1);
6345 procedure TMainForm
.aMoveToFore(Sender
: TObject
);
6349 if SelectedObjects
= nil then
6352 for a
:= 0 to High(SelectedObjects
) do
6353 with SelectedObjects
[a
] do
6354 if Live
and (ObjectType
= OBJECT_PANEL
) then
6356 SelectedObjects
[0] := SelectedObjects
[a
];
6357 SetLength(SelectedObjects
, 1);
6364 procedure TMainForm
.aSaveMapAsExecute(Sender
: TObject
);
6368 SaveDialog
.Filter
:= _lc
[I_FILE_FILTER_WAD
];
6370 if not SaveDialog
.Execute() then
6373 SaveMapForm
.GetMaps(SaveDialog
.FileName
, True);
6375 if SaveMapForm
.ShowModal() <> mrOK
then
6378 SaveDialog
.InitialDir
:= ExtractFileDir(SaveDialog
.FileName
);
6379 OpenedMap
:= SaveDialog
.FileName
+':\'+SaveMapForm
.eMapName
.Text;
6380 OpenedWAD
:= SaveDialog
.FileName
;
6382 idx
:= RecentFiles
.IndexOf(OpenedMap
);
6383 // Такая карта уже недавно открывалась:
6385 RecentFiles
.Delete(idx
);
6386 RecentFiles
.Insert(0, OpenedMap
);
6391 gMapInfo
.FileName
:= SaveDialog
.FileName
;
6392 gMapInfo
.MapName
:= SaveMapForm
.eMapName
.Text;
6393 UpdateCaption(gMapInfo
.Name
, ExtractFileName(gMapInfo
.FileName
), gMapInfo
.MapName
);
6396 procedure TMainForm
.aSelectAllExecute(Sender
: TObject
);
6400 RemoveSelectFromObjects();
6402 case pcObjects
.ActivePageIndex
+1 of
6404 if gPanels
<> nil then
6405 for a
:= 0 to High(gPanels
) do
6406 if gPanels
[a
].PanelType
<> PANEL_NONE
then
6407 SelectObject(OBJECT_PANEL
, a
, True);
6409 if gItems
<> nil then
6410 for a
:= 0 to High(gItems
) do
6411 if gItems
[a
].ItemType
<> ITEM_NONE
then
6412 SelectObject(OBJECT_ITEM
, a
, True);
6414 if gMonsters
<> nil then
6415 for a
:= 0 to High(gMonsters
) do
6416 if gMonsters
[a
].MonsterType
<> MONSTER_NONE
then
6417 SelectObject(OBJECT_MONSTER
, a
, True);
6419 if gAreas
<> nil then
6420 for a
:= 0 to High(gAreas
) do
6421 if gAreas
[a
].AreaType
<> AREA_NONE
then
6422 SelectObject(OBJECT_AREA
, a
, True);
6424 if gTriggers
<> nil then
6425 for a
:= 0 to High(gTriggers
) do
6426 if gTriggers
[a
].TriggerType
<> TRIGGER_NONE
then
6427 SelectObject(OBJECT_TRIGGER
, a
, True);
6430 RecountSelectedObjects();
6433 procedure TMainForm
.tbGridOnClick(Sender
: TObject
);
6435 DotEnable
:= not DotEnable
;
6436 (Sender
as TToolButton
).Down
:= DotEnable
;
6439 procedure TMainForm
.OnIdle(Sender
: TObject
; var Done
: Boolean);
6441 // FIXME: this is a shitty hack
6442 if not gDataLoaded
then
6444 e_WriteLog('Init OpenGL', MSG_NOTIFY
);
6446 e_WriteLog('Loading data', MSG_NOTIFY
);
6447 LoadStdFont('STDTXT', 'STDFONT', gEditorFont
);
6448 e_WriteLog('Loading more data', MSG_NOTIFY
);
6450 e_WriteLog('Loading even more data', MSG_NOTIFY
);
6451 gDataLoaded
:= True;
6452 MainForm
.FormResize(nil);
6457 procedure TMainForm
.miMapPreviewClick(Sender
: TObject
);
6459 if PreviewMode
= 2 then
6462 if PreviewMode
= 0 then
6464 Splitter2
.Visible
:= False;
6465 Splitter1
.Visible
:= False;
6466 StatusBar
.Visible
:= False;
6467 PanelObjs
.Visible
:= False;
6468 PanelProps
.Visible
:= False;
6469 MainToolBar
.Visible
:= False;
6470 sbHorizontal
.Visible
:= False;
6471 sbVertical
.Visible
:= False;
6475 StatusBar
.Visible
:= True;
6476 PanelObjs
.Visible
:= True;
6477 PanelProps
.Visible
:= True;
6478 Splitter2
.Visible
:= True;
6479 Splitter1
.Visible
:= True;
6480 MainToolBar
.Visible
:= True;
6481 sbHorizontal
.Visible
:= True;
6482 sbVertical
.Visible
:= True;
6485 PreviewMode
:= PreviewMode
xor 1;
6486 (Sender
as TMenuItem
).Checked
:= PreviewMode
> 0;
6491 procedure TMainForm
.miLayer1Click(Sender
: TObject
);
6493 SwitchLayer(LAYER_BACK
);
6496 procedure TMainForm
.miLayer2Click(Sender
: TObject
);
6498 SwitchLayer(LAYER_WALLS
);
6501 procedure TMainForm
.miLayer3Click(Sender
: TObject
);
6503 SwitchLayer(LAYER_FOREGROUND
);
6506 procedure TMainForm
.miLayer4Click(Sender
: TObject
);
6508 SwitchLayer(LAYER_STEPS
);
6511 procedure TMainForm
.miLayer5Click(Sender
: TObject
);
6513 SwitchLayer(LAYER_WATER
);
6516 procedure TMainForm
.miLayer6Click(Sender
: TObject
);
6518 SwitchLayer(LAYER_ITEMS
);
6521 procedure TMainForm
.miLayer7Click(Sender
: TObject
);
6523 SwitchLayer(LAYER_MONSTERS
);
6526 procedure TMainForm
.miLayer8Click(Sender
: TObject
);
6528 SwitchLayer(LAYER_AREAS
);
6531 procedure TMainForm
.miLayer9Click(Sender
: TObject
);
6533 SwitchLayer(LAYER_TRIGGERS
);
6536 procedure TMainForm
.tbShowClick(Sender
: TObject
);
6542 for a
:= 0 to High(LayerEnabled
) do
6543 b
:= b
and LayerEnabled
[a
];
6547 ShowLayer(LAYER_BACK
, b
);
6548 ShowLayer(LAYER_WALLS
, b
);
6549 ShowLayer(LAYER_FOREGROUND
, b
);
6550 ShowLayer(LAYER_STEPS
, b
);
6551 ShowLayer(LAYER_WATER
, b
);
6552 ShowLayer(LAYER_ITEMS
, b
);
6553 ShowLayer(LAYER_MONSTERS
, b
);
6554 ShowLayer(LAYER_AREAS
, b
);
6555 ShowLayer(LAYER_TRIGGERS
, b
);
6558 procedure TMainForm
.miMiniMapClick(Sender
: TObject
);
6563 procedure TMainForm
.miSwitchGridClick(Sender
: TObject
);
6565 if DotStep
= DotStepOne
then
6566 DotStep
:= DotStepTwo
6568 DotStep
:= DotStepOne
;
6570 MousePos
.X
:= (MousePos
.X
div DotStep
) * DotStep
;
6571 MousePos
.Y
:= (MousePos
.Y
div DotStep
) * DotStep
;
6574 procedure TMainForm
.miShowEdgesClick(Sender
: TObject
);
6579 procedure TMainForm
.miSnapToGridClick(Sender
: TObject
);
6581 SnapToGrid
:= not SnapToGrid
;
6583 MousePos
.X
:= (MousePos
.X
div DotStep
) * DotStep
;
6584 MousePos
.Y
:= (MousePos
.Y
div DotStep
) * DotStep
;
6586 miSnapToGrid
.Checked
:= SnapToGrid
;
6589 procedure TMainForm
.minexttabClick(Sender
: TObject
);
6591 if pcObjects
.ActivePageIndex
< pcObjects
.PageCount
-1 then
6592 pcObjects
.ActivePageIndex
:= pcObjects
.ActivePageIndex
+1
6594 pcObjects
.ActivePageIndex
:= 0;
6597 procedure TMainForm
.miSaveMiniMapClick(Sender
: TObject
);
6599 SaveMiniMapForm
.ShowModal();
6602 procedure TMainForm
.bClearTextureClick(Sender
: TObject
);
6604 lbTextureList
.ItemIndex
:= -1;
6605 lTextureWidth
.Caption
:= '';
6606 lTextureHeight
.Caption
:= '';
6609 procedure TMainForm
.miPackMapClick(Sender
: TObject
);
6611 PackMapForm
.ShowModal();
6614 procedure TMainForm
.miMapTestSettingsClick(Sender
: TObject
);
6616 MapTestForm
.ShowModal();
6619 procedure TMainForm
.miTestMapClick(Sender
: TObject
);
6621 cmd
, mapWAD
, mapToRun
, tempWAD
: String;
6628 if OpenedMap
<> '' then
6630 // Указываем текущую карту для теста:
6631 g_ProcessResourceStr(OpenedMap
, @mapWAD
, nil, @mapToRun
);
6632 mapToRun
:= mapWAD
+ ':\' + mapToRun
;
6633 mapToRun
:= ExtractRelativePath(ExtractFilePath(TestD2dExe
) + 'maps/', mapToRun
);
6635 // Сохраняем временную карту:
6638 mapWAD
:= ExtractFilePath(TestD2dExe
) + Format('maps/temp%.4d.wad', [time
]);
6640 until not FileExists(mapWAD
);
6641 tempWAD
:= mapWAD
+ ':\' + TEST_MAP_NAME
;
6644 tempWAD
:= ExtractRelativePath(ExtractFilePath(TestD2dExe
) + 'maps/', tempWAD
);
6645 // Если карта не была открыта, указываем временную в качестве текущей:
6646 if mapToRun
= '' then
6647 mapToRun
:= tempWAD
;
6651 if TestOptionsTwoPlayers
then
6653 if TestOptionsTeamDamage
then
6655 if TestOptionsAllowExit
then
6657 if TestOptionsWeaponStay
then
6659 if TestOptionsMonstersDM
then
6662 // Составляем командную строку:
6663 cmd
:= '-map "' + mapToRun
+ '"';
6664 cmd
:= cmd
+ ' -testmap "' + tempWAD
+ '"';
6665 cmd
:= cmd
+ ' -gm ' + TestGameMode
;
6666 cmd
:= cmd
+ ' -limt ' + TestLimTime
;
6667 cmd
:= cmd
+ ' -lims ' + TestLimScore
;
6668 cmd
:= cmd
+ ' -opt ' + IntToStr(opt
);
6671 cmd
:= cmd
+ ' --close';
6673 cmd
:= cmd
+ ' --debug';
6676 proc
:= TProcessUTF8
.Create(nil);
6677 proc
.Executable
:= TestD2dExe
;
6678 proc
.Parameters
.Add(cmd
);
6687 Application
.Minimize();
6690 if (not res
) or (proc
.ExitCode
< 0) then
6692 MessageBox(0, 'FIXME',
6693 PChar(_lc
[I_MSG_EXEC_ERROR
]),
6694 MB_OK
or MB_ICONERROR
);
6698 SysUtils
.DeleteFile(mapWAD
);
6699 Application
.Restore();
6702 procedure TMainForm
.sbVerticalScroll(Sender
: TObject
;
6703 ScrollCode
: TScrollCode
; var ScrollPos
: Integer);
6705 MapOffset
.Y
:= -Normalize16(sbVertical
.Position
);
6708 procedure TMainForm
.sbHorizontalScroll(Sender
: TObject
;
6709 ScrollCode
: TScrollCode
; var ScrollPos
: Integer);
6711 MapOffset
.X
:= -Normalize16(sbHorizontal
.Position
);
6714 procedure TMainForm
.miOpenWadMapClick(Sender
: TObject
);
6716 if OpenedWAD
<> '' then
6718 OpenMap(OpenedWAD
, '');
6722 procedure TMainForm
.selectall1Click(Sender
: TObject
);
6726 RemoveSelectFromObjects();
6728 if gPanels
<> nil then
6729 for a
:= 0 to High(gPanels
) do
6730 if gPanels
[a
].PanelType
<> PANEL_NONE
then
6731 SelectObject(OBJECT_PANEL
, a
, True);
6733 if gItems
<> nil then
6734 for a
:= 0 to High(gItems
) do
6735 if gItems
[a
].ItemType
<> ITEM_NONE
then
6736 SelectObject(OBJECT_ITEM
, a
, True);
6738 if gMonsters
<> nil then
6739 for a
:= 0 to High(gMonsters
) do
6740 if gMonsters
[a
].MonsterType
<> MONSTER_NONE
then
6741 SelectObject(OBJECT_MONSTER
, a
, True);
6743 if gAreas
<> nil then
6744 for a
:= 0 to High(gAreas
) do
6745 if gAreas
[a
].AreaType
<> AREA_NONE
then
6746 SelectObject(OBJECT_AREA
, a
, True);
6748 if gTriggers
<> nil then
6749 for a
:= 0 to High(gTriggers
) do
6750 if gTriggers
[a
].TriggerType
<> TRIGGER_NONE
then
6751 SelectObject(OBJECT_TRIGGER
, a
, True);
6753 RecountSelectedObjects();
6756 procedure TMainForm
.Splitter1CanResize(Sender
: TObject
;
6757 var NewSize
: Integer; var Accept
: Boolean);
6759 Accept
:= (NewSize
> 140);
6762 procedure TMainForm
.Splitter2CanResize(Sender
: TObject
;
6763 var NewSize
: Integer; var Accept
: Boolean);
6765 Accept
:= (NewSize
> 110);
6768 procedure TMainForm
.vleObjectPropertyEnter(Sender
: TObject
);
6770 EditingProperties
:= True;
6773 procedure TMainForm
.vleObjectPropertyExit(Sender
: TObject
);
6775 EditingProperties
:= False;
6778 procedure TMainForm
.FormKeyUp(Sender
: TObject
; var Key
: Word;
6779 Shift
: TShiftState
);
6781 // Объекты передвигались:
6782 if MainForm
.ActiveControl
= RenderPanel
then
6784 if (Key
= VK_NUMPAD4
) or
6785 (Key
= VK_NUMPAD6
) or
6786 (Key
= VK_NUMPAD8
) or
6787 (Key
= VK_NUMPAD5
) or
6788 (Key
= Ord('V')) then
6791 // Быстрое превью карты:
6792 if Key
= Ord('E') then
6794 if PreviewMode
= 2 then
6797 RenderPanelMouseMove(Sender
, Shift
, RenderMousePos().X
, RenderMousePos().Y
);