From adf306d5b2f1557e5bfa8083199d31c67413361c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 17 Oct 2020 09:22:27 +0200 Subject: [PATCH] - added a new 'Translate' struct which wraps the native methods of 'Translation'. This is for use in actors where the name 'Translation' is shadowed by a local member variable. --- wadsrc/static/zscript/doombase.zs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/doombase.zs b/wadsrc/static/zscript/doombase.zs index d4c4129a5..1cb0c1151 100644 --- a/wadsrc/static/zscript/doombase.zs +++ b/wadsrc/static/zscript/doombase.zs @@ -46,11 +46,27 @@ extend struct Translation { Color colors[256]; - native int AddTranslation(); native static bool SetPlayerTranslation(int group, int num, int plrnum, PlayerClass pclass); native static int GetID(Name transname); } +// This is needed because Actor contains a field named 'translation' which shadows the above. +struct Translate version("4.5") +{ + static int MakeID(int group, int num) + { + return (group << 16) + num; + } + static bool SetPlayerTranslation(int group, int num, int plrnum, PlayerClass pclass) + { + return Translation.SetPlayerTranslation(group, num, plrnum, pclass); + } + static int GetID(Name transname) + { + return Translation.GetID(transname); + } +} + struct DamageTypeDefinition native { native static bool IgnoreArmor(Name type);