Skip to content

Commit

Permalink
Do not spawn effects if shield are low
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Oct 28, 2024
1 parent 6ac6013 commit e1d4439
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "lib/framework/frame.h"
#include "lib/framework/fixedpoint.h"
#include "lib/framework/math_ext.h"
#include "lib/netplay/sync_debug.h"

#include "lib/ivis_opengl/ivisdef.h"
Expand All @@ -45,8 +46,6 @@
#include "objmem.h"
#include "effects.h"



#define DROID_SHIELD_DAMAGE_SPREAD (16 - rand()%32)
#define DROID_SHIELD_PARTICLES (6 + rand()%8)

Expand Down Expand Up @@ -523,18 +522,20 @@ int32_t objDamage(BASE_OBJECT *psObj, unsigned damage, unsigned originalhp, WEAP
psDroid->shieldInterruptRegenTime = psDroid->time;
}

Vector3i dv;
dv.y = psDroid->pos.z;
dv.y += (psDroid->sDisplay.imd->max.y * 2);
if (PERCENT(psDroid->shieldPoints, droidGetMaxShieldPoints(psDroid)) > 25) {
Vector3i dv;
dv.y = psDroid->pos.z;
dv.y += (psDroid->sDisplay.imd->max.y * 2);

for (uint32_t i = 0; i < DROID_SHIELD_PARTICLES; i++)
{
dv.x = psDroid->pos.x + DROID_SHIELD_DAMAGE_SPREAD;
dv.z = psDroid->pos.y + DROID_SHIELD_DAMAGE_SPREAD;
addEffect(&dv, EFFECT_FIREWORK, FIREWORK_TYPE_STARBURST, false, nullptr, 0, gameTime - deltaGameTime + 1);
}
for (uint32_t i = 0; i < DROID_SHIELD_PARTICLES; i++)
{
dv.x = psDroid->pos.x + DROID_SHIELD_DAMAGE_SPREAD;
dv.z = psDroid->pos.y + DROID_SHIELD_DAMAGE_SPREAD;
addEffect(&dv, EFFECT_FIREWORK, FIREWORK_TYPE_STARBURST, false, nullptr, 0, gameTime - deltaGameTime + 1);
}

audio_PlayStaticTrack(psDroid->pos.x, psDroid->pos.y, ID_SOUND_SHIELD_HIT);
audio_PlayStaticTrack(psDroid->pos.x, psDroid->pos.y, ID_SOUND_SHIELD_HIT);
}
}
}

Expand Down

0 comments on commit e1d4439

Please sign in to comment.