Xonotic
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  {
9  CONSTRUCT(Model);
10  this.model_str = path;
11  }
12  METHOD(Model, model_precache, void(Model this))
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()); \
30 MACRO_END
CLASS(Object) Object
Definition: oo.qh:318
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
#define CONSTRUCT(cname,...)
Definition: oo.qh:111
#define ATTRIB(...)
Definition: oo.qh:136
#define strcpy(this, s)
Definition: string.qh:49
#define LOG_WARNF(...)
Definition: log.qh:67
int m_id
Definition: effect.qh:19
Definition: model.qh:3
#define TC(T, sym)
Definition: _all.inc:82
#define ENDCLASS(cname)
Definition: oo.qh:269
ERASEABLE bool fexists(string f)
Definition: file.qh:4
#define CONSTRUCTOR(cname,...)
Definition: oo.qh:201