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

Method DispatchScriptProperty

src/scripting/zscript/zcc_compile_doom.cpp:440–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440void ZCCDoomCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *property, AActor *defaults, Baggage &bag)
441{
442 ZCC_ExprConstant one;
443 unsigned parmcount = 1;
444 ZCC_TreeNode *x = property->Values;
445 if (x == nullptr)
446 {
447 parmcount = 0;
448 }
449 else
450 {
451 while (x->SiblingNext != property->Values)
452 {
453 x = x->SiblingNext;
454 parmcount++;
455 }
456 }
457 if (parmcount == 0 && prop->Variables.Size() == 1 && prop->Variables[0]->Type == TypeBool)
458 {
459 // allow boolean properties to have the parameter omitted
460 memset(&one, 0, sizeof(one));
461 one.SourceName = property->SourceName; // This may not be null!
462 one.Operation = PEX_ConstValue;
463 one.NodeType = AST_ExprConstant;
464 one.Type = TypeBool;
465 one.IntVal = 1;
466 property->Values = &one;
467 }
468 else if (parmcount != prop->Variables.Size())
469 {
470 Error(x == nullptr? property : x, "Argument count mismatch: Got %u, expected %u", parmcount, prop->Variables.Size());
471 return;
472 }
473
474 auto exp = property->Values;
475 FCompileContext ctx(OutNamespace, bag.Info->VMType, false, mVersion);
476 for (auto f : prop->Variables)
477 {
478 void *addr;
479 if (f == nullptr)
480 {
481 // This variable was missing. The error had been reported for the property itself already.
482 return;
483 }
484
485 if (f->Flags & VARF_Meta)
486 {
487 addr = ((char*)bag.Info->Meta) + f->Offset;
488 }
489 else
490 {
491 addr = ((char*)defaults) + f->Offset;
492 }
493
494 FxExpression *ex = ConvertNode(exp);
495 ex = ex->Resolve(ctx);
496 if (ex == nullptr)
497 {

Callers

nothing calls this directly

Calls 15

GetIntConstFunction · 0.85
S_FindSoundFunction · 0.85
V_GetColorFunction · 0.85
GetFloatConstFunction · 0.85
stricmpFunction · 0.85
isConstVectorMethod · 0.80
isIntCompatibleMethod · 0.80
isClassPointerMethod · 0.80
FindClassTentativeMethod · 0.80
IsDescendantOfMethod · 0.80
isFunctionPointerMethod · 0.80
SplitMethod · 0.80

Tested by

no test coverage detected