Nuclide
Software Development Kit for id Tech
weapon_common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17#ifndef NEW_INVENTORY
18/* for AI identification purposes */
19typedef enum
20{
21 WPNTYPE_INVALID, /* no logic */
22 WPNTYPE_RANGED, /* will want to keep their distance mostly */
23 WPNTYPE_THROW, /* has to keep some distance, but not too far */
24 WPNTYPE_CLOSE, /* have to get really close */
25 WPNTYPE_FULLAUTO, /* for things that need to be held down */
26 WPNTYPE_SEMI /* semi automatic */
28
29typedef struct
30{
31 string name;
32 int id; /* bitflag id */
33 int slot;
36 int weight; /* required for bestweapon */
37 void(void) precache;
38 string() wmodel;
39 string() deathmsg;
40
41 /* NSClientPlayer specific */
42 string(NSClientPlayer) pmodel;
43 float(NSClientPlayer) aimanim;
44 weapontype_t(NSClientPlayer) type; /* required for bot-AI */
45 void(NSClientPlayer) draw;
46 void(NSClientPlayer) holster;
47 void(NSClientPlayer) primary;
48 void(NSClientPlayer) secondary;
49 void(NSClientPlayer) reload;
50 void(NSClientPlayer) release;
51 int(NSClientPlayer, int, int) pickup;
52 void(NSClientPlayer) updateammo;
53
54 void(NSClientPlayer, int) predraw; /* predraw... */
55 void(NSClientPlayer) postdraw; /* postdraw... */
56
57 int(NSClientPlayer) isempty; /* kinda handy */
58 void(NSClientPlayer, int, vector, float) hudpic;
59} weapon_t;
60
61void Weapons_Init(void);
69
78void Weapons_UpdateAmmo(NSClientPlayer, int, int, int);
80void Weapons_EnableModel(void);
81void Weapons_DisableModel(void);
83
84void Weapons_SetLeftModel(string);
85void Weapons_SetRightModel(string);
86
87void Weapons_SetRightGeomset(string);
88void Weapons_SetLeftGeomset(string);
89
90/* compat */
91void Weapons_SetGeomset(string);
92void Weapons_SetModel(string);
93
94void Weapons_Sound(entity, float, string);
95string Weapons_GetWorldmodel(int);
96
97#ifdef CLIENT
99void Weapons_HUDPic(NSClientPlayer, int, int, vector, float);
100#endif
101#else
102#endif
weapontype_t
Definition: NSNavAI.h:35
This entity class represents every player client.
Definition: NSClientPlayer.h:26
entity *__variant __variant int type
Definition: fteextensions.qc:1746
vector(vector) normalize
entity() spawn
Definition: weapon_common.h:30
int slot
Definition: weapon_common.h:33
int slot_pos
Definition: weapon_common.h:34
int weight
Definition: weapon_common.h:36
void(void) precache
int id
Definition: weapon_common.h:32
int allow_drop
Definition: weapon_common.h:35
string() wmodel
string name
Definition: weapon_common.h:31
weapontype_t
Definition: weapon_common.h:20
@ WPNTYPE_SEMI
Definition: weapon_common.h:26
@ WPNTYPE_THROW
Definition: weapon_common.h:23
@ WPNTYPE_RANGED
Definition: weapon_common.h:22
@ WPNTYPE_FULLAUTO
Definition: weapon_common.h:25
@ WPNTYPE_CLOSE
Definition: weapon_common.h:24
@ WPNTYPE_INVALID
Definition: weapon_common.h:21
void Weapons_DisableModel(void)
Definition: weapon_common.qc:213
void Weapons_Primary(NSClientPlayer pl)
Definition: weapon_common.qc:69
weapontype_t Weapons_GetType(NSClientPlayer, int)
Definition: weapon_common.qc:113
void Weapons_PreDraw(NSClientPlayer pl, int)
Definition: weapon_common.qc:100
void Weapons_Release(NSClientPlayer pl)
Definition: weapon_common.qc:94
void Weapons_MakeVectors(NSClientPlayer pl)
Definition: weapon_common.qc:156
void Weapons_HUDPic(NSClientPlayer, int, int, vector, float)
Definition: weapon_common.qc:150
void Weapons_DrawCrosshair(NSClientPlayer pl)
Definition: weapon_common.qc:119
void Weapons_SetModel(string)
Definition: weapon_common.qc:35
void Weapons_SetLeftGeomset(string)
Definition: weapon_common.qc:46
void Weapons_SetGeomset(string)
Definition: weapon_common.qc:52
int Weapons_IsEmpty(NSClientPlayer, int)
Definition: weapon_common.qc:106
int Weapons_IsPresent(NSClientPlayer, int)
Definition: weapon_common.qc:199
void Weapons_Draw(NSClientPlayer pl)
Definition: weapon_common.qc:57
void Weapons_SetLeftModel(string)
Definition: weapon_common.qc:24
float Weapons_GetAim(NSClientPlayer, int)
Definition: weapon_common.qc:143
void Weapons_ViewAnimation(NSClientPlayer pl, int)
Definition: weapon_common.qc:176
void Weapons_ViewPunchAngle(NSClientPlayer pl, vector)
Definition: weapon_common.qc:193
vector Weapons_GetCameraPos(NSClientPlayer pl)
Definition: weapon_common.qc:166
string Weapons_GetPlayermodel(NSClientPlayer, int)
Definition: weapon_common.qc:131
void Weapons_Init(void)
Definition: weapon_common.qc:18
void Weapons_SetRightModel(string)
Definition: weapon_common.qc:29
int Weapons_GetAnimation(NSClientPlayer pl)
Definition: weapon_common.qc:187
string Weapons_GetWorldmodel(int)
Definition: weapon_common.qc:125
void Weapons_Reload(NSClientPlayer pl)
Definition: weapon_common.qc:88
void Weapons_EnableModel(void)
Definition: weapon_common.qc:205
void Weapons_Holster(NSClientPlayer pl)
Definition: weapon_common.qc:63
void Weapons_Sound(entity, float, string)
Definition: weapon_common.qc:245
void Weapons_Secondary(NSClientPlayer pl)
Definition: weapon_common.qc:82
void Weapons_SetRightGeomset(string)
Definition: weapon_common.qc:41
void Weapons_UpdateAmmo(NSClientPlayer, int, int, int)
Definition: weapon_common.qc:228