Duke4.net Forums: Shotgun firing animation error - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Shotgun firing animation error  "Both in vanilla and EDuke32"

User is offline   MrFlibble 

#1

Recently I recorded some videos of Duke3D shareware v1.3D in DOSBox in order to extract screenshots for this page and I noticed that the shotgun firing animation seems to use a wrong frame here:
Posted Image

It appears that the correct shotgun frame to match the muzzle flash should be this one:
Posted Image

Indeed it is used properly in this recoil frame of the same animation:
Posted Image

Today I felt like checking if this was fixed in EDuke32, and apparently it is not:
Posted Image

Also I don't think that EDuke32 uses the recoil frame anymore, even though this might be a feature in the original Atomic Edition/DOS EDuke code (?).
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2

This is something for mods to fix using capabilities provided by the source port, not something to be fixed in the source port itself. Several weapons have oddities in addition to the shotgun's problems with animation:

  • the Shotgun and RPG muzzle flashes are drawn underneath the weapons
  • the Freezer's two parts are misaligned (fixed in ART for World Tour)
  • the Shrinker and Expander are not drawn to the same positions
  • the Pistol has unused frames for reloading

This is good miscellaneous knowledge.
0

User is offline   Perro Seco 

#3

I wrote this based on some tutorials about weapon drawing. You can put it anywhere inside game.con:

gamevar digx  0 1
gamevar digy  0 1
gamevar pal   0 1

state initweapondisplay
  subvarvar digx looking_angSR1 addvarvar digy looking_arc
  subvarvar digy gun_pos addvarvar digx weapon_xoffset
  getsector[THISACTOR].floorpal pal ifvarg pal 8 setvar pal 0
ends

state shotgundisplay
  switch weaponcount
  case 3 case 4 case 5
  setvar digx 140 setvar digy 204 state initweapondisplay setvar RETURN -1
  rotatesprite digx digy 65536 0 2613 0 pal 0 0 0 windowx2 windowy2
  setvar digx 165 setvar digy 206 state initweapondisplay
  rotatesprite digx digy 65536 0 2614 0 pal 0 0 0 windowx2 windowy2
  break
  endswitch
ends

onevent EVENT_DRAWWEAPON ifvare currentweapon 2 state shotgundisplay endevent


I'm not very good at coding, so this may not be the perfect solution, but for me it looks more realistic.
3

User is offline   Hendricks266 

  • Weaponized Autism

  #4

That's basically the way to patch the weapon display code, but here it is with improved formatting, and fixed to use the correct shade values, window bounds, and palette when the player is frozen.

// these are used as scratch variables and store no state between tics
gamevar digx 0 0
gamevar digy 0 0
gamevar pal 0 0

state common_weapon_coordinates
    subvarvar digx looking_angSR1
    addvarvar digy looking_arc
    subvarvar digy gun_pos
    addvarvar digx weapon_xoffset
ends

state shotgundisplay
    switch weaponcount

    case 3 case 4 case 5

        // automatically tests for frozenness and whether the floor pal should be applied
        getplayer[THISACTOR].hudpal pal

        setvar digx 140
        setvar digy 204
        state common_weapon_coordinates
        rotatesprite digx digy 65536 0 2613 gs pal 2 windowx1 windowy1 windowx2 windowy2

        setvar digx 165
        setvar digy 206
        state common_weapon_coordinates
        rotatesprite digx digy 65536 0 2614 -128 pal 2 windowx1 windowy1 windowx2 windowy2

        // only cancel hardcoded drawing when we are doing it ourselves
        setvar RETURN -1

        break

    endswitch
ends

onevent EVENT_DRAWWEAPON
    ifvare currentweapon 2
        state shotgundisplay
endevent


I have not tested the actual modifications to what is drawn, but this should give a better idea of how to properly patch weapon display code.

Even then, this still lacks support for EDuke32's weapon scaling feature and sector shade transitions. Currently these require a bit more code. I ported this code to CON way back when I made weapons.con.sample, but today I think it should be abstracted back into the source code and exposed through new CON commands or structures, like hudpal. So, don't use this code in your projects without talking to me first.

The complexity of this is task is 1) why I lack interest in answering requests for a "how do I make new weapons?!?!?!" tutorial and 2) why you're generally better off starting with my weapons.con.sample and making changes to it, though sometimes I need to make changes to it and I don't believe any mod that uses it (such as Hypercore) has ever brought these changes downstream unless it is part of an effort like NightFright's compilation.
6

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options