mirror of
https://github.com/cxong/cdogs-sdl.git
synced 2025-07-23 07:23:01 +02:00
Fix multi ammo pickup, add lives pickup text #739
This commit is contained in:
@@ -389,6 +389,14 @@
|
||||
"GravityFactor": 0,
|
||||
"DrawAbove": true
|
||||
},
|
||||
{
|
||||
"Name": "lives_text",
|
||||
"Type": "Text",
|
||||
"TextMask": "00ffff",
|
||||
"Range": 120,
|
||||
"GravityFactor": 0,
|
||||
"DrawAbove": true
|
||||
},
|
||||
{
|
||||
"Name": "trail",
|
||||
"Pic": {
|
||||
|
@@ -45,7 +45,7 @@
|
||||
},
|
||||
"Effects": [{
|
||||
"Type": "Health",
|
||||
"Health": 100
|
||||
"Health": 200
|
||||
}, {
|
||||
"Type": "Ammo",
|
||||
"Ammo": "Ammo",
|
||||
|
@@ -363,6 +363,20 @@ static void HandleGameEvent(
|
||||
case GAME_EVENT_PLAYER_ADD_LIVES: {
|
||||
PlayerData *p = PlayerDataGetByUID(e.u.PlayerAddLives.UID);
|
||||
p->Lives += e.u.PlayerAddLives.Lives;
|
||||
const TActor *a = ActorGetByUID(p->ActorUID);
|
||||
if (a && a->isInUse && !a->dead)
|
||||
{
|
||||
GameEvent s = GameEventNew(GAME_EVENT_ADD_PARTICLE);
|
||||
s.u.AddParticle.Class =
|
||||
StrParticleClass(&gParticleClasses, "lives_text");
|
||||
s.u.AddParticle.Pos = a->Pos;
|
||||
s.u.AddParticle.Z = BULLET_Z * Z_FACTOR;
|
||||
s.u.AddParticle.DZ = 4;
|
||||
sprintf(
|
||||
s.u.AddParticle.Text, "+%d %s", (int)e.u.PlayerAddLives.Lives,
|
||||
e.u.PlayerAddLives.Lives > 1 ? "Lives" : "Life");
|
||||
GameEventsEnqueue(&gGameEvents, s);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GAME_EVENT_ACTOR_MELEE:
|
||||
|
@@ -193,11 +193,11 @@ void PickupPickup(TActor *a, Pickup *p, const bool pickupAll)
|
||||
case PICKUP_GUN:
|
||||
if (TreatAsGunPickup(pe, a))
|
||||
{
|
||||
canPickup = canPickup || TryPickupGun(a, pe, pickupAll, &sound);
|
||||
canPickup = TryPickupGun(a, pe, pickupAll, &sound) || canPickup;
|
||||
}
|
||||
else
|
||||
{
|
||||
canPickup = canPickup || TryPickupAmmo(a, p, pe);
|
||||
canPickup = TryPickupAmmo(a, p, pe) || canPickup;
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user