Skip to content

Commit

Permalink
Add dieEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
jerethk committed Oct 5, 2024
1 parent 36c751f commit 0d3153e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions TheForceEngine/TFE_DarkForces/Actor/enemies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ namespace TFE_DarkForces
DamageModule* damageMod = actor_createDamageModule(dispatch);
damageMod->hp = FIXED(cust->hitPoints);
damageMod->itemDropId = (ItemId)cust->dropItem;
damageMod->dieEffect = (HitEffectID)cust->dieEffect;
damageMod->hurtSndSrc = sound_load(cust->painSound, SOUND_PRIORITY_MED5);
damageMod->dieSndSrc = sound_load(cust->dieSound, SOUND_PRIORITY_MED5);
actor_addModule(dispatch, (ActorModule*)damageMod);
Expand Down
44 changes: 44 additions & 0 deletions TheForceEngine/TFE_Settings/logics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ namespace TFE_Settings
"PILE", // 44
};

const char* s_dieEffectTable[] =
{
"SMALL_EXP", // 0 // small "puff" - blaster weapons.
"THERMDET_EXP", // 1 // thermal detonator explosion.
"PLASMA_EXP", // 2 // plasma "puff".
"MORTAR_EXP", // 3 // mortar explosion
"CONCUSSION", // 4 // concussion - first stage.
"CONCUSSION2", // 5 // concussion - second stage.
"MISSILE_EXP", // 6 // missile explosion.
"MISSILE_WEAK", // 7 // weaker version of the missle explosion.
"PUNCH", // 8 // punch
"CANNON_EXP", // 9 // cannon "puff".
"REPEATER_EXP", // 10 // repeater "puff".
"LARGE_EXP", // 11 // large explosion such as land mine.
"EXP_BARREL", // 12 // exploding barrel.
"EXP_INVIS", // 13 // an explosion that makes no sound and has no visual effect.
"SPLASH", // 14 // water splash
"EXP_35", // 15 // medium explosion, 35 damage.
"EXP_NO_DMG", // 16 // medium explosion, no damage.
"EXP_25", // 17 // medium explosion, 25 damage.
};


///////////////////////////
/// Forward declarations
Expand Down Expand Up @@ -215,6 +237,28 @@ namespace TFE_Settings
return false;
}

// Die effect as a number
if (cJSON_IsNumber(data) && strcasecmp(data->string, "dieEffect") == 0)
{
customLogic.dieEffect = data->valueint;
return true;
}

// Die effect as a string
if (cJSON_IsString(data) && strcasecmp(data->string, "dieEffect") == 0)
{
for (int i = 0; i <= 17; i++)
{
if (strcasecmp(data->valuestring, s_dieEffectTable[i]) == 0)
{
customLogic.dieEffect = i;
return true;
}
}

return false;
}

if (cJSON_IsBool(data) && strcasecmp(data->string, "hasMeleeAttack") == 0)
{
customLogic.hasMeleeAttack = cJSON_IsTrue(data);
Expand Down
1 change: 1 addition & 0 deletions TheForceEngine/TFE_Settings/logics.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct CustomActorLogic
// Defaults are based on what is set by default in the original code
u32 hitPoints = 4;
s32 dropItem = -1;
s32 dieEffect = -1;

bool hasMeleeAttack = false;
bool hasRangedAttack = true;
Expand Down

0 comments on commit 0d3153e

Please sign in to comment.