Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trap EffectType Accepts Names #3698

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions config/fxdata/trapdoor.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ TriggerType = 0
; 6: Spawns a creature, at level 1.
; 7: Keeper spell.
ActivationType = 0
; The shot/effect/slab number/creature number/keeper power, dependent on the Activation Type.
; The shot/effect/slab/creature/keeper power, based on the Activation Type. Accepts both names and numbers.
EffectType = 0
; Controls which things will be affected by the AreaDamage of the spell (1~8), see magic.cfg.
HitType = 0
Expand Down Expand Up @@ -273,7 +273,7 @@ Shots = 1
TimeBetweenShots = 0
TriggerType = 1
ActivationType = 1
EffectType = 15
EffectType = SHOT_BOULDER
HitType = 9
Hidden = 0
Slappable = 1
Expand Down Expand Up @@ -311,7 +311,7 @@ Shots = 12
TimeBetweenShots = 2000
TriggerType = 2
ActivationType = 3
EffectType = 19
EffectType = SHOT_ALARM
HitType = 2
Hidden = 1
DetectInvisible = 1
Expand Down Expand Up @@ -351,7 +351,7 @@ Shots = 5
TimeBetweenShots = 200
TriggerType = 2
ActivationType = 2
EffectType = 13
EffectType = EFFECT_GAS_3
HitType = 4
Hidden = 1
DetectInvisible = 1
Expand Down Expand Up @@ -390,7 +390,7 @@ Shots = 6
TimeBetweenShots = 140
TriggerType = 2
ActivationType = 3
EffectType = 29
EffectType = SHOT_TRAP_LIGHTNING
HitType = 4
Hidden = 1
DetectInvisible = 1
Expand Down Expand Up @@ -429,7 +429,7 @@ Shots = 3
TimeBetweenShots = 84
TriggerType = 2
ActivationType = 3
EffectType = 31
EffectType = SHOT_TRAP_WORD_OF_POWER
HitType = 4
Hidden = 1
DetectInvisible = 1
Expand Down Expand Up @@ -468,7 +468,7 @@ Shots = 1
TimeBetweenShots = 0
TriggerType = 2
ActivationType = 4
EffectType = 12
EffectType = LAVA
HitType = 4
Hidden = 1
DetectInvisible = 1
Expand Down Expand Up @@ -506,7 +506,7 @@ Shots = 1
TimeBetweenShots = 0
TriggerType = 0
ActivationType = 3
EffectType = 32
EffectType = SHOT_TRAP_TNT
HitType = 9
Hidden = 0
Slappable = 1
Expand Down
55 changes: 46 additions & 9 deletions src/config_trapdoor.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,19 +491,56 @@ TbBool parse_trapdoor_trap_blocks(char *buf, long len, const char *config_textna
}
break;
case 15: // EFFECTTYPE
if (get_conf_parameter_single(buf,&pos,len,word_buf,sizeof(word_buf)) > 0)
if (get_conf_parameter_single(buf, &pos, len, word_buf, sizeof(word_buf)) > 0)
{
k = atoi(word_buf);
if (k >= 0)
{
trapst->created_itm_model = k;
n++;
}
if (parameter_is_number(word_buf))
{
k = atoi(word_buf);
}
else
{
switch (trapst->activation_type)
{
case TrpAcT_EffectonTrap:
{
k = get_id(effect_desc, word_buf);
break;
}
case TrpAcT_SlabChange:
{
k = get_id(slab_desc, word_buf);
break;
}
case TrpAcT_CreatureSpawn:
{
k = get_id(creature_desc, word_buf);
break;
}
case TrpAcT_Power:
{
k = get_id(power_desc, word_buf);
break;
}
case TrpAcT_HeadforTarget90:
case TrpAcT_ShotonTrap:
case TrpAcT_CreatureShot:
default:
{
k = get_id(shot_desc, word_buf);
break;
}
}
}
if (k >= 0)
{
trapst->created_itm_model = k;
n++;
}
}
if (n < 1)
{
CONFWRNLOG("Incorrect value of \"%s\" parameter in [%.*s] block of %s file.",
COMMAND_TEXT(cmd_num), blocknamelen, blockname, config_textname);
CONFWRNLOG("Incorrect value of \"%s\" parameter in [%.*s] block of %s file.",
COMMAND_TEXT(cmd_num), blocknamelen, blockname, config_textname);
}
break;
case 16: // ANIMATIONID
Expand Down
53 changes: 51 additions & 2 deletions src/lvl_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,56 @@ static void set_trap_configuration_check(const struct ScriptLine* scline)
return;
}
}
else if (trapvar == 41) // DestroyedEffect
else if (trapvar == 17) // EffectType
{
if (parameter_is_number(valuestring))
{
newvalue = atoi(valuestring);
}
else
{
struct TrapConfigStats *trapst = get_trap_model_stats(trap_id);
switch (trapst->activation_type)
{
case TrpAcT_EffectonTrap:
{
newvalue = get_id(effect_desc, valuestring);
break;
}
case TrpAcT_SlabChange:
{
newvalue = get_id(slab_desc, valuestring);
break;
}
case TrpAcT_CreatureSpawn:
{
newvalue = get_id(creature_desc, valuestring);
break;
}
case TrpAcT_Power:
{
newvalue = get_id(power_desc, valuestring);
break;
}
case TrpAcT_HeadforTarget90:
case TrpAcT_ShotonTrap:
case TrpAcT_CreatureShot:
default:
{
newvalue = get_id(shot_desc, valuestring);
break;
}
}
}
if ((newvalue > USHRT_MAX) || (newvalue < 0))
{
SCRPTERRLOG("Value out of range: %ld", newvalue);
DEALLOCATE_SCRIPT_VALUE
return;
}
value->shorts[2] = newvalue;
}
else if (trapvar == 41) // DestroyedEffect
{
newvalue = effect_or_effect_element_id(valuestring);
if ((newvalue == 0) && (!parameter_is_number(valuestring)))
Expand All @@ -1087,7 +1136,7 @@ static void set_trap_configuration_check(const struct ScriptLine* scline)
}
value->ulongs[1] = newvalue;
}
else if (trapvar == 46) //FlameAnimationOffset
else if (trapvar == 46) // FlameAnimationOffset
{
value->chars[8] = atoi(scline->tp[2]);
value->chars[9] = scline->np[3];
Expand Down
Loading