From 5180265ab124a29eb9020fa8bf92cd6403e6e27a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 17 Nov 2018 21:21:23 +0100 Subject: [PATCH] - fixed: The Dehacked function wrappers now need full parameter lists. --- src/d_dehacked.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index c12e50078..bf709fbec 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -65,6 +65,7 @@ #include "backend/vmbuilder.h" #include "types.h" #include "m_argv.h" +#include "actorptrselect.h" void JitDumpLog(FILE *file, VMScriptFunction *func); @@ -631,6 +632,7 @@ static int GetLine (void) } } + // misc1 = vrange (arg +3), misc2 = hrange (arg+4) static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2) { // A_Mushroom @@ -668,14 +670,17 @@ static int CreateSpawnFunc(VMFunctionBuilder &buildit, int value1, int value2) } int typereg = buildit.GetConstantAddress(InfoNames[value1-1]); int heightreg = buildit.GetConstantFloat(value2); + int distreg = buildit.GetConstantFloat(0); buildit.Emit(OP_PARAM, REGT_POINTER | REGT_KONST, typereg); // itemtype - buildit.Emit(OP_PARAM, REGT_NIL, 0); // distance + buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, distreg); // distance buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, heightreg); // height - // The rest of the parameters to A_SpawnItem can just keep their defaults - return 3; + buildit.Emit(OP_PARAMI, 0); // useammo + buildit.Emit(OP_PARAMI, 0); // transfer_translation + return 5; } + // misc1 = angle (in degrees) (arg +0 but factor in current actor angle too) static int CreateTurnFunc(VMFunctionBuilder &buildit, int value1, int value2) { // A_Turn @@ -687,19 +692,20 @@ static int CreateTurnFunc(VMFunctionBuilder &buildit, int value1, int value2) static int CreateFaceFunc(VMFunctionBuilder &buildit, int value1, int value2) { // A_FaceTarget buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, buildit.GetConstantFloat(value1)); // angle - return 1; + buildit.Emit(OP_PARAMI, 0); // flags + buildit.Emit(OP_PARAMI, AAPTR_DEFAULT); // ptr + return 3; } // misc1 = damage, misc 2 = sound static int CreateScratchFunc(VMFunctionBuilder &buildit, int value1, int value2) { // A_CustomMeleeAttack - buildit.EmitParamInt(value1); // damage - if (value2) - { - buildit.EmitParamInt(SoundMap[value2-1]); // hit sound - return 2; - } - return 1; + buildit.EmitParamInt(value1); // damage + buildit.EmitParamInt(value2? SoundMap[value2 - 1] : 0); // hit sound + buildit.Emit(OP_PARAMI, 0); // miss sound + buildit.Emit(OP_PARAMI, NAME_None); // damage type + buildit.Emit(OP_PARAMI, true); // bleed + return 5; } // misc1 = sound, misc2 = attenuation none (true) or normal (false) @@ -713,7 +719,8 @@ static int CreatePlaySoundFunc(VMFunctionBuilder &buildit, int value1, int value buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, float1); // volume buildit.Emit(OP_PARAMI, false); // looping buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, attenreg); // attenuation - return 5; + buildit.Emit(OP_PARAMI, false); // local + return 6; } // misc1 = state, misc2 = probability @@ -744,6 +751,7 @@ static int CreateNailBombFunc(VMFunctionBuilder &buildit, int value1, int value2 { // A_Explode // This one does not actually have MBF-style parameters. But since // we're aliasing it to an extension of A_Explode... + int typereg = buildit.GetConstantAddress(PClass::FindClass(NAME_BulletPuff)); buildit.Emit(OP_PARAM, REGT_NIL, 0); // damage buildit.Emit(OP_PARAM, REGT_NIL, 0); // distance buildit.Emit(OP_PARAM, REGT_NIL, 0); // flags @@ -751,7 +759,10 @@ static int CreateNailBombFunc(VMFunctionBuilder &buildit, int value1, int value2 buildit.Emit(OP_PARAM, REGT_NIL, 0); // fulldamagedistance buildit.Emit(OP_PARAMI, 30); // nails buildit.Emit(OP_PARAMI, 10); // naildamage - return 7; + buildit.Emit(OP_PARAM, REGT_POINTER | REGT_KONST, typereg); // itemtype + buildit.Emit(OP_PARAMI, NAME_None); // damage type + + return 9; } // This array must be in sync with the Aliases array in DEHSUPP. @@ -3186,4 +3197,3 @@ DEFINE_ACTION_FUNCTION(ADehackedPickup, DetermineType) } ACTION_RETURN_POINTER(nullptr); } -