From 73819d45b762b51725270d01131e03f5d4c2c11b Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Nov 2018 17:00:29 +0100 Subject: [PATCH 01/10] - annotate which function we are calling for better dumpjit info --- src/scripting/vm/jit_call.cpp | 6 ++++-- src/scripting/vm/jitintern.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index c86176c34..c3c1802ed 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -62,13 +62,13 @@ void JitCompiler::EmitCALL_K() { auto ptr = newTempIntPtr(); cc.mov(ptr, asmjit::imm_ptr(target)); - EmitVMCall(ptr); + EmitVMCall(ptr, target); } pc += C; // Skip RESULTs } -void JitCompiler::EmitVMCall(asmjit::X86Gp vmfunc) +void JitCompiler::EmitVMCall(asmjit::X86Gp vmfunc, VMFunction *target) { using namespace asmjit; @@ -97,6 +97,7 @@ void JitCompiler::EmitVMCall(asmjit::X86Gp vmfunc) call->setArg(2, Imm(B)); call->setArg(3, GetCallReturns()); call->setArg(4, Imm(C)); + call->setInlineComment(target ? target->PrintableName.GetChars() : "VMCall"); LoadInOuts(); LoadReturns(pc + 1, C); @@ -324,6 +325,7 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target) asmjit::CBNode *cursorBefore = cc.getCursor(); auto call = cc.call(imm_ptr(target->DirectNativeCall), CreateFuncSignature(target)); + call->setInlineComment(target->PrintableName.GetChars()); asmjit::CBNode *cursorAfter = cc.getCursor(); cc.setCursor(cursorBefore); diff --git a/src/scripting/vm/jitintern.h b/src/scripting/vm/jitintern.h index 7c6a3386b..a88eb61eb 100644 --- a/src/scripting/vm/jitintern.h +++ b/src/scripting/vm/jitintern.h @@ -51,7 +51,7 @@ private: void EmitPopFrame(); void EmitNativeCall(VMNativeFunction *target); - void EmitVMCall(asmjit::X86Gp ptr); + void EmitVMCall(asmjit::X86Gp ptr, VMFunction *target); void EmitVtbl(const VMOP *op); int StoreCallParams(); From 9dbb1d77ce95484dac36f71ad8f8b446833fd7c5 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Nov 2018 17:02:51 +0100 Subject: [PATCH 02/10] - fix compile error --- src/scripting/vm/jit_call.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index c3c1802ed..c4e58f260 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -42,7 +42,7 @@ void JitCompiler::EmitVtbl(const VMOP *op) void JitCompiler::EmitCALL() { - EmitVMCall(regA[A]); + EmitVMCall(regA[A], nullptr); pc += C; // Skip RESULTs } From d5b9b8e57aa8b1f804bbe57b8745ff85b96168da Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Nov 2018 17:10:20 +0100 Subject: [PATCH 03/10] - fixed missing setRet call for REGT_POINTER return types --- src/scripting/vm/jit_call.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index c4e58f260..c92fee735 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -445,6 +445,7 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target) break; case REGT_POINTER: tmp = newResultIntPtr(); + call->setRet(0, tmp); cc.mov(regA[regnum], tmp); break; case REGT_STRING: From 3d3a00fd0dbf0258f9c90e2189adae08bd5542eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 27 Nov 2018 17:48:34 +0100 Subject: [PATCH 04/10] - fixed: The flat drawer did not check for full brightness before processing dynamic lights. --- src/hwrenderer/scene/hw_flats.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hwrenderer/scene/hw_flats.cpp b/src/hwrenderer/scene/hw_flats.cpp index 553b934bd..4e53635b7 100644 --- a/src/hwrenderer/scene/hw_flats.cpp +++ b/src/hwrenderer/scene/hw_flats.cpp @@ -182,7 +182,7 @@ void GLFlat::SetupLights(HWDrawInfo *di, FLightNode * node, FDynLightData &light void GLFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state) { - if (level.HasDynamicLights && screen->BuffersArePersistent()) + if (level.HasDynamicLights && screen->BuffersArePersistent() && !di->isFullbrightScene()) { SetupLights(di, section->lighthead, lightdata, sector->PortalGroup); } @@ -375,7 +375,7 @@ inline void GLFlat::PutFlat(HWDrawInfo *di, bool fog) } else if (!screen->BuffersArePersistent()) { - if (level.HasDynamicLights && gltexture != nullptr && !(hacktype & (SSRF_PLANEHACK|SSRF_FLOODHACK)) ) + if (level.HasDynamicLights && gltexture != nullptr && !di->isFullbrightScene() && !(hacktype & (SSRF_PLANEHACK|SSRF_FLOODHACK)) ) { SetupLights(di, section->lighthead, lightdata, sector->PortalGroup); } From 59b4e297c0ef20fcb008c3f0b94e67a3a1be9cdd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 27 Nov 2018 19:43:10 +0100 Subject: [PATCH 05/10] - fixed the mapping of additive translucency to color-based translucency. The destination mode sould be 'One', not 'InvSrcColor'. Now both of these are available as explicit modes, not just through the optional mapping. --- src/hwrenderer/scene/hw_sprites.cpp | 2 +- src/namedef.h | 3 +++ src/p_mobj.cpp | 2 +- src/p_udmf.cpp | 9 +++++++++ src/r_data/renderstyle.cpp | 1 + src/r_data/renderstyle.h | 1 + src/scripting/thingdef_properties.cpp | 6 ++++-- 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/hwrenderer/scene/hw_sprites.cpp b/src/hwrenderer/scene/hw_sprites.cpp index 94e86beb4..fe7a0aa36 100644 --- a/src/hwrenderer/scene/hw_sprites.cpp +++ b/src/hwrenderer/scene/hw_sprites.cpp @@ -94,7 +94,7 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent) gl_usecolorblending && !di->isFullbrightScene() && actor && fullbright && gltexture && !gltexture->tex->GetTranslucency()) { - RenderStyle = LegacyRenderStyles[STYLE_ColorBlend]; + RenderStyle = LegacyRenderStyles[STYLE_ColorAdd]; } state.SetRenderStyle(RenderStyle); diff --git a/src/namedef.h b/src/namedef.h index 184c58fd0..c2f4cd3f5 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -46,6 +46,9 @@ xx(Shadow) xx(Subtract) xx(Subtractive) xx(FillColor) +xx(ColorBlend) +xx(ColorAdd) +xx(Multiply) // Healingradius types xx(Mana) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index a02ea4064..0999e71eb 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -8602,7 +8602,7 @@ void PrintMiscActorInfo(AActor *query) /*for (flagi = 0; flagi < 31; flagi++) if (query->BounceFlags & 1<Alpha, query->renderflags.GetValue()); /*for (flagi = 0; flagi < 31; flagi++) if (query->renderflags & 1<RenderStyle = STYLE_Subtract; break; + case NAME_ColorBlend: + th->RenderStyle = STYLE_ColorBlend; + break; + case NAME_ColorAdd: + th->RenderStyle = STYLE_ColorAdd; + break; + case NAME_Multiply: + th->RenderStyle = STYLE_Multiply; + break; default: break; } diff --git a/src/r_data/renderstyle.cpp b/src/r_data/renderstyle.cpp index 2ce22d19c..80bc00539 100644 --- a/src/r_data/renderstyle.cpp +++ b/src/r_data/renderstyle.cpp @@ -62,6 +62,7 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] = { { STYLEOP_Add, STYLEALPHA_InvDstCol, STYLEALPHA_Zero, 0 } }, /* STYLE_InverseMultiply */ { { STYLEOP_Add, STYLEALPHA_SrcCol, STYLEALPHA_InvSrcCol, 0 } }, /* STYLE_ColorBlend */ { { STYLEOP_Add, STYLEALPHA_One, STYLEALPHA_Zero, 0 } }, /* STYLE_Source */ + { { STYLEOP_Add, STYLEALPHA_SrcCol, STYLEALPHA_One, 0 } }, /* STYLE_ColorAdd */ }; double GetAlpha(int type, double alpha) diff --git a/src/r_data/renderstyle.h b/src/r_data/renderstyle.h index 8bedb4cc5..64326fd3c 100644 --- a/src/r_data/renderstyle.h +++ b/src/r_data/renderstyle.h @@ -78,6 +78,7 @@ enum ERenderStyle STYLE_InverseMultiply, // Multiply source with inverse of destination (HW renderer only.) STYLE_ColorBlend, // Use color intensity as transparency factor STYLE_Source, // No blending (only used internally) + STYLE_ColorAdd, // Use color intensity as transparency factor and blend additively. STYLE_Count }; diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 522a569ee..00864f4f1 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -700,12 +700,14 @@ DEFINE_PROPERTY(renderstyle, S, Actor) PROP_STRING_PARM(str, 0); static const char * renderstyles[]={ "NONE", "NORMAL", "FUZZY", "SOULTRANS", "OPTFUZZY", "STENCIL", - "TRANSLUCENT", "ADD", "SHADED", "SHADOW", "SUBTRACT", "ADDSTENCIL", "ADDSHADED", NULL }; + "TRANSLUCENT", "ADD", "SHADED", "SHADOW", "SUBTRACT", "ADDSTENCIL", + "ADDSHADED", "COLORBLEND", "COLORADD", "MULTIPLY", NULL }; static const int renderstyle_values[]={ STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy, STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded, - STYLE_Shadow, STYLE_Subtract, STYLE_AddStencil, STYLE_AddShaded}; + STYLE_Shadow, STYLE_Subtract, STYLE_AddStencil, STYLE_AddShaded, + STYLE_ColorBlend, STYLE_ColorAdd, STYLE_Multiply}; // make this work for old style decorations, too. if (!strnicmp(str, "style_", 6)) str+=6; From 4a85e242286f67111f1aeabc511e7d73003009be Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 26 Nov 2018 23:15:40 +0700 Subject: [PATCH 06/10] fixed spelling (mostly comments) --- wadsrc/static/language.enu | 12 ++++++------ wadsrc/static/language.fr | 4 ++-- wadsrc/static/language.ptb | 2 +- wadsrc/static/zscript/actor.txt | 2 +- wadsrc/static/zscript/constants.txt | 2 +- wadsrc/static/zscript/doom/fatso.txt | 2 +- wadsrc/static/zscript/heretic/weaponskullrod.txt | 2 +- wadsrc/static/zscript/hexen/flechette.txt | 1 - wadsrc/static/zscript/hexen/heresiarch.txt | 2 +- wadsrc/static/zscript/inventory/health.txt | 2 +- wadsrc/static/zscript/inventory/inventory.txt | 2 +- wadsrc/static/zscript/inventory/weaponpiece.txt | 2 +- wadsrc/static/zscript/level_compatibility.txt | 6 +++--- wadsrc/static/zscript/mapdata.txt | 2 +- wadsrc/static/zscript/menu/messagebox.txt | 2 +- wadsrc/static/zscript/shared/bridge.txt | 2 +- wadsrc/static/zscript/shared/soundsequence.txt | 2 +- wadsrc/static/zscript/statusbar/statusbar.txt | 6 +++--- wadsrc/static/zscript/strife/thingstoblowup.txt | 2 +- wadsrc/static/zscript/strife/weapongrenade.txt | 2 +- 20 files changed, 29 insertions(+), 30 deletions(-) diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 5d9ec105b..ab2f74fb4 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -660,7 +660,7 @@ SPREE15 = "%k is dominating!"; SPREE20 = "%k is unstoppable!"; SPREE25 = "%k is Godlike!"; -// Mulitkill messages +// Multikill messages MULTI2 = "Double kill!"; MULTI3 = "Multi kill!"; MULTI4 = "Ultra kill!"; @@ -824,12 +824,12 @@ OB_MPCWEAPFLAME = "%o was lit up by %k's flames."; OB_MPCWEAPWRAITHVERGE = "%o was cleansed by %k's Wraithverge."; OB_MPMWEAPWAND = "%o took one too many sapphire beams from %k."; OB_MPMWEAPFROST = "%o was turned into a frosty fellow by %k."; -OB_MPMWEAPLIGHTNING = "%o recieved a shocking revelation from %k."; +OB_MPMWEAPLIGHTNING = "%o received a shocking revelation from %k."; OB_MPMWEAPBLOODSCOURGE = "%o was wiped off the face of the universe by %k's Bloodscourge."; OB_MPPUNCHDAGGER = "%o was unwittingly backstabbed by %k."; OB_MPELECTRICBOLT = "%o got bolted to the wall by %k."; -OB_MPPOISONBOLT = "%o recieved a lethal dose of %k's wrath."; +OB_MPPOISONBOLT = "%o received a lethal dose of %k's wrath."; OB_MPASSAULTGUN = "%o was drilled full of holes by %k's assault gun."; OB_MPMINIMISSILELAUNCHER = "%o gulped down %k's missile."; OB_MPSTRIFEGRENADE = "%o was inverted by %k's H-E grenade."; @@ -950,7 +950,7 @@ TAG_ARTIPUZZGEMGREEN2 = "Emerald Planet (2)"; TAG_ARTIPUZZGEMBLUE1 = "Sapphire Planet (1)"; TAG_ARTIPUZZGEMBLUE2 = "Sapphire Planet (2)"; TAG_ARTIPUZZBOOK1 = "Daemon Codex"; -TAG_ARTIPUZZBOOK2 = "Liber Obscura"; +TAG_ARTIPUZZBOOK2 = "Liber Oscura"; TAG_ARTIPUZZSKULL2 = "Flame Mask"; TAG_ARTIPUZZFWEAPON = "Glaive Seal"; TAG_ARTIPUZZCWEAPON = "Holy Relic"; @@ -1003,7 +1003,7 @@ TAG_TELEPORTERBEACON = "Teleporter Beacon"; TAG_METALARMOR = "Metal Armor"; TAG_LEATHER = "Leather Armor"; TAG_HEGRENADES = "HE-Grenade Rounds"; -TAG_PHGRENADES = "Phoshorus-Grenade Rounds"; // "Fire-Grenade_Rounds" in the Teaser +TAG_PHGRENADES = "Phosphorus-Grenade Rounds"; // "Fire-Grenade_Rounds" in the Teaser TAG_CLIPOFBULLETS = "Clip of Bullets"; // "bullets" in the Teaser TAG_BOXOFBULLETS = "Ammo"; TAG_MINIMISSILES = "Mini Missiles"; //"rocket" in the Teaser @@ -2692,7 +2692,7 @@ OB_CYCLOPTIS = "%o was slimed by a cycloptis."; OB_FLEMBRANE = "%o was defeated by the Flembrane."; OB_MPSPOON = "%o was spoon fed by %k."; -OB_MPBOOTSPORK = "%o was thouroughly mixed with %k's bootspork."; +OB_MPBOOTSPORK = "%o was thoroughly mixed with %k's bootspork."; OB_MPZORCH = "%o was zorched by %k."; OB_MPMEGAZORCH = "%o was hit by %k's mega-zorcher."; OB_MPRAPIDZORCH = "%o was rapid zorched by %k."; diff --git a/wadsrc/static/language.fr b/wadsrc/static/language.fr index 22cd852d8..70f6a5b22 100644 --- a/wadsrc/static/language.fr +++ b/wadsrc/static/language.fr @@ -1016,7 +1016,7 @@ TAG_ARTIPUZZGEMGREEN2 = "Planète en émeraude (2)"; TAG_ARTIPUZZGEMBLUE1 = "Planète en saphir (1)"; TAG_ARTIPUZZGEMBLUE2 = "Planète en saphir (2)"; TAG_ARTIPUZZBOOK1 = "Codex Démoniaque"; -TAG_ARTIPUZZBOOK2 = "Liber Obscura"; +TAG_ARTIPUZZBOOK2 = "Liber Oscura"; TAG_ARTIPUZZSKULL2 = "Masque de Flammes"; TAG_ARTIPUZZFWEAPON = "Sceau du Glaive"; TAG_ARTIPUZZCWEAPON = "Relique Sacrée"; @@ -1459,7 +1459,7 @@ TXT_ARTIPUZZGEMGREEN2 = "PLANETE D'EMERAUDE"; TXT_ARTIPUZZGEMBLUE1 = "PLANETE DE SAPHIR"; TXT_ARTIPUZZGEMBLUE2 = "PLANETE DE SAPHIR"; TXT_ARTIPUZZBOOK1 = "CODEX DEMONIAQUE"; -TXT_ARTIPUZZBOOK2 = "LIBER OBSCURA"; +TXT_ARTIPUZZBOOK2 = "LIBER OSCURA"; TXT_ARTIPUZZSKULL2 = "MASQUE DE FLAMMES"; TXT_ARTIPUZZFWEAPON = "SCEAU DU GLAIVE"; TXT_ARTIPUZZCWEAPON = "RELIQUE SACREE"; diff --git a/wadsrc/static/language.ptb b/wadsrc/static/language.ptb index 7e981e93c..75ae54222 100644 --- a/wadsrc/static/language.ptb +++ b/wadsrc/static/language.ptb @@ -882,7 +882,7 @@ TAG_ARTIPUZZGEMGREEN2 = "Emerald Planet (2)"; TAG_ARTIPUZZGEMBLUE1 = "Sapphire Planet (1)"; TAG_ARTIPUZZGEMBLUE2 = "Sapphire Planet (2)"; TAG_ARTIPUZZBOOK1 = "Daemon Codex"; -TAG_ARTIPUZZBOOK2 = "Liber Obscura"; +TAG_ARTIPUZZBOOK2 = "Liber Oscura"; TAG_ARTIPUZZSKULL2 = "Flame Mask"; TAG_ARTIPUZZFWEAPON = "Glaive Seal"; TAG_ARTIPUZZCWEAPON = "Holy Relic"; diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 7f9cd5afd..1099464a1 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -1175,7 +1175,7 @@ class Actor : Thinker native native void A_SetMugshotState(String name); native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); - native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); + native void A_TransferPointer(int ptr_source, int ptr_recipient, int sourcefield, int recipientfield=AAPTR_DEFAULT, int flags=0); native void A_CopyFriendliness(int ptr_source = AAPTR_MASTER); action native bool A_Overlay(int layer, statelabel start = null, bool nooverride = false); diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index ccb3f4848..316f858f4 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -428,7 +428,7 @@ const ATTN_NORM = 1; const ATTN_IDLE = 1.001; const ATTN_STATIC = 3; -// For SetPlayerProprty action special +// For SetPlayerProperty action special enum EPlayerProperties { PROP_FROZEN = 0, diff --git a/wadsrc/static/zscript/doom/fatso.txt b/wadsrc/static/zscript/doom/fatso.txt index 7d3c1197a..f24b0d2e7 100644 --- a/wadsrc/static/zscript/doom/fatso.txt +++ b/wadsrc/static/zscript/doom/fatso.txt @@ -194,7 +194,7 @@ extend class Actor Actor owner = (flags & MSF_DontHurt) ? target : self; aimtarget.Height = Height; - bool shootmode = ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options + bool shootmode = ((flags & MSF_Classic) || // Flag explicitly set, or no flags and compat options (flags == 0 && CurState.bDehacked && compat_mushroom)); for (i = -numspawns; i <= numspawns; i += 8) diff --git a/wadsrc/static/zscript/heretic/weaponskullrod.txt b/wadsrc/static/zscript/heretic/weaponskullrod.txt index edfda93ff..c0ad6e561 100644 --- a/wadsrc/static/zscript/heretic/weaponskullrod.txt +++ b/wadsrc/static/zscript/heretic/weaponskullrod.txt @@ -224,7 +224,7 @@ class HornRodFX2 : Actor RainTracker tracker; if (target == null || target.health <= 0) - { // Shooter is dead or nonexistant + { // Shooter is dead or nonexistent return; } diff --git a/wadsrc/static/zscript/hexen/flechette.txt b/wadsrc/static/zscript/hexen/flechette.txt index 1708b843b..bc50080c3 100644 --- a/wadsrc/static/zscript/hexen/flechette.txt +++ b/wadsrc/static/zscript/hexen/flechette.txt @@ -347,7 +347,6 @@ class ArtiPoisonBag3 : ArtiPoisonBag // is as set by the projectile. To accommodate self with a proper trajectory, we // aim the projectile ~20 degrees higher than we're looking at and increase the // speed we fire at accordingly. - double orgpitch = -Owner.Pitch; double modpitch = clamp(-Owner.Pitch + 20, -89., 89.); double ang = mo.angle; double speed = (mo.Speed, 4.).Length(); diff --git a/wadsrc/static/zscript/hexen/heresiarch.txt b/wadsrc/static/zscript/hexen/heresiarch.txt index d7888ccfd..f856e7e7e 100644 --- a/wadsrc/static/zscript/hexen/heresiarch.txt +++ b/wadsrc/static/zscript/hexen/heresiarch.txt @@ -1038,7 +1038,7 @@ class SorcFX3 : Actor mo.Destroy (); } else if (target != null) - { // [RH] Make the new bishops inherit the Heriarch's target + { // [RH] Make the new bishops inherit the Heresiarch's target mo.CopyFriendliness (target, true); mo.master = target; } diff --git a/wadsrc/static/zscript/inventory/health.txt b/wadsrc/static/zscript/inventory/health.txt index e69d85814..69a5781df 100644 --- a/wadsrc/static/zscript/inventory/health.txt +++ b/wadsrc/static/zscript/inventory/health.txt @@ -4,7 +4,7 @@ ** **--------------------------------------------------------------------------- ** Copyright 2000-2016 Randy Heit -** Copyright 2006-2017 Cheistoph Oelckers +** Copyright 2006-2017 Christoph Oelckers ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without diff --git a/wadsrc/static/zscript/inventory/inventory.txt b/wadsrc/static/zscript/inventory/inventory.txt index d724c90d9..1e4742892 100644 --- a/wadsrc/static/zscript/inventory/inventory.txt +++ b/wadsrc/static/zscript/inventory/inventory.txt @@ -827,7 +827,7 @@ class Inventory : Actor native } /* else if ((ItemFlags & IF_FANCYPICKUPSOUND) && - (toucher == NULL || toucher->CheckLocalView(consoeplayer))) + (toucher == NULL || toucher->CheckLocalView(consoleplayer))) { atten = ATTN_NONE; } diff --git a/wadsrc/static/zscript/inventory/weaponpiece.txt b/wadsrc/static/zscript/inventory/weaponpiece.txt index af816aabc..2f2434d6c 100644 --- a/wadsrc/static/zscript/inventory/weaponpiece.txt +++ b/wadsrc/static/zscript/inventory/weaponpiece.txt @@ -3,7 +3,7 @@ ** Implements generic weapon pieces ** **--------------------------------------------------------------------------- -** Copyright 2006-2016 Cheistoph Oelckers +** Copyright 2006-2016 Christoph Oelckers ** Copyright 2006-2016 Randy Heit ** All rights reserved. ** diff --git a/wadsrc/static/zscript/level_compatibility.txt b/wadsrc/static/zscript/level_compatibility.txt index e7bd242be..90ecf8c96 100644 --- a/wadsrc/static/zscript/level_compatibility.txt +++ b/wadsrc/static/zscript/level_compatibility.txt @@ -1109,7 +1109,7 @@ class LevelCompatibility play break; } - case 'D67CECE3F60083383DF992B8C824E4AC': // Icarus: Alien Vanuguard MAP13 + case 'D67CECE3F60083383DF992B8C824E4AC': // Icarus: Alien Vanguard MAP13 { // Moves sector special to platform with Berserk powerup. The // map's only secret can now be scored. @@ -1118,7 +1118,7 @@ class LevelCompatibility play break; } - case '61373587339A768854E2912CC99A4781': // Icarus: Alien Vanuguard MAP15 + case '61373587339A768854E2912CC99A4781': // Icarus: Alien Vanguard MAP15 { // Can press use on the lift to reveal the secret Shotgun, // making 100% secrets possible. @@ -1128,7 +1128,7 @@ class LevelCompatibility play break; } - case '9F66B0797925A09D4DC0725540F8EEF7': // Icarus: Alien Vanuguard MAP16 + case '9F66B0797925A09D4DC0725540F8EEF7': // Icarus: Alien Vanguard MAP16 { // Can press use on the walls at the secret Rocket Launcher in // case of getting stuck. diff --git a/wadsrc/static/zscript/mapdata.txt b/wadsrc/static/zscript/mapdata.txt index 11827e3ad..9f9b66774 100644 --- a/wadsrc/static/zscript/mapdata.txt +++ b/wadsrc/static/zscript/mapdata.txt @@ -156,7 +156,7 @@ struct Line native play native uint activation; // activation type native int special; native int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width) - native double alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque) + native double alpha; // <--- translucency (0=invisible, FRACUNIT=opaque) native readonly Side sidedef[2]; native readonly double bbox[4]; // bounding box, for the extent of the LineDef. native readonly Sector frontsector, backsector; diff --git a/wadsrc/static/zscript/menu/messagebox.txt b/wadsrc/static/zscript/menu/messagebox.txt index 86796d301..ec49dcfe9 100644 --- a/wadsrc/static/zscript/menu/messagebox.txt +++ b/wadsrc/static/zscript/menu/messagebox.txt @@ -1,6 +1,6 @@ /* ** messagebox.cpp -** Confirmation, notification screns +** Confirmation, notification screens ** **--------------------------------------------------------------------------- ** Copyright 2010-2017 Christoph Oelckers diff --git a/wadsrc/static/zscript/shared/bridge.txt b/wadsrc/static/zscript/shared/bridge.txt index 9446ac12c..cbaf49925 100644 --- a/wadsrc/static/zscript/shared/bridge.txt +++ b/wadsrc/static/zscript/shared/bridge.txt @@ -46,7 +46,7 @@ class BridgeBall : Actor { if (target == NULL) { // Don't crash if somebody spawned this into the world - // independantly of a Bridge actor. + // independently of a Bridge actor. return; } // Set default values diff --git a/wadsrc/static/zscript/shared/soundsequence.txt b/wadsrc/static/zscript/shared/soundsequence.txt index c5e2b2604..727b66e38 100644 --- a/wadsrc/static/zscript/shared/soundsequence.txt +++ b/wadsrc/static/zscript/shared/soundsequence.txt @@ -1,6 +1,6 @@ /* ** a_soundsequence.cpp -** Actors for independantly playing sound sequences in a map. +** Actors for independently playing sound sequences in a map. ** **--------------------------------------------------------------------------- ** Copyright 1998-2006 Randy Heit diff --git a/wadsrc/static/zscript/statusbar/statusbar.txt b/wadsrc/static/zscript/statusbar/statusbar.txt index 385db36bf..6af5199ec 100644 --- a/wadsrc/static/zscript/statusbar/statusbar.txt +++ b/wadsrc/static/zscript/statusbar/statusbar.txt @@ -205,7 +205,7 @@ class BaseStatusBar native ui DI_ITEM_VMASK = 0x180000, DI_ITEM_LEFT = 0x200000, - DI_ITEM_HCENTER = 0, // this is the deafault horizontal alignment + DI_ITEM_HCENTER = 0, // this is the default horizontal alignment DI_ITEM_RIGHT = 0x400000, DI_ITEM_HOFFSET = 0x600000, DI_ITEM_HMASK = 0x600000, @@ -1140,7 +1140,7 @@ class LinearValueInterpolator : Object mCurrentValue = value; } - // This must be called peroiodically in the status bar's Tick function. + // This must be called periodically in the status bar's Tick function. // Do not call this in the Draw function because that may skip some frames! void Update(int destvalue) { @@ -1184,7 +1184,7 @@ class DynamicValueInterpolator : Object mCurrentValue = value; } - // This must be called peroiodically in the status bar's Tick function. + // This must be called periodically in the status bar's Tick function. // Do not call this in the Draw function because that may skip some frames! void Update(int destvalue) { diff --git a/wadsrc/static/zscript/strife/thingstoblowup.txt b/wadsrc/static/zscript/strife/thingstoblowup.txt index f18e783f7..fc4b89f26 100644 --- a/wadsrc/static/zscript/strife/thingstoblowup.txt +++ b/wadsrc/static/zscript/strife/thingstoblowup.txt @@ -38,7 +38,7 @@ extend class Actor } -// A Cloud used for varius explosions --------------------------------------- +// A Cloud used for various explosions -------------------------------------- // This actor has no direct equivalent in strife. To create this, Strife // spawned a spark and then changed its state to that of this explosion // cloud. Weird. diff --git a/wadsrc/static/zscript/strife/weapongrenade.txt b/wadsrc/static/zscript/strife/weapongrenade.txt index e160be3c8..c3f3cf524 100644 --- a/wadsrc/static/zscript/strife/weapongrenade.txt +++ b/wadsrc/static/zscript/strife/weapongrenade.txt @@ -204,7 +204,7 @@ class PhosphorousGrenade : Actor } } -// Fire from the Phoshorous Grenade ----------------------------------------- +// Fire from the Phosphorous Grenade ---------------------------------------- class PhosphorousFire : Actor { From 3202c86ea7db83daffbc1db2c86dee8fcc4362e6 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Nov 2018 19:56:39 +0100 Subject: [PATCH 07/10] - use the OP_PARAM and OP_RESULT opcodes to build the function signature --- src/scripting/vm/jit_call.cpp | 141 ++++++++++++++++++++++------------ src/scripting/vm/jitintern.h | 2 +- 2 files changed, 92 insertions(+), 51 deletions(-) diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index c92fee735..8576075bd 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -324,7 +324,7 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target) } asmjit::CBNode *cursorBefore = cc.getCursor(); - auto call = cc.call(imm_ptr(target->DirectNativeCall), CreateFuncSignature(target)); + auto call = cc.call(imm_ptr(target->DirectNativeCall), CreateFuncSignature()); call->setInlineComment(target->PrintableName.GetChars()); asmjit::CBNode *cursorAfter = cc.getCursor(); cc.setCursor(cursorBefore); @@ -460,81 +460,122 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target) ParamOpcodes.Clear(); } -asmjit::FuncSignature JitCompiler::CreateFuncSignature(VMFunction *func) +asmjit::FuncSignature JitCompiler::CreateFuncSignature() { using namespace asmjit; TArray args; FString key; - for (unsigned int i = 0; i < func->Proto->ArgumentTypes.Size(); i++) + + // First add parameters as args to the signature + + for (unsigned int i = 0; i < ParamOpcodes.Size(); i++) { - const PType *type = func->Proto->ArgumentTypes[i]; - if (func->ArgFlags.Size() && func->ArgFlags[i] & (VARF_Out | VARF_Ref)) - { - args.Push(TypeIdOf::kTypeId); - key += "v"; - } - else if (type == TypeVector2) - { - args.Push(TypeIdOf::kTypeId); - args.Push(TypeIdOf::kTypeId); - key += "ff"; - } - else if (type == TypeVector3) - { - args.Push(TypeIdOf::kTypeId); - args.Push(TypeIdOf::kTypeId); - args.Push(TypeIdOf::kTypeId); - key += "fff"; - } - else if (type == TypeFloat64) - { - args.Push(TypeIdOf::kTypeId); - key += "f"; - } - else if (type == TypeString) - { - args.Push(TypeIdOf::kTypeId); - key += "s"; - } - else if (type->isIntCompatible()) + if (ParamOpcodes[i]->op == OP_PARAMI) { args.Push(TypeIdOf::kTypeId); key += "i"; } - else + else // OP_PARAM { - args.Push(TypeIdOf::kTypeId); - key += "v"; + int bc = ParamOpcodes[i]->i16u; + switch (ParamOpcodes[i]->a) + { + case REGT_NIL: + case REGT_POINTER: + case REGT_POINTER | REGT_KONST: + case REGT_STRING | REGT_ADDROF: + case REGT_INT | REGT_ADDROF: + case REGT_POINTER | REGT_ADDROF: + case REGT_FLOAT | REGT_ADDROF: + args.Push(TypeIdOf::kTypeId); + key += "v"; + break; + case REGT_INT: + case REGT_INT | REGT_KONST: + args.Push(TypeIdOf::kTypeId); + key += "i"; + break; + case REGT_STRING: + case REGT_STRING | REGT_KONST: + args.Push(TypeIdOf::kTypeId); + key += "s"; + break; + case REGT_FLOAT: + case REGT_FLOAT | REGT_KONST: + args.Push(TypeIdOf::kTypeId); + key += "f"; + break; + case REGT_FLOAT | REGT_MULTIREG2: + args.Push(TypeIdOf::kTypeId); + args.Push(TypeIdOf::kTypeId); + key += "ff"; + break; + case REGT_FLOAT | REGT_MULTIREG3: + args.Push(TypeIdOf::kTypeId); + args.Push(TypeIdOf::kTypeId); + args.Push(TypeIdOf::kTypeId); + key += "fff"; + break; + + default: + I_FatalError("Unknown REGT value passed to EmitPARAM\n"); + break; + } } } + const VMOP *retval = pc + 1; + int numret = C; + uint32_t rettype = TypeIdOf::kTypeId; - if (func->Proto->ReturnTypes.Size() > 0) + + // Check if first return value can be placed in the function's real return value slot + int startret = 1; + if (numret > 0) { - const PType *type = func->Proto->ReturnTypes[0]; - if (type == TypeFloat64) + if (retval[0].op != OP_RESULT) { - rettype = TypeIdOf::kTypeId; - key += "rf"; + I_FatalError("Expected OP_RESULT to follow OP_CALL\n"); } - else if (type == TypeString) - { - rettype = TypeIdOf::kTypeId; - key += "rs"; - } - else if (type->isIntCompatible()) + + int type = retval[0].b; + switch (type) { + case REGT_INT: rettype = TypeIdOf::kTypeId; key += "ri"; - } - else - { + break; + case REGT_FLOAT: + rettype = TypeIdOf::kTypeId; + key += "rf"; + break; + case REGT_STRING: + rettype = TypeIdOf::kTypeId; + key += "rs"; + break; + case REGT_POINTER: rettype = TypeIdOf::kTypeId; key += "rv"; + break; + default: + startret = 0; + break; } } + // Add any additional return values as function arguments + for (int i = startret; i < numret; ++i) + { + if (retval[i].op != OP_RESULT) + { + I_FatalError("Expected OP_RESULT to follow OP_CALL\n"); + } + + args.Push(TypeIdOf::kTypeId); + key += "v"; + } + // FuncSignature only keeps a pointer to its args array. Store a copy of each args array variant. static std::map>> argsCache; std::unique_ptr> &cachedArgs = argsCache[key]; diff --git a/src/scripting/vm/jitintern.h b/src/scripting/vm/jitintern.h index a88eb61eb..2f67e6ed3 100644 --- a/src/scripting/vm/jitintern.h +++ b/src/scripting/vm/jitintern.h @@ -38,7 +38,7 @@ private: #include "vmops.h" #undef xx - static asmjit::FuncSignature CreateFuncSignature(VMFunction *sfunc); + asmjit::FuncSignature CreateFuncSignature(); void Setup(); void CreateRegisters(); From 8860517bbd19157e75d62463c2f061364160f035 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 27 Nov 2018 20:43:35 +0100 Subject: [PATCH 08/10] - pass additional return values as the last args to a direct native call --- src/scripting/vm/jit_call.cpp | 99 ++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 14 deletions(-) diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index 8576075bd..f0fe9e42a 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -403,36 +403,78 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target) } } - cc.setCursor(cursorAfter); - if (numparams != B) I_FatalError("OP_CALL parameter count does not match the number of preceding OP_PARAM instructions\n"); + // Note: the usage of newResultXX is intentional. Asmjit has a register allocation bug + // if the return virtual register is already allocated in an argument slot. + + const VMOP *retval = pc + 1; int numret = C; - if (numret > 1) - I_FatalError("Only one return parameter is supported for direct native calls\n"); - if (numret == 1) + // Check if first return value was placed in the function's real return value slot + int startret = 1; + if (numret > 0) { - const auto &retval = pc[1]; - if (retval.op != OP_RESULT) + int type = retval[0].b; + switch (type) { - I_FatalError("Expected OP_RESULT to follow OP_CALL\n"); + case REGT_INT: + case REGT_FLOAT: + case REGT_POINTER: + break; + default: + startret = 0; + break; } + } - int type = retval.b; - int regnum = retval.c; + // Pass return pointers as arguments + for (int i = startret; i < numret; ++i) + { + int type = retval[i].b; + int regnum = retval[i].c; if (type & REGT_KONST) { I_FatalError("OP_RESULT with REGT_KONST is not allowed\n"); } - // Note: the usage of newResultXX is intentional. Asmjit has a register allocation bug - // if the return virtual register is already allocated in an argument slot. + CheckVMFrame(); + + auto regPtr = newTempIntPtr(); switch (type & REGT_TYPE) { + case REGT_INT: + cc.lea(regPtr, x86::ptr(vmframe, offsetD + (int)(regnum * sizeof(int32_t)))); + break; + case REGT_FLOAT: + cc.lea(regPtr, x86::ptr(vmframe, offsetF + (int)(regnum * sizeof(double)))); + break; + case REGT_STRING: + cc.lea(regPtr, x86::ptr(vmframe, offsetS + (int)(regnum * sizeof(FString)))); + break; + case REGT_POINTER: + cc.lea(regPtr, x86::ptr(vmframe, offsetA + (int)(regnum * sizeof(void*)))); + break; + default: + I_FatalError("Unknown OP_RESULT type encountered\n"); + break; + } + + cc.setArg(numparams + i - startret, regPtr); + } + + cc.setCursor(cursorAfter); + + if (startret == 1 && numret > 0) + { + int type = retval[0].b; + int regnum = retval[0].c; + + switch (type) + { case REGT_INT: tmp = newResultInt32(); call->setRet(0, tmp); @@ -448,11 +490,40 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target) call->setRet(0, tmp); cc.mov(regA[regnum], tmp); break; - case REGT_STRING: + } + } + + // Move the result into virtual registers + for (int i = startret; i < numret; ++i) + { + int type = retval[i].b; + int regnum = retval[i].c; + + switch (type) + { + case REGT_INT: + cc.mov(regD[regnum], asmjit::x86::dword_ptr(vmframe, offsetD + regnum * sizeof(int32_t))); + break; + case REGT_FLOAT: + cc.movsd(regF[regnum], asmjit::x86::qword_ptr(vmframe, offsetF + regnum * sizeof(double))); + break; case REGT_FLOAT | REGT_MULTIREG2: + cc.movsd(regF[regnum], asmjit::x86::qword_ptr(vmframe, offsetF + regnum * sizeof(double))); + cc.movsd(regF[regnum + 1], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 1) * sizeof(double))); + break; case REGT_FLOAT | REGT_MULTIREG3: + cc.movsd(regF[regnum], asmjit::x86::qword_ptr(vmframe, offsetF + regnum * sizeof(double))); + cc.movsd(regF[regnum + 1], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 1) * sizeof(double))); + cc.movsd(regF[regnum + 2], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 2) * sizeof(double))); + break; + case REGT_STRING: + // We don't have to do anything in this case. String values are never moved to virtual registers. + break; + case REGT_POINTER: + cc.mov(regA[regnum], asmjit::x86::ptr(vmframe, offsetA + regnum * sizeof(void*))); + break; default: - I_FatalError("Unsupported OP_RESULT type encountered in EmitNativeCall\n"); + I_FatalError("Unknown OP_RESULT type encountered\n"); break; } } From 6a9696e525795fbbab564d216d6e85aa5cc030bb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Nov 2018 00:11:06 +0100 Subject: [PATCH 09/10] - moved the remaining exports from p_sectors.cpp to vmthunks.cpp --- src/p_sectors.cpp | 295 +----------------------------------- src/scripting/vmthunks.cpp | 296 ++++++++++++++++++++++++++++++++++++- 2 files changed, 295 insertions(+), 296 deletions(-) diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 6eeea5442..6494a202d 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -139,16 +139,6 @@ double sector_t::FindLowestFloorSurrounding (vertex_t **v) const return floor; } -DEFINE_ACTION_FUNCTION(_Sector, FindLowestFloorSurrounding) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindLowestFloorSurrounding(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // P_FindHighestFloorSurrounding() // FIND HIGHEST FLOOR HEIGHT IN SURROUNDING SECTORS @@ -188,18 +178,6 @@ double sector_t::FindHighestFloorSurrounding (vertex_t **v) const return floor; } -DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorSurrounding) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindHighestFloorSurrounding(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - - - // // P_FindNextHighestFloor() // @@ -251,16 +229,6 @@ double sector_t::FindNextHighestFloor (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestFloor) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindNextHighestFloor(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // P_FindNextLowestFloor() @@ -313,16 +281,6 @@ double sector_t::FindNextLowestFloor (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestFloor) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindNextLowestFloor(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // P_FindNextLowestCeiling() @@ -375,16 +333,6 @@ double sector_t::FindNextLowestCeiling (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestCeiling) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindNextLowestCeiling(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // P_FindNextHighestCeiling() @@ -438,16 +386,6 @@ double sector_t::FindNextHighestCeiling (vertex_t **v) const } -DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestCeiling) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindNextHighestCeiling(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // FIND LOWEST CEILING IN THE SURROUNDING SECTORS // @@ -486,16 +424,6 @@ double sector_t::FindLowestCeilingSurrounding (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingSurrounding) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindLowestCeilingSurrounding(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // FIND HIGHEST CEILING IN THE SURROUNDING SECTORS @@ -535,16 +463,6 @@ double sector_t::FindHighestCeilingSurrounding (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindHighestCeilingSurrounding) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindHighestCeilingSurrounding(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} - // // P_FindShortestTextureAround() @@ -692,14 +610,6 @@ int sector_t::FindMinSurroundingLight (int min) const return min; } -DEFINE_ACTION_FUNCTION(_Sector, FindMinSurroundingLight) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_INT(min); - auto h = self->FindMinSurroundingLight(min); - ACTION_RETURN_INT(h); -} - // // Find the highest point on the floor of the sector // @@ -739,15 +649,6 @@ double sector_t::FindHighestFloorPoint (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorPoint) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindHighestFloorPoint(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} // // Find the lowest point on the ceiling of the sector @@ -788,15 +689,6 @@ double sector_t::FindLowestCeilingPoint (vertex_t **v) const return height; } -DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingPoint) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - vertex_t *v; - double h = self->FindLowestCeilingPoint(&v); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(v); - return numret; -} //===================================================================================== // @@ -1056,18 +948,6 @@ double sector_t::HighestCeilingAt(const DVector2 &p, sector_t **resultsec) return check->ceilingplane.ZatPoint(pos); } -DEFINE_ACTION_FUNCTION(_Sector, HighestCeilingAt) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_FLOAT(x); - PARAM_FLOAT(y); - sector_t *s; - double h = self->HighestCeilingAt(DVector2(x, y), &s); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(s); - return numret; -} - //=========================================================================== // // Finds the lowest floor at the given position, all portals considered @@ -1091,18 +971,6 @@ double sector_t::LowestFloorAt(const DVector2 &p, sector_t **resultsec) return check->floorplane.ZatPoint(pos); } -DEFINE_ACTION_FUNCTION(_Sector, LowestFloorAt) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_FLOAT(x); - PARAM_FLOAT(y); - sector_t *s; - double h = self->LowestFloorAt(DVector2(x, y), &s); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetPointer(s); - return numret; -} - //===================================================================================== // // @@ -1152,34 +1020,6 @@ double sector_t::NextHighestCeilingAt(double x, double y, double bottomz, double } } -DEFINE_ACTION_FUNCTION(_Sector, NextHighestCeilingAt) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_FLOAT(x); - PARAM_FLOAT(y); - PARAM_FLOAT(bottomz); - PARAM_FLOAT(topz); - PARAM_INT(flags); - sector_t *resultsec; - F3DFloor *resultff; - double resultheight = self->NextHighestCeilingAt(x, y, bottomz, topz, flags, &resultsec, &resultff); - - if (numret > 2) - { - ret[2].SetPointer(resultff); - numret = 3; - } - if (numret > 1) - { - ret[1].SetPointer(resultsec); - } - if (numret > 0) - { - ret[0].SetFloat(resultheight); - } - return numret; -} - //===================================================================================== // // @@ -1230,35 +1070,6 @@ double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, doub } } -DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_FLOAT(x); - PARAM_FLOAT(y); - PARAM_FLOAT(z); - PARAM_INT(flags); - PARAM_FLOAT(steph); - sector_t *resultsec; - F3DFloor *resultff; - double resultheight = self->NextLowestFloorAt(x, y, z, flags, steph, &resultsec, &resultff); - - if (numret > 2) - { - ret[2].SetPointer(resultff); - numret = 3; - } - if (numret > 1) - { - ret[1].SetPointer(resultsec); - } - if (numret > 0) - { - ret[0].SetFloat(resultheight); - } - return numret; -} - - //=========================================================================== // // @@ -1285,18 +1096,7 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) } } - DEFINE_ACTION_FUNCTION(_Sector, GetFriction) - { - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_INT(plane); - double mf; - double h = self->GetFriction(plane, &mf); - if (numret > 0) ret[0].SetFloat(h); - if (numret > 1) ret[1].SetFloat(mf); - return numret; - } - - //=========================================================================== + //=========================================================================== // // // @@ -1478,14 +1278,6 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) return res; } - DEFINE_ACTION_FUNCTION(_Sector, TriggerSectorActions) - { - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_OBJECT(thing, AActor); - PARAM_INT(activation); - ACTION_RETURN_BOOL(self->TriggerSectorActions(thing, activation)); - } - //=========================================================================== // // checks if the floor is higher than the ceiling and sets a flag @@ -1782,88 +1574,3 @@ void vertex_t::RecalcVertexHeights() dirty = false; } -DEFINE_ACTION_FUNCTION(_Sector, GetPortalDisplacement) -{ - PARAM_SELF_STRUCT_PROLOGUE(sector_t); - PARAM_INT(pos); - ACTION_RETURN_VEC2(self->GetPortalDisplacement(pos)); -} - - -DEFINE_FIELD_X(Sector, sector_t, floorplane) -DEFINE_FIELD_X(Sector, sector_t, ceilingplane) -DEFINE_FIELD_X(Sector, sector_t, Colormap) -DEFINE_FIELD_X(Sector, sector_t, SpecialColors) -DEFINE_FIELD_X(Sector, sector_t, SoundTarget) -DEFINE_FIELD_X(Sector, sector_t, special) -DEFINE_FIELD_X(Sector, sector_t, lightlevel) -DEFINE_FIELD_X(Sector, sector_t, seqType) -DEFINE_FIELD_X(Sector, sector_t, sky) -DEFINE_FIELD_X(Sector, sector_t, SeqName) -DEFINE_FIELD_X(Sector, sector_t, centerspot) -DEFINE_FIELD_X(Sector, sector_t, validcount) -DEFINE_FIELD_X(Sector, sector_t, thinglist) -DEFINE_FIELD_X(Sector, sector_t, friction) -DEFINE_FIELD_X(Sector, sector_t, movefactor) -DEFINE_FIELD_X(Sector, sector_t, terrainnum) -DEFINE_FIELD_X(Sector, sector_t, floordata) -DEFINE_FIELD_X(Sector, sector_t, ceilingdata) -DEFINE_FIELD_X(Sector, sector_t, lightingdata) -DEFINE_FIELD_X(Sector, sector_t, interpolations) -DEFINE_FIELD_X(Sector, sector_t, soundtraversed) -DEFINE_FIELD_X(Sector, sector_t, stairlock) -DEFINE_FIELD_X(Sector, sector_t, prevsec) -DEFINE_FIELD_X(Sector, sector_t, nextsec) -DEFINE_FIELD_UNSIZED(Sector, sector_t, Lines) -DEFINE_FIELD_X(Sector, sector_t, heightsec) -DEFINE_FIELD_X(Sector, sector_t, bottommap) -DEFINE_FIELD_X(Sector, sector_t, midmap) -DEFINE_FIELD_X(Sector, sector_t, topmap) -DEFINE_FIELD_X(Sector, sector_t, touching_thinglist) -DEFINE_FIELD_X(Sector, sector_t, sectorportal_thinglist) -DEFINE_FIELD_X(Sector, sector_t, gravity) -DEFINE_FIELD_X(Sector, sector_t, damagetype) -DEFINE_FIELD_X(Sector, sector_t, damageamount) -DEFINE_FIELD_X(Sector, sector_t, damageinterval) -DEFINE_FIELD_X(Sector, sector_t, leakydamage) -DEFINE_FIELD_X(Sector, sector_t, ZoneNumber) -DEFINE_FIELD_X(Sector, sector_t, healthceiling) -DEFINE_FIELD_X(Sector, sector_t, healthfloor) -DEFINE_FIELD_X(Sector, sector_t, healthceilinggroup) -DEFINE_FIELD_X(Sector, sector_t, healthfloorgroup) -DEFINE_FIELD_X(Sector, sector_t, MoreFlags) -DEFINE_FIELD_X(Sector, sector_t, Flags) -DEFINE_FIELD_X(Sector, sector_t, SecActTarget) -DEFINE_FIELD_X(Sector, sector_t, Portals) -DEFINE_FIELD_X(Sector, sector_t, PortalGroup) -DEFINE_FIELD_X(Sector, sector_t, sectornum) - -DEFINE_FIELD_X(Line, line_t, v1) -DEFINE_FIELD_X(Line, line_t, v2) -DEFINE_FIELD_X(Line, line_t, delta) -DEFINE_FIELD_X(Line, line_t, flags) -DEFINE_FIELD_X(Line, line_t, activation) -DEFINE_FIELD_X(Line, line_t, special) -DEFINE_FIELD_X(Line, line_t, args) -DEFINE_FIELD_X(Line, line_t, alpha) -DEFINE_FIELD_X(Line, line_t, sidedef) -DEFINE_FIELD_X(Line, line_t, bbox) -DEFINE_FIELD_X(Line, line_t, frontsector) -DEFINE_FIELD_X(Line, line_t, backsector) -DEFINE_FIELD_X(Line, line_t, validcount) -DEFINE_FIELD_X(Line, line_t, locknumber) -DEFINE_FIELD_X(Line, line_t, portalindex) -DEFINE_FIELD_X(Line, line_t, portaltransferred) -DEFINE_FIELD_X(Line, line_t, health) -DEFINE_FIELD_X(Line, line_t, healthgroup) - -DEFINE_FIELD_X(Side, side_t, sector) -DEFINE_FIELD_X(Side, side_t, linedef) -DEFINE_FIELD_X(Side, side_t, Light) -DEFINE_FIELD_X(Side, side_t, Flags) - -DEFINE_FIELD_X(Secplane, secplane_t, normal) -DEFINE_FIELD_X(Secplane, secplane_t, D) -DEFINE_FIELD_X(Secplane, secplane_t, negiC) - -DEFINE_FIELD_X(Vertex, vertex_t, p) diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 65953ec91..bf3fffef8 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -1,4 +1,4 @@ -//----------------------------------------------------------------------------- +s//----------------------------------------------------------------------------- // // Copyright 2016-2018 Christoph Oelckers // @@ -17,7 +17,7 @@ // //----------------------------------------------------------------------------- // -// VM thunks for simple functions. +// VM thunks for internal functions. // //----------------------------------------------------------------------------- @@ -27,6 +27,219 @@ #include "s_sound.h" #include "p_local.h" + +DEFINE_ACTION_FUNCTION(_Sector, FindLowestFloorSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindLowestFloorSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + + +DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindHighestFloorSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestFloor) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextHighestFloor(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestFloor) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextLowestFloor(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestCeiling) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextLowestCeiling(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestCeiling) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextHighestCeiling(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindLowestCeilingSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, FindHighestCeilingSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindHighestCeilingSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + + +DEFINE_ACTION_FUNCTION(_Sector, FindMinSurroundingLight) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(min); + auto h = self->FindMinSurroundingLight(min); + ACTION_RETURN_INT(h); +} + +DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorPoint) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindHighestFloorPoint(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} +DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingPoint) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindLowestCeilingPoint(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, HighestCeilingAt) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + sector_t *s; + double h = self->HighestCeilingAt(DVector2(x, y), &s); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(s); + return numret; +} +DEFINE_ACTION_FUNCTION(_Sector, LowestFloorAt) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + sector_t *s; + double h = self->LowestFloorAt(DVector2(x, y), &s); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(s); + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, NextHighestCeilingAt) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + PARAM_FLOAT(bottomz); + PARAM_FLOAT(topz); + PARAM_INT(flags); + sector_t *resultsec; + F3DFloor *resultff; + double resultheight = self->NextHighestCeilingAt(x, y, bottomz, topz, flags, &resultsec, &resultff); + + if (numret > 2) + { + ret[2].SetPointer(resultff); + numret = 3; + } + if (numret > 1) + { + ret[1].SetPointer(resultsec); + } + if (numret > 0) + { + ret[0].SetFloat(resultheight); + } + return numret; +} +DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + PARAM_FLOAT(z); + PARAM_INT(flags); + PARAM_FLOAT(steph); + sector_t *resultsec; + F3DFloor *resultff; + double resultheight = self->NextLowestFloorAt(x, y, z, flags, steph, &resultsec, &resultff); + + if (numret > 2) + { + ret[2].SetPointer(resultff); + numret = 3; + } + if (numret > 1) + { + ret[1].SetPointer(resultsec); + } + if (numret > 0) + { + ret[0].SetFloat(resultheight); + } + return numret; +} + +DEFINE_ACTION_FUNCTION(_Sector, GetFriction) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(plane); + double mf; + double h = self->GetFriction(plane, &mf); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetFloat(mf); + return numret; +} +DEFINE_ACTION_FUNCTION(_Sector, TriggerSectorActions) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_OBJECT(thing, AActor); + PARAM_INT(activation); + ACTION_RETURN_BOOL(self->TriggerSectorActions(thing, activation)); +} + +DEFINE_ACTION_FUNCTION(_Sector, GetPortalDisplacement) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_VEC2(self->GetPortalDisplacement(pos)); +} + DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindShortestTextureAround, FindShortestTextureAround) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); @@ -1265,3 +1478,82 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_PlaySound, A_PlaySound) A_PlaySound(self, soundid, channel, volume, looping, attenuation, local); return 0; } + + +DEFINE_FIELD_X(Sector, sector_t, floorplane) +DEFINE_FIELD_X(Sector, sector_t, ceilingplane) +DEFINE_FIELD_X(Sector, sector_t, Colormap) +DEFINE_FIELD_X(Sector, sector_t, SpecialColors) +DEFINE_FIELD_X(Sector, sector_t, SoundTarget) +DEFINE_FIELD_X(Sector, sector_t, special) +DEFINE_FIELD_X(Sector, sector_t, lightlevel) +DEFINE_FIELD_X(Sector, sector_t, seqType) +DEFINE_FIELD_X(Sector, sector_t, sky) +DEFINE_FIELD_X(Sector, sector_t, SeqName) +DEFINE_FIELD_X(Sector, sector_t, centerspot) +DEFINE_FIELD_X(Sector, sector_t, validcount) +DEFINE_FIELD_X(Sector, sector_t, thinglist) +DEFINE_FIELD_X(Sector, sector_t, friction) +DEFINE_FIELD_X(Sector, sector_t, movefactor) +DEFINE_FIELD_X(Sector, sector_t, terrainnum) +DEFINE_FIELD_X(Sector, sector_t, floordata) +DEFINE_FIELD_X(Sector, sector_t, ceilingdata) +DEFINE_FIELD_X(Sector, sector_t, lightingdata) +DEFINE_FIELD_X(Sector, sector_t, interpolations) +DEFINE_FIELD_X(Sector, sector_t, soundtraversed) +DEFINE_FIELD_X(Sector, sector_t, stairlock) +DEFINE_FIELD_X(Sector, sector_t, prevsec) +DEFINE_FIELD_X(Sector, sector_t, nextsec) +DEFINE_FIELD_UNSIZED(Sector, sector_t, Lines) +DEFINE_FIELD_X(Sector, sector_t, heightsec) +DEFINE_FIELD_X(Sector, sector_t, bottommap) +DEFINE_FIELD_X(Sector, sector_t, midmap) +DEFINE_FIELD_X(Sector, sector_t, topmap) +DEFINE_FIELD_X(Sector, sector_t, touching_thinglist) +DEFINE_FIELD_X(Sector, sector_t, sectorportal_thinglist) +DEFINE_FIELD_X(Sector, sector_t, gravity) +DEFINE_FIELD_X(Sector, sector_t, damagetype) +DEFINE_FIELD_X(Sector, sector_t, damageamount) +DEFINE_FIELD_X(Sector, sector_t, damageinterval) +DEFINE_FIELD_X(Sector, sector_t, leakydamage) +DEFINE_FIELD_X(Sector, sector_t, ZoneNumber) +DEFINE_FIELD_X(Sector, sector_t, healthceiling) +DEFINE_FIELD_X(Sector, sector_t, healthfloor) +DEFINE_FIELD_X(Sector, sector_t, healthceilinggroup) +DEFINE_FIELD_X(Sector, sector_t, healthfloorgroup) +DEFINE_FIELD_X(Sector, sector_t, MoreFlags) +DEFINE_FIELD_X(Sector, sector_t, Flags) +DEFINE_FIELD_X(Sector, sector_t, SecActTarget) +DEFINE_FIELD_X(Sector, sector_t, Portals) +DEFINE_FIELD_X(Sector, sector_t, PortalGroup) +DEFINE_FIELD_X(Sector, sector_t, sectornum) + +DEFINE_FIELD_X(Line, line_t, v1) +DEFINE_FIELD_X(Line, line_t, v2) +DEFINE_FIELD_X(Line, line_t, delta) +DEFINE_FIELD_X(Line, line_t, flags) +DEFINE_FIELD_X(Line, line_t, activation) +DEFINE_FIELD_X(Line, line_t, special) +DEFINE_FIELD_X(Line, line_t, args) +DEFINE_FIELD_X(Line, line_t, alpha) +DEFINE_FIELD_X(Line, line_t, sidedef) +DEFINE_FIELD_X(Line, line_t, bbox) +DEFINE_FIELD_X(Line, line_t, frontsector) +DEFINE_FIELD_X(Line, line_t, backsector) +DEFINE_FIELD_X(Line, line_t, validcount) +DEFINE_FIELD_X(Line, line_t, locknumber) +DEFINE_FIELD_X(Line, line_t, portalindex) +DEFINE_FIELD_X(Line, line_t, portaltransferred) +DEFINE_FIELD_X(Line, line_t, health) +DEFINE_FIELD_X(Line, line_t, healthgroup) + +DEFINE_FIELD_X(Side, side_t, sector) +DEFINE_FIELD_X(Side, side_t, linedef) +DEFINE_FIELD_X(Side, side_t, Light) +DEFINE_FIELD_X(Side, side_t, Flags) + +DEFINE_FIELD_X(Secplane, secplane_t, normal) +DEFINE_FIELD_X(Secplane, secplane_t, D) +DEFINE_FIELD_X(Secplane, secplane_t, negiC) + +DEFINE_FIELD_X(Vertex, vertex_t, p) From fc7ca39927a26af35a90ed41ba753f7480a4293b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Nov 2018 00:24:00 +0100 Subject: [PATCH 10/10] - allocate storage for all of a function's return values --- src/scripting/backend/vmbuilder.cpp | 12 ++++++++++++ src/scripting/vm/vm.h | 2 +- src/scripting/vmthunks.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/scripting/backend/vmbuilder.cpp b/src/scripting/backend/vmbuilder.cpp index a141c3f8e..fd4ce1c93 100644 --- a/src/scripting/backend/vmbuilder.cpp +++ b/src/scripting/backend/vmbuilder.cpp @@ -35,6 +35,7 @@ #include "vmbuilder.h" #include "codegen.h" #include "m_argv.h" +#include "c_cvars.h" #include "scripting/vm/jit.h" struct VMRemap @@ -1046,6 +1047,8 @@ void FunctionCallEmitter::AddParameterStringConst(const FString &konst) }); } +EXTERN_CVAR(Bool, vm_jit) + ExpEmit FunctionCallEmitter::EmitCall(VMFunctionBuilder *build, TArray *ReturnRegs) { unsigned paramcount = 0; @@ -1085,6 +1088,15 @@ ExpEmit FunctionCallEmitter::EmitCall(VMFunctionBuilder *build, TArray if (ReturnRegs) ReturnRegs->Push(reg); else return reg; } + if (vm_jit) // The JIT compiler needs this, but the VM interpreter does not. + { + for (unsigned i = returns.Size(); i < target->Proto->ReturnTypes.Size(); i++) + { + ExpEmit reg(build, target->Proto->ReturnTypes[i]->RegType, target->Proto->ReturnTypes[i]->RegCount); + build->Emit(OP_RESULT, 0, EncodeRegType(reg), reg.RegNum); + reg.Free(build); + } + } return ExpEmit(); } diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index 6e328c4c8..cf429ce37 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -36,8 +36,8 @@ #ifndef VM_H #define VM_H -#include "zstring.h" #include "autosegs.h" +#include "zstring.h" #include "vectors.h" #include "cmdlib.h" #include "doomerrors.h" diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index bf3fffef8..93717fb99 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -1,4 +1,4 @@ -s//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // // Copyright 2016-2018 Christoph Oelckers //