- added two new integral types SpriteID and TextureID, both are needed to allow proper serialization as they require something different to be written out than a regular integer.

This commit is contained in:
Christoph Oelckers 2016-11-21 13:45:33 +01:00
parent 7c122d03e9
commit 7d99552903
10 changed files with 164 additions and 17 deletions

View file

@ -127,6 +127,8 @@ enum
CAST_So2S,
CAST_V22S,
CAST_V32S,
CAST_SID2S,
CAST_TID2S,
};
// Register types for VMParam

View file

@ -36,6 +36,8 @@
#include <s_sound.h>
#include "dobject.h"
#include "xs_Float.h"
#include "r_state.h"
#include "textures/textures.h"
#include "math/cmath.h"
#define IMPLEMENT_VMEXEC

View file

@ -1695,6 +1695,19 @@ static void DoCast(const VMRegisters &reg, const VMFrame *f, int a, int b, int c
reg.s[a] = S_sfx[reg.d[b]].name;
break;
case CAST_SID2S:
ASSERTS(a); ASSERTD(b);
reg.s[a] = unsigned(reg.d[b]) >= sprites.Size() ? "TNT1" : sprites[reg.d[b]].name;
break;
case CAST_TID2S:
{
ASSERTS(a); ASSERTD(b);
auto tex = TexMan[*(FTextureID*)&(reg.d[b])];
reg.s[a] = tex == nullptr ? "(null)" : tex->Name.GetChars();
break;
}
default:
assert(0);
}