diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9fd1251537..e171b1fade 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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. diff --git a/src/r_data.h b/src/r_data.h index b4853b9026..acd70284de 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -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); diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 01c50962ac..9b0d14520d 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -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; diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index e6e8ce48f8..d6c9249a62 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -515,6 +515,11 @@ bool FTexture::UseBasePalette() return true; } +FTexture *FTexture::GetRedirect(bool wantwarped) +{ + return this; +} + FDummyTexture::FDummyTexture () diff --git a/src/textures/textures.h b/src/textures/textures.h index 073a11e5b5..84777da39b 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -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; diff --git a/src/textures/warptexture.cpp b/src/textures/warptexture.cpp index a0307c79c7..8f6a1eecd7 100644 --- a/src/textures/warptexture.cpp +++ b/src/textures/warptexture.cpp @@ -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); +} + diff --git a/src/thingdef/olddecorations.cpp b/src/thingdef/olddecorations.cpp index 984def2c6d..3a8be7c046 100644 --- a/src/thingdef/olddecorations.cpp +++ b/src/thingdef/olddecorations.cpp @@ -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)); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 121f93b54c..2aa67bc367 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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! diff --git a/src/thingdef/thingdef_main.cpp b/src/thingdef/thingdef_main.cpp index 3da7ad6488..4525ff7353 100644 --- a/src/thingdef/thingdef_main.cpp +++ b/src/thingdef/thingdef_main.cpp @@ -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; diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 9831a07f35..585f142f3b 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -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('('))