author | ecalot
<ecalot> 2006-06-19 15:56:17 UTC |
committer | ecalot
<ecalot> 2006-06-19 15:56:17 UTC |
parent | cb25c634c1bc048118ce2dc304e17b94947a194a |
PR/src/lib/actions/export.c | +10 | -24 |
PR/src/lib/layers/pallist.c | +2 | -2 |
PR/src/lib/object/palette/pop1_16c.c | +8 | -8 |
PR/src/ports/winfiles/pr.dev | +1 | -1 |
diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index 953167b..6b6340a 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -110,18 +110,12 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti /* handle palette linking */ switch (res.type) { - /*case eResTypePop2Palette4bits: */ case eResTypePalettePop2_NColors: case eResTypePalettePop1_16: { /* save and remember palette file */ - /*tPaletteListItem e; * deprecated */ o=objectCreate(&res,&ok); printf("new palette object: o=%p type=%d\n",o.obj,o.type); if (!ok) { /* if SUCCESS remember the palette, otherwise keep using the default one */ - pl_add(&palettes,o,res.id,lowPriority); - /*e.pal=currentPalette=o; - e.id=res.id; - list_insert(&paletteBuffer,(void*)&e);*/ } } break; case eResTypeImage16: /* save image */ @@ -130,26 +124,18 @@ printf("new palette object: o=%p type=%d\n",o.obj,o.type); tResource otherPalette; int priorityRight; tObject pal; - otherPalette.id=res.paletteId; /* TODO: use the try system */ + otherPalette.id=res.paletteId; /* Read the palette and load it into memory */ - if (resourceListCompareId(res.paletteId,nullPalette) /* add &&!paletteCheckCompatibility(currentPalette,image) */) { /* The palette isn't in the buffer */ - if (mReadFileInDatFileId(&otherPalette)==PR_RESULT_SUCCESS) { - o=objectCreate(&otherPalette,&ok); + if (resourceListCompareId(res.paletteId,nullPalette)) { /* The palette isn't in the buffer */ + if (mReadFileInDatFileId(&otherPalette)==PR_RESULT_SUCCESS) { + o=objectCreate(&otherPalette,&ok); printf("adding "); showobj(o); - pl_add(&palettes,o,res.paletteId,highPriority); - - /*tPaletteListItem e; - resourceListAddInfo(r,&otherPalette);*/ - /* All right, it's not so bad, I can handle it! I'll buffer the new palette */ - /*e.pal=currentPalette=objectCreate(&otherPalette,&ok); - e.id=res.id;*/ - /*list_insert(&paletteBuffer,(void*)&e);*/ - } else { /*, that's bad, I'll have to use the previous palette, even if it is the default */ - printf("Warning: the selected palette doesn't exist in the file, the extracted image could result in a wrong palette\n"); - } + pl_add(&palettes,o,res.paletteId,highPriority); + } else { /*, that's bad, I'll have to use the previous palette, even if it is the default */ + printf("Warning: the selected palette doesn't exist in the file, the extracted image could result in a wrong palette\n"); + } } - /*res.palette=currentPalette;*/ o=objectCreate(&res,&ok); printf("getting the palette for the %d colours object ",objectGetColors(o)); showobj(o); @@ -166,7 +152,7 @@ showobj(pal); o=objectCreate(&res,&ok); break; } - /* TODO: warning counting here */ +/* TODO: warning counting here */ /* if (!fatal(ok)) */ if (ok==PR_RESULT_SUCCESS) ok=objectWrite(o,file,optionflag,backupExtension); @@ -194,7 +180,7 @@ showobj(pal); /* Free allocated resources, dynamic strings and the index */ resourceListDrop(r); mReadCloseDatFile(); - /*list_drop(&paletteBuffer);*/ + /*pl_free(&paletteBuffer);*/ /* Close unknownXML */ return ok?count:PR_RESULT_ERR_EXTRACTION; diff --git a/PR/src/lib/layers/pallist.c b/PR/src/lib/layers/pallist.c index 20d726f..eb9979f 100644 --- a/PR/src/lib/layers/pallist.c +++ b/PR/src/lib/layers/pallist.c @@ -36,7 +36,7 @@ pallist.c: Princed Resources : Palette list layer implementation #include "reslist.h" /* resourceListCompareId */ /* palette list layer (that uses the abstract list layer primitives) */ - +#if 0 int pallist_compare(const void* a,const void* b) { return resourceListCompareId(((tPaletteListItem*)a)->id,((tPaletteListItem*)b)->id); } @@ -44,7 +44,7 @@ int pallist_compare(const void* a,const void* b) { tPaletteList paletteListCreate() { return list_create(sizeof(tPaletteListItem),pallist_compare,NULL); } - +#endif /* Priority list */ #include <stdlib.h> #include "object.h" diff --git a/PR/src/lib/object/palette/pop1_16c.c b/PR/src/lib/object/palette/pop1_16c.c index 9ed2e5f..1449395 100644 --- a/PR/src/lib/object/palette/pop1_16c.c +++ b/PR/src/lib/object/palette/pop1_16c.c @@ -19,7 +19,7 @@ */ /* -pop1_4bit.c: Princed Resources : The palette object implementation +pop1_16c.c: Princed Resources : The palette object implementation \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2006 Princed Development Team Created: 09 Feb 2006 @@ -166,18 +166,18 @@ void addPop1Raw(tPalette* p,unsigned char* data, int dataSize) { typedef struct { tColor c[16]; unsigned char raw[100]; -}tPop1_4bitsPalette; +}tPalettePop1_16c; void* objectPalettePop1_16Create(tBinary cont, int *error) { int i; - tPop1_4bitsPalette* pal; + tPalettePop1_16c* pal; if (cont.size!=100) { *error=PR_RESULT_XML_AND_DAT_FORMAT_DO_NOT_MATCH; return NULL; } - pal=(tPop1_4bitsPalette*)malloc(sizeof(tPop1_4bitsPalette)); + pal=(tPalettePop1_16c*)malloc(sizeof(tPalettePop1_16c)); for (i=0;i<16;i++) { pal->c[i].r=cont.data[(i*3)+4]<<2; @@ -193,7 +193,7 @@ void* objectPalettePop1_16Create(tBinary cont, int *error) { } int objectPalettePop1_16Write(void* o, const char* file, int optionflag, const char* backupExtension) { - tPop1_4bitsPalette* pal=o; + tPalettePop1_16c* pal=o; char aux[260]; /* Export extra palette information */ @@ -204,7 +204,7 @@ int objectPalettePop1_16Write(void* o, const char* file, int optionflag, const c } tColor* objectPalettePop1_16GetColors(void* o) { - tPop1_4bitsPalette* pal=o; + tPalettePop1_16c* pal=o; return pal->c; } @@ -242,7 +242,7 @@ tColor* objectGetColorsArrayForColors(int colors) { } void* objectPalettePop1_16Read(const char* file,int *result) { - tPop1_4bitsPalette* pal=(tPop1_4bitsPalette*)malloc(sizeof(tPop1_4bitsPalette)); + tPalettePop1_16c* pal=(tPalettePop1_16c*)malloc(sizeof(tPalettePop1_16c)); tColor* colorArray; int colors; char aux[260]; @@ -269,7 +269,7 @@ void* objectPalettePop1_16Read(const char* file,int *result) { } int objectPalettePop1_16Set(void* o,tResource* res) { - tPop1_4bitsPalette* pal=o; + tPalettePop1_16c* pal=o; int i; res->content.size=100; diff --git a/PR/src/ports/winfiles/pr.dev b/PR/src/ports/winfiles/pr.dev index 606411a..b27894a 100644 --- a/PR/src/ports/winfiles/pr.dev +++ b/PR/src/ports/winfiles/pr.dev @@ -933,7 +933,7 @@ BuildCmd= Major=1 Minor=3 Release=0 -Build=33 +Build=40 LanguageID=2057 CharsetID=1252 CompanyName=Princed development team