-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
UZDoom 4.14.3
Map: Any
Other mods: No
Error: No
Description: Modern SSG pellets have no vertical spread, if autoaim is enabled.
I have been trying to fix this, and kinda found the solution, but it's not complete:
-- If the player has Autoaim disabled, works correctly
-- If the player has Autoaim enabled and Mouselook disabled and is looking straight forward(!), works correctly
-- If the player has Autoaim enabled and Mouselook enabled (for some stupid reason, but nonetheless), the pitch will be calculated incorrectly (like it's is being doubled). So I added !CheckFreeLook() just for that. Maybe there is a better way, like subtract player's current vertical view angle or something?
action void BD_FireModernBullet(Class<Actor> bullet, double spread_horz = 0., double spread_vert = 0., int numbullets = 1, bool useammo = true) {
if (numbullets < 1) numbullets = 1;
let weapon = player.ReadyWeapon;
if (!weapon || (useammo && !weapon.DepleteAmmo(weapon.bAltFire, true)))
return;
// ### Doesn't work correctly with Autoaim enabled and Mouselook enabled, if player's view vertical angle is non-zero
double pitch = 0.;
if (!CheckFreeLook()) pitch = BulletSlope(); // ### UPD: this works, unless the player looks not forward and then disables Mouselook
//if (sv_noautoaim == 0) pitch = BulletSlope(); // ### not sure how to properly check autoaim, maybe should also check player.GetAutoaim()<35 or smth?
// Alert the monsters:
A_AlertMonsters();
// Activate shootable linedefs:
LineAttack(angle, PLAYERMISSILERANGE, pitch, 0, 'Normal', "BD_NullPuff", LAF_NOIMPACTDECAL, offsetforward: radius);
vector2 spread = (0.,0.);
for (int i = 0; i < numbullets; i++) {
spread.x = random2[BDFireBull]() * spread_horz / 255.;
spread.y = pitch + ( random2[BDFireBull]() * spread_vert / 255. );
//spread.y = BulletSlope() - pitch + ( random2[BDFireBull]() * spread_vert / 255. );
A_FireProjectile(
bullet,
angle: spread.x,
useammo: false,
spawnheight: 2.,
flags: FPF_NOAUTOAIM, // ### otherwise Modern SSG pellets have no vertical spread if Autoaim is enabled
pitch: spread.y
);
}
}Metadata
Metadata
Assignees
Labels
No labels