mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- backend update from GZDoom
menu enhancements, IQM indices and an important fix in the sound system.
This commit is contained in:
parent
d710407b08
commit
003f4a035e
7 changed files with 74 additions and 9 deletions
|
@ -357,7 +357,7 @@ public:
|
|||
bool isValidSoundId(FSoundID sid)
|
||||
{
|
||||
int id = sid.index();
|
||||
return id > 0 && id < (int)S_sfx.Size() && !S_sfx[id].bTentative && S_sfx[id].lumpnum != sfx_empty;
|
||||
return id > 0 && id < (int)S_sfx.Size() && !S_sfx[id].bTentative && (S_sfx[id].lumpnum != sfx_empty || S_sfx[id].bRandomHeader || S_sfx[id].link != sfxinfo_t::NO_LINK);
|
||||
}
|
||||
|
||||
template<class func> bool EnumerateChannels(func callback)
|
||||
|
|
|
@ -1033,6 +1033,8 @@ DEFINE_FIELD(DListMenuDescriptor, mFontColor2)
|
|||
DEFINE_FIELD(DListMenuDescriptor, mAnimatedTransition)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mAnimated)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mCenter)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mDontDim)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mDontBlur)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mVirtWidth)
|
||||
DEFINE_FIELD(DListMenuDescriptor, mVirtHeight)
|
||||
|
||||
|
@ -1045,6 +1047,9 @@ DEFINE_FIELD(DOptionMenuDescriptor, mScrollPos)
|
|||
DEFINE_FIELD(DOptionMenuDescriptor, mIndent)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mPosition)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mDontDim)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mDontBlur)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mAnimatedTransition)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mAnimated)
|
||||
DEFINE_FIELD(DOptionMenuDescriptor, mFont)
|
||||
|
||||
DEFINE_FIELD(FOptionMenuSettings, mTitleColor)
|
||||
|
@ -1063,6 +1068,8 @@ DEFINE_FIELD(DImageScrollerDescriptor,textFont)
|
|||
DEFINE_FIELD(DImageScrollerDescriptor, textScale)
|
||||
DEFINE_FIELD(DImageScrollerDescriptor, mAnimatedTransition)
|
||||
DEFINE_FIELD(DImageScrollerDescriptor, mAnimated)
|
||||
DEFINE_FIELD(DImageScrollerDescriptor, mDontDim)
|
||||
DEFINE_FIELD(DImageScrollerDescriptor, mDontBlur)
|
||||
DEFINE_FIELD(DImageScrollerDescriptor, virtWidth)
|
||||
DEFINE_FIELD(DImageScrollerDescriptor, virtHeight)
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ public:
|
|||
bool mFromEngine;
|
||||
bool mAnimated;
|
||||
bool mAnimatedTransition;
|
||||
bool mDontDim;
|
||||
bool mDontBlur;
|
||||
int mVirtWidth;
|
||||
int mVirtHeight;
|
||||
bool mCustomSizeSet;
|
||||
|
@ -124,6 +126,9 @@ public:
|
|||
int mIndent;
|
||||
int mPosition;
|
||||
bool mDontDim;
|
||||
bool mDontBlur;
|
||||
bool mAnimatedTransition;
|
||||
bool mAnimated;
|
||||
FFont *mFont;
|
||||
|
||||
void CalcIndent();
|
||||
|
@ -143,6 +148,8 @@ public:
|
|||
double textScale;
|
||||
bool mAnimatedTransition;
|
||||
bool mAnimated;
|
||||
bool mDontDim;
|
||||
bool mDontBlur;
|
||||
int virtWidth, virtHeight;
|
||||
|
||||
};
|
||||
|
|
|
@ -358,6 +358,14 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
|
|||
{
|
||||
desc->mAnimated = true;
|
||||
}
|
||||
else if (sc.Compare("DontDim"))
|
||||
{
|
||||
desc->mDontDim = true;
|
||||
}
|
||||
else if (sc.Compare("DontBlur"))
|
||||
{
|
||||
desc->mDontBlur = true;
|
||||
}
|
||||
else if (sc.Compare("MouseWindow"))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
|
@ -763,6 +771,10 @@ static void ParseListMenu(FScanner &sc)
|
|||
desc->mFromEngine = fileSystem.GetFileContainer(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD.
|
||||
desc->mVirtWidth = -2;
|
||||
desc->mCustomSizeSet = false;
|
||||
desc->mAnimatedTransition = false;
|
||||
desc->mAnimated = false;
|
||||
desc->mDontDim = false;
|
||||
desc->mDontBlur = false;
|
||||
desc->mForceList = false;
|
||||
if (DefaultListMenuSettings->mCustomSizeSet)
|
||||
{
|
||||
|
@ -1020,6 +1032,22 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc, int i
|
|||
sc.MustGetNumber();
|
||||
desc->mIndent = sc.Number;
|
||||
}
|
||||
else if (sc.Compare("AnimatedTransition"))
|
||||
{
|
||||
desc->mAnimatedTransition = true;
|
||||
}
|
||||
else if (sc.Compare("Animated"))
|
||||
{
|
||||
desc->mAnimated = true;
|
||||
}
|
||||
else if (sc.Compare("DontDim"))
|
||||
{
|
||||
desc->mDontDim = true;
|
||||
}
|
||||
else if (sc.Compare("DontBlur"))
|
||||
{
|
||||
desc->mDontBlur = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = false;
|
||||
|
@ -1189,7 +1217,10 @@ static void ParseOptionMenu(FScanner &sc)
|
|||
desc->mPosition = DefaultOptionMenuSettings->mPosition;
|
||||
desc->mScrollTop = DefaultOptionMenuSettings->mScrollTop;
|
||||
desc->mIndent = DefaultOptionMenuSettings->mIndent;
|
||||
desc->mDontDim = DefaultOptionMenuSettings->mDontDim;
|
||||
desc->mDontDim = false;
|
||||
desc->mDontBlur = false;
|
||||
desc->mAnimatedTransition = false;
|
||||
desc->mAnimated = false;
|
||||
desc->mProtected = sc.CheckString("protected");
|
||||
|
||||
ParseOptionMenuBody(sc, desc, -1);
|
||||
|
@ -1275,6 +1306,14 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc)
|
|||
{
|
||||
desc->mAnimated = true;
|
||||
}
|
||||
else if (sc.Compare("DontDim"))
|
||||
{
|
||||
desc->mDontDim = true;
|
||||
}
|
||||
else if (sc.Compare("DontBlur"))
|
||||
{
|
||||
desc->mDontBlur = true;
|
||||
}
|
||||
else if (sc.Compare("textBackground"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
|
@ -1450,7 +1489,10 @@ static void ParseImageScroller(FScanner& sc)
|
|||
desc->textBackgroundBrightness = 0xffffffff;
|
||||
desc->textFont = SmallFont;
|
||||
desc->textScale = 1;
|
||||
desc->mDontDim = false;
|
||||
desc->mDontBlur = false;
|
||||
desc->mAnimatedTransition = false;
|
||||
desc->mAnimated = false;
|
||||
desc->virtWidth = 320;
|
||||
desc->virtHeight = 200;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) = 0;
|
||||
virtual float getAspectFactor(float vscale) { return 1.f; }
|
||||
virtual const TArray<TRS>* AttachAnimationData() { return nullptr; };
|
||||
virtual const TArray<VSMatrix> CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>& animationData, DBoneComponents* bones, int index) { return {}; };
|
||||
virtual const TArray<VSMatrix> CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>* animationData, DBoneComponents* bones, int index) { return {}; };
|
||||
|
||||
void SetVertexBuffer(int type, IModelVertexBuffer *buffer) { mVBuf[type] = buffer; }
|
||||
IModelVertexBuffer *GetVertexBuffer(int type) const { return mVBuf[type]; }
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
||||
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
||||
const TArray<TRS>* AttachAnimationData() override;
|
||||
const TArray<VSMatrix> CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>& animationData, DBoneComponents* bones, int index) override;
|
||||
const TArray<VSMatrix> CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>* animationData, DBoneComponents* bones, int index) override;
|
||||
|
||||
private:
|
||||
void LoadGeometry();
|
||||
|
|
|
@ -434,10 +434,19 @@ void IQMModel::UnloadGeometry()
|
|||
|
||||
int IQMModel::FindFrame(const char* name, bool nodefault)
|
||||
{
|
||||
// This doesn't really mean all that much for IQM
|
||||
// [MK] allow looking up frames by animation name plus offset (using a colon as separator)
|
||||
const char* colon = strrchr(name,':');
|
||||
int nlen = (colon==nullptr)?strlen(name):(colon-name);
|
||||
for (unsigned i = 0; i < Anims.Size(); i++)
|
||||
{
|
||||
if (!stricmp(name, Anims[i].Name.GetChars())) return i;
|
||||
if (!strnicmp(name, Anims[i].Name.GetChars(), nlen))
|
||||
{
|
||||
// if no offset is given, return the first frame
|
||||
if (colon == nullptr) return Anims[i].FirstFrame;
|
||||
unsigned offset = atoi(colon+1);
|
||||
if (offset >= Anims[i].NumFrames) return FErr_NotFound;
|
||||
return Anims[i].FirstFrame+offset;
|
||||
}
|
||||
}
|
||||
return FErr_NotFound;
|
||||
}
|
||||
|
@ -514,9 +523,9 @@ const TArray<TRS>* IQMModel::AttachAnimationData()
|
|||
return &TRSData;
|
||||
}
|
||||
|
||||
const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>& animationData, DBoneComponents* boneComponentData, int index)
|
||||
const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>* animationData, DBoneComponents* boneComponentData, int index)
|
||||
{
|
||||
const TArray<TRS>& animationFrames = &animationData ? animationData : TRSData;
|
||||
const TArray<TRS>& animationFrames = animationData ? *animationData : TRSData;
|
||||
if (Joints.Size() > 0)
|
||||
{
|
||||
int numbones = Joints.Size();
|
||||
|
@ -604,4 +613,4 @@ const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double i
|
|||
return bones;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue