From 3f6a265be15702407d13e055359463f27dd3e742 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 6 Aug 2019 01:31:39 +0300 Subject: [PATCH] Triggers: Add DamageKind to TRIGGER_DAMAGE --- src/editor/f_main.pas | 39 ++++++++++++++++++++++++++++++++++++++ src/editor/g_language.pas | 24 +++++++++++++++++++++++ src/shared/MAPDEF.pas | 3 ++- src/shared/mapstructio.inc | 2 ++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 481f597..74d43c0 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -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: diff --git a/src/editor/g_language.pas b/src/editor/g_language.pas index ea8c562..0ba24c1 100644 --- a/src/editor/g_language.pas +++ b/src/editor/g_language.pas @@ -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', diff --git a/src/shared/MAPDEF.pas b/src/shared/MAPDEF.pas index a94f1ec..b39b5fa 100644 --- a/src/shared/MAPDEF.pas +++ b/src/shared/MAPDEF.pas @@ -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; diff --git a/src/shared/mapstructio.inc b/src/shared/mapstructio.inc index ae432b9..d1198d5 100644 --- a/src/shared/mapstructio.inc +++ b/src/shared/mapstructio.inc @@ -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 (); -- 2.29.2