本文整理汇总了C++中FWadLump::Seek方法的典型用法代码示例。如果您正苦于以下问题:C++ FWadLump::Seek方法的具体用法?C++ FWadLump::Seek怎么用?C++ FWadLump::Seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWadLump
的用法示例。
在下文中一共展示了FWadLump::Seek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeTexture
void FTGATexture::MakeTexture ()
{
BYTE PaletteMap[256];
FWadLump lump = Wads.OpenLumpNum (SourceLump);
TGAHeader hdr;
WORD w;
BYTE r,g,b,a;
BYTE * buffer;
Pixels = new BYTE[Width*Height];
lump.Read(&hdr, sizeof(hdr));
lump.Seek(hdr.id_len, SEEK_CUR);
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
hdr.cm_first = LittleShort(hdr.cm_first);
hdr.cm_length = LittleShort(hdr.cm_length);
if (hdr.has_cm)
{
memset(PaletteMap, 0, 256);
for (int i = hdr.cm_first; i < hdr.cm_first + hdr.cm_length && i < 256; i++)
{
switch (hdr.cm_size)
{
case 15:
case 16:
lump >> w;
r = (w & 0x001F) << 3;
g = (w & 0x03E0) >> 2;
b = (w & 0x7C00) >> 7;
a = 255;
break;
case 24:
lump >> b >> g >> r;
a=255;
break;
case 32:
lump >> b >> g >> r >> a;
if ((hdr.img_desc&15)!=8) a=255;
break;
default: // should never happen
r=g=b=a=0;
break;
}
PaletteMap[i] = a>=128? ColorMatcher.Pick(r, g, b) : 0;
}
}
示例2: if
void FFontChar2::MakeTexture ()
{
FWadLump lump = Wads.OpenLumpNum (SourceLump);
int destSize = Width * Height;
BYTE max = 255;
// This is to "fix" bad fonts
{
BYTE buff[8];
lump.Read (buff, 4);
if (buff[3] == '2')
{
lump.Read (buff, 7);
max = buff[6];
lump.Seek (SourcePos - 11, SEEK_CUR);
}
else
{
lump.Seek (SourcePos - 4, SEEK_CUR);
}
}
Pixels = new BYTE[destSize];
int runlen = 0, setlen = 0;
BYTE setval = 0; // Shut up, GCC!
BYTE *dest_p = Pixels;
int dest_adv = Height;
int dest_rew = destSize - 1;
for (int y = Height; y != 0; --y)
{
for (int x = Width; x != 0; )
{
if (runlen != 0)
{
BYTE color;
lump >> color;
*dest_p = MIN (color, max);
if (SourceRemap != NULL)
{
*dest_p = SourceRemap[*dest_p];
}
dest_p += dest_adv;
x--;
runlen--;
}
else if (setlen != 0)
{
*dest_p = setval;
dest_p += dest_adv;
x--;
setlen--;
}
else
{
SBYTE code;
lump >> code;
if (code >= 0)
{
runlen = code + 1;
}
else if (code != -128)
{
BYTE color;
lump >> color;
setlen = (-code) + 1;
setval = MIN (color, max);
if (SourceRemap != NULL)
{
setval = SourceRemap[setval];
}
}
}