- fixed: The Dehacked function wrappers now need full parameter lists.

This commit is contained in:
Christoph Oelckers 2018-11-17 21:21:23 +01:00
parent 533f66396d
commit 5180265ab1

View file

@ -65,6 +65,7 @@
#include "backend/vmbuilder.h" #include "backend/vmbuilder.h"
#include "types.h" #include "types.h"
#include "m_argv.h" #include "m_argv.h"
#include "actorptrselect.h"
void JitDumpLog(FILE *file, VMScriptFunction *func); void JitDumpLog(FILE *file, VMScriptFunction *func);
@ -631,6 +632,7 @@ static int GetLine (void)
} }
} }
// misc1 = vrange (arg +3), misc2 = hrange (arg+4) // misc1 = vrange (arg +3), misc2 = hrange (arg+4)
static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2) static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2)
{ // A_Mushroom { // A_Mushroom
@ -668,14 +670,17 @@ static int CreateSpawnFunc(VMFunctionBuilder &buildit, int value1, int value2)
} }
int typereg = buildit.GetConstantAddress(InfoNames[value1-1]); int typereg = buildit.GetConstantAddress(InfoNames[value1-1]);
int heightreg = buildit.GetConstantFloat(value2); 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_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 buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, heightreg); // height
// The rest of the parameters to A_SpawnItem can just keep their defaults buildit.Emit(OP_PARAMI, 0); // useammo
return 3; buildit.Emit(OP_PARAMI, 0); // transfer_translation
return 5;
} }
// misc1 = angle (in degrees) (arg +0 but factor in current actor angle too) // misc1 = angle (in degrees) (arg +0 but factor in current actor angle too)
static int CreateTurnFunc(VMFunctionBuilder &buildit, int value1, int value2) static int CreateTurnFunc(VMFunctionBuilder &buildit, int value1, int value2)
{ // A_Turn { // A_Turn
@ -687,19 +692,20 @@ static int CreateTurnFunc(VMFunctionBuilder &buildit, int value1, int value2)
static int CreateFaceFunc(VMFunctionBuilder &buildit, int value1, int value2) static int CreateFaceFunc(VMFunctionBuilder &buildit, int value1, int value2)
{ // A_FaceTarget { // A_FaceTarget
buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, buildit.GetConstantFloat(value1)); // angle 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 // misc1 = damage, misc 2 = sound
static int CreateScratchFunc(VMFunctionBuilder &buildit, int value1, int value2) static int CreateScratchFunc(VMFunctionBuilder &buildit, int value1, int value2)
{ // A_CustomMeleeAttack { // A_CustomMeleeAttack
buildit.EmitParamInt(value1); // damage buildit.EmitParamInt(value1); // damage
if (value2) buildit.EmitParamInt(value2? SoundMap[value2 - 1] : 0); // hit sound
{ buildit.Emit(OP_PARAMI, 0); // miss sound
buildit.EmitParamInt(SoundMap[value2-1]); // hit sound buildit.Emit(OP_PARAMI, NAME_None); // damage type
return 2; buildit.Emit(OP_PARAMI, true); // bleed
} return 5;
return 1;
} }
// misc1 = sound, misc2 = attenuation none (true) or normal (false) // 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_PARAM, REGT_FLOAT | REGT_KONST, float1); // volume
buildit.Emit(OP_PARAMI, false); // looping buildit.Emit(OP_PARAMI, false); // looping
buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, attenreg); // attenuation buildit.Emit(OP_PARAM, REGT_FLOAT | REGT_KONST, attenreg); // attenuation
return 5; buildit.Emit(OP_PARAMI, false); // local
return 6;
} }
// misc1 = state, misc2 = probability // misc1 = state, misc2 = probability
@ -744,6 +751,7 @@ static int CreateNailBombFunc(VMFunctionBuilder &buildit, int value1, int value2
{ // A_Explode { // A_Explode
// This one does not actually have MBF-style parameters. But since // This one does not actually have MBF-style parameters. But since
// we're aliasing it to an extension of A_Explode... // 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); // damage
buildit.Emit(OP_PARAM, REGT_NIL, 0); // distance buildit.Emit(OP_PARAM, REGT_NIL, 0); // distance
buildit.Emit(OP_PARAM, REGT_NIL, 0); // flags 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_PARAM, REGT_NIL, 0); // fulldamagedistance
buildit.Emit(OP_PARAMI, 30); // nails buildit.Emit(OP_PARAMI, 30); // nails
buildit.Emit(OP_PARAMI, 10); // naildamage 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. // 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); ACTION_RETURN_POINTER(nullptr);
} }