MCPcopy Create free account
hub / github.com/ZDoom/gzdoom / DispatchProperty

Method DispatchProperty

src/scripting/zscript/zcc_compile_doom.cpp:229–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227//==========================================================================
228
229void ZCCDoomCompiler::DispatchProperty(FPropertyInfo *prop, ZCC_PropertyStmt *property, AActor *defaults, Baggage &bag)
230{
231 static TArray<FPropParam> params;
232 static TArray<FString> strings;
233
234 params.Clear();
235 strings.Clear();
236 params.Reserve(1);
237 params[0].i = 0;
238 if (prop->params[0] != '0')
239 {
240 if (property->Values == nullptr)
241 {
242 Error(property, "%s: arguments missing", prop->name);
243 return;
244 }
245 const char * p = prop->params;
246 auto exp = property->Values;
247
248 FCompileContext ctx(OutNamespace, bag.Info->VMType, false, mVersion);
249 while (true)
250 {
251 FPropParam conv;
252 FPropParam pref;
253
254 FxExpression *ex = ConvertNode(exp);
255 ex = ex->Resolve(ctx);
256 if (ex == nullptr)
257 {
258 return;
259 }
260 else if (!ex->isConstant())
261 {
262 // If we get TypeError, there has already been a message from deeper down so do not print another one.
263 if (exp->Type != TypeError) Error(exp, "%s: non-constant parameter", prop->name);
264 return;
265 }
266 conv.s = nullptr;
267 pref.s = nullptr;
268 pref.i = -1;
269 switch ((*p) & 223)
270 {
271
272 case 'X': // Expression in parentheses or number. We only support the constant here. The function will have to be handled by a separate property to get past the parser.
273 conv.i = GetIntConst(ex, ctx);
274 params.Push(conv);
275 conv.exp = nullptr;
276 break;
277
278 case 'I':
279 case 'M': // special case for morph styles in DECORATE . This expression-aware parser will not need this.
280 case 'N': // special case for thing activations in DECORATE. This expression-aware parser will not need this.
281 conv.i = GetIntConst(ex, ctx);
282 break;
283
284 case 'F':
285 conv.d = GetFloatConst(ex, ctx);
286 break;

Callers

nothing calls this directly

Calls 9

GetIntConstFunction · 0.85
GetFloatConstFunction · 0.85
GetFuncConstFunction · 0.85
ReserveMethod · 0.80
GetMessageMethod · 0.80
ClearMethod · 0.45
ResolveMethod · 0.45
isConstantMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected