author | ecalot
<ecalot> 2006-06-11 03:56:12 UTC |
committer | ecalot
<ecalot> 2006-06-11 03:56:12 UTC |
parent | 3af0bd7793df3536aa64650a2cc4a99331e15841 |
PR/doc/changelog.txt | +3 | -0 |
PR/src/include/palette.h | +6 | -0 |
PR/src/lib/layers/pallist.c | +46 | -0 |
PR/src/lib/object/object.c | +5 | -3 |
diff --git a/PR/doc/changelog.txt b/PR/doc/changelog.txt index c59e92f..f293871 100644 --- a/PR/doc/changelog.txt +++ b/PR/doc/changelog.txt @@ -189,6 +189,8 @@ Versions: x Common factor in LGZ compression (a .h or compress.h) for win size, etc. x Common palette calculation x Create a new isDirSep in disk.h and handle all the / and \ as the same char + x Rename all xbit names with xcolor + x Create a priority list for the palettes x Don't create empty unknown.xml x Fix ./pr -ie it -f bug x Fix repeated resource name in CPALACE.DAT bug @@ -196,6 +198,7 @@ Versions: - Moved tResource* from reslist to types.h - Renamed "uncompress" to "decomporess" x Transform flags from the hex form to the [a-y]* form (a is 1, b is 2, c is 4...) + x Prepeare the skeletton abstraction layer for bitmap to support .png files * PR v1.4 (future plans) x Added full POP2 RLEV compression algorithm x Code a palette adapting feature diff --git a/PR/src/include/palette.h b/PR/src/include/palette.h index 5a2ab08..4152dec 100644 --- a/PR/src/include/palette.h +++ b/PR/src/include/palette.h @@ -85,4 +85,10 @@ tColor* objPalette_pop2_ncolorsGetColors(void* o); #define convert24to18(x) (unsigned char)((x+2)>>2); +/* Hooks */ + +#define PAL_COLORS_eResTypePop2PaletteNColors 256 +#define PAL_COLORS_eResTypePop1Palette4bits 16 +#define PAL_COLORS_eResTypePop1PaletteMono 2 + #endif diff --git a/PR/src/lib/layers/pallist.c b/PR/src/lib/layers/pallist.c index f62b156..9d460b4 100644 --- a/PR/src/lib/layers/pallist.c +++ b/PR/src/lib/layers/pallist.c @@ -45,3 +45,49 @@ tPaletteList paletteListCreate() { return list_create(sizeof(tPaletteListItem),pallist_compare,NULL); } +/* Priority list */ + +#include "object.h" + +typedef enum {highPriority, lowPriority}tPriority; +typedef struct pln{ + tResourceId resid; + tObject* object; + struct pln* next; +} tPL_Node; + +typedef struct { + struct { + tResourceId idres; + tObject* object; + } priority_field; + tPL_Node* list_first; + tPL_Node* list_deleted_first; +} tPL; + +void pl_free (tPL* pl); +int pl_tryAdd(tPL* pl, tResourceId resid, tPriority p); +int pl_add (tPL* pl, tObject* o, tResourceId resid, tPriority p); +int pl_hasPriority(tPL* pl, tResourceId resid); +void pl_free (tPL* pl); +tPL pl_create(); +tObject* pl_get(int* priorityRight, int colors); + +tPL pl_create() { + tPL r; + + r.priority_field.object=NULL; + r.list_first=NULL; + r.list_deleted_first=NULL; + + return r; +} + +int pl_hasPriority(tPL* pl, tResourceId resid) { + if (!pl->priority_field.object) return 0; /* false */ + return resourceListCompareId(resid,pl->priority_field.idres); +} + + + + diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c index 0bfb699..1f10bcb 100644 --- a/PR/src/lib/object/object.c +++ b/PR/src/lib/object/object.c @@ -159,12 +159,14 @@ int paletteGetBits(tObject pal) { int paletteGetColors(tObject pal) { switch (pal.type) { case eResTypePop2PaletteNColors: - return 256; + return PAL_COLORS_eResTypePop2PaletteNColors; /*256;*/ case eResTypePop1Palette4bits: case eResTypePop2Palette4bits: - return 16; + return PAL_COLORS_eResTypePop1Palette4bits; /*16;*/ case eResTypePop1PaletteMono: - return 2; + return PAL_COLORS_eResTypePop1PaletteMono; /*2;*/ + case eResTypeNone: + return 256; /*256; TODO: use the pal none object */ default: return 0; }