Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
resources.qh
Go to the documentation of this file.
1#pragma once
2
3#ifdef SVQC
4 #include <common/stats.qh>
5#endif
6
7#ifdef CSQC
9.float health;
11#endif
12
13#if 1
19#ifdef SVQC
20const .int ammo_fuel = _STAT(FUEL);
21#else
22.int ammo_fuel;
23#endif
24#endif
25
27 ATTRIB(Resource, netname, string, "");
28#ifdef GAMEQC
30#endif
31 ATTRIB(Resource, m_name, string, "");
32 ATTRIB(Resource, m_icon, string, "");
34
35#define REGISTER_RESOURCE(id, inst) REGISTER(Resources, RES, id, m_id, inst)
36REGISTRY(Resources, BITS(4));
37REGISTER_REGISTRY(Resources)
38
39#ifdef CSQC
40// Copy Resources registry here before it gets sorted alphabetically by REGISTRY_SORT
41// so we can keep resources sorted by categories (as they appear in the code)
50#endif
51
52REGISTRY_SORT(Resources)
53REGISTRY_CHECK(Resources)
54
55REGISTRY_DEFINE_GET(Resources, NULL)
56STATIC_INIT(Resources_renumber) { FOREACH(Resources, true, it.m_id = i); }
57
59const int RES_AMOUNT_HARD_LIMIT = 999;
60const int RES_LIMIT_NONE = -1;
61
64
65#include "all.inc"
66
67#ifdef GAMEQC
68// ===================== Legacy and/or internal API ===========================
69
73Resource GetResourceType(.float res_field);
74
78.float GetResourceField(Resource res_type);
79#endif
#define BITS(n)
Definition bits.qh:9
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
string m_icon
Definition resources.qh:32
string m_name
Definition resources.qh:31
string netname
Definition resources.qh:27
float m_field
Definition resources.qh:29
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_NEW()
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define _STAT(id)
Definition stats.qh:93
#define NEW(cname,...)
Definition oo.qh:117
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define ATTRIB(...)
Definition oo.qh:148
#define NULL
Definition post.qh:14
#define REGISTRY_SORT(...)
Definition registry.qh:128
#define REGISTER_REGISTRY(id)
Definition registry.qh:229
#define REGISTRY(id, max)
Declare a new registry.
Definition registry.qh:26
#define REGISTRY_CHECK(id)
Definition registry.qh:175
#define REGISTRY_DEFINE_GET(id, null)
Definition registry.qh:40
int ammo_nails
Definition resources.qh:16
Resource GetResourceType(.float res_field)
Converts an entity field to resource type.
Definition resources.qc:4
IntrusiveList default_order_resources
Definition resources.qh:42
const int ammo_fuel
Definition resources.qh:20
#define REGISTER_RESOURCE(id, inst)
Definition resources.qh:35
int ammo_cells
Definition resources.qh:18
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
int ammo_shells
Definition resources.qh:15
float armorvalue
Definition resources.qh:10
const int RES_LIMIT_NONE
Definition resources.qh:60
float GetResourceField(Resource res_type)
Converts resource type (a RES_* constant) to entity field.
Definition resources.qc:11
int ammo_rockets
Definition resources.qh:17
int ammo_none
Definition resources.qh:14
const int RES_AMOUNT_HARD_LIMIT
Unconditional maximum amount of resources the entity can have.
Definition resources.qh:59
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32