From da2df2778ea47ba2c58ae0b195fcfd71ef17b80c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 8 Jun 2009 23:49:27 +0000 Subject: [PATCH] Added Line_SetTextureScale. SVN r1658 (trunk) --- src/p_lnspec.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++- src/r_defs.h | 9 ++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index f8f24ad18..fa477c25f 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2357,6 +2357,57 @@ FUNC(LS_Line_SetTextureOffset) return true; } +FUNC(LS_Line_SetTextureScale) +// Line_SetTextureScale (id, x, y, side, flags) +{ + const fixed_t NO_CHANGE = 32767< 1) + return false; + + for(int line = -1; (line = P_FindLineFromID (arg0, line)) >= 0; ) + { + if (lines[line].sidenum[arg3] != NO_SIDE) + { + side_t *side = &sides[lines[line].sidenum[arg3]]; + + if ((arg4&8)==0) + { + // set + if (arg1 != NO_CHANGE) + { + if (arg4&1) side->SetTextureXScale(side_t::top, arg1); + if (arg4&2) side->SetTextureXScale(side_t::mid, arg1); + if (arg4&4) side->SetTextureXScale(side_t::bottom, arg1); + } + if (arg2 != NO_CHANGE) + { + if (arg4&1) side->SetTextureYScale(side_t::top, arg2); + if (arg4&2) side->SetTextureYScale(side_t::mid, arg2); + if (arg4&4) side->SetTextureYScale(side_t::bottom, arg2); + } + } + else + { + // add + if (arg1 != NO_CHANGE) + { + if (arg4&1) side->MultiplyTextureXScale(side_t::top, arg1); + if (arg4&2) side->MultiplyTextureXScale(side_t::mid, arg1); + if (arg4&4) side->MultiplyTextureXScale(side_t::bottom, arg1); + } + if (arg2 != NO_CHANGE) + { + if (arg4&1) side->MultiplyTextureYScale(side_t::top, arg2); + if (arg4&2) side->MultiplyTextureYScale(side_t::mid, arg2); + if (arg4&4) side->MultiplyTextureYScale(side_t::bottom, arg2); + } + } + } + } + return true; +} + FUNC(LS_Line_SetBlocking) // Line_SetBlocking (id, setflags, clearflags) { @@ -2978,7 +3029,7 @@ lnSpecFunc LineSpecials[256] = LS_Line_SetTextureOffset, LS_Sector_ChangeFlags, LS_Line_SetBlocking, - LS_NOP, // 56 + LS_Line_SetTextureScale, LS_NOP, // 57 LS_NOP, // 58 LS_NOP, // 59 diff --git a/src/r_defs.h b/src/r_defs.h index c1387a428..4e4433ca3 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -804,6 +804,11 @@ struct side_t { return textures[which].xscale; } + void MultiplyTextureXScale(int which, fixed_t delta) + { + textures[which].xscale = FixedMul(textures[which].xscale, delta); + } + void SetTextureYScale(int which, fixed_t scale) { @@ -817,6 +822,10 @@ struct side_t { return textures[which].yscale; } + void MultiplyTextureYScale(int which, fixed_t delta) + { + textures[which].yscale = FixedMul(textures[which].yscale, delta); + } DInterpolation *SetInterpolation(int position); void StopInterpolation(int position);