Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
resources.qh File Reference
#include <common/stats.qh>
#include "all.inc"
Include dependency graph for resources.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Resource

Macros

#define REGISTER_RESOURCE(id, inst)

Functions

float GetResourceField (Resource res_type)
 Converts resource type (a RES_* constant) to entity field.
Resource GetResourceType (.float res_field)
 Converts an entity field to resource type.
 REGISTER_RESOURCE (NONE, NEW(Resource))
 Describes the available resource types.
 REGISTRY (Resources, BITS(4))
 STATIC_INIT (default_order_resources)
 STATIC_INIT (Resources_renumber)

Variables

int ammo_cells
const int ammo_fuel = _STAT(FUEL)
int ammo_nails
int ammo_none
int ammo_rockets
int ammo_shells
float armorvalue
IntrusiveList default_order_resources
float health
 Legacy fields for the resources. To be removed.
const int RES_AMOUNT_HARD_LIMIT = 999
 Unconditional maximum amount of resources the entity can have.
const int RES_LIMIT_NONE = -1

Macro Definition Documentation

◆ REGISTER_RESOURCE

#define REGISTER_RESOURCE ( id,
inst )
Value:
REGISTER(Resources, RES, id, m_id, inst)
int m_id
Definition effect.qh:19
#define REGISTER(...)
Register a new entity with a registry.
Definition registry.qh:87

Definition at line 35 of file resources.qh.

Referenced by REGISTER_RESOURCE().

Function Documentation

◆ GetResourceField()

float GetResourceField ( Resource res_type)

Converts resource type (a RES_* constant) to entity field.

Parameters
[in]res_typeType of the resource.
Returns
Entity field for that resource.

Definition at line 11 of file resources.qc.

12{
13 return res_type.m_field;
14}
float m_field
Definition resources.qh:29

References Resource::m_field.

Referenced by SetResourceExplicit().

◆ GetResourceType()

Resource GetResourceType ( .float res_field)

Converts an entity field to resource type.

Parameters
[in]res_fieldEntity field to convert.
Returns
Resource type (a RES_* constant).

Definition at line 4 of file resources.qc.

5{
6 FOREACH(Resources, it.m_field == res_field, return it);
7 error("GetResourceType: Invalid field.");
8 return RES_NONE;
9}
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define error
Definition pre.qh:6

References error, and FOREACH.

◆ REGISTER_RESOURCE()

REGISTER_RESOURCE ( NONE ,
NEW(Resource)  )

Describes the available resource types.

Indicates the lack of resource. Use with caution.

◆ REGISTRY()

REGISTRY ( Resources ,
BITS(4)  )

◆ STATIC_INIT() [1/2]

STATIC_INIT ( default_order_resources )

Definition at line 43 of file resources.qh.

44{
46 FOREACH(Resources, true, {
48 });
49}
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_NEW()
IntrusiveList default_order_resources
Definition resources.qh:42

References default_order_resources, FOREACH, IL_NEW, and IL_PUSH().

◆ STATIC_INIT() [2/2]

STATIC_INIT ( Resources_renumber )

Definition at line 56 of file resources.qh.

56{ FOREACH(Resources, true, it.m_id = i); }

References FOREACH, and STATIC_INIT.

Variable Documentation

◆ ammo_cells

int ammo_cells

Definition at line 18 of file resources.qh.

Referenced by REGISTER_RESOURCE().

◆ ammo_fuel

const int ammo_fuel = _STAT(FUEL)

Definition at line 20 of file resources.qh.

Referenced by REGISTER_RESOURCE().

◆ ammo_nails

int ammo_nails

Definition at line 16 of file resources.qh.

Referenced by REGISTER_RESOURCE().

◆ ammo_none

int ammo_none

Definition at line 14 of file resources.qh.

◆ ammo_rockets

int ammo_rockets

Definition at line 17 of file resources.qh.

Referenced by REGISTER_RESOURCE().

◆ ammo_shells

int ammo_shells

Definition at line 15 of file resources.qh.

Referenced by REGISTER_RESOURCE(), and SPAWNFUNC_Q3().

◆ armorvalue

float armorvalue

Definition at line 10 of file resources.qh.

Referenced by classfield(), and REGISTER_RESOURCE().

◆ default_order_resources

IntrusiveList default_order_resources

Definition at line 42 of file resources.qh.

Referenced by HUD_Ammo(), and STATIC_INIT().

◆ health

◆ RES_AMOUNT_HARD_LIMIT

const int RES_AMOUNT_HARD_LIMIT = 999

Unconditional maximum amount of resources the entity can have.

Definition at line 59 of file resources.qh.

Referenced by GetResourceLimit().

◆ RES_LIMIT_NONE