raze-gles/polymer/eduke32/package/samples/weapons.con.sample
hendricks266 cae310d8d5 weapons.con.sample: Sync with r3614 and r3616.
git-svn-id: https://svn.eduke32.com/eduke32@3620 1a8010ca-5511-0410-912e-c29ae57300e0
2013-03-28 09:05:55 +00:00

1759 lines
40 KiB
Text

// Note: This file has been directly converted from the EDuke32
// C source code to CON code, without any fixes or improvements.
// Further changes to player.c may or may not be reflected here.
/*
gamevar currentweapon 0 0 // (system) (pointer)
gamevar gs 0 0 // (system) (pointer)
gamevar looking_arc 0 0 // (system) (pointer)
gamevar gun_pos 0 0 // (system) (pointer)
gamevar weapon_xoffset 0 0 // (system) (pointer)
gamevar weaponcount 0 0 // (system) (pointer)
gamevar looking_angSR1 0 0 // (system) (pointer)
gamevar xdim 0 0 // (system) (pointer) (read only)
gamevar ydim 0 0 // (system) (pointer) (read only)
gamevar windowx1 0 0 // (system) (pointer) (read only)
gamevar windowx2 0 0 // (system) (pointer) (read only)
gamevar windowy1 0 0 // (system) (pointer) (read only)
gamevar windowy2 0 0 // (system) (pointer) (read only)
*/
gamevar hud_tilenum 0 1
gamevar hud_x 0 1
gamevar hud_y 0 1
gamevar hud_scale 65536 1
gamevar hud_angle 0 1
gamevar hud_shade 0 1
gamevar hud_pal 0 1
gamevar hud_orientation 0 1
gamevar hud_fistsign 0 1
gamevar hud_totaltime 0 1
gamevar hud_shadef 0 1
gamevar hud_shadef_crystal 0 1
gamevar hud_palf 0 1
// It is unfortunate that we need so many temporary gamevars.
gamevar hud_temp 0 1
gamevar hud_temp2 0 1
gamevar hud_temp3 0 1
gamevar hud_temp4 0 1
/*
// The following temporary gamevars are named differently because they are used
// in G_Draw[...] which would overwrite their values if used elsewhere.
*/
gamevar hud_G_Draw_temp 0 1
gamevar hud_G_Draw_temp2 0 1
gamevar weapon_pos 0 1
gamevar weaponscale 0 1
gamevar playerid 0 1
// define ROTATESPRITE_MAX 2048
// preliminary functions
state G_DrawTile
getplayer[THISACTOR].cursectnum hud_G_Draw_temp2
ifvarg hud_G_Draw_temp2 -1
getsector[hud_G_Draw_temp2].floorpal hud_G_Draw_temp2
else
setvar hud_G_Draw_temp2 0
ifvarand hud_orientation 4
addvar hud_angle 1024
orvar hud_orientation 2
rotatesprite hud_x hud_y hud_scale hud_angle hud_tilenum hud_shade hud_G_Draw_temp2 hud_orientation windowx1 windowy1 windowx2 windowy2
ifvarand hud_orientation 2
xorvar hud_orientation 2
ifvarand hud_orientation 4
subvar hud_angle 1024
ends
state G_DrawTilePal
ifvarand hud_orientation 4
addvar hud_angle 1024
orvar hud_orientation 2
rotatesprite hud_x hud_y hud_scale hud_angle hud_tilenum hud_shade hud_pal hud_orientation windowx1 windowy1 windowx2 windowy2
ifvarand hud_orientation 2
xorvar hud_orientation 2
ifvarand hud_orientation 4
subvar hud_angle 1024
ends
state G_DrawTileScaled
setvar hud_G_Draw_temp 192 // xoff
switch currentweapon
case DEVISTATOR_WEAPON
case TRIPBOMB_WEAPON
setvar hud_G_Draw_temp 160
break
default
ifvarand hud_orientation 262144
{
setvar hud_G_Draw_temp 160
xorvar hud_orientation 262144
}
break
endswitch
ifvarand hud_orientation 4
addvar hud_angle 1024
/*
ifvarg rendermode 2
ifvarn usemodels 0
ifhasmodel hud_tilenum hud_pal
{
setvar hud_G_Draw_temp2 224
mulvarvar hud_G_Draw_temp2 weaponscale
divvar hud_G_Draw_temp2 100
addvar hud_y 224
subvarvar hud_y hud_G_Draw_temp2
}
*/
mulvarvar hud_x weaponscale
divvar hud_x 100
setvarvar hud_G_Draw_temp2 hud_G_Draw_temp
mulvarvar hud_G_Draw_temp2 weaponscale
divvar hud_G_Draw_temp2 100
subvarvar hud_G_Draw_temp hud_G_Draw_temp2
addvarvar hud_x hud_G_Draw_temp
mulvarvar hud_y weaponscale
divvar hud_y 100
setvar hud_G_Draw_temp 200
setvarvar hud_G_Draw_temp2 hud_G_Draw_temp
mulvarvar hud_G_Draw_temp2 weaponscale
divvar hud_G_Draw_temp2 100
subvarvar hud_G_Draw_temp hud_G_Draw_temp2
addvarvar hud_y hud_G_Draw_temp
// setvar hud_scale 65536 // do this elsewhere; leave it open for modification
mulvarvar hud_scale weaponscale
divvar hud_scale 100
orvar hud_orientation 2
rotatesprite hud_x hud_y hud_scale hud_angle hud_tilenum hud_shade hud_pal hud_orientation windowx1 windowy1 windowx2 windowy2
ifvarand hud_orientation 2
xorvar hud_orientation 2
ifvarand hud_orientation 4
subvar hud_angle 1024
ends
state G_DrawWeaponTile
// basic fading between player weapon shades
ifvarvarn hud_shade hud_shadef
{
setvar hud_G_Draw_temp 0
ifvare hud_pal 0 setvar hud_G_Draw_temp 1
ifvarvare hud_pal hud_palf setvar hud_G_Draw_temp 1
ifvare hud_G_Draw_temp 1
{
setvarvar hud_G_Draw_temp hud_shade
subvarvar hud_G_Draw_temp hud_shadef
setvarvar hud_G_Draw_temp2 hud_G_Draw_temp
shiftvarr hud_G_Draw_temp 2
addvarvar hud_shadef hud_G_Draw_temp
ifvare hud_G_Draw_temp 0
{
shiftvarr hud_G_Draw_temp2 1
addvarvar hud_shadef hud_G_Draw_temp2
ifvare hud_G_Draw_temp2 0
setvarvar hud_shadef hud_shade
}
}
}
else
setvarvar hud_shadef hud_shade
setvarvar hud_palf hud_pal
setvarvar hud_shade hud_shadef
state G_DrawTileScaled
ends
state G_DrawWeaponTile_crystal
// basic fading between player weapon shades
ifvarvarn hud_shade hud_shadef_crystal
{
setvarvar hud_G_Draw_temp hud_shade
subvarvar hud_G_Draw_temp hud_shadef_crystal
setvarvar hud_G_Draw_temp2 hud_G_Draw_temp
shiftvarr hud_G_Draw_temp 2
addvarvar hud_shadef_crystal hud_G_Draw_temp
ifvare hud_G_Draw_temp 0
{
shiftvarr hud_G_Draw_temp2 1
addvarvar hud_shadef_crystal hud_G_Draw_temp2
ifvare hud_G_Draw_temp2 0
setvarvar hud_shadef_crystal hud_shade
}
}
else
setvarvar hud_shadef_crystal hud_shade
setvarvar hud_shade hud_shadef_crystal
state G_DrawTileScaled
ends
// helper states
state reset_hud_weapon_x_coordinate
setvarvar hud_x weapon_xoffset
subvarvar hud_x looking_angSR1
ends
state reset_hud_weapon_y_coordinate
setvarvar hud_y looking_arc
subvarvar hud_y gun_pos
ends
state reset_hud_weapon_coordinates
state reset_hud_weapon_x_coordinate
state reset_hud_weapon_y_coordinate
ends
state determine_animation
getuserdef[THISACTOR].pause_on hud_temp
ifvarn hud_temp 0
setvar hud_temp 1
ifvarand player[THISACTOR].gm 1 // MODE_MENU
orvar hud_temp 1
getactor[playerid].pal hud_G_Draw_temp
ifvare hud_G_Draw_temp 1
orvar hud_temp 1
ends
// other EVENT_DISPLAYWEAPON code
state draw_shrunk_fists // Shrunk Running Fists
// common calculations
state reset_hud_weapon_x_coordinate
setvarvar hud_temp3 looking_arc
ifvare player[THISACTOR].jetpack_on 0
{
getactor[playerid].xvel hud_temp2
shiftvarr hud_temp2 3
addvar hud_temp3 32
subvarvar hud_temp3 hud_temp2
addvarvar hud_fistsign hud_temp2
}
// common calculations continued
setvarvar hud_temp2 hud_fistsign
andvar hud_temp2 2047
sin hud_temp2 hud_temp2
setvarvar hud_temp4 hud_temp2
shiftvarr hud_temp2 10
shiftvarr hud_temp4 8
ifvarl hud_temp4 0
mulvar hud_temp4 -1
// right fist
guniqhudid 101
addvarvar hud_x hud_temp2
addvar hud_x 250
setvarvar hud_y hud_temp3
addvar hud_y 258
subvarvar hud_y hud_temp4
setvar hud_tilenum FIST
state G_DrawTile
// cleanup
subvar hud_x 250
// left fist
guniqhudid 102
subvarvar hud_x hud_temp2
addvar hud_x 40
setvarvar hud_y hud_temp3
addvar hud_y 200
addvarvar hud_y hud_temp4
orvar hud_orientation 4
state G_DrawTile
// cleanup
setvar hud_orientation 0
setvar hud_angle 0
guniqhudid 0
ends
state draw_quick_kick // Quick Kick
setvar hud_temp 14
subvarvar hud_temp player[THISACTOR].quick_kick
setvar hud_temp2 0
ifvarn hud_temp 14 setvar hud_temp2 1
ifvarn player[THISACTOR].last_quick_kick 0 setvar hud_temp2 1
ifvare hud_temp2 1
{
getactor[playerid].pal hud_pal
ifvarn hud_pal 1
{
getplayer[THISACTOR].cursectnum hud_temp2
ifvarg hud_temp2 -1
getsector[hud_temp2].floorpal hud_pal
ifvare hud_pal 0
getplayer[THISACTOR].palookup hud_pal
}
guniqhudid 100
// common calculations
state reset_hud_weapon_coordinates
setvar hud_tilenum KNEE
setvar hud_orientation 262148 // o|4|262144
setvar hud_temp3 0
ifvarg hud_temp 5
ifvarl hud_temp 13
{
addvar hud_x 144 // 160-16
addvar hud_y 214
addvar hud_tilenum 1
state G_DrawTileScaled
setvar hud_temp3 1
}
ifvare hud_temp3 0
{
addvar hud_x 80
addvar hud_y 250
state G_DrawTileScaled
}
}
ends
// weapon code
state draw_kick // KNEE_WEAPON:
ifvarg weaponcount 0
{
guniqhudid currentweapon
state reset_hud_weapon_coordinates
getactor[playerid].pal hud_pal
ifvarn hud_pal 1
{
getplayer[THISACTOR].cursectnum hud_temp2
ifvarg hud_temp2 -1
getsector[hud_temp2].floorpal hud_pal
ifvare hud_pal 0
getplayer[THISACTOR].palookup hud_pal
}
setvar hud_tilenum KNEE
setvar hud_temp3 0
ifvarg weaponcount 4
ifvarl weaponcount 10
{
addvar hud_x 160
addvar hud_y 214
addvar hud_tilenum 1
state G_DrawTileScaled
setvar hud_temp3 1
}
ifvare hud_temp3 0
{
addvar hud_x 220
addvar hud_y 250
state G_DrawTileScaled
}
}
ends
state draw_tripbomb // TRIPBOMB_WEAPON:
state reset_hud_weapon_coordinates
addvar hud_x 8
addvar hud_y 10
ifvarg weaponcount 6
{
setvarvar hud_temp weaponcount
shiftvarl hud_temp 3
addvarvar hud_y hud_temp
}
else ifvarl weaponcount 4
{
setvarvar hud_temp currentweapon
shiftvarl currentweapon 2
guniqhudid hud_temp
addvar hud_x 142
addvar hud_y 234
setvar hud_tilenum HANDHOLDINGLASER
addvar hud_tilenum 3
state G_DrawWeaponTile
// undo
subvar hud_x 142
subvar hud_y 234
}
// common to both hands
addvar hud_y 249
setvarvar hud_tilenum weaponcount
shiftvarr hud_tilenum 2
addvar hud_tilenum HANDHOLDINGLASER
// left hand
guniqhudid currentweapon
addvar hud_x 130
state G_DrawWeaponTile
// right hand
setvarvar hud_temp3 currentweapon
shiftvarl hud_temp3 1
guniqhudid hud_temp3
/*
// absolute method
subvar hud_x 130 // undo
addvar hud_x 152
*/
// relative method
addvar hud_x 22
orvar hud_orientation 4
state G_DrawWeaponTile
ifvarand hud_orientation 4
xorvar hud_orientation 4
guniqhudid 0
ends
state draw_rpg // RPG_WEAPON:
setvarvar hud_x weapon_xoffset
setvarvar hud_y looking_arc
shiftvarl hud_y 1
subvarvar hud_y gun_pos
setvarvar hud_temp weaponcount
shiftvarl hud_temp 7
addvar hud_temp 768
andvar hud_temp 2047
sin hud_temp hud_temp
shiftvarr hud_temp 11
subvarvar hud_x hud_temp
subvarvar hud_y hud_temp
orvar hud_orientation 512
addvar hud_x 164
addvar hud_y 176
ifvarg weaponcount 0
ifvarl weaponcount 8
{
setvarvar hud_tilenum weaponcount
shiftvarr hud_tilenum 1
addvar hud_tilenum RPGGUN
state G_DrawWeaponTile
}
setvar hud_tilenum RPGGUN
state G_DrawWeaponTile
ifvarand hud_orientation 512
xorvar hud_orientation 512
ends
state draw_shotgun // SHOTGUN_WEAPON:
state reset_hud_weapon_coordinates
subvar hud_x 8
switch weaponcount
case 1
case 2
setvarvar hud_temp4 currentweapon
shiftvarl hud_temp4 1
guniqhudid hud_temp4
addvar hud_x 168
addvar hud_y 201
setvar hud_shade -128
setvar hud_tilenum SHOTGUN
addvar hud_tilenum 2
state G_DrawWeaponTile
subvar hud_x 168
subvar hud_y 201
setvarvar hud_shade gs
case 0
case 6
case 7
case 8
guniqhudid currentweapon
addvar hud_x 146
addvar hud_y 202
setvar hud_tilenum SHOTGUN
state G_DrawWeaponTile
guniqhudid 0
break
case 3
case 4
case 5
case 9
case 10
case 11
case 12
ifvarg weaponcount 1
ifvarl weaponcount 5
{
addvar hud_y 40
addvar hud_x 20
setvarvar hud_temp4 currentweapon
shiftvarl hud_temp4 1
guniqhudid hud_temp4
addvar hud_x 178
addvar hud_y 194
setvar hud_shade -128
setvarvar hud_tilenum weaponcount
subvar hud_tilenum 1
shiftvarr hud_tilenum 1
addvar hud_tilenum SHOTGUN
addvar hud_tilenum 1
state G_DrawWeaponTile
subvar hud_x 178
subvar hud_y 194
setvarvar hud_shade gs
}
guniqhudid currentweapon
addvar hud_x 158
addvar hud_y 220
setvar hud_tilenum SHOTGUN
addvar hud_tilenum 3
state G_DrawWeaponTile
guniqhudid 0
break
case 13
case 14
case 15
case 28
case 29
case 30
guniqhudid currentweapon
addvar hud_x 198 // 32 + 166
addvar hud_y 210
setvar hud_tilenum SHOTGUN
addvar hud_tilenum 4
state G_DrawWeaponTile
guniqhudid 0
break
case 16
case 17
case 18
case 19
case 24
case 25
case 26
case 27
guniqhudid currentweapon
addvar hud_x 234 // 64 + 170
addvar hud_y 196
setvar hud_tilenum SHOTGUN
addvar hud_tilenum 5
state G_DrawWeaponTile
break
case 20
case 21
case 22
case 23
guniqhudid currentweapon
addvar hud_x 240 // 64 + 176
addvar hud_y 196
setvar hud_tilenum SHOTGUN
addvar hud_tilenum 6
state G_DrawWeaponTile
break
endswitch
ends
state draw_chaingun // CHAINGUN_WEAPON:
// hud_temp4 = FIREDELAY
state reset_hud_weapon_coordinates
ifvarg weaponcount 0
{
setvarvar hud_temp weaponcount
shiftvarl hud_temp 7
sin hud_temp hud_temp
shiftvarr hud_temp 12
addvarvar hud_y hud_temp
state determine_animation
ifvarn hud_temp 1
{
displayrand hud_temp
andvar hud_temp 3
mulvar hud_temp -1
addvar hud_temp 1
addvarvar hud_x hud_temp
}
}
// base
addvar hud_x 168
addvar hud_y 260
setvar hud_tilenum CHAINGUN
state G_DrawWeaponTile
subvar hud_x 168
subvar hud_y 260
switch weaponcount
case 0
addvar hud_x 178
addvar hud_y 233
addvar hud_tilenum 1 // relative
state G_DrawWeaponTile
break
default
state determine_animation
ifvarvarg weaponcount hud_temp4
ifvarvarl weaponcount hud_totaltime
{
// muzzleflash 1
ifvarn hud_temp 1
{
displayrand hud_temp3
andvar hud_temp3 7
}
else
setvar hud_temp3 0
addvar hud_x 136 // -4+140
addvarvar hud_x hud_temp3
setvarvar hud_temp2 weaponcount
shiftvarr hud_temp2 1
addvarvar hud_y hud_temp3
subvarvar hud_y hud_temp2
addvar hud_y 208
setvarvar hud_tilenum weaponcount
subvar hud_tilenum 4
divvar hud_tilenum 5
addvar hud_tilenum CHAINGUN
addvar hud_tilenum 5
state G_DrawWeaponTile
// cleanup
subvarvar hud_x hud_temp3
subvarvar hud_y hud_temp3
// muzzleflash 3
ifvarn hud_temp 1
{
displayrand hud_temp3
andvar hud_temp3 7
}
addvar hud_x 44 // relative
addvarvar hud_x hud_temp3
addvarvar hud_y hud_temp3
state G_DrawWeaponTile
// cleanup
subvar hud_x 180 // -4+140 + 44
subvar hud_y 208
subvarvar hud_x hud_temp3
subvarvar hud_y hud_temp3
addvarvar hud_y hud_temp2
}
subvar hud_totaltime 4
ifvarvarl weaponcount hud_totaltime
{
// muzzleflash 2
ifvarn hud_temp 1
{
displayrand hud_temp3
andvar hud_temp3 7
}
else
setvar hud_temp3 0
setvarvar hud_temp2 weaponcount
shiftvarr hud_temp2 1
addvarvar hud_x hud_temp3
addvar hud_x 158 // -4+162
addvarvar hud_y hud_temp3
subvarvar hud_y hud_temp2
addvar hud_y 208
setvarvar hud_tilenum weaponcount
subvar hud_tilenum 2
divvar hud_tilenum 5
addvar hud_tilenum CHAINGUN
addvar hud_tilenum 5
state G_DrawWeaponTile
// cleanup
subvarvar hud_x hud_temp3
subvar hud_x 158
subvarvar hud_y hud_temp3
addvarvar hud_y hud_temp2
subvar hud_y 208
// barrels (hot)
addvar hud_x 178
addvar hud_y 233
setvar hud_tilenum CHAINGUN
addvar hud_tilenum 1
addvarvar hud_tilenum hud_temp2
state G_DrawWeaponTile
}
else
{
// barrels
addvar hud_x 178
addvar hud_y 233
setvar hud_tilenum CHAINGUN
addvar hud_tilenum 1
state G_DrawWeaponTile
}
break
endswitch
ends
state draw_pistol // PISTOL_WEAPON:
// hud_temp4 = FIREDELAY
// hud_temp3 = RELOAD
state reset_hud_weapon_y_coordinate
setvar hud_tilenum FIRSTGUN
addvar hud_totaltime 1
ifvarvarl weaponcount hud_totaltime
{
setvar hud_x 183 // 195-12
addvarvar hud_x weapon_xoffset
subvarvar hud_x looking_angSR1
addvar hud_y 244
ifvarvare weaponcount hud_temp4
subvar hud_x 3
ifvarl weaponcount 3
addvarvar hud_tilenum weaponcount
setvar hud_orientation 2
guniqhudid currentweapon
state G_DrawWeaponTile
guniqhudid 0
}
else
{
orvar hud_orientation 512
subvarvar hud_temp3 weaponcount
ifvarg hud_temp3 17
{
guniqhudid currentweapon
setvar hud_x 194
subvarvar hud_x looking_angSR1
addvar hud_y 230
addvar hud_tilenum 4
state G_DrawWeaponTile
guniqhudid 0
}
else ifvarg hud_temp3 12
{
addvar hud_tilenum 6
setvarvar hud_temp weaponcount
shiftvarl hud_temp 3
setvar hud_x 244
subvarvar hud_x hud_temp
subvarvar hud_x looking_angSR1
setvarvar hud_temp2 weaponcount
shiftvarl hud_temp2 4
addvar hud_y 130
addvarvar hud_y hud_temp2
state G_DrawWeaponTile
subvar hud_y 130
subvarvar hud_y hud_temp2
subvar hud_tilenum 6
guniqhudid currentweapon
setvar hud_x 224
subvarvar hud_x looking_angSR1
addvar hud_y 220
addvar hud_tilenum 5
state G_DrawWeaponTile
guniqhudid 0
}
else ifvarg hud_temp3 7
{
addvar hud_tilenum 6
setvarvar hud_temp weaponcount
shiftvarl hud_temp 1
setvar hud_x 124
addvarvar hud_x hud_temp
subvarvar hud_x looking_angSR1
setvarvar hud_temp2 weaponcount
shiftvarl hud_temp2 3
addvar hud_y 430
subvarvar hud_y hud_temp2
state G_DrawWeaponTile
subvar hud_y 430
addvarvar hud_y hud_temp2
subvar hud_tilenum 6
guniqhudid currentweapon
setvar hud_x 224
subvarvar hud_x looking_angSR1
addvar hud_y 220
addvar hud_tilenum 5
state G_DrawWeaponTile
guniqhudid 0
}
else ifvarg hud_temp3 4
{
setvar hud_x 184
subvarvar hud_x looking_angSR1
addvar hud_y 235
addvar hud_tilenum 8
state G_DrawWeaponTile
subvar hud_y 235
subvar hud_tilenum 8
guniqhudid currentweapon
setvar hud_x 224
subvarvar hud_x looking_angSR1
addvar hud_y 210
addvar hud_tilenum 5
state G_DrawWeaponTile
guniqhudid 0
}
else ifvarg hud_temp3 2
{
setvar hud_x 164
subvarvar hud_x looking_angSR1
addvar hud_y 245
addvar hud_tilenum 8
state G_DrawWeaponTile
subvar hud_y 245
subvar hud_tilenum 8
guniqhudid currentweapon
setvar hud_x 224
subvarvar hud_x looking_angSR1
addvar hud_y 220
addvar hud_tilenum 5
state G_DrawWeaponTile
guniqhudid 0
}
else ifvarg hud_temp3 0
{
guniqhudid currentweapon
setvar hud_x 194
subvarvar hud_x looking_angSR1
addvar hud_y 235
addvar hud_tilenum 5
state G_DrawWeaponTile
guniqhudid 0
}
}
ends
state draw_pipebomb // HANDBOMB_WEAPON:
state reset_hud_weapon_coordinates
guniqhudid currentweapon
setvar hud_tilenum HANDTHROW
ifvarn weaponcount 0
{
ifvarvarl weaponcount hud_totaltime
{
ifvarl weaponcount 7
{
setvarvar hud_temp weaponcount
mulvar hud_temp 10
addvarvar hud_y hud_temp // D
}
else ifvarl weaponcount 12
{
setvarvar hud_temp weaponcount
subvar hud_temp 10
mulvar hud_temp 20
subvarvar hud_y hud_temp // U
}
else ifvarl weaponcount 20
{
setvarvar hud_temp weaponcount
subvar hud_temp 14
mulvar hud_temp 9
addvarvar hud_y hud_temp // D
}
addvar hud_x 190
addvar hud_y 250
switch weaponcount
/*
case 0
case 1
case 2
case 3
case 4
addvar hud_tilenum 0
break
*/
case 5
case 6
case 7
case 8
case 9
case 10
case 11
addvar hud_tilenum 1
break
case 12
case 13
case 14
case 15
case 16
case 17
case 18
case 19
case 20
addvar hud_tilenum 2
break
endswitch
state G_DrawWeaponTile
}
}
else
{
addvar hud_x 190
addvar hud_y 260
state G_DrawWeaponTile
}
guniqhudid 0
ends
state draw_detonator // HANDREMOTE_WEAPON:
state reset_hud_weapon_coordinates
guniqhudid currentweapon
addvar hud_x 102 // -48+150
addvar hud_y 258
setvar hud_tilenum HANDREMOTE
switch weaponcount
/*
case 0
case 6
case 7
case 8
case 9
case 10
addvar hud_tilenum 0
break
*/
case 1
case 2
case 4
case 5
addvar hud_tilenum 1
break
case 3
addvar hud_tilenum 2
break
endswitch
state G_DrawWeaponTile
guniqhudid 0
ends
state draw_devastator // DEVISTATOR_WEAPON:
state reset_hud_weapon_coordinates
// for guniqhudid
setvarvar hud_temp4 currentweapon
shiftvarl hud_temp4 1
setvar hud_tilenum DEVISTATOR
setvar hud_temp -1 // flag
ifvarg weaponcount 0
{
addvar hud_totaltime 1
ifvarvarl weaponcount hud_totaltime
{
setvar hud_temp 0
switch weaponcount
default
addlogvar weaponcount // debug
break
/*
case 0
case 6
setvar hud_temp 0
break
*/
case 1
case 5
setvar hud_temp 4
break
case 2
case 4
setvar hud_temp 12
break
case 3
setvar hud_temp 24
break
endswitch
setvarvar hud_temp2 weaponcount
shiftvarr hud_temp2 2
// sign function:
ifvare hud_temp2 0
setvar hud_temp3 0
else ifvarg hud_temp2 0
setvar hud_temp3 1
else ifvarl hud_temp2 0
setvar hud_temp3 -1
ifvarn player[THISACTOR].hbomb_hold_delay 0
{
guniqhudid currentweapon
setvarvar hud_temp2 hud_temp
shiftvarr hud_temp2 1
addvarvar hud_x hud_temp2
addvar hud_x 268
addvarvar hud_y hud_temp
addvar hud_y 238
addvarvar hud_tilenum hud_temp3
setvar hud_shade -32
state G_DrawWeaponTile
// cleanup
/*
subvar hud_x 268
subvarvar hud_x hud_temp2
subvar hud_y 238
subvarvar hud_y hud_temp
*/
state reset_hud_weapon_coordinates
subvarvar hud_tilenum hud_temp3
setvarvar hud_shade gs
guniqhudid hud_temp4
addvar hud_x 30
addvar hud_y 240
orvar hud_orientation 4
state G_DrawWeaponTile
ifvarand hud_orientation 4
xorvar hud_orientation 4
guniqhudid 0
}
else
{
guniqhudid hud_temp4
addvar hud_x 30
setvarvar hud_temp2 hud_temp
shiftvarr hud_temp2 1
subvarvar hud_x hud_temp2
addvar hud_y 240
addvarvar hud_y hud_temp
addvarvar hud_tilenum hud_temp3
setvar hud_shade -32
orvar hud_orientation 4
state G_DrawWeaponTile
// cleanup
/*
subvar hud_x 30
addvarvar hud_x hud_temp2
subvar hud_y 240
subvarvar hud_y hud_temp
*/
state reset_hud_weapon_coordinates
subvarvar hud_tilenum hud_temp3
setvarvar hud_shade gs
ifvarand hud_orientation 4
xorvar hud_orientation 4
guniqhudid currentweapon
addvar hud_x 268
addvar hud_y 238
state G_DrawWeaponTile
guniqhudid 0
}
break
}
}
ifvare hud_temp -1
{
guniqhudid currentweapon
addvar hud_x 268
addvar hud_y 238
state G_DrawWeaponTile
subvar hud_x 268
subvar hud_y 238
guniqhudid hud_temp4
addvar hud_x 30
addvar hud_y 240
orvar hud_orientation 4
state G_DrawWeaponTile
ifvarand hud_orientation 4
xorvar hud_orientation 4
guniqhudid 0
}
ends
state draw_freezer // FREEZE_WEAPON:
state reset_hud_weapon_coordinates
setvar hud_tilenum FREEZE
orvar hud_orientation 512
setvar hud_temp3 0
ifvarg weaponcount 0
{
addvar hud_totaltime 1
ifvarvarl weaponcount hud_totaltime
{
state determine_animation
ifvarn hud_temp 1
{
displayrand hud_temp
andvar hud_temp 3
addvarvar hud_x hud_temp
displayrand hud_temp
andvar hud_temp 3
addvarvar hud_y hud_temp
}
guniqhudid 0
addvar hud_x 210
addvar hud_y 277 // 16 + 261
addvar hud_tilenum 2
setvar hud_shade -32
state G_DrawWeaponTile
guniqhudid currentweapon
subvar hud_y 26 // relative
setvarvar hud_temp weaponcount
modvar hud_temp 6
divvar hud_temp 2
addvar hud_tilenum 1
addvarvar hud_tilenum hud_temp
state G_DrawWeaponTile
guniqhudid 0
setvar hud_temp3 1
}
}
ifvare hud_temp3 0
{
guniqhudid currentweapon
addvar hud_x 210
addvar hud_y 261
state G_DrawWeaponTile
guniqhudid 0
}
ifvarand hud_orientation 512
xorvar hud_orientation 512
ends
state draw_expander // GROW_WEAPON:
state reset_hud_weapon_coordinates
addvar hud_x 28
addvar hud_y 18
setvarvar hud_temp4 hud_pal
setvar hud_pal 2
setvarvar hud_temp3 currentweapon
shiftvarl hud_temp3 1
setvar hud_temp2 0
ifvarg weaponcount 0
{
ifvarvarl weaponcount hud_totaltime
{
state determine_animation
ifvarn hud_temp 1
{
displayrand hud_temp
andvar hud_temp 3
addvarvar hud_x hud_temp
displayrand hud_temp
andvar hud_temp 3
subvarvar hud_y hud_temp
}
addvar hud_x 184
addvar hud_y 240
setvarvar hud_tilenum weaponcount
andvar hud_tilenum 3
addvar hud_tilenum SHRINKER
addvar hud_tilenum 3
setvar hud_shade -32
guniqhudid hud_temp3
state G_DrawWeaponTile_crystal
guniqhudid currentweapon
addvar hud_x 4
setvar hud_tilenum SHRINKER
subvar hud_tilenum 1
setvarvar hud_shade gs
setvarvar hud_pal hud_temp4
state G_DrawWeaponTile
guniqhudid 0
setvar hud_temp2 1
}
}
ifvare hud_temp2 0
{
addvar hud_x 184
addvar hud_y 240
setvar hud_tilenum SHRINKER
addvar hud_tilenum 2
getplayer[THISACTOR].random_club_frame hud_shade
andvar hud_shade 2047
sin hud_shade hud_shade
shiftvarr hud_shade 10
mulvar hud_shade -1
addvar hud_shade 16
guniqhudid hud_temp3
state G_DrawWeaponTile_crystal
guniqhudid currentweapon
addvar hud_x 4
setvar hud_tilenum SHRINKER
subvar hud_tilenum 2
setvarvar hud_shade gs
setvarvar hud_pal hud_temp4
state G_DrawWeaponTile
guniqhudid 0
}
ends
state draw_shrinker // SHRINKER_WEAPON:
state reset_hud_weapon_coordinates
addvar hud_x 28
addvar hud_y 18
setvarvar hud_temp4 hud_pal
setvar hud_pal 0
setvarvar hud_temp3 currentweapon
shiftvarl hud_temp3 1
setvar hud_temp2 0
ifvarg weaponcount 0
{
ifvarvarl weaponcount hud_totaltime
{
state determine_animation
ifvarn hud_temp 1
{
displayrand hud_temp
andvar hud_temp 3
addvarvar hud_x hud_temp
displayrand hud_temp
andvar hud_temp 3
subvarvar hud_y hud_temp
}
addvar hud_x 184
addvar hud_y 240
setvarvar hud_tilenum weaponcount
andvar hud_tilenum 3
addvar hud_tilenum SHRINKER
addvar hud_tilenum 3
setvar hud_shade -32
guniqhudid hud_temp3
state G_DrawWeaponTile_crystal
guniqhudid currentweapon
addvar hud_x 4
setvar hud_tilenum SHRINKER
addvar hud_tilenum 1
setvarvar hud_shade gs
setvarvar hud_pal hud_temp4
state G_DrawWeaponTile
guniqhudid 0
setvar hud_temp2 1
}
}
ifvare hud_temp2 0
{
addvar hud_x 184
addvar hud_y 240
setvar hud_tilenum SHRINKER
addvar hud_tilenum 2
getplayer[THISACTOR].random_club_frame hud_shade
andvar hud_shade 2047
sin hud_shade hud_shade
shiftvarr hud_shade 10
mulvar hud_shade -1
addvar hud_shade 16
guniqhudid hud_temp3
state G_DrawWeaponTile_crystal
guniqhudid currentweapon
addvar hud_x 4
setvar hud_tilenum SHRINKER
setvarvar hud_shade gs
setvarvar hud_pal hud_temp4
state G_DrawWeaponTile
guniqhudid 0
}
ends
// framework
onevent EVENT_DISPLAYWEAPON // P_DisplayWeapon
setvar RETURN -1
getplayer[THISACTOR].weapon_pos weapon_pos
getuserdef[THISACTOR].weaponscale weaponscale
getplayer[THISACTOR].i playerid
getuserdef[THISACTOR].drawweapon hud_temp
ifvare hud_temp 2 // weapon icons
{
setvar hud_tilenum -1
switch currentweapon
case PISTOL_WEAPON
setvar hud_tilenum FIRSTGUNSPRITE
break
case CHAINGUN_WEAPON
setvar hud_tilenum CHAINGUNSPRITE
break
case RPG_WEAPON
setvar hud_tilenum RPGSPRITE
break
case FREEZE_WEAPON
setvar hud_tilenum FREEZESPRITE
break
case SHRINKER_WEAPON
setvar hud_tilenum SHRINKERSPRITE
break
case GROW_WEAPON
setvar hud_tilenum GROWSPRITEICON
break
case DEVISTATOR_WEAPON
setvar hud_tilenum DEVISTATORSPRITE
break
case TRIPBOMB_WEAPON
setvar hud_tilenum TRIPBOMBSPRITE
break
case HANDREMOTE_WEAPON
case HANDBOMB_WEAPON
setvar hud_tilenum HEAVYHBOMB
break
case SHOTGUN_WEAPON
setvar hud_tilenum SHOTGUNSPRITE
break
default
addlogvar currentweapon
break
/*
case KNEE_WEAPON
setvar hud_tilenum -1
break
*/
endswitch
ifvarn hud_tilenum -1
{
setvar hud_x 160
setvarvar hud_y weapon_pos
mulvarvar hud_y weapon_pos
addvar hud_y 180
setvar hud_scale 65536
getuserdef[THISACTOR].statusbarscale hud_temp2
mulvarvar hud_scale hud_temp2
divvar hud_scale 100
rotatesprite hud_x hud_y hud_scale 0 hud_tilenum 0 0 2 windowx1 windowy1 windowx2 windowy2
}
}
ifvarn hud_temp 1 break // If we are not displaying the actual HUD weapons, stop processing.
// these gamevars can get changed in the states up above, so reset them now.
setvar hud_scale 65536
setvar hud_orientation 0
setvar hud_angle 0
setvarvar hud_shade gs
state draw_quick_kick
// cleanup
setvar hud_orientation 0
setvar hud_angle 0
guniqhudid 0
getactor[playerid].xrepeat hud_temp
ifvarl hud_temp 40
state draw_shrunk_fists
else
{
getactor[playerid].pal hud_pal
ifvarn hud_pal 1
{
getplayer[THISACTOR].cursectnum hud_temp2
ifvarg hud_temp2 -1
getsector[hud_temp2].floorpal hud_pal
else
setvar hud_pal 0
}
switch currentweapon
case KNEE_WEAPON
setvarvar hud_totaltime WEAPON0_TOTALTIME
state draw_kick
break
case TRIPBOMB_WEAPON
setvarvar hud_totaltime WEAPON8_TOTALTIME
state draw_tripbomb
break
case RPG_WEAPON
setvarvar hud_totaltime WEAPON4_TOTALTIME
state draw_rpg
break
case SHOTGUN_WEAPON
setvarvar hud_totaltime WEAPON2_TOTALTIME
state draw_shotgun
break
case CHAINGUN_WEAPON
setvarvar hud_temp4 WEAPON3_FIREDELAY
setvarvar hud_totaltime WEAPON3_TOTALTIME
state draw_chaingun
break
case PISTOL_WEAPON
setvarvar hud_temp3 WEAPON1_RELOAD
setvarvar hud_temp4 WEAPON1_FIREDELAY
setvarvar hud_totaltime WEAPON1_TOTALTIME
state draw_pistol
break
case HANDBOMB_WEAPON
setvarvar hud_totaltime WEAPON5_TOTALTIME
state draw_pipebomb
break
case HANDREMOTE_WEAPON
setvarvar hud_totaltime WEAPON10_TOTALTIME
state draw_detonator
break
case DEVISTATOR_WEAPON
setvarvar hud_totaltime WEAPON7_TOTALTIME
state draw_devastator
break
case FREEZE_WEAPON
setvarvar hud_totaltime WEAPON9_TOTALTIME
state draw_freezer
break
case GROW_WEAPON
setvarvar hud_totaltime WEAPON11_TOTALTIME
state draw_expander
break
case SHRINKER_WEAPON
setvarvar hud_totaltime WEAPON6_TOTALTIME
state draw_shrinker
break
default
addlogvar currentweapon
break
endswitch
// cleanup
setvar hud_orientation 0
setvar hud_angle 0
guniqhudid 0
}
endevent