- Fixed: A_VileAttack positioned the fire on the wrong side of the target.

- Reorganized the HackHack code so that the image creation was moved into
  MakeTexture. This was necessary because Unload deleted the pixel data
  and broke the whole thing.
- Fixed: FPatchTexture::HackHack and FDoomStatusbarTexture::DrawToBar used the
  obsolete and uninitialized variable Near255. 
- Removed the span creation code specific to FPatchTexture. It only has an
  advantage when the lump has already been loaded in memory but since that
  is no longer the case now the generic version in FTexture is actually better.
- Changed: FTexture::CopyToBlock no longer uses the spans but the pixel buffer
  directly. Since most patches in multipatch textures are non transparent
  the added overhead from creating the spans far outweighs any savings they
  might provide. It is also simpler to handle for mirrored or rotated patches now.
- Changed: Textures only create the spans when really needed. Flats and native
  textures, for example, do not and it only created needless overhead that they
  were always created along with the pixel buffer.
- Made use of player and actor variables consistent in a_hereticweaps.cpp.
- Fixed: A few calls to P_SpawnPlayerMissile passed 0 as angle



SVN r911 (trunk)
This commit is contained in:
Christoph Oelckers 2008-04-14 12:10:45 +00:00
commit b54b9bad7a
20 changed files with 216 additions and 345 deletions

View file

@ -272,55 +272,39 @@ void FTexture::FreeSpans (Span **spans) const
void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, const BYTE *translation)
{
int x1 = xpos, x2 = x1 + GetWidth(), xo = -x1;
const BYTE *pixels = GetPixels();
int srcwidth = Width;
int srcheight = Height;
int step_x = Height;
int step_y = 1;
if (x1 < 0)
if (ClipCopyPixelRect(dwidth, dheight, xpos, ypos, pixels, srcwidth, srcheight, step_x, step_y))
{
x1 = 0;
}
if (x2 > dwidth)
{
x2 = dwidth;
}
for (; x1 < x2; ++x1)
{
const BYTE *data;
const Span *span;
BYTE *outtop = &dest[dheight * x1];
data = GetColumn (x1 + xo, &span);
while (span->Length != 0)
dest += ypos + dheight * xpos;
if (translation == NULL)
{
int len = span->Length;
int y = ypos + span->TopOffset;
int adv = span->TopOffset;
if (y < 0)
for (int x = 0; x < srcwidth; x++)
{
adv -= y;
len += y;
y = 0;
}
if (y + len > dheight)
{
len = dheight - y;
}
if (len > 0)
{
if (translation == NULL)
int pos = x * dheight;
for (int y = 0; y < srcheight; y++, pos++)
{
memcpy (outtop + y, data + adv, len);
// the optimizer is doing a good enough job here so there's no need to make this harder to read.
BYTE v = pixels[y * step_y + x * step_x];
if (v != 0) dest[pos] = v;
}
else
}
}
else
{
for (int x = 0; x < srcwidth; x++)
{
int pos = x * dheight;
for (int y = 0; y < srcheight; y++, pos++)
{
for (int j = 0; j < len; ++j)
{
outtop[y+j] = translation[data[adv+j]];
}
BYTE v = pixels[y * step_y + x * step_x];
if (v != 0) dest[pos] = translation[v];
}
}
span++;
}
}
}