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.