diff options
Diffstat (limited to 'System.c4g')
| -rw-r--r-- | System.c4g/DTCallback.c | 1 | ||||
| -rw-r--r-- | System.c4g/DTUtility.c | 58 |
2 files changed, 30 insertions, 29 deletions
diff --git a/System.c4g/DTCallback.c b/System.c4g/DTCallback.c index 58f6403..5ec876d 100644 --- a/System.c4g/DTCallback.c +++ b/System.c4g/DTCallback.c @@ -172,6 +172,7 @@ global func BindArgs(array binding, array args, bool safe, array& refs) var ret = CreateArray(GetLength(binding)), pos = 0; for(var bind in binding) { + bind ??= 0; // necessary for non-#strict 3 compatibility if(GetType(bind) == C4V_Int || GetType(bind) == C4V_Any && bind >= 0) { ret[pos] = args[bind]; diff --git a/System.c4g/DTUtility.c b/System.c4g/DTUtility.c index 752000b..be8200e 100644 --- a/System.c4g/DTUtility.c +++ b/System.c4g/DTUtility.c @@ -315,9 +315,9 @@ global func GetIDByName(string name, int category) // WARNING: desyncs between c var i, id;
while(id = GetDefinition(i++, category))
{
- if(GetName(0, id) == name) return id;
+ if(GetName(nil, id) == name) return id;
}
- return 0;
+ return nil;
}
global func GetIDsByName(string name, int category) // WARNING: desyncs between clients with different languages
@@ -325,7 +325,7 @@ global func GetIDsByName(string name, int category) // WARNING: desyncs between var i, id, ret = [];
while(id = GetDefinition(i++, category))
{
- if(GetName(0, id) == name)
+ if(GetName(nil, id) == name)
{
ret[] = id;
}
@@ -598,9 +598,9 @@ global func GetSolidMask(object obj) obj = obj || this;
return
[
- GetObjectVal("SolidMask", 0, obj, 0), GetObjectVal("SolidMask", 0, obj, 1),
- GetObjectVal("SolidMask", 0, obj, 2), GetObjectVal("SolidMask", 0, obj, 3),
- GetObjectVal("SolidMask", 0, obj, 4), GetObjectVal("SolidMask", 0, obj, 5)
+ GetObjectVal("SolidMask", nil, obj, 0), GetObjectVal("SolidMask", nil, obj, 1),
+ GetObjectVal("SolidMask", nil, obj, 2), GetObjectVal("SolidMask", nil, obj, 3),
+ GetObjectVal("SolidMask", nil, obj, 4), GetObjectVal("SolidMask", nil, obj, 5)
];
}
@@ -628,7 +628,7 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje {
if(getValue == 0)
{
- if(GetObjectVal("GfxOverlay", 0, obj, startIndex) == 0)
+ if(GetObjectVal("GfxOverlay", nil, obj, startIndex) == 0)
{
// there is no such overlay
return -1;
@@ -640,13 +640,13 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje }
else if(getValue == 1)
{
- return GetObjectVal("GfxOverlay", 0, obj, startIndex);
+ return GetObjectVal("GfxOverlay", nil, obj, startIndex);
}
found = true;
}
for(var i = startIndex + 1, foundIndex = 0; ;) // skip overlay ID
{
- var val = GetObjectVal("GfxOverlay", 0, obj, i);
+ var val = GetObjectVal("GfxOverlay", nil, obj, i);
if(val == 0)
{
// there is no overlay left
@@ -674,13 +674,13 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje }
else if(getValue == 4)
{
- return GetObjectVal("GfxOverlay", 0, obj, i + 1);
+ return GetObjectVal("GfxOverlay", nil, obj, i + 1);
}
}
i += 2; // skip Graphics-Definition and -Name, so i points to OverlayMode here too
if(found && getValue == 2)
{
- return GetObjectVal("GfxOverlay", 0, obj, i);
+ return GetObjectVal("GfxOverlay", nil, obj, i);
}
}
else
@@ -693,11 +693,11 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje {
if(getValue == 5)
{
- return GetObjectVal("GfxOverlay", 0, obj, i + 1);
+ return GetObjectVal("GfxOverlay", nil, obj, i + 1);
}
else if(getValue == 6)
{
- return GetObjectVal("GfxOverlay", 0, obj, i + 2);
+ return GetObjectVal("GfxOverlay", nil, obj, i + 2);
}
else if(getValue == 7)
{
@@ -706,7 +706,7 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje }
i += 10; // this is either the last row of the Transformation matrix or the Color-Modulation
- val = GetObjectVal("GfxOverlay", 0, obj, i);
+ val = GetObjectVal("GfxOverlay", nil, obj, i);
if(GetType(val) == C4V_String)
{
@@ -716,14 +716,14 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje if(found && getValue == 8)
{
- return GetObjectVal("GfxOverlay", 0, obj, i + 2);
+ return GetObjectVal("GfxOverlay", nil, obj, i + 2);
}
i += 3; // and the rest
if(++foundIndex == index)
{
- if(GetObjectVal("GfxOverlay", 0, obj, i) == 0)
+ if(GetObjectVal("GfxOverlay", nil, obj, i) == 0)
{
// there is no overlay left
return -1;
@@ -737,7 +737,7 @@ global func GetOverlayValueByIndex(int index, int startIndex, int getValue, obje }
else if(getValue == 1)
{
- return GetObjectVal("GfxOverlay", 0, obj, i);
+ return GetObjectVal("GfxOverlay", nil, obj, i);
}
}
}
@@ -771,20 +771,20 @@ global func GetObjDrawTransform(int overlay, int overlayOffset, object obj) obj = obj || this;
if(overlay == 0)
{
- var first = GetObjectVal("DrawTransform", 0, obj, 0);
+ var first = GetObjectVal("DrawTransform", nil, obj, 0);
if(first == 0)
{
return [1000, 0, 0, 0, 1000, 0];
}
- var ret = [ParseFloat(first, 3), ParseFloat(GetObjectVal("DrawTransform", 0, obj, 1), 3), ParseFloat(GetObjectVal("DrawTransform", 0, obj, 2), 3), ParseFloat(GetObjectVal("DrawTransform", 0, obj, 3), 3), ParseFloat(GetObjectVal("DrawTransform", 0, obj, 4), 3), ParseFloat(GetObjectVal("DrawTransform", 0, obj, 5), 3)];
+ var ret = [ParseFloat(first, 3), ParseFloat(GetObjectVal("DrawTransform", nil, obj, 1), 3), ParseFloat(GetObjectVal("DrawTransform", nil, obj, 2), 3), ParseFloat(GetObjectVal("DrawTransform", nil, obj, 3), 3), ParseFloat(GetObjectVal("DrawTransform", nil, obj, 4), 3), ParseFloat(GetObjectVal("DrawTransform", nil, obj, 5), 3)];
- var rest = GetObjectVal("DrawTransform", 0, obj, 7); // 6 is left out intentionally, because its only FlipDir (used internally for Actions with FlipDir)
+ var rest = GetObjectVal("DrawTransform", nil, obj, 7); // 6 is left out intentionally, because its only FlipDir (used internally for Actions with FlipDir)
if(GetType(rest) == C4V_String) // the last 3 matrix-values are only decompiled if they are not the default of [0, 0, 1.0]
{
SetLength(ret, 9);
ret[6] = ParseFloat(rest, 3);
- ret[7] = ParseFloat(GetObjectVal("DrawTransform", 0, obj, 8), 3);
- ret[8] = ParseFloat(GetObjectVal("DrawTransform", 0, obj, 9), 3);
+ ret[7] = ParseFloat(GetObjectVal("DrawTransform", nil, obj, 8), 3);
+ ret[8] = ParseFloat(GetObjectVal("DrawTransform", nil, obj, 9), 3);
}
return ret;
@@ -810,15 +810,15 @@ global func GetObjDrawTransform(int overlay, int overlayOffset, object obj) return index;
}
- var ret = [ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index), 3), ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 1), 3), ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 2), 3), ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 3), 3), ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 4), 3), ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 5), 3)];
+ var ret = [ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index), 3), ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 1), 3), ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 2), 3), ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 3), 3), ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 4), 3), ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 5), 3)];
- var rest = GetObjectVal("GfxOverlay", 0, obj, index + 7); // 6 is left out intentionally, because its only FlipDir (used internally for Actions with FlipDir)
+ var rest = GetObjectVal("GfxOverlay", nil, obj, index + 7); // 6 is left out intentionally, because its only FlipDir (used internally for Actions with FlipDir)
if(GetType(rest) == C4V_String) // the last 3 matrix-values are only decompiled if they are not the default of [0, 0, 1.0]
{
SetLength(ret, 9);
ret[6] = ParseFloat(rest, 3);
- ret[7] = ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 8), 3);
- ret[8] = ParseFloat(GetObjectVal("GfxOverlay", 0, obj, index + 9), 3);
+ ret[7] = ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 8), 3);
+ ret[8] = ParseFloat(GetObjectVal("GfxOverlay", nil, obj, index + 9), 3);
}
return ret;
@@ -827,8 +827,8 @@ global func GetObjDrawTransform(int overlay, int overlayOffset, object obj) global func GetShape(object obj)
{
- obj = obj || this;
- return [GetObjectVal("Offset", 0, obj, 0), GetObjectVal("Offset", 0, obj, 1), GetObjectVal("Width", 0, obj), GetObjectVal("Height", 0, obj)];
+ obj ??= this;
+ return [GetObjectVal("Offset", nil, obj, 0) ?? 0, GetObjectVal("Offset", nil, obj, 1) ?? 0, GetObjectVal("Width", nil, obj), GetObjectVal("Height", nil, obj)];
}
global func InRect(array point, array rect)
@@ -885,4 +885,4 @@ global func InitMap(array init) ret[init[i]] = init[i + 1];
}
return ret;
-}
\ No newline at end of file +}
|
