Skip to content

Commit

Permalink
SpriteCollection - more notes on PCK+TAB files
Browse files Browse the repository at this point in the history
  • Loading branch information
kevL committed Oct 3, 2019
1 parent 92219fb commit 013059f
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions XCom/Resources/Images/SpriteCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ public SpriteCollection(
}
}

// NOTE: I'd just like to point out here that a Tabfile is
// utterly redundant if the Pckfile is wellformed. But if the
// Pckfile is *not* wellformed you might as well be screwing the
// dog anyway.
// NOTE: I'd just like to point out that a Tabfile is redundant
// if the Pckfile is wellformed. But if the Pckfile is *not*
// wellformed you might as well be screwing the dog anyway.
//
// At least under my conception of PCK-RLE-compression.
// Obviously there are others. Which is what makes PCKs so
Expand All @@ -253,9 +252,22 @@ public SpriteCollection(
// b) the first byte in a sprite shall not be FE or FF
// c) the first byte shall always be a quantity of transparent fullrows
// c) the final byte of a sprite shall be FF
// d) FE shall be followed by a byte that is a quantity of transparent pixels (FF is allowed as a quantity)
// d) FE shall be followed by a byte that is a quantity of
// transparent pixels (FF is allowed as a quantity)
// f) do not allow FE or FF to be used as a palette-color
// e) a decoding program shall initialize the entire buffer of a sprite with transparent pixels first.
// e) a decoding program shall initialize the entire buffer of a
// sprite with transparent pixels first. Hence a contiguous
// sequence of transparent pixels that hit the final FF do
// not need to be written.
//
// I've seen a fair few whacky PCK files, including ones with
// "FE 01" <- "make the next pixel transparent". Hint, that's
// the equivalent of simply "00". Another common occurance is to
// write a blank sprite as FF only; while this could be valid
// if it were policy (and ofc not preceeded by FE), decoding
// problems can occur depending on the decoding application.
//
// protip: a Minimal (blank) sprite would/could/should be "00 FF".

if (CountSprites == CountOffsets) // avoid throwing 1 or 15000 exceptions ...
{
Expand Down

0 comments on commit 013059f

Please sign in to comment.