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

Function DispatchScriptProperty

src/scripting/decorate/thingdef_parse.cpp:849–931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847//==========================================================================
848
849static void DispatchScriptProperty(FScanner &sc, PProperty *prop, AActor *defaults, Baggage &bag)
850{
851 for (unsigned i=0; i<prop->Variables.Size();i++)
852 {
853 auto f = prop->Variables[i];
854 void *addr;
855
856 if (i > 0) sc.MustGetStringName(",");
857 if (f->Flags & VARF_Meta)
858 {
859 addr = ((char*)bag.Info->Meta) + f->Offset;
860 }
861 else
862 {
863 addr = ((char*)defaults) + f->Offset;
864 }
865
866 if (f->Type == TypeBool)
867 {
868 bool val = sc.CheckNumber() ? !!sc.Number : true;
869 static_cast<PBool*>(f->Type)->SetValue(addr, !!val);
870 }
871 else if (f->Type == TypeName)
872 {
873 sc.MustGetString();
874 *(FName*)addr = sc.String;
875 }
876 else if (f->Type == TypeSound)
877 {
878 sc.MustGetString();
879 *(FSoundID*)addr = S_FindSound(sc.String);
880 }
881 else if (f->Type == TypeColor)
882 {
883 if (sc.CheckNumber()) *(int*)addr = sc.Number;
884 else *(PalEntry*)addr = V_GetColor(sc);
885 }
886 else if (f->Type->isIntCompatible())
887 {
888 sc.MustGetNumber();
889 static_cast<PInt*>(f->Type)->SetValue(addr, sc.Number);
890 }
891 else if (f->Type->isFloat())
892 {
893 sc.MustGetFloat();
894 static_cast<PFloat*>(f->Type)->SetValue(addr, sc.Float);
895 }
896 else if (f->Type == TypeString)
897 {
898 sc.MustGetString();
899 *(FString*)addr = strbin1(sc.String);
900 }
901 else if (f->Type->isClassPointer())
902 {
903 sc.MustGetString();
904
905 if (*sc.String == 0 || !stricmp(sc.String, "none"))
906 {

Callers 2

ParseActorPropertyFunction · 0.85

Calls 15

S_FindSoundFunction · 0.85
V_GetColorFunction · 0.85
strbin1Function · 0.85
stricmpFunction · 0.85
MustGetStringNameMethod · 0.80
MustGetStringMethod · 0.80
isIntCompatibleMethod · 0.80
MustGetNumberMethod · 0.80
MustGetFloatMethod · 0.80
isClassPointerMethod · 0.80
FindClassTentativeMethod · 0.80
IsDescendantOfMethod · 0.80

Tested by

no test coverage detected