port: give correct ammo to bots when spawning armed; give at least one round when spawning armed

This commit is contained in:
fgsfds committed 2024-05-15 12:29:39 +02:00
1 parent 9edfd667b7
commit 5c7d4ecf52
2 files changed
+16 -2

No files matched your search

+8 -1
View File
@@ -268,7 +268,14 @@ void botSpawn(struct chrdata *chr, u8 respawning)
&& g_MpSetup.weapons[0] != MPWEAPON_SHIELD) {
struct mpweapon *mpweapon = &g_MpWeapons[g_MpSetup.weapons[0]];
botinvGiveSingleWeapon(chr, mpweapon->weaponnum);
botactGiveAmmoByType(aibot, mpweapon->priammotype - 1, mpweapon->priammoqty / 2);
const s32 ammotype = (g_MpSetup.weapons[0] == MPWEAPON_COMBATBOOST) ? AMMOTYPE_BOOST : mpweapon->priammotype;
if (ammotype) {
s32 startammo = mpweapon->priammoqty / 2;
if (startammo == 0) {
startammo = 1;
}
botactGiveAmmoByType(aibot, ammotype, startammo);
}
botinvSwitchToWeapon(chr, mpweapon->weaponnum, FUNC_PRIMARY);
}
#endif
+8 -1
View File
@@ -1110,9 +1110,16 @@ void playerSpawn(void)
&& g_MpSetup.weapons[0] != MPWEAPON_SHIELD) {
struct mpweapon *mpweapon = &g_MpWeapons[g_MpSetup.weapons[0]];
invGiveSingleWeapon(mpweapon->weaponnum);
const s32 ammotype = (g_MpSetup.weapons[0] == MPWEAPON_COMBATBOOST) ? AMMOTYPE_BOOST : mpweapon->priammotype;
if (ammotype) {
s32 startammo = mpweapon->priammoqty / 2;
if (startammo == 0) {
startammo = 1;
}
bgunSetAmmoQuantity(ammotype, startammo);
}
bgunEquipWeapon2(HAND_LEFT, WEAPON_NONE);
bgunEquipWeapon2(HAND_RIGHT, mpweapon->weaponnum);
bgunSetAmmoQuantity(mpweapon->priammotype, mpweapon->priammoqty / 2);
} else
#endif
{