| |
PM2 Character Component Sheets
Lightning |
|

Ignorance isn't stupidity but choosing to remain ignorant is
![Super Happy Heart Badge [*]](https://archive.mfgg.net/html/badges/shappyheart.gif) ![MFGG Awards 2008 Winner [*]](https://archive.mfgg.net/html/badges/award08.gif)

Group: IRC Operators
Posts: 6381
Member No.: 583
Joined: 31-August 04
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
=P Yeah, any Goomba seems to have Kuribo in the name EDIT: By the way, what tool ? =P
This post has been edited by Lightning on Apr 25 2005, 06:08 PM
--------------------
click here to change my avatar. / gosh why are you even here lightninghacker, n.an individual who enjoys learning computer system details and how to capitalize on his or her capabilities...not a criminal. (from webster's new world hacker dictionary) |  Fedora 10 Final! Download today! | quality web comics (stories):- girl genius: adventure! romance! mad science!
- punch an' pie: try a slice of life, then swallow.
- dresden codak: most interesting comic ever
quality web comics (one-shots):- a softer world: truth and beauty bombs
- smbc: saturday morning breakfast cereal
- buttersafe: pictures and probably some words
|
"Religion is comparable to a childhood neurosis." - Sigmund Freud “It is not by delusion, however exalted, that mankind can prosper, but only by unswerving courage in the pursuit of truth.” - Bertrand Russell “To kill an error is as good a service as, and sometimes better than, the establishing of a new truth or fact.” - Charles Darwin
|
|
|
Lightning |
|

Ignorance isn't stupidity but choosing to remain ignorant is
![Super Happy Heart Badge [*]](https://archive.mfgg.net/html/badges/shappyheart.gif) ![MFGG Awards 2008 Winner [*]](https://archive.mfgg.net/html/badges/award08.gif)

Group: IRC Operators
Posts: 6381
Member No.: 583
Joined: 31-August 04
Status: (0d)
![[--]](style_images/mfgg2_skin/warn_nosuspend.gif)

|
| QUOTE (Retriever II @ Apr 25 2005, 06:14 PM) | | How far have you gotten on it? |
| CODE | int unpackColour(int type, int colour);
struct tplFileHeader // Very beginning of the file { long identifyingBytes; // 0x30AF2000 long textureCount; // Number of textures in the file long headerSize; // 0x0000000C }; struct tplOffsetHeader // Repeats tplFileHeader.textureCount times after it { long textureHeaderOffset; // Points to the tplTextureHeader long paletteHeaderOffset; // Points to the tplPaletteHeader if there is one }; struct tplTextureHeader // Pointed to by tplOffsetHeader.textureHeaderOffset { short height; // Height of the texture short width; // Width of the texture long type; // Format of the texture data stored /*// 0 I4 (4 bit intensity, 8x8 tiles) 1 I8 (8 bit intensity, 8x4 tiles) 2 IA4 (4 bit intensity with 4 bit alpha, 8x4 tiles) 3 IA8 (8 bit intensity with 8 bit alpha, 4x4 tiles) 4 RGB565 (4x4 tiles) 5 RGB5A3 (4x4 tiles - RGB5 if color value is negative and RGB4A3 otherwise.) 6 RGBA8 (4x4 tiles in two cache lines - first is AR and second is GB) 8 CI4 (4 bit color index, 8x8 tiles) 9 CI8 (8 bit color index, 8x4 tiles) 10 CI14X2 (14 bit color index, 4x4 tiles) 14 CMP (S3TC compressed, 2x2 blocks of 4x4 tiles) //*/ long textureOffset; // Points to image data long wrapS; long wrapT; long minFilter; long magFilter; float lodBias; char edgeLod; char minLod; char maxLod; char unpacked; }; struct tplPaletteHeader // Pointed to by tplOffsetHeader.paletteHeaderOffset { short paletteCount; // Number of palettes char unpacked; char pad; long type; // Format of the palette /*// 0 IA8 1 RGB565 2 RGB5A3 (RGB5 if color value is negative and RGB4A3 otherwise.) //*/ long palleteOffset; // Points to the palette data };
int unpackColour(int type, int colour) { if(type == 0) // I4 return colour | (colour << 0x04) | ((colour << 0x04) << 0x08) | (((colour << 0x04) << 0x08) << 0x10); else if(type == 1) // I8 return colour | (colour << 0x08) | ((colour << 0x08) << 0x10); else if(type == 2) // IA4 return ((colour & 0x0F) | ((colour & 0x0F) << 0x04) | (((colour & 0x0F) << 0x04) << 0x08)) | (((colour & 0x0F) | ((colour & 0x0F) << 0x04) | (((colour & 0x0F) << 0x04) << 0x08)) << 0x08) | ((colour & 0xF0) << 0x18) | ((colour & 0xF0) << 0x14); else if(type == 3) // IA8 return ((colour & 0x00FF) | ((colour & 0x00FF) << 0x08) | ((colour & 0x00FF) << 0x10) | ((colour & 0xFF00) << 0x10)); else if(type == 4) // RGB565 return (((colour & 0xF800) >> 0x08) | ((colour & 0xE000) >> 0x0D) | ((colour & 0x07E0) << 0x05) | ((colour & 0x0600) >> 0x01) | ((colour & 0x001F) << 0x13) | ((colour & 0x001C) << 0x0E)) | 0xFF000000; else if(type == 5) // RGB5A3 if(colour & 0x8000) // RGB5 return (((colour & 0x7C00) >> 0x07) | ((colour & 0x7000) >> 0x0C) | ((colour & 0x03E0) << 0x06) | ((colour & 0x0380) << 0x01) | ((colour & 0x001F) << 0x13) | ((colour & 0x001C) << 0x0E)) | 0xFF000000; else // RGB4A3 return ((colour & 0x0F00) >> 0x04) | ((colour & 0x0F00) >> 0x08) | ((colour & 0x00F0) << 0x08) | ((colour & 0x00F0) << 0x04) | ((colour & 0x000F) << 0x14) | ((colour & 0x000F) << 0x10) | ((colour & 0x7000) << 0x11) | ((colour & 0x7000) << 0x0D); return 0; }
|
That far. *huggles YAGCD* Then stupid school ate my time and I haven't worked on it in weeks ;.;
--------------------
click here to change my avatar. / gosh why are you even here lightninghacker, n.an individual who enjoys learning computer system details and how to capitalize on his or her capabilities...not a criminal. (from webster's new world hacker dictionary) |  Fedora 10 Final! Download today! | quality web comics (stories):- girl genius: adventure! romance! mad science!
- punch an' pie: try a slice of life, then swallow.
- dresden codak: most interesting comic ever
quality web comics (one-shots):- a softer world: truth and beauty bombs
- smbc: saturday morning breakfast cereal
- buttersafe: pictures and probably some words
|
"Religion is comparable to a childhood neurosis." - Sigmund Freud “It is not by delusion, however exalted, that mankind can prosper, but only by unswerving courage in the pursuit of truth.” - Bertrand Russell “To kill an error is as good a service as, and sometimes better than, the establishing of a new truth or fact.” - Charles Darwin
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
[ Script Execution time: 0.0957 ] [ 13 queries used ] [ GZIP Enabled ] [ Server Load: 1.24 ]
| |