[discontinued] Weapon sway

Projects that have specifically been abandoned or considered "dead" get moved here, so people will quit bumping them. If your project has wound up here and it should not be, contact a moderator to have it moved back to the land of the living.
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

[discontinued] Weapon sway

Post by Nash »



Requires ZDoom devbuild 115dbd0 or higher because of [wiki]A_WeaponOffset[/wiki]
Weapon Sway and Weapon Pitch Shifting
by Nash Muhandes

Requires ZDoom/GZDoom dev build 115dbd0 or later

This code example shifts the weapon sprite as you move the view around. Since the original Doom sprites were not made with this effect in mind, most of the graphics will be cut off if you look down too much. You have to provide custom artwork to make the most out of this. For perfect examples of how "tall" a sprite should be, consult the sprites for the Rocket Launcher or the BFG.

Feel free to take this apart and adapt this code for your mods. No permission needed, credits and a link to your mod would be nice. Have fun!
26 August 2017: I am no longer using ACS and am going to retire this. Despite stating clearly in my original post that this was a proof of concept and code resource, I am still getting PMs from people asking me how to "fix" this "mod" because "it's not working" with their load order. I never offered to support this "mod" because well it wasn't a mod.

Also, I don't use ACS anymore and even if I plan to return to this project, it will be rewritten from scratch and all the old code will be thrown away so this is as good as dead.

Requesting graveyard.
Last edited by Nash on Sat Aug 26, 2017 1:57 am, edited 5 times in total.
User avatar
Gifty
Posts: 615
Joined: Sat Jun 15, 2013 8:21 pm

Re: [code] Weapon sway

Post by Gifty »

My god... it's full of stars.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [code] Weapon sway

Post by kodi »

A_WeaponOffset
wait
what

:shock:
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: [code] Weapon sway

Post by Nash »

kodi: perfect for your System Shock clone. :mrgreen:
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [code] Weapon sway

Post by kodi »

Dunno when the feature was introduced, but I'm gonna feel pretty stupid if I made the whole hudmessage weapon drawing entirely in vain :x

This release of yours will mesh very well with DS cursor code if I decide to pursue it (or a Terra Nova: SFC thing I'm being extremely tempted to do) further.

i wonder if A_WeaponOffset will one day support Z, Pitch and Angle arguments for 3d model weapons? A nerd can dream..
User avatar
Jaxxoon R
Posts: 772
Joined: Sun May 04, 2014 7:22 pm

Re: [code] Weapon sway

Post by Jaxxoon R »

Wouldn't it look more natural if the weapon moved slightly ahead of the viewpoint instead of lagging behind it? In my experience, It seems humans having an intent to point something whilst looking where its pointing would move the smaller, faster hand before the entire body.
User avatar
HorrorMovieRei
Posts: 251
Joined: Fri May 24, 2013 5:08 pm
Preferred Pronouns: They/Them
Contact:

Re: [code] Weapon sway

Post by HorrorMovieRei »

I can see this being used to emulate Build Engine's weapon bob when the player jumps and/or lands from a great fall.
User avatar
tsukiyomaru0
Posts: 295
Joined: Sat May 29, 2010 6:20 pm

Re: [code] Weapon sway

Post by tsukiyomaru0 »

I wish something like this was implemented as a feature for ZDoom and similar, but default off to prevent issues with certain PWADs. I like this kind of sway over the traditional one.
User avatar
TheDoomctator
Posts: 21
Joined: Fri May 13, 2016 7:03 pm
Location: Stereotype Land,Well that's Brazil of Course

Re: [code] Weapon sway

Post by TheDoomctator »

This is quite the nice idea...good work there mate
you made me want to make a doom mod just to use this...to bad i suck at coding XD
User avatar
chronoteeth
Posts: 2662
Joined: Wed Sep 08, 2004 1:29 pm
Preferred Pronouns: It/Its

Re: [code] Weapon sway

Post by chronoteeth »

can this be combined with other weapon sway animations? Or even stuff like, lets say i want the gun to tilt to the right when moving right, a lil more to the left, but through sprite animations combined with the code?
loismustdie555
Posts: 220
Joined: Thu Sep 25, 2014 2:20 pm
Location: Renton, Washington, USA

Re: [code] Weapon sway

Post by loismustdie555 »

Ayyyy you ported it! Good job! Was wondering when you'd get around to it mang!
Great work man!
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: [code] Weapon sway

Post by Nash »

Jaxxon: when I initially implemented this feature years ago via a source modification (custom ACS command), I was trying to emulate Skyrim's sway, that is, the weapon lags behind instead of moving forward. This is easy to customize, but currently requires editing the ACS and recompiling.

chronoteeth: A_WeaponOffset does not interfere with other offsets, if that's what you're asking. It's stacked.

___________________

I'm trying to see if I can make this more user friendly and easier to customize without ACS source mucking. I have several questions

1) When I was putting this together, the new weapons wouldn't be given to the player via IDFA. I had no idea what I was doing, eventually it forced me to add a custom player class with a custom weapon slot list. So much baggage for just a simple weapon demonstration. I'd really like to put this file out without all that MAPINFO and custom player classes. :/ Any help on this area would be much appreciated

2) When inheriting from the stock weapons, I have to copy and paste the Fire state too, otherwise the offset sways would stop working when firing a weapon. WHY?!
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [code] Weapon sway

Post by kodi »

If you don't want to edit the player class you could have the weapon replace the shotgun for example, and spawn it on top of the player with acs on startup then nudge him a miniscule amount like in ijons telekinesis script
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: [code] Weapon sway

Post by Nash »

Ugh, that hacky? I didn't realize making weapon replacements for ZDoom had to be so needlessly complicated...
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: [code] Weapon sway

Post by kodi »

or simply spawn it in front of the player. Or tell people to just type summon shotgun in the console.
Locked

Return to “Abandoned/Dead Projects”