Shared: Go over the weapon pickup logic for all the weapons to ensure

we guarantee new pickups properly.
This commit is contained in:
Marco Cawthorne 2022-01-03 16:45:24 -08:00
parent 3049576c5b
commit 8d1dbdd79c
Signed by: eukara
GPG key ID: C196CD8BA993248A
12 changed files with 51 additions and 32 deletions

View file

@ -87,13 +87,16 @@ w_crossbow_pickup(int new, int startammo)
if (new) {
pl.crossbow_mag = 5;
} else {
if (pl.ammo_bolt < MAX_A_BOLT) {
pl.ammo_bolt = bound(0, pl.ammo_bolt + 5, MAX_A_BOLT);
} else {
return (0);
}
return (1);
}
if (pl.ammo_bolt < MAX_A_BOLT) {
pl.ammo_bolt = bound(0, pl.ammo_bolt + 5, MAX_A_BOLT);
} else {
if (!new)
return (0);
}
#endif
return (1);
}

View file

@ -92,7 +92,8 @@ int w_egon_pickup(int new, int startammo)
if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, MAX_A_URANIUM);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);

View file

@ -79,7 +79,8 @@ int w_gauss_pickup(int new, int startammo)
if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, MAX_A_URANIUM);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);

View file

@ -126,12 +126,14 @@ w_glock_pickup(int new, int startammo)
if (new) {
pl.glock_mag = 18;
return (1);
}
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 18, MAX_A_9MM);
} else {
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 18, MAX_A_9MM);
} else {
if (!new)
return (0);
}
}
#endif
return (1);

View file

@ -70,7 +70,8 @@ int w_handgrenade_pickup(int new, int startammo)
if (pl.ammo_handgrenade < MAX_A_HANDGRENADE) {
pl.ammo_handgrenade = bound(0, pl.ammo_handgrenade + 1, MAX_A_HANDGRENADE);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);

View file

@ -72,12 +72,14 @@ w_mp5_pickup(int new, int startammo)
if (new) {
pl.mp5_mag = 25;
return (1);
}
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 25, MAX_A_9MM);
} else {
if (pl.ammo_9mm < MAX_A_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 25, MAX_A_9MM);
} else {
if (!new)
return (0);
}
}
#endif
return (1);

View file

@ -67,12 +67,14 @@ w_python_pickup(int new, int startammo)
if (new) {
pl.python_mag = 6;
return (1);
}
if (pl.ammo_357 < MAX_A_357) {
pl.ammo_357 = bound(0, pl.ammo_357 + 6, MAX_A_357);
} else {
if (pl.ammo_357 < MAX_A_357) {
pl.ammo_357 = bound(0, pl.ammo_357 + 6, MAX_A_357);
} else {
if (!new)
return (0);
}
}
#endif
return (1);

View file

@ -74,12 +74,14 @@ int w_rpg_pickup(int new, int startammo)
if (new) {
pl.rpg_mag = 1;
return (1);
}
if (pl.ammo_rocket < MAX_A_ROCKET) {
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
} else {
if (pl.ammo_rocket < MAX_A_ROCKET) {
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
} else {
if (!new)
return (0);
}
}
#endif
return (1);

View file

@ -130,7 +130,8 @@ w_satchel_pickup(int new, int startammo)
if (pl.ammo_satchel < MAX_A_SATCHEL) {
pl.ammo_satchel = bound(0, pl.ammo_satchel + 1, MAX_A_SATCHEL);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);

View file

@ -127,12 +127,14 @@ w_shotgun_pickup(int new, int startammo)
if (new) {
pl.shotgun_mag = 8;
return (1);
}
if (pl.ammo_buckshot < MAX_A_BUCKSHOT) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 8, MAX_A_BUCKSHOT);
} else {
if (pl.ammo_buckshot < MAX_A_BUCKSHOT) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 8, MAX_A_BUCKSHOT);
} else {
if (!new)
return (0);
}
}
#endif
return (1);

View file

@ -155,7 +155,8 @@ int w_snark_pickup(int new, int startammo)
if (pl.ammo_snark < MAX_A_SNARK) {
pl.ammo_snark = bound(0, pl.ammo_snark + 5, MAX_A_SNARK);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);

View file

@ -240,7 +240,8 @@ int w_tripmine_pickup(int new, int startammo)
if (pl.ammo_tripmine < MAX_A_TRIPMINE) {
pl.ammo_tripmine = bound(0, pl.ammo_tripmine + 1, MAX_A_TRIPMINE);
} else {
return (0);
if (!new)
return (0);
}
#endif
return (1);