mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-30 21:31:03 +00:00
- resolve the single Doom specific dependency in the VM by using a callback.
This commit is contained in:
parent
c9b2399cd0
commit
a6d982ed04
4 changed files with 7 additions and 3 deletions
|
@ -52,7 +52,7 @@ static int CastS2Co(FString *b) { return V_GetColor(nullptr, *b); }
|
||||||
static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %02x", c.r, c.g, c.b); }
|
static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %02x", c.r, c.g, c.b); }
|
||||||
static int CastS2So(FString *b) { return FSoundID(*b); }
|
static int CastS2So(FString *b) { return FSoundID(*b); }
|
||||||
static void CastSo2S(FString* a, int b) { *a = soundEngine->GetSoundName(b); }
|
static void CastSo2S(FString* a, int b) { *a = soundEngine->GetSoundName(b); }
|
||||||
static void CastSID2S(FString* a, unsigned int b) { *a = "";/* (b >= sprites.Size()) ? "TNT1" : sprites[b].name;*/ }
|
static void CastSID2S(FString* a, unsigned int b) { VM_CastSpriteIDToString(a, b); }
|
||||||
static void CastTID2S(FString *a, int b) { auto tex = TexMan.GetTexture(*(FTextureID*)&b); *a = (tex == nullptr) ? "(null)" : tex->GetName().GetChars(); }
|
static void CastTID2S(FString *a, int b) { auto tex = TexMan.GetTexture(*(FTextureID*)&b); *a = (tex == nullptr) ? "(null)" : tex->GetName().GetChars(); }
|
||||||
|
|
||||||
void JitCompiler::EmitCAST()
|
void JitCompiler::EmitCAST()
|
||||||
|
|
|
@ -56,6 +56,8 @@ extern FMemArena ClassDataAllocator;
|
||||||
|
|
||||||
void JitRelease();
|
void JitRelease();
|
||||||
|
|
||||||
|
extern void (*VM_CastSpriteIDToString)(FString* a, unsigned int b);
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned char VM_UBYTE;
|
typedef unsigned char VM_UBYTE;
|
||||||
typedef signed char VM_SBYTE;
|
typedef signed char VM_SBYTE;
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
extern cycle_t VMCycles[10];
|
extern cycle_t VMCycles[10];
|
||||||
extern int VMCalls[10];
|
extern int VMCalls[10];
|
||||||
|
|
||||||
|
// THe sprite ID to string cast is game specific so let's do it with a callback to remove the dependency and allow easier reuse.
|
||||||
|
void (*VM_CastSpriteIDToString)(FString* a, unsigned int b) = [](FString* a, unsigned int b) { a->Format("%d", b); };
|
||||||
|
|
||||||
// intentionally implemented in a different source file to prevent inlining.
|
// intentionally implemented in a different source file to prevent inlining.
|
||||||
#if 0
|
#if 0
|
||||||
void ThrowVMException(VMException *x);
|
void ThrowVMException(VMException *x);
|
||||||
|
|
|
@ -1711,7 +1711,6 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static double DoFLOP(int flop, double v)
|
static double DoFLOP(int flop, double v)
|
||||||
{
|
{
|
||||||
switch(flop)
|
switch(flop)
|
||||||
|
@ -1843,7 +1842,7 @@ static void DoCast(const VMRegisters ®, const VMFrame *f, int a, int b, int c
|
||||||
|
|
||||||
case CAST_SID2S:
|
case CAST_SID2S:
|
||||||
ASSERTS(a); ASSERTD(b);
|
ASSERTS(a); ASSERTD(b);
|
||||||
reg.s[a] = "";// unsigned(reg.d[b]) >= sprites.Size() ? "TNT1" : sprites[reg.d[b]].name;
|
VM_CastSpriteIDToString(®.s[a], reg.d[b]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAST_TID2S:
|
case CAST_TID2S:
|
||||||
|
|
Loading…
Reference in a new issue