Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
model.qh
Go to the documentation of this file.
1#pragma once
2
4 ATTRIB(Model, m_id, int, 0);
5 ATTRIB(Model, model_str, string());
6 ATTRIB(Model, model_str_, string);
7 CONSTRUCTOR(Model, string() path)
8 {
10 this.model_str = path;
11 }
13 {
14 TC(Model, this);
15 string s = this.model_str();
16 if (s != "" && s != "null" && !fexists(s)) {
17 LOG_WARNF("Missing model: \"%s\"", s);
18 return;
19 }
20 //profile(sprintf("precache_model(\"%s\")", s));
21 precache_model(s);
22 strcpy(this.model_str_, s);
23 }
25
26#define setmodel(this, m) MACRO_BEGIN \
27 Model _setmodel_model = (m); \
28 string _setmodel_cached = _setmodel_model.model_str_; \
29 _setmodel((this), _setmodel_cached ? _setmodel_cached : _setmodel_model.model_str()); \
30MACRO_END
Definition model.qh:3
Model(string() path)
Definition model.qh:7
int m_id
Definition model.qh:4
virtual void model_precache()
Definition model.qh:12
ATTRIB(Model, model_str, string())
ERASEABLE bool fexists(string f)
Definition file.qh:4
#define TC(T, sym)
Definition _all.inc:82
#define LOG_WARNF(...)
Definition log.qh:62
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define CONSTRUCTOR(cname,...)
Definition oo.qh:213
#define CONSTRUCT(cname,...)
Definition oo.qh:123
#define strcpy(this, s)
Definition string.qh:52