DEADSOFTWARE

Triggers: Add DamageKind to TRIGGER_DAMAGE
authorfgsfds <pvt.fgsfds@gmail.com>
Mon, 5 Aug 2019 22:31:39 +0000 (01:31 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Mon, 5 Aug 2019 22:31:39 +0000 (01:31 +0300)
src/editor/f_main.pas
src/editor/g_language.pas
src/shared/MAPDEF.pas
src/shared/mapstructio.inc

index 481f597163599fabe72c50eba1127988af2abb0e..74d43c0b59d93824edf5b0956cff19186d9e1250 100644 (file)
@@ -1410,6 +1410,20 @@ begin
                   EditStyle := esSimple;
                   MaxLength := 5;
                 end;
+                case Data.DamageKind of
+                  3: str := _lc[I_PROP_TR_DAMAGE_KIND_3];
+                  4: str := _lc[I_PROP_TR_DAMAGE_KIND_4];
+                  5: str := _lc[I_PROP_TR_DAMAGE_KIND_5];
+                  6: str := _lc[I_PROP_TR_DAMAGE_KIND_6];
+                  7: str := _lc[I_PROP_TR_DAMAGE_KIND_7];
+                  8: str := _lc[I_PROP_TR_DAMAGE_KIND_8];
+                  else str := _lc[I_PROP_TR_DAMAGE_KIND_0];
+                end;
+                with ItemProps[InsertRow(_lc[I_PROP_TR_DAMAGE_KIND], str, True)] do
+                begin
+                  EditStyle := esPickList;
+                  ReadOnly := True;
+                end;
               end;
 
             TRIGGER_HEALTH:
@@ -4765,6 +4779,16 @@ begin
         Values.Add(_lc[I_PROP_TR_SHOT_AIM_2]);
         Values.Add(_lc[I_PROP_TR_SHOT_AIM_3]);
       end
+    else if KeyName = _lc[I_PROP_TR_DAMAGE_KIND] then
+      begin
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_0]);
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_3]);
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_4]);
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_5]);
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_6]);
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_7]);
+        Values.Add(_lc[I_PROP_TR_DAMAGE_KIND_8]);
+      end
     else if (KeyName = _lc[I_PROP_PANEL_BLEND]) or
             (KeyName = _lc[I_PROP_DM_ONLY]) or
             (KeyName = _lc[I_PROP_ITEM_FALLS]) or
@@ -5168,6 +5192,21 @@ begin
                   StrToIntDef(vleObjectProperty.Values[_lc[I_PROP_TR_DAMAGE_VALUE]], 0), 0), 65535);
                 Data.DamageInterval := Min(Max(
                   StrToIntDef(vleObjectProperty.Values[_lc[I_PROP_TR_INTERVAL]], 0), 0), 65535);
+                s := vleObjectProperty.Values[_lc[I_PROP_TR_DAMAGE_KIND]];
+                if s = _lc[I_PROP_TR_DAMAGE_KIND_3] then
+                  Data.DamageKind := 3
+                else if s = _lc[I_PROP_TR_DAMAGE_KIND_4] then
+                  Data.DamageKind := 4
+                else if s = _lc[I_PROP_TR_DAMAGE_KIND_5] then
+                  Data.DamageKind := 5
+                else if s = _lc[I_PROP_TR_DAMAGE_KIND_6] then
+                  Data.DamageKind := 6
+                else if s = _lc[I_PROP_TR_DAMAGE_KIND_7] then
+                  Data.DamageKind := 7
+                else if s = _lc[I_PROP_TR_DAMAGE_KIND_8] then
+                  Data.DamageKind := 8
+                else
+                  Data.DamageKind := 0;
               end;
 
             TRIGGER_HEALTH:
index ea8c56292ad54cb666a9c6243520893fc95b95ec..0ba24c1550d1b554320cf93529881b3e01e4eb39 100644 (file)
@@ -234,6 +234,14 @@ Type
     I_PROP_TR_SCORE_CON,
     I_PROP_TR_SCORE_MSG,
     I_PROP_TR_DAMAGE_VALUE,
+    I_PROP_TR_DAMAGE_KIND,
+    I_PROP_TR_DAMAGE_KIND_0,
+    I_PROP_TR_DAMAGE_KIND_3,
+    I_PROP_TR_DAMAGE_KIND_4,
+    I_PROP_TR_DAMAGE_KIND_5,
+    I_PROP_TR_DAMAGE_KIND_6,
+    I_PROP_TR_DAMAGE_KIND_7,
+    I_PROP_TR_DAMAGE_KIND_8,
     I_PROP_TR_HEALTH_MAX,
     I_PROP_TR_SHOT_TYPE,
     I_PROP_TR_SHOT_SOUND,
@@ -1092,6 +1100,22 @@ Const
                                        'Сообщение в игру'),
     ('PROP TR DAMAGE VALUE',           'Damage',
                                        'Ущерб'),
+    ('PROP TR DAMAGE KIND',            'Damage type',
+                                       'Тип урона'),
+    ('PROP TR DAMAGE KIND 0',          'HIT_SOME',
+                                       'HIT_SOME'),
+    ('PROP TR DAMAGE KIND 3',          'HIT_TRAP',
+                                       'HIT_TRAP'),
+    ('PROP TR DAMAGE KIND 4',          'HIT_FALL',
+                                       'HIT_FALL'),
+    ('PROP TR DAMAGE KIND 5',          'HIT_WATER',
+                                       'HIT_WATER'),
+    ('PROP TR DAMAGE KIND 6',          'HIT_ACID',
+                                       'HIT_ACID'),
+    ('PROP TR DAMAGE KIND 7',          'HIT_ELECTRO',
+                                       'HIT_ELECTRO'),
+    ('PROP TR DAMAGE KIND 8',          'HIT_FLAME',
+                                       'HIT_FLAME'),
     ('PROP TR HEALTH MAX',             'To maximum',
                                        'До максимума'),
     ('PROP TR SHOT TYPE',              'Projectile',
index a94f1ecd0c2b006541d9ff07f753d17993cf3eb3..b39b5fabb3ba64de636e9564036d96d1dc8c5736 100644 (file)
@@ -293,7 +293,8 @@ Type
                              MessageText: Char100;
                              MessageTime: Word);
       TRIGGER_DAMAGE:       (DamageValue: Word;
-                             DamageInterval: Word);
+                             DamageInterval: Word;
+                             DamageKind: Byte);
       TRIGGER_HEALTH:       (HealValue: Word;
                              HealInterval: Word;
                              HealMax: Boolean;
index ae432b9614f0a857f524af2fa522be8b06d8d2fa..d1198d539aadee69b5e2961350d172dcc20f6cb8 100644 (file)
@@ -184,6 +184,7 @@ procedure mb_Read_TriggerData (var tr: TTriggerData; ttype: Integer; const buf;
   begin
     getWordAt(tr.DamageValue, buf, 0);
     getWordAt(tr.DamageInterval, buf, 2);
+    getBytesAt(tr.DamageKind, buf, 4);
   end;
 
   procedure xreadHealth ();
@@ -495,6 +496,7 @@ procedure mb_Write_TriggerData (var buf; bufsize: Integer; ttype: Integer; var t
   begin
     putWordAt(buf, 0, tr.DamageValue);
     putWordAt(buf, 2, tr.DamageInterval);
+    putBytesAt(buf, 4, tr.DamageKind);
   end;
 
   procedure xwriteHealth ();