ifndef plBipedWeap00_wdl;
define plBipedWeap00_wdl;
// ver: 2
// date: 040505
// title: Biped Player Weapons (00)
// image: plBipedWeap00.pcx
// help: Give the player simple weapons.
// needs: gid01.wdl
// needs: plSelect.wdl, cameraTarget.wdl
// needs: miscInput01.wdl, plBipedInput01.wdl
// needs: bipedPhy01.wdl,
// needs: bipedAnim01.wdl, bipedSnd01.wdl, plBiped01.wdl,
// needs: trigger00.wdl, particle00.wdl,
// needs: weaponfx00.wdl, weapons00.wdl
// external:
// prefix: plBipedWeap00_
// idcode: 015
// enable: Debug Display?
// help: Display debug information for weapon.
// id: 1
//define PLBIPEDWEAP00_DEBUG;
ifdef PLBIPEDWEAP00_DEBUG;
font plBipedWeap00_debug_font = <ackfont.pcx>,6,9;
text plBipedWeap00_debug_txt
{
font = plBipedWeap00_debug_font;
pos_x = 600;
pos_y = 1;
string =
"Weapon Stats\n============\n->curr weapon\n->in clip\n->total ammo\n->cycle?\n->xxxx\n\n->xxx\n->xxx\n->xxx\n->xxxx\n->xxx\n->xxx\n->xxx\n->xxx\n->xxx\n->xxx";
flags = d3d, visible;
}
var plBipedWeap00_debug_data[16];
panel plBipedWeap00_debug_pan
{
pos_x = 570;
pos_y = 10;
digits = 0, 9, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[0]; //current weapon #
digits = 0, 18, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[1]; //ammo in current clip
digits = 0, 27, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[2]; //total ammo ammount
digits = 0, 36, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[3]; //cycle time left
digits = 0, 45, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[4]; //
digits = 0, 63, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[5]; //
digits = 0, 72, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[6]; //
digits = 0, 81, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[7]; //
digits = 0, 90, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[8]; //
digits = 0, 99, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[9]; //
digits = 0, 108, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[10];
digits = 0, 117, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[11];
digits = 0, 126, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[12];
digits = 0, 135, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[13];
digits = 0, 144, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[14];
digits = 0, 153, 5, plBipedWeap00_debug_font, 1, plBipedWeap00_debug_data[15];
flags = refresh, d3d, visible;
}
endif; // PLBIPEDWEAP00_DEBUG --------------------------------------------------------------------
// enable: 3rd Person Tilt?
// help: Use the 3rd person view "head angle" to tilt the gun up and down.
// id: 400
define PLBIPEDWEAP00_3RDPTILT;
//----------------------------------------------------------------------
// Ammo types [current,max]
//----------------------------------------------------------------------
define plBipedWeap00_ammo_tcount = 6; // number of types of ammo
define plBipedWeap00_ammo_count = 0; // ammo count offset
define plBipedWeap00_ammo_max = 1; // max ammo offset
define plBipedWeap00_ammo_field_count = 2; // number of fields in each ammo record
var plBipedWeap00_ammo[12]; //plBipedWeap00_ammo_tcount*2fields
//----------------------------------------------------------------------
// Weapons [valid,id]
//----------------------------------------------------------------------
define plBipedWeap00_weap_count = 8; // number of weapons
//offsets:
define plBipedWeap00_weap_id = 0; // id number of the weapon (from weapons00.wdl)
define plBipedWeap00_weap_valid = 1; // is weapon valid (owned by player)?
define plBipedWeap00_weap_rounds = 2; // current number of rounds in weapon
define plBipedWeap00_weap_field_count = 3; // # of fields
var plBipedWeap00_weapon[24]; // plBipedWeap00_weap_count*2 fields
// entry: Starting weapon
// help: (0 = none, 1-8 = weapon number)
// cntl: spin 0 8 1
// id: 2
var plBipedWeap00_current_weapon = 0; // current weapon equiped by player (0=none)
// current ammo count (can be used by external functions to track/display)
var plBipedWeap00_curr_ammo = 0;
// entry: SwitchTime
// help: Time it takes (in ticks) to switch weapons.
// id: 4
define plBipedWeap00_switch_wait = 6;
//----------------------------------------------------------------------
// section: Crosshair Panels
// todo: move to HUD?
// entry: Crosshair Image
// help: The bitmap image used as the player's crosshair.
// id: 5
bmap plBipedWeap00_crosshair1_bmp = <crosshair_64x64.tga>;
panel plBipedWeap00_crosshair1_pan
{
bmap = plBipedWeap00_crosshair1_bmp;
flags = overlay;
}
//----------------------------------------------------------------------
// Weapon entity (avatar view)
// Model animation format:
// - "stand" frames (idle animation)
// - "shot" frames
// - "reload" frames
// - "switch" weapon frames
entity* plBipedWeap00_cur_weapon_ent; // 3rd person weapon entity
var plBipedWeap00_cur_weapon_vertex = -1;// 3rd person weapon firing vertex
//-------------------------------------------
// section: Weapon #1 Model (avatar view)
entity plBipedWeap00_weapon1_ent
{
// entry: Model
// id: 6
type = <laser_1st.mdl>;
view = camera; // default view
// entry: Offset X
// help: Distance (quants) the model is offset ahead of the player origin.
// id: 7
x = 10;
// entry: Offset Y
// help: Distance (quants) the model is offset to the left of the player origin.
// id: 8
y = -4;
// entry: Offset Z
// help: Distance (quants) the model is offset above the player origin.
// id: 9
z = -5.5;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 10
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 11
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 12
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 93
skill1 = 60;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 94
skill2 = -14;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 95
skill3 = -20;
}
// section: Weapon #1 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 13
string plBipedWeap00_weapon1_mdl = <tempgun_3rd.mdl>;
// entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 14
var plBipedWeap00_weapon1_vertex = 128;
//-------------------------------------------
// section: Weapon #2 Model (avatar view)
entity plBipedWeap00_weapon2_ent
{
// entry: model
// id: 15
type = <mgun_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 16
x = 8;
// entry: offset y (left)
// id: 17
y = -4;
// entry: offset z (up)
// id: 18
z = -6;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 19
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 20
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 21
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 96
skill1 = 20;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 97
skill2 = -8;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 98
skill3 = -16;
}
// section: Weapon #2 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 22
string plBipedWeap00_weapon2_mdl = <tempgun2_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 23
var plBipedWeap00_weapon2_vertex = 101;
//-------------------------------------------
// section: Weapon #3 Model (avatar view)
entity plBipedWeap00_weapon3_ent
{
// entry: model
// id: 24
type = <shotgun_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 25
x = 10;
// entry: offset y (left)
// id: 26
y = -4;
// entry: offset z (up)
// id: 27
z = -6;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 28
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 29
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 30
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 99
skill1 = 80;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 103
skill2 = -22;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 104
skill3 = -25;
}
// section: Weapon #3 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 31
string plBipedWeap00_weapon3_mdl = <tempgun3_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 32
var plBipedWeap00_weapon3_vertex = 101;
//-------------------------------------------
// section: Weapon #4 Model (avatar view)
entity plBipedWeap00_weapon4_ent
{
// entry: model
// id: 33
type = <laser_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 34
x = 10;
// entry: offset y (left)
// id: 35
y = -4;
// entry: offset z (up)
// id: 36
z = -5.5;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 37
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 38
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 39
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 105
skill1 = 80;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 106
skill2 = -16;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 107
skill3 = -20;
}
// section: Weapon #4 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 40
string plBipedWeap00_weapon4_mdl = <tempgun_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 41
var plBipedWeap00_weapon4_vertex = -1;
//-------------------------------------------
// section: Weapon #5 Model (avatar view)
entity plBipedWeap00_weapon5_ent
{
// entry: model
// id: 42
type = <laser_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 43
x = 10;
// entry: offset y (left)
// id: 44
y = -4;
// entry: offset z (up)
// id: 45
z = -5.5;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 46
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 47
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 48
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 108
skill1 = 80;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 109
skill2 = -16;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 113
skill3 = -20;
}
// section: Weapon #5 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 50
string plBipedWeap00_weapon5_mdl = <tempgun_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 51
var plBipedWeap00_weapon5_vertex = -1;
//-------------------------------------------
// section: Weapon #6 Model (avatar view)
entity plBipedWeap00_weapon6_ent
{
// entry: model
// id: 52
type = <laser_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 53
x = 10;
// entry: offset y (left)
// id: 54
y = -4;
// entry: offset z (up)
// id: 55
z = -5.5;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 56
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 57
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 58
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 114
skill1 = 80;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 115
skill2 = -16;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 116
skill3 = -20;
}
// section: Weapon #6 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 60
string plBipedWeap00_weapon6_mdl = <tempgun_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 61
var plBipedWeap00_weapon6_vertex = -1;
//-------------------------------------------
// section: Weapon #7 Model (avatar view)
entity plBipedWeap00_weapon7_ent
{
// entry: model
// id: 62
type = <laser_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 63
x = 10;
// entry: offset y (left)
// id: 64
y = -4;
// entry: offset z (up)
// id: 65
z = -5.5;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 66
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 67
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 68
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 117
skill1 = 80;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 118
skill2 = -16;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 119
skill3 = -20;
}
// section: Weapon #7 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 70
string plBipedWeap00_weapon7_mdl = <tempgun_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 71
var plBipedWeap00_weapon7_vertex = -1;
//-------------------------------------------
// section: Weapon #8 Model (avatar view)
entity plBipedWeap00_weapon8_ent
{
// entry: model
// id: 72
type = <laser_1st.mdl>;
view = camera; // default view
// entry: offset x (ahead)
// id: 73
x = 10;
// entry: offset y (left)
// id: 74
y = -4;
// entry: offset z (up)
// id: 75
z = -5.5;
// entry: Reflectivity
// help: Albedo value.
// cntl: spin 0 100 1
// id: 76
albedo = 50;
// entry: Ambient
// help: The weapon's ambient light value.
// cntl: spin -100 100 1
// id: 77
ambient = 0;
// entry: Layer
// help: Higher layer elements are placed over lower layer elements.
// id: 78
layer = 2;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset forward from the 1st person view.
// id: 123
skill1 = 80;
// entry: Muzzle Y Offset
// help: Distance the muzzle is offset left from the 1st person view.
// id: 124
skill2 = -16;
// entry: Muzzle X Offset
// help: Distance the muzzle is offset up from the 1st person view.
// id: 125
skill3 = -20;
}
// section: Weapon #8 Model (3rd person view)
// entry: 3rd person view model
// entry_help: Should be animated to follow the player's movements
// id: 80
string plBipedWeap00_weapon8_mdl = <tempgun_3rd.mdl>;
//entry: Firing vertex (-1 for none)
// entry_help: Gun muzzle vertex on the 3rd person gun model.
// id: 81
var plBipedWeap00_weapon8_vertex = -1;
//----------------------------------------------------------------------
// Initialize Values
//----------------------------------------------------------------------
// image: plBipedWeap00_weapon.pcx
// section: Player Weapons
// Desc: Initialize player weapons
function PlBipedWeap00_Weapon_Init()
{
//-------------------
// section: Weapon #1
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 90
plBipedWeap00_weapon[plBipedWeap00_weap_id] = 1;
plBipedWeap00_weapon[plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 91
plBipedWeap00_weapon[plBipedWeap00_weap_rounds] = 999;
// enable: Player starts with weapon?
// id: 92
plBipedWeap00_weapon[plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #2
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 100
plBipedWeap00_weapon[plBipedWeap00_weap_field_count + plBipedWeap00_weap_id] = 2;
plBipedWeap00_weapon[plBipedWeap00_weap_field_count + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 101
plBipedWeap00_weapon[plBipedWeap00_weap_field_count + plBipedWeap00_weap_rounds] = 60;
// enable: Player starts with weapon?
// id: 102
plBipedWeap00_weapon[plBipedWeap00_weap_field_count + plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #3
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 110
plBipedWeap00_weapon[(2*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] = 3;
plBipedWeap00_weapon[(2*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 111
plBipedWeap00_weapon[(2*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_rounds] = 20;
// enable: Player starts with weapon?
// id: 112
plBipedWeap00_weapon[(2*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #4
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 120
plBipedWeap00_weapon[(3*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] = 101;
plBipedWeap00_weapon[(3*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 121
plBipedWeap00_weapon[(3*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_rounds] = 6;
// enable: Player starts with weapon?
// id: 122
plBipedWeap00_weapon[(3*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #5
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 130
plBipedWeap00_weapon[(4*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] = 5;
plBipedWeap00_weapon[(4*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 131
plBipedWeap00_weapon[(4*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_rounds] = 20;
// enable: Player starts with weapon?
// id: 132
// plBipedWeap00_weapon[(4*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #6
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 140
plBipedWeap00_weapon[(5*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] = 6;
plBipedWeap00_weapon[(5*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 141
plBipedWeap00_weapon[(5*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_rounds] = 20;
// enable: Player starts with weapon?
// id: 142
// plBipedWeap00_weapon[(5*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #7
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 150
plBipedWeap00_weapon[(6*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] = 7;
plBipedWeap00_weapon[(6*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 151
plBipedWeap00_weapon[(6*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_rounds] = 20;
// enable: Player starts with weapon?
// id: 152
// plBipedWeap00_weapon[(6*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
//-------------------
// section: Weapon #8
// entry: Weapon Template
// entry_help: Weapon from weapons00.wdl template (1-12)
// entry_help: Weapon from weapLaunch00.wdl template (101-106)
// id: 160
plBipedWeap00_weapon[(7*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] = 8;
plBipedWeap00_weapon[(7*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_id] -= 1; // offset
// entry: Starting Rounds
// help: Starting number of rounds in weapon
// id: 161
plBipedWeap00_weapon[(7*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_rounds] = 20;
// enable: Player starts with weapon?
// id: 162
// plBipedWeap00_weapon[(7*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
}
//--------------------------------------------------------------------
// section: Ammo types
// Desc: Initialize player ammo
function PlBipedWeap00_Ammo_Init()
{
// section: Ammo type #1
// entry: Starting Ammo
// id: 170
plBipedWeap00_ammo[plBipedWeap00_ammo_count] = 100;
// entry: Max Ammo
// id: 171
plBipedWeap00_ammo[plBipedWeap00_ammo_max] = 200;
// section: Ammo type #2
// entry: Starting Ammo
// id: 172
plBipedWeap00_ammo[(1*2)+plBipedWeap00_ammo_count] = 30;
// entry: Max Ammo
// id: 173
plBipedWeap00_ammo[(1*2)+plBipedWeap00_ammo_max] = 100;
// section: Ammo type #3
// entry: Starting Ammo
// id: 174
plBipedWeap00_ammo[(2*2)+plBipedWeap00_ammo_count] = 15;
// entry: Max Ammo
// id: 175
plBipedWeap00_ammo[(2*2)+plBipedWeap00_ammo_max] = 100;
// section: Ammo type #4
// entry: Starting Ammo
// id: 176
plBipedWeap00_ammo[(3*2)+plBipedWeap00_ammo_count] = 0;
// entry: Max Ammo
// id: 177
plBipedWeap00_ammo[(3*2)+plBipedWeap00_ammo_max] = 100;
// section: Ammo type #5
// entry: Starting Ammo
// id: 178
plBipedWeap00_ammo[(4*2)+plBipedWeap00_ammo_count] = 0;
// entry: Max Ammo
// id: 179
plBipedWeap00_ammo[(4*2)+plBipedWeap00_ammo_max] = 100;
// section: Ammo type #6
// entry: Starting Ammo
// id: 180
plBipedWeap00_ammo[(5*2)+plBipedWeap00_ammo_count] = 0;
// entry: Max Ammo
// id: 181
plBipedWeap00_ammo[(5*2)+plBipedWeap00_ammo_max] = 100;
}
//----------------------------------------------------------------------
// Default keys
//----------------------------------------------------------------------
// section: Player Input
// entry: Fire Weapon key
// id: 200
string plBipedWeap00_fire_key_c = "mouse_left";
var plBipedWeap00_fire_scancode = 0;
// entry: Reload Weapon key
// id: 201
string plBipedWeap00_reload_key_c = "r";
var plBipedWeap00_reload_scancode = 0;
// entry: Select Next Weapon
// id: 202
string plBipedWeap00_next_key_c = "e";
var plBipedWeap00_next_scancode = 0;
// entry: Select Previous Weapon
// id: 203
string plBipedWeap00_prev_key_c = "q";
var plBipedWeap00_prev_scancode = 0;
// Desc: takes the current values stored in the user defined keys and create scancodes
function PlBipedWeap00_SetKeys()
{
// use MiscInput01_Key_For_Str() to convert strings into scancodes
// fire key
str_cpy(miscInput01_temp_str,plBipedWeap00_fire_key_c);
plBipedWeap00_fire_scancode = MiscInput01_Key_For_Str();
// reload key
str_cpy(miscInput01_temp_str,plBipedWeap00_reload_key_c);
plBipedWeap00_reload_scancode = MiscInput01_Key_For_Str();
// next weapon key
str_cpy(miscInput01_temp_str,plBipedWeap00_next_key_c);
plBipedWeap00_next_scancode = MiscInput01_Key_For_Str();
// prev weapon key
str_cpy(miscInput01_temp_str,plBipedWeap00_prev_key_c);
plBipedWeap00_prev_scancode = MiscInput01_Key_For_Str();
}
//----------------------------------------------------------------------
// Functions
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// Animation
var plBipedWeap00_gun_state = 0;
define plBipedWeap00_state_idle = 0; // gun idle
define plBipedWeap00_state_fire = 1; // gun firing
define plBipedWeap00_state_reload = 2; // gun reloading
define plBipedWeap00_state_switch = 3; // switching gun
var plBipedWeap00_cycle = 0; // ticks left in current cycle
// Desc: animate the current weapon in hand (1st person view)
function PlBipedWeap00_Animate(per)
{
if(plBipedWeap00_gun_state == plBipedWeap00_state_fire)
{
//--old ent_cycle("shot",(per*100));
ent_animate(me,"shot",(per*100),ANM_CYCLE);
return;
}
if(plBipedWeap00_gun_state == plBipedWeap00_state_reload)
{
//--old ent_cycle("reload",(per*100));
ent_animate(me,"reload",(per*100),ANM_CYCLE);
return;
}
if(plBipedWeap00_gun_state == plBipedWeap00_state_switch)
{
//--old ent_cycle("switch",(per*100));
ent_animate(me,"switch",(per*100),ANM_CYCLE);
return;
}
// keep at main frame
//--old ent_cycle("shot",0);
ent_animate(me,"shot",0,ANM_CYCLE);
}
//----------------------------------------------------------------------
// Desc: Reload a weapon clip
//
// Mod: temp
function PlBipedWeap00_Reload_Clip(n_weapon)
{
var weap_offset; // offset into the weapon template array
var plWeap_offset; // offset into the player weapon array
var ammo_offset;
var reload_time; // time the weapon takes to reload
// Calculate Offsets ------------------------------------------------
// calculate offset into player weapon arrays
plWeap_offset = ((n_weapon - 1)*plBipedWeap00_weap_field_count);
if(plWeap_offset < 0) { return(0); }
// use player weapon id to calculate offset into weapons template
weap_offset = plBipedWeap00_weapon[plWeap_offset + plBipedWeap00_weap_id];
if(weap_offset < 100) // using a weapon00 template
{
////////////////////////////////////////
// using a weapons00.wdl weapon template
weap_offset = (weap_offset*weapons00_weap_field_count);
if(weap_offset < 0) { return(0); }
ammo_offset = plBipedWeap00_ammo_field_count * (weapons00_template[weap_offset+weapons00_weap_ammotype]-1);
if(ammo_offset < 0) { return(0); }
// calculate number of rounds short of full clip
temp = weapons00_template[weap_offset+weapons00_weap_clipmax]
- plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds];
// get reload clip time
reload_time = (weapons00_template[weap_offset + weapons00_weap_reloadtime]);
}
else // using a weapLaunch00 template
{
///////////////////////////////////////////
// using a weapLaunch00.wdl weapon template
weap_offset -= 100;
weap_offset = (weap_offset*weapLaunch00_weap_field_count);
if(weap_offset < 0) { return(0); }
ammo_offset = plBipedWeap00_ammo_field_count * (weapLaunch00_template[weap_offset+weapLaunch00_weap_ammotype]-1);
if(ammo_offset < 0) { return(0); }
// calculate number of rounds short of full clip
temp = weapLaunch00_template[weap_offset+weapons00_weap_clipmax]
- plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds];
// get reload clip time
reload_time = (weapLaunch00_template[weap_offset + weapons00_weap_reloadtime]);
}
// remove ammo from total
if(temp <= plBipedWeap00_ammo[ammo_offset])
{
// remove diff from ammo store
plBipedWeap00_ammo[ammo_offset] -= temp;
}
else
{
// empty ammo store
temp = plBipedWeap00_ammo[ammo_offset];
plBipedWeap00_ammo[ammo_offset] = 0;
}
// add to clip
plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds] += temp;
// play reload sound
ent_playsound(plBiped01_entity,weaponfx00_reload_snd,weaponfx00_reload_vol);
// return the reload time
return(reload_time);
}
// Set fx_vec to the 1st person muzzle offset of the current gun
function PlBipedWeap00_1st_Muzzle(&fx_vec,num)
{
if((num < 1) || (num > plBipedWeap00_weap_count))
{
vec_set(fx_vec,vector(0,0,0));
return;
}
if(num < 2) //1
{
vec_set(fx_vec,plBipedWeap00_weapon1_ent.skill1);
return;
}
if(num < 3) //2
{
vec_set(fx_vec,plBipedWeap00_weapon2_ent.skill1);
return;
}
if(num < 4) //3
{
vec_set(fx_vec,plBipedWeap00_weapon3_ent.skill1);
return;
}
if(num < 5) //4
{
vec_set(fx_vec,plBipedWeap00_weapon4_ent.skill1);
return;
}
if(num < 6) //5
{
vec_set(fx_vec,plBipedWeap00_weapon5_ent.skill1);
return;
}
if(num < 7) //6
{
vec_set(fx_vec,plBipedWeap00_weapon6_ent.skill1);
return;
}
if(num < 8) //7
{
vec_set(fx_vec,plBipedWeap00_weapon7_ent.skill1);
return;
}
// 8
vec_set(fx_vec,plBipedWeap00_weapon8_ent.skill1);
}
//----------------------------------------------------------------------
// Weapon fire, cycle, sound functions
// DescL Fire the current weapon00 template weapon
function PlBipedWeap00_Fire_Weapon00(weap_fx,weap_offset,plWeap_offset)
{
var loop; // temp loop value
var temp_vec[3];
// use ammo
if(weapons00_template[weap_offset+weapons00_weap_ammotype] != 0)
{
// weapon uses ammo...
if(plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds] <= 0)
{
//play 'empty' noise
ent_playsound(plBiped01_entity,weaponfx00_empty_snd,weaponfx00_empty_vol);
return(-1);
}
plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds] -= 1; // remove round
}
// in a avatar (first person) view?
if(cameraTarget_avatar_view_q == 1)
{
// use camera rotation and camera target pos for gunshot
vec_set(weapons00_from_vec,cameraTarget_pos_vec);
vec_set(weapons00_to_vec,cameraTarget_ang_vec);
// fx comes from a different place then shot...
PlBipedWeap00_1st_Muzzle(weapons00_fx_vec,plBipedWeap00_current_weapon);// set muzzle offset
/* vec_set(weapons00_fx_vec,vector(80,-16,-20)); // set to current muzzle fx offset
vec_for_vertex(weapons00_from_vec, plBipedWeap00_weapon1_ent, 158);
breakpoint;
weapons00_from_vec.x = weapons00_from_vec.x;
weapons00_from_vec.y = weapons00_from_vec.y;
weapons00_from_vec.x = weapons00_from_vec.z;
/* */
vec_rotate(weapons00_fx_vec,cameraTarget_ang_vec); // rotate by view facing
vec_add(weapons00_fx_vec,cameraTarget_pos_vec.x); // add view pos
}
else
{
// use entity rotation and gun vertex pos for gunshot
if(plSelect_curr_ent == NULL) { return(1); } // no entity
if((plBipedWeap00_cur_weapon_vertex > 0) && (plBipedWeap00_cur_weapon_ent != NULL))
{
vec_for_vertex(weapons00_from_vec, plBipedWeap00_cur_weapon_ent, plBipedWeap00_cur_weapon_vertex);
}
else
{
vec_set(weapons00_from_vec,plSelect_curr_ent.x);
}
vec_set(weapons00_to_vec,plSelect_curr_ent.pan);
ifdef PLBIPEDWEAP00_3RDPTILT;
// use 3rd Person "head angle" to tilt the gun
weapons00_to_vec.tilt = plBiped01_head_ang_vec[1];
endif;
// fx comes from the same area shoot comes from
vec_set(weapons00_fx_vec,weapons00_from_vec);
}
// ignore the current player model
me = plSelect_curr_ent;
if(weap_fx & weapons00_fx_shotgun)
{
// section: Shotgun
// "shotgun" pattern
// entry: Shot Number
// help: Number of 'pellets' in a shotgun shot
// id: 300
loop = 7;
vec_set(temp_vec,weapons00_to_vec); // store angle value (changed in 'Weapons00_Gun_Fire_AngleA')
while(loop > 0)
{
// fire weapon with param: accuracy,range,damage,gun_fx
Weapons00_Gun_Fire_AngleA(weapons00_template[weap_offset + weapons00_weap_acc],
weapons00_template[weap_offset + weapons00_weap_range],
weapons00_template[weap_offset + weapons00_weap_damage],
weap_fx);//plBipedWeap00_weapon[offset + plBipedWeap00_weap_fx]);
loop -= 1;
vec_set(weapons00_to_vec,temp_vec); // restore angle value
}
}
else
{
// fire weapon with param: accuracy,range,damage,gun_fx
Weapons00_Gun_Fire_AngleA(weapons00_template[weap_offset + weapons00_weap_acc],
weapons00_template[weap_offset + weapons00_weap_range],
weapons00_template[weap_offset + weapons00_weap_damage],
weap_fx);//plBipedWeap00_weapon[offset + plBipedWeap00_weap_fx]);
}
// play weapon noise
WeaponFX00_Play_Shot(plBiped01_entity,weapons00_template[weap_offset + weapons00_weap_snd]);
// return reload time
return(weapons00_template[weap_offset + weapons00_weap_cycle]); // cycle time
}
// Desc: Fire the current weapLaunch00 template weapon
function PlBipedWeap00_Fire_WeapLaunch00(weap_fx,weap_offset,plWeap_offset)
{
// use ammo
if(weapLaunch00_template[weap_offset+weapLaunch00_weap_ammotype] != 0)
{
// weapon uses ammo...
if(plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds] <= 0)
{
//play 'empty' noise
ent_playsound(plBiped01_entity,weaponfx00_empty_snd,weaponfx00_empty_vol);
return(-1);
}
plBipedWeap00_weapon[plWeap_offset+plBipedWeap00_weap_rounds] -= 1; // remove round
}
// in a avatar (first person) view?
if(cameraTarget_avatar_view_q == 1)
{
// use camera rotation and camera target pos for gunshot
vec_set(weapons00_from_vec,cameraTarget_pos_vec);
vec_set(weapons00_to_vec,cameraTarget_ang_vec);
// disable any 3rd person only fx
//-- if(weap_fx & weapons00_fx_muzzleflash) { weap_fx -= weapons00_fx_muzzleflash; }
}
else
{
// use entity rotation and gun vertex pos for gunshot
if(plSelect_curr_ent == NULL) { return(1); } // no entity
if((plBipedWeap00_cur_weapon_vertex > 0) && (plBipedWeap00_cur_weapon_ent != NULL))
{
vec_for_vertex(weapons00_from_vec, plBipedWeap00_cur_weapon_ent, plBipedWeap00_cur_weapon_vertex);
}
else
{
vec_set(weapons00_from_vec,plSelect_curr_ent.x);
}
vec_set(weapons00_to_vec,plSelect_curr_ent.pan);
}
// ignore the current player model
me = plSelect_curr_ent;
// launch shell
weapLaunch00_shell_data[0] = weapLaunch00_template[weap_offset + weapLaunch00_weap_speed]; // launch speed
weapLaunch00_shell_data[1] = weapLaunch00_template[weap_offset + weapLaunch00_weap_grav]; // gravity effect
weapLaunch00_shell_data[2] = weapLaunch00_template[weap_offset + weapLaunch00_weap_damage];// base damage
weapLaunch00_shell_data[3] = weapLaunch00_template[weap_offset + weapLaunch00_weap_radius];// blast radius
WeapLaunch00_Fire_AngleA(weapLaunch00_template[weap_offset + weapLaunch00_weap_shell]);
// play weapon launch noise
WeaponFX00_Play_Shot(plBiped01_entity,weapLaunch00_template[weap_offset + weapLaunch00_weap_snd]);
// play launching fx
Weapons00_Gun_FX(weap_fx);
// return reload time
return(weapLaunch00_template[weap_offset + weapLaunch00_weap_cycle]); // cycle time
}
// Desc: Fire the current weapon.
function PlBipedWeap00_Fire_Current(weap_fx)
{
var weap_offset; // offset into the weapon template array
var plWeap_offset; // offset into the player weapon array
if((plBipedWeap00_current_weapon <= 0) || (plBipedWeap00_current_weapon >= plBipedWeap00_weap_count))
{
// no weapon
return(-1);
}
// Calculate Offsets ------------------------------------------------
// calculate offset into player weapon arrays
plWeap_offset = ((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count);
if(plWeap_offset < 0) { return(0); }
// use player weapon id to calculate offset into weapons template
weap_offset = plBipedWeap00_weapon[plWeap_offset + plBipedWeap00_weap_id];
if(weap_offset < 100) // using a weapon00 template
{
////////////////////////////////////////
// using a weapons00.wdl weapon template
weap_offset = ((weap_offset)*weapons00_weap_field_count);
if(weap_offset < 0) { return(0); }
return(PlBipedWeap00_Fire_Weapon00(weap_fx,weap_offset,plWeap_offset));
}
else
{
////////////////////////////////////////////
// using a weapLaunch00.wdl weapon template
weap_offset -= 100;
weap_offset = (weap_offset*weapLaunch00_weap_field_count);
if(weap_offset < 0) { return(0); }
return(PlBipedWeap00_Fire_WeapLaunch00(weap_fx,weap_offset,plWeap_offset));
}
return(0);
}
// Desc: select the 'next' weapon
function PLWeapons00_Select_Next()
{
temp = plBipedWeap00_current_weapon; // save the current weapon_number
plBipedWeap00_current_weapon += 1;
while(temp != plBipedWeap00_current_weapon)
{
if(plBipedWeap00_current_weapon > plBipedWeap00_weap_count)
{
plBipedWeap00_current_weapon = 0;
if(temp == 0) // started with no weapon
{
return(0);
}
}
if(plBipedWeap00_current_weapon > 0)
{
if( plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_valid]== 1)
{
return(plBipedWeap00_current_weapon);
}
}
plBipedWeap00_current_weapon += 1; // try next weapon
}
// check to make sure the starting weapon is valid
if( plBipedWeap00_weapon[((temp - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_valid]== 1)
{
plBipedWeap00_current_weapon = temp;
return(plBipedWeap00_current_weapon);
}
return(0); // no weapon
}
// Desc: select the 'prev' weapon
function PLWeapons00_Select_Prev()
{
temp = plBipedWeap00_current_weapon; // save the current weapon_number
plBipedWeap00_current_weapon -= 1;
while(temp != plBipedWeap00_current_weapon)
{
if(plBipedWeap00_current_weapon < 0)
{
plBipedWeap00_current_weapon = plBipedWeap00_weap_count;
if(temp == plBipedWeap00_weap_count) // started with max weapon
{
return(plBipedWeap00_weap_count);
}
}
if(plBipedWeap00_current_weapon > 0)
{
if( plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_valid]== 1)
{
return(plBipedWeap00_current_weapon);
}
}
plBipedWeap00_current_weapon -= 1; // try prev weapon
}
}
// Desc: hide all weapons (reset)
function PlBipedWeap00_Hide_All_Weapons()
{
plBipedWeap00_weapon1_ent.visible = off;
plBipedWeap00_weapon2_ent.visible = off;
plBipedWeap00_weapon3_ent.visible = off;
plBipedWeap00_weapon4_ent.visible = off;
plBipedWeap00_weapon5_ent.visible = off;
plBipedWeap00_weapon6_ent.visible = off;
plBipedWeap00_weapon7_ent.visible = off;
plBipedWeap00_weapon8_ent.visible = off;
}
// Desc: show the current weapon in hand
function PlBipedWeap00_Display_Weapon(num,per)
{
if((num < 1) || (num > plBipedWeap00_weap_count)) { PlBipedWeap00_Hide_All_Weapons(); }
if(num < 2) //1
{
my = plBipedWeap00_weapon1_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
if(num < 3) //2
{
my = plBipedWeap00_weapon2_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
if(num < 4) //3
{
my = plBipedWeap00_weapon3_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
if(num < 5) //4
{
my = plBipedWeap00_weapon4_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
if(num < 6) //5
{
my = plBipedWeap00_weapon5_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
if(num < 7) //6
{
my = plBipedWeap00_weapon6_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
if(num < 8) //7
{
my = plBipedWeap00_weapon7_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
return;
}
//8
my = plBipedWeap00_weapon8_ent;
my.visible = on;
PlBipedWeap00_Animate(per);
}
// Desc: hide weapon in hand
function PlBipedWeap00_Hide_Weapon(num)
{
if((num < 1) || (num > plBipedWeap00_weap_count)) { PlBipedWeap00_Hide_All_Weapons(); }
if(num < 2) { plBipedWeap00_weapon1_ent.visible = off; return; } //1
if(num < 3) { plBipedWeap00_weapon2_ent.visible = off; return; } //2
if(num < 4) { plBipedWeap00_weapon3_ent.visible = off; return; } //3
if(num < 5) { plBipedWeap00_weapon4_ent.visible = off; return; } //4
if(num < 6) { plBipedWeap00_weapon5_ent.visible = off; return; } //5
if(num < 7) { plBipedWeap00_weapon6_ent.visible = off; return; } //6
if(num < 8) { plBipedWeap00_weapon7_ent.visible = off; return; } //7
plBipedWeap00_weapon8_ent.visible = off; //8
}
// Desc: display the crosshair
function PlBipedWeap00_Display_Crosshair()
{
// Display crosshair
plBipedWeap00_crosshair1_pan.visible = on;
plBipedWeap00_crosshair1_pan.pos_x = (screen_size.x - bmap_width(plBipedWeap00_crosshair1_bmp))/2;
plBipedWeap00_crosshair1_pan.pos_y = (screen_size.y - bmap_height(plBipedWeap00_crosshair1_bmp))/2;
}
// Desc: Hide crosshair
function PlBipedWeap00_Hide_Crosshair()
{
// Display crosshair
plBipedWeap00_crosshair1_pan.visible = off;
}
//----------------------------------------------------------------------
// Desc: used to update the 3rd person weapon model
function PlBipedWeap00_Model_Update()
{
proc_late(); // should run after player is updated
my.passable = on;
while(1)
{
while(plBiped01_entity != 0)
{
vec_set(my.x,plBiped01_entity.x);
vec_set(my.pan,plBiped01_entity.pan);
my.frame = plBiped01_entity.frame;
my.next_frame = plBiped01_entity.next_frame;
wait(1);
}
wait(1);
}
}
// Desc: morph to the current weapon
function PlBipedWeap00_Model_Switch(ent,num)
{
if((num < 1) || (num > plBipedWeap00_weap_count)) { plBipedWeap00_cur_weapon_ent.invisible = on; return; }
if(num < 2) //1
{
ent_morph(ent,plBipedWeap00_weapon1_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon1_vertex;
return;
}
if(num < 3) //2
{
ent_morph(ent,plBipedWeap00_weapon2_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon2_vertex;
return;
}
if(num < 4) //3
{
ent_morph(ent,plBipedWeap00_weapon3_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon3_vertex;
return;
}
if(num < 5) //4
{
ent_morph(ent,plBipedWeap00_weapon4_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon4_vertex;
return;
}
if(num < 6) //5
{
ent_morph(ent,plBipedWeap00_weapon5_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon5_vertex;
return;
}
if(num < 7) //6
{
ent_morph(ent,plBipedWeap00_weapon6_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon6_vertex;
return;
}
if(num < 8) //7
{
ent_morph(ent,plBipedWeap00_weapon7_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon7_vertex;
return;
}
// 8
ent_morph(ent,plBipedWeap00_weapon8_mdl);
plBipedWeap00_cur_weapon_vertex = plBipedWeap00_weapon8_vertex;
}
// Desc: create/restore 3rd person weapon entity model
function PlBipedWeap00_Restore_Weapon_Ent()
{
if(plBipedWeap00_cur_weapon_ent != NULL) // already have a current weapon
{
return;
}
// create a placeholder weapon model
plBipedWeap00_cur_weapon_ent = ent_create(plBipedWeap00_weapon1_mdl,nullvector,PlBipedWeap00_Model_Update);
// switch to current weapon (if one is active)
PlBipedWeap00_Model_Switch(plBipedWeap00_cur_weapon_ent,plBipedWeap00_current_weapon);
}
//----------------------------------------------------------------------
// Starter Functions
//----------------------------------------------------------------------
// Desc: Initialize the starting values
starter PlBipedWeap00_Init()
{
var timer; // while timer < plBipedWeap00_cycle weapon is "busy"
var q_trigger_up; // has the fire button been released since last shot?
var burst_count; // shots left in the burst
var local_temp; // local temp value
// wait for the level to load before running
while(gid01_level_state == gid01_level_not_loaded) { wait(1); }
diag("\nWDL-Loaded:plBipedWeap00.wdl");
// Init:
PlBipedWeap00_Ammo_Init(); // ..ammo
PlBipedWeap00_Weapon_Init(); // ..weapons
plBipedWeap00_SetKeys(); // ..keys
PlBipedWeap00_Hide_All_Weapons(); // reset weapon panels
PlBipedWeap00_Restore_Weapon_Ent(); //create/restore 3rd person weapon entity model
// set current gun state to idle
plBipedWeap00_gun_state = plBipedWeap00_state_idle;
// Main loop...
while(1)
{
// only loop while we have a valid player, a level loaded, and the player is active
while((plSelect_curr_ent != NULL) && (gid01_level_state == gid01_level_loaded) && (plSelect_state == plSelect_state_active))
{
plSelect_curr_ent._biped01_state2_mod = biped01_state2_mod_none_const; // reset fire mode
// does player have a weapon active?
if(plBipedWeap00_current_weapon > 0)
{
// Display weapon and crosshair
if(cameraTarget_avatar_view_q == 1)
{
PlBipedWeap00_Display_Crosshair();
// Show 1st person weapon (and animate)
if(plBipedWeap00_cycle <= 0) { plBipedWeap00_cycle = 1; }
PlBipedWeap00_Display_Weapon(plBipedWeap00_current_weapon,(timer/plBipedWeap00_cycle));
// Hide 3rd person weapon
plBipedWeap00_cur_weapon_ent.invisible = on;
}
else
{
// Hide crosshair
PlBipedWeap00_Hide_Crosshair();
// Hide 1st person weapon
PlBipedWeap00_Hide_Weapon(plBipedWeap00_current_weapon);
// Show 3rd person weapon
plBipedWeap00_cur_weapon_ent.invisible = off;
}
// reset trigger down flag?
if(!Key_Pressed(plBipedWeap00_fire_scancode)) // wait until player releases fire key..
{
q_trigger_up = 1;
// section: Burst
// entry: Rounds
// entry: Number of rounds in a 'burst'
// id: 301
burst_count = 3; // 3 rounds burst reset.
}
// Is the player done with previous action?
if(timer >= plBipedWeap00_cycle)
{
// set current gun state to idle
plBipedWeap00_gun_state = plBipedWeap00_state_idle;
// if the player wants to fire...
if(Key_Pressed(plBipedWeap00_fire_scancode))
{
temp = plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_id];
if(temp < 100) // use weapon00 template
{
local_temp = weapons00_template[(temp*weapons00_weap_field_count) + weapons00_weap_fx];
}
else // use weapLaunch00 template
{
local_temp = weapLaunch00_template[((temp-100)*weapLaunch00_weap_field_count) + weapons00_weap_fx];
}
// check to see if we can fire
if((q_trigger_up == 1) // trigger let up...
|| (local_temp & weapons00_fx_auto) // ..or auto fire weapon
|| ((local_temp & weapons00_fx_burst)&&(burst_count>0))) // ..or burst with shots left
{
burst_count -= 1;
timer = 0; // reset timer
plBipedWeap00_gun_state = plBipedWeap00_state_fire; // change states to fire
plSelect_curr_ent._biped01_state2_mod = biped01_state2_mod_attack_const; // biped anim
wait(1); // allow animation to get to first frame!
plBipedWeap00_cycle = PlBipedWeap00_Fire_Current(local_temp); // fire weapon
q_trigger_up = 0; // trigger down
}
}
else // not firing
{
// player wants to reload?
if(Key_Pressed(plBipedWeap00_reload_scancode))
{
plBipedWeap00_cycle = plBipedWeap00_Reload_Clip(plBipedWeap00_current_weapon); // reload weapon?
timer = 0; // reset timer
plBipedWeap00_gun_state = plBipedWeap00_state_reload;
}
}
} // if(plBipedWeap00_cycle <= 0)
} // if(plBipedWeap00_current_weapon > 0) // weapon active
// Execute even if no weapon in hand...
// is the player done with previous action?
if(timer >= plBipedWeap00_cycle)
{
// switch to next weapon..
if(Key_Pressed(plBipedWeap00_next_scancode))
{
PlBipedWeap00_Hide_Weapon(plBipedWeap00_current_weapon); // hide current weapon
PLWeapons00_Select_Next();
plBipedWeap00_cycle = plBipedWeap00_switch_wait; // switch weapon wait
timer = 0; // reset timer
plBipedWeap00_gun_state = plBipedWeap00_state_switch;
// morph the 3rd person model to new weapon
PlBipedWeap00_Model_Switch(plBipedWeap00_cur_weapon_ent,plBipedWeap00_current_weapon);
}
// switch to previous weapon..
if(Key_Pressed(plBipedWeap00_prev_scancode))
{
PlBipedWeap00_Hide_Weapon(plBipedWeap00_current_weapon); // hide current weapon
PLWeapons00_Select_Prev();
plBipedWeap00_cycle = plBipedWeap00_switch_wait; // switch weapon wait
timer = 0; // reset timer
plBipedWeap00_gun_state = plBipedWeap00_state_switch;
// morph the 3rd person model to new weapon
PlBipedWeap00_Model_Switch(plBipedWeap00_cur_weapon_ent,plBipedWeap00_current_weapon);
}
}
else
{
timer += TIME; // increase timer
}
// if a valid weapon is active...
if((plBipedWeap00_current_weapon>0)&&(plBipedWeap00_current_weapon<=8))
{
// update the ammo counter for things like HUDs
plBipedWeap00_curr_ammo = plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_rounds];
}
/*ifdef PLBIPEDWEAP00_DEBUG;
plBipedWeap00_debug_data[0] = plBipedWeap00_current_weapon;
if((plBipedWeap00_current_weapon>0)&&(plBipedWeap00_current_weapon<=8))
{
plBipedWeap00_debug_data[1] = plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_rounds];
if((plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_ammotype]-1)>=0)
{
plBipedWeap00_debug_data[2] = plBipedWeap00_ammo[(plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_ammotype]-1)*plBipedWeap00_ammo_field_count];
}
// plBipedWeap00_debug_data[5] = plBipedWeap00_weapon[((plBipedWeap00_current_weapon - 1)*plBipedWeap00_weap_field_count)+plBipedWeap00_weap_fx];
}
plBipedWeap00_debug_data[3] = plBipedWeap00_cycle;
plBipedWeap00_debug_data[4] = timer;
plBipedWeap00_debug_data[5] = plBipedWeap00_gun_state;
endif;
*/
wait(1);
}
// while(plSelect_curr_ent != NULL) && ( gid01_level_state == gid01_level_loaded )
if( gid01_level_state == gid01_level_change) // changing level
{
while( gid01_level_state == gid01_level_change) // changing level
{
wait(1);
}
PlBipedWeap00_Restore_Weapon_Ent(); //create/restore 3rd person weapon entity model
}
wait(1);
}
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// Actions
// SKILL DEFINES
define _type__015,SKILL1;
define _amount__015,SKILL2;
define _message_time__015,SKILL3;
define _spin__015,SKILL4;
// Desc: pickup event for ammo
function PlBipedWeap00_Ammo_Pickup_Event()
{
if(you._gid01_id != gid01_player_const) { return; } // only react to player
// only react to player activate scans
if((event_type == event_scan) && (gid01_event_type != gid01_event_scan_activate)) { return; }
// hide object
my.passable = on;
my.invisible = on;
my.shadow = off;
my.enable_scan = off;
my.enable_impact = off;
my.enable_sonar = off;
// add ammo
plBipedWeap00_ammo[plBipedWeap00_ammo_field_count * my._type__015] += my._amount__015;
// clip to max
if(plBipedWeap00_ammo[plBipedWeap00_ammo_field_count * my._type__015]
> plBipedWeap00_ammo[(plBipedWeap00_ammo_field_count * my._type__015)+plBipedWeap00_ammo_max])
{
plBipedWeap00_ammo[plBipedWeap00_ammo_field_count * my._type__015]
= plBipedWeap00_ammo[(plBipedWeap00_ammo_field_count * my._type__015)+plBipedWeap00_ammo_max];
}
// play sound++
// display message++
// pause for set ammount of seconds
// sleep(my._message_time__015);
// remove object
wait(1);
remove(ME);
}
// Desc: when picked up, add ammo to player
//
// uses _type__015, _amount__015,
// uses _message_time__015, _spin__015
//------------------
// cntl: spin 1 x 1
// help: Ammo ID given to player on pickup.
// skill1: AmmoID 1
//
// cntl: spin 0 x 1
// help: Amount of ammo.
// skill2: Ammo 10
//
// cntl: spin 0 x 1
// help: How many seconds the "pickup message" sould be displayed.
// skill3: MessageTime 0
//
// cntl: spin x x 1
// help: How fast the object rotates (0 = no rotation).
// skill4: Spin 0
action PlBipedWeap00_AmmoP
{
ifdef GID01_OLD_COLLIDE; // use the old collision code
my.fat = OFF; my.narrow = ON;
ifelse; // use A6 collison
my.fat = ON; my.narrow = ON;
c_setminmax(my);
endif;
// check range
if((my._type__015 <= 0) || (my._type__015 > plBipedWeap00_ammo_tcount))
{
diag("\nWARNING! plBipedWeap00.wdl::PlBipedWeap00_Ammo_Pickup- ammo type out of range!");
my._type__015 = 0; // default ammo type is 1
}
else
{
my._type__015 -= 1; // correct for offset
}
// default ammo amount
if(my._amount__015 == 0)
{
diag("\nWARNING! plBipedWeap00.wdl::PlBipedWeap00_Ammo_Pickup- ammo ammount out of range!");
my._amount__015 = 10;
}
if(my._message_time__015 < 0)
{
my._message_time__015 = 0;
}
my.enable_scan = on; // player scans
my.enable_impact = on; // player hits
my.enable_sonar = on; // player steps on
my.event = PlBipedWeap00_Ammo_Pickup_Event;
if(my._spin__015 != 0)
{
while(1)
{
my.pan += TIME*my._spin__015;
wait(1);
}
}
}
// Desc: pickup event for weapon boxes
function PlBipedWeap00_Weapon_Pickup_Event()
{
if(you._gid01_id != gid01_player_const) { return; } // only react to player
// only react to player activate scans
if((event_type == event_scan) && (gid01_event_type != gid01_event_scan_activate)) { return; }
// hide object
my.passable = on;
my.invisible = on;
my.shadow = off;
my.enable_scan = off;
my.enable_impact = off;
my.enable_sonar = off;
// add weapon
plBipedWeap00_weapon[(my._type__015*plBipedWeap00_weap_field_count) + plBipedWeap00_weap_valid] = 1;
// add ammo
temp = weapons00_template[(my._type__015*weapons00_weap_field_count) + weapons00_weap_ammotype] - 1;
if(temp >= 0)
{
plBipedWeap00_ammo[plBipedWeap00_ammo_field_count * temp] += my._amount__015;
// clip to max
if(plBipedWeap00_ammo[plBipedWeap00_ammo_field_count * temp]
> plBipedWeap00_ammo[(plBipedWeap00_ammo_field_count * temp)+plBipedWeap00_ammo_max])
{
plBipedWeap00_ammo[plBipedWeap00_ammo_field_count * temp]
= plBipedWeap00_ammo[(plBipedWeap00_ammo_field_count * temp)+plBipedWeap00_ammo_max];
}
}
// play sound++
// display message++
// pause for set ammount of seconds
//sleep(my._message_time__015);
// remove object
my.enable_scan = off; // deactivate player scans
my.enable_impact = off; // deactivate player hits
my.enable_sonar = off; // deactivate player steps on
wait(1);
remove(ME);
}
// Desc: when picked up allow the player to use that weapon
//
// uses _type__015, _amount__015,
// uses _message_time__015, _spin__015
//
//------------------
// cntl: spin 1 x 1
// help: Weapon ID given to player on pickup.
// skill1: WeaponID 1
//
// cntl: spin 0 x 1
// help: Amount of ammo in this gun.
// skill2: Ammo 0
//
// cntl: spin 0 x 1
// help: How many seconds the "pickup message"