ECWolf's A_GunAttack function & BackpackBoostAmount property

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

ECWolf's A_GunAttack function & BackpackBoostAmount property

Post by StroggVorbis »

GZDoom already adopted the A_WolfAttack codepointer which allows to create enemy hitscan attacks that behave like in Wolfenstein 3D.
It feels kinda weird that the player oriented variant, A_GunAttack, wasn't brought over yet. This would of course enable the creation of Wolf3D-like player weapons.

Lastly, ECWolf's version of the ammo actor has an additional property, ammo.backpackboostamount.

The 3D0, Jaguar, Mac & SNES ports of Wolf3D had backpacks, that like Doom increased the maximum carrying capacity. However, instead of doubling the amount, it was increased by a specific value until it reached a defined maximum.

In the SNES version for example, you could carry 99 bullets max, 199 with one backpack and a maximum of 299 if you found a second backpack. All backpacks collected afterwards had no capacity boosting effect, only giving ammo.

Implementation should be possible without breaking compatibility with older mods. Simply treat the absence of the property like Doom's default: Ammo.MaxAmount -> Ammo.BackpackMaxAmount after picking up a backpackitem.

Otherwise, increment Ammo.MaxAmount by BackpackBoostAmount for each subsequent BackpackItem until BackpackMaxAmount has been reached.

To prevent going over the limit imposed by BackpackMaxAmount, BackpackBoostAmount is clamped at (BackpackMaxAmount - MaxAmount).

Additionally, if only BackpackBoostAmount without BackpackMaxAmount is specified, have the max amount be 2147483647 :P

This would be a good substitute or alternative for CustomInventory actors with SetAmmoCapacity :wink:
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: ECWolf's A_GunAttack function & BackpackBoostAmount prop

Post by Rachael »

DabbingSquidward wrote: It feels kinda weird that the player oriented variant, A_GunAttack, wasn't brought over yet. This would of course enable the creation of Wolf3D-like player weapons.
Could you be a bit more specific about what exactly you mean by this? I don't use ECWolf very much.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: ECWolf's A_GunAttack function & BackpackBoostAmount prop

Post by StroggVorbis »

Simple, A_GunAttack is to A_WolfAttack what A_FireBullets is to A_CustomBulletAttack or what A_FireProjectile is to A_SpawnProjectile, e.g. player or monster fire function. It would take almost all the parameters as A_WolfAttack.

Taken from: https://maniacsvault.net/ecwolf/wiki/A_GunAttack

Code: Select all

A_GunAttack [(int flags[, string sound[, float snipe[, int maxdamage[, int blocksize[, int pointblank[, int longrange[, int maxrange]]]]]]])]

Performs a standard player attack similar to A_WolfAttack. Deals damage to the closest shootable enemy in front of the player in a 9 degree cone.

flags: Modify the behavior of the function.
GAF_NOAMMO: This attack does not draw from the weapon's ammo.
GAF_NORANDOM: Disables random damage calculation.
sound: Sound to play for this attack. The default of "*" plays the weapon's attack sound.
snipe: Factor to multiply distance calculations by (smaller values are more accurate).
maxdamage: The amount of damage the attack does. Maximum of 256 without GAF_NORANDOM.
blocksize: Size of a map block. This defaults to 128 to account for the scale of Doom 2's Wolf3D maps.
pointblank: Number of blocks for which the damage is done in full. After which the damage is multiplied by 2/3. (Default 2)
longrange: Number of blocks after which accuracy is lost. The attack will have a distance/maxrange chance of failing. (Default 4)
maxrange: Maximum number of blocks an attack can travel. (Default 21)
As a matter of fact, GZDoom does already have A_WolfAttack: https://zdoom.org/wiki/A_WolfAttack
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: ECWolf's A_GunAttack function & BackpackBoostAmount prop

Post by Rachael »

Since this can be done in ZScript pretty much exclusively, I am not sure how Graf feels about this, so I am going to hold off on attempting any resolution of this thread. This might be a [DIY].
Post Reply

Return to “Feature Suggestions [GZDoom]”