- Fixed: A_Jump used a wrong index into the jump address table.

- Fixed: The recent changes in the DECORATE parser require the special parameter
  to A_CallSpecial to be an expression, not a constant.
- Removed game filters from old style decorations. No WAD in existence ever 
  used them and removing them allows to make the parser more robust.


SVN r1170 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-14 19:08:38 +00:00
parent f3922ec6a1
commit 61cbb1d2e1
10 changed files with 73 additions and 4 deletions

View file

@ -1,4 +1,9 @@
August 14, 2008 (Changes by Graf Zahl)
- Fixed: A_Jump used a wrong index into the jump address table.
- Fixed: The recent changes in the DECORATE parser require the special parameter
to A_CallSpecial to be an expression, not a constant.
- Removed game filters from old style decorations. No WAD in existence ever
used them and removing them allows to make the parser more robust.
- Added a few more macros so that the action function code doesn't have
to reference its arguments directly, except 'self'. This may be helpful if it
becomes necessary to restructure this code once DoomScript becomes real.

View file

@ -49,18 +49,22 @@ public:
FWarpTexture (FTexture *source);
~FWarpTexture ();
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
const BYTE *GetPixels ();
void Unload ();
bool CheckModified ();
float GetSpeed() const { return Speed; }
int GetSourceLump() { return SourcePic->GetSourceLump(); }
void SetSpeed(float fac) { Speed = fac; }
FTexture *GetRedirect(bool wantwarped);
DWORD GenTime;
protected:
FTexture *SourcePic;
BYTE *Pixels;
Span **Spans;
DWORD GenTime;
float Speed;
virtual void MakeTexture (DWORD time);

View file

@ -184,6 +184,7 @@ protected:
bool bTranslucentPatches:1;
void MakeTexture ();
FTexture *GetRedirect(bool wantwarped);
private:
void CheckForHacks ();
@ -755,6 +756,18 @@ void FMultiPatchTexture::CheckForHacks ()
//
//==========================================================================
FTexture *FMultiPatchTexture::GetRedirect(bool wantwarped)
{
if (bRedirect) return Parts->Texture;
else return this;
}
//==========================================================================
//
// FMultiPatchTexture :: TexPart :: TexPart
//
//==========================================================================
FMultiPatchTexture::TexPart::TexPart()
{
OriginX = OriginY = 0;

View file

@ -515,6 +515,11 @@ bool FTexture::UseBasePalette()
return true;
}
FTexture *FTexture::GetRedirect(bool wantwarped)
{
return this;
}
FDummyTexture::FDummyTexture ()

View file

@ -147,6 +147,7 @@ public:
int CopyTrueColorTranslated(FBitmap *bmp, int x, int y, int rotate, FRemapTable *remap, FCopyInfo *inf = NULL);
virtual bool UseBasePalette();
virtual int GetSourceLump() { return -1; }
virtual FTexture *GetRedirect(bool wantwarped);
virtual void Unload () = 0;

View file

@ -222,3 +222,29 @@ void FWarp2Texture::MakeTexture (DWORD time)
}
}
//==========================================================================
//
// FMultiPatchTexture :: TexPart :: TexPart
//
//==========================================================================
FTexture *FWarpTexture::GetRedirect(bool wantwarped)
{
if (!wantwarped) return SourcePic;
else return this;
}
//==========================================================================
//
// FMultiPatchTexture :: CopyTrueColorPixels
//
// This doesn't warp. It's just here in case someone tries to use a warp
// texture for compositing a multipatch texture
//
//==========================================================================
int FWarpTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf)
{
return SourcePic->CopyTrueColorPixels(bmp, x, y, rotate, inf);
}

View file

@ -244,6 +244,10 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
info->GameFilter = 0x80;
MakeStateDefines(parent->ActorInfo->StateList);
// There isn't a single WAD out there which uses game filters with old style
// decorations so this may as well be disabled. Without this option is is much
// easier to detect incorrect declarations
#if 0
sc.MustGetString ();
while (!sc.Compare ("{"))
{
@ -295,6 +299,10 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
{
info->GameFilter &= ~0x80;
}
#else
info->GameFilter = GAME_Any;
sc.MustGetStringName("{");
#endif
states.Clear ();
memset (&extra, 0, sizeof(extra));

View file

@ -460,7 +460,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump)
}
else
{
ACTION_JUMP(jumps[(pr_cajump() % (count - 1)) + 2]);
ACTION_JUMP(jumps[(pr_cajump() % (count - 1))]);
}
}
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!

View file

@ -122,7 +122,9 @@ static void ParseDecorate (FScanner &sc)
}
default:
// Yuck! Too bad that there's no better way to check this properly
// without the option of game filters following, anything but an opening brace
// here means a syntax error.
sc.MustGetStringName("{");
sc.RestorePos(pos);
ParseOldDecoration(sc, DEF_Decoration);
break;

View file

@ -421,7 +421,12 @@ bool DoActionSpecials(FScanner &sc, FState & state, bool multistate, int * state
int paramindex=PrepareStateParameters(&state, 6);
StateParameters[paramindex]=special;
// The function expects the special to be passed as expression so we
// have to convert it.
specname.Format("%d", special);
FScanner sc2;
sc2.OpenMem("", (char*)specname.GetChars(), int(specname.Len()));
StateParameters[paramindex] = ParseExpression(sc2, false, bag.Info->Class);
// Make this consistent with all other parameter parsing
if (sc.CheckToken('('))