Wolf3d Haven Forum

Please log in or register. Smile
Wolf3d Haven Forum

A friendly Wolfenstein 3D community, about Wolfenstein 3D, the game that gave birth to first person shooters...

    Weasel's coding questions thread



    Number of posts : 15
    Age : 29
    Registration date : 2011-05-01

    Weasel's coding questions thread

    Post by wildweasel on Mon May 09, 2011 10:57 pm

    Development of my new Wolf4SDL mod, Cosa Nostra, is going smoothly enough, but there are some coding issues that I'm having slight bits of trouble with.

    1. New gun attack and ammo type.
    I'd like to replace the Chaingun with a shotgun. Well, technically I already have, but my implementation is amateurish.

    Currently, the shotgun just takes the same ammo as everything else, but it fires 4 shots in very quick succession and then goes through its pump animation. This makes it not even remotely as powerful as the old chaingun (due to the slowness of its animation). However, since it's just firing four times in a row, it does have the (unintended but highly desirable) side-effect of being able to damage multiple targets, particularly four guards in a line.

    Here's the code for the shotgun's frame sequence:
    { {3,1,1},{1,1,2},{1,1,3},{16,1,17},{4,0,4},{4,0,5},{4,0,6},{4,0,7},{4,0,8},{3,0,9},{2,0,10},{2,0,11},{3,0,12},{4,0,13},{4,0,14},{4,0,15},{4,0,16},{3,-1,17} },

    My first issue here is that Wolf4SDL refuses to compile if I set any of the sequence's frame durations to zero, so those four frames at the beginning that are actually calling the "gun" attack have to have a duration of at least 1 frame, which a keen-eyed (and keen-eared) player will probably notice is just me firing the gun four times. I'd like for there to be a more elegant way to do this; perhaps I could somehow create a third attack that is literally just the gun attack called four times, and maybe with slightly more damage potential than the standard gun attack? (And also, this attack would ideally only consume 1 unit of ammo per shot - detailed in the next paragraph.)

    The second issue with the way I'm doing things is that, currently, the shotgun takes the same bullets as the other weapons (currently, a revolver and a Thompson SMG). Being a gun nut and a fan of logic, this doesn't really make much sense (unless the weapon in question is a four-barreled pepperbox pistol, which this isn't). So I'd like to figure out how to add an alternate ammo type for the shotgun, with its own pickup and such.

    Something tells me the majority of the work will be in wl_agent.cpp, but I haven't been able to figure out what to do with it.

    2. Replacing Adlib sounds with digital ones.
    I'm not nearly skilled enough to mess with things like alternative sound managers or adding support for Ogg Vorbis to my mod, but I have at least figured out how to increase the sample rate of the existing sounds. Unfortunately, I can't replace all of the sounds - what I need to know is how to replace the Adlib sounds with digitized ones of my choosing. I'd imagine it has something to do with Audiowl6.h and the #define statements therein, but I haven't a clue what to do with them.

    3. Adding more guard sounds.
    I'd like my guards to have a wider vocabulary than "Huh?!" - how does one have different types of guards select from a random bank of several "spotted" sounds?

    I offer cookies to anybody that can help me with these and any potential future issues I might happen upon. =P

      Current date/time is Sat Dec 10, 2016 10:29 am