mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-23 20:32:51 +00:00
- added ZScript property handling for names, sounds and colors.
This commit is contained in:
parent
2f1b5c375e
commit
c01289e999
2 changed files with 28 additions and 1 deletions
|
@ -840,6 +840,21 @@ static void DispatchScriptProperty(FScanner &sc, PProperty *prop, AActor *defaul
|
|||
bool val = sc.CheckNumber() ? !!sc.Number : true;
|
||||
static_cast<PBool*>(f->Type)->SetValue(addr, !!val);
|
||||
}
|
||||
else if (f->Type == TypeName)
|
||||
{
|
||||
sc.MustGetString();
|
||||
*(FName*)addr = sc.String;
|
||||
}
|
||||
else if (f->Type == TypeSound)
|
||||
{
|
||||
sc.MustGetString();
|
||||
*(FSoundID*)addr = sc.String;
|
||||
}
|
||||
else if (f->Type == TypeColor)
|
||||
{
|
||||
if (sc.CheckNumber()) *(int*)addr = sc.Number;
|
||||
else *(PalEntry*)addr = V_GetColor(nullptr, sc);
|
||||
}
|
||||
else if (f->Type->IsKindOf(RUNTIME_CLASS(PInt)))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
|
|
|
@ -1720,7 +1720,19 @@ void ZCCCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *prop
|
|||
{
|
||||
static_cast<PBool*>(f->Type)->SetValue(addr, !!GetIntConst(ex, ctx));
|
||||
}
|
||||
if (f->Type->IsKindOf(RUNTIME_CLASS(PInt)))
|
||||
else if (f->Type == TypeName)
|
||||
{
|
||||
*(FName*)addr = GetStringConst(ex, ctx);
|
||||
}
|
||||
else if (f->Type == TypeSound)
|
||||
{
|
||||
*(FSoundID*)addr = GetStringConst(ex, ctx);
|
||||
}
|
||||
else if (f->Type == TypeColor && ex->ValueType == TypeString) // colors can also be specified as ints.
|
||||
{
|
||||
*(PalEntry*)addr = V_GetColor(nullptr, GetStringConst(ex, ctx).GetChars(), &ex->ScriptPosition);
|
||||
}
|
||||
else if (f->Type->IsKindOf(RUNTIME_CLASS(PInt)))
|
||||
{
|
||||
static_cast<PInt*>(f->Type)->SetValue(addr, GetIntConst(ex, ctx));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue