MCPcopy Create free account
hub / github.com/assaultcube/AC / mapmodel

Function mapmodel

source/src/rendermodel.cpp:112–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110const char *mmshortname(const char *name) { return !strncmp(name, mmpath, strlen(mmpath)) ? name + strlen(mmpath) : name; }
111
112void mapmodel(int *rad, int *h, int *zoff, char *scale, char *name, char *flags)
113{
114 if(*scale && *name) // ignore "mapmodel" commands with insufficient parameters
115 {
116 if(!_ignoreillegalpaths && !strchr(name, '/') && !strchr(name, '\\')) { flagmapconfigerror(LWW_CONFIGERR * 2); } // throw errors for unconverted mapmodels (unspecific, because not all get detected)
117 intret(mapmodels.length());
118 mapmodelinfo &mmi = mapmodels.add();
119 mmi.rad = *rad;
120 mmi.h = *h;
121 mmi.zoff = *zoff;
122 mmi.scale = atof(scale);
123 mmi.flags = 0;
124 if(*flags) mmi.flags = ATOI(flags);
125 if(mmi.scale < 0.25f || mmi.scale > 4.0f)
126 {
127 mmi.scale = 1.0f;
128 if(strcmp(scale, "0")) { flagmapconfigerror(LWW_CONFIGERR * 2); scripterr(); }
129 }
130 mmi.m = NULL;
131
132 filtertext(name, name, FTXT__MEDIAFILEPATH);
133 formatstring(mmi.name)("%s%s", mmpath, name[0] == '.' && name[1] == '/' ? name + 2 : name);
134 mapmodelchanged = 1;
135 flagmapconfigchange();
136 }
137 else { flagmapconfigerror(LWW_CONFIGERR * 2); scripterr(); }
138}
139COMMAND(mapmodel, "iiisss");
140
141void mapmodelreset()

Callers

nothing calls this directly

Calls 7

flagmapconfigerrorFunction · 0.85
intretFunction · 0.85
scripterrFunction · 0.85
filtertextFunction · 0.85
flagmapconfigchangeFunction · 0.85
lengthMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected