author | ecalot
<ecalot> 2006-02-17 04:54:16 UTC |
committer | ecalot
<ecalot> 2006-02-17 04:54:16 UTC |
parent | 35528c0e8f7fd56dd4042a52c5d3e078d64c25d4 |
PR/src/include/object.h | +0 | -5 |
PR/src/include/pallist.h | +4 | -4 |
PR/src/include/reslist.h | +7 | -1 |
PR/src/include/types.h | +7 | -1 |
PR/src/lib/actions/export.c | +11 | -17 |
PR/src/lib/layers/reslist.c | +3 | -3 |
PR/src/lib/xml/search.c | +2 | -2 |
PR/src/lib/xml/unknown.c | +1 | -1 |
diff --git a/PR/src/include/object.h b/PR/src/include/object.h index 208ffb4..9c0df5a 100644 --- a/PR/src/include/object.h +++ b/PR/src/include/object.h @@ -36,11 +36,6 @@ object.h: Princed Resources : Main item class types and prototypes #include "reslist.h" #include "common.h" -typedef struct { - tResourceType type; - void* obj; -}tObject; - tObject getObject(tResource* r, int* error); #endif diff --git a/PR/src/include/pallist.h b/PR/src/include/pallist.h index 323d53c..f528567 100644 --- a/PR/src/include/pallist.h +++ b/PR/src/include/pallist.h @@ -34,17 +34,17 @@ #ifndef _PALLIST_H_ #define _PALLIST_H_ -#include "list.h" /* tList */ +#include "list.h" /* tList */ typedef tList tPaletteList; -#include "palette.h" /* Item Types */ +#include "common.h" /* tResourceType */ +#include "object.h" /* tObject */ #include "reslist.h" /* tResourceId */ /* types */ typedef struct { tResourceId id; - tPalette pal; - int bits; + tObject pal; }tPaletteListItem; tPaletteList paletteListCreate(); diff --git a/PR/src/include/reslist.h b/PR/src/include/reslist.h index 58d57cf..89256a4 100644 --- a/PR/src/include/reslist.h +++ b/PR/src/include/reslist.h @@ -40,6 +40,11 @@ typedef tList tResourceList; #include "common.h" /* Item Types */ /* types */ +typedef struct { + tResourceType type; + void* obj; +}tObject; + typedef struct { unsigned short int value; char index[5]; @@ -48,7 +53,8 @@ typedef struct { typedef struct { tResourceId id; - tResourceId palette; + tResourceId paletteId; + tObject palette; long int size; unsigned long int offset; /* Used internally in dat.c to remember the offset */ unsigned char number; /* Used for level number */ diff --git a/PR/src/include/types.h b/PR/src/include/types.h index 58d57cf..89256a4 100644 --- a/PR/src/include/types.h +++ b/PR/src/include/types.h @@ -40,6 +40,11 @@ typedef tList tResourceList; #include "common.h" /* Item Types */ /* types */ +typedef struct { + tResourceType type; + void* obj; +}tObject; + typedef struct { unsigned short int value; char index[5]; @@ -48,7 +53,8 @@ typedef struct { typedef struct { tResourceId id; - tResourceId palette; + tResourceId paletteId; + tObject palette; long int size; unsigned long int offset; /* Used internally in dat.c to remember the offset */ unsigned char number; /* Used for level number */ diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index 147420c..6c1af00 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -74,7 +74,8 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti char vFileext[MAX_FILENAME_SIZE]; int indexNumber; int ok; - tImage image; /* this is used to make a persistent palette */ +/* tImage image; * this is used to make a persistent palette */ + tObject currentPalette; unsigned short int numberOfItems; tPaletteList paletteBuffer; tResourceId bufferedPalette={0,"",0}; @@ -88,7 +89,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti /* initialize palette buffer */ paletteBuffer=paletteListCreate(); /* initialize the default palette */ - image.pal=createPalette(); /* TODO: add the default palette ad 0,"",0 */ + /*currentPalette=objCreatePalette(); * TODO: add the default palette ad 0,"",0 */ /* main loop */ for (indexNumber=0;ok&&(indexNumber<numberOfItems);indexNumber++) { @@ -111,38 +112,31 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti /* handle palette linking */ switch (res.type) { case eResTypePop1Palette4bits: { /* save and remember palette file */ - tPaletteListItem e; - /* Remember the palette for the next images - * (because it's more probable to get all the images after its palette) */ - e.bits=readPalette(&e.pal,res.data,res.size); - applyPalette(&e.pal,&image); - bufferedPalette=res.id; + tPaletteListItem e; /* TODO: decide if the palette list has to be erased from the code */ + o=e.pal=currentPalette=getObject(&res,&ok); e.id=res.id; list_insert(&paletteBuffer,(void*)&e); } break; case eResTypeImage: /* save image */ /* Palette handling */ - if (resourceListCompareId(res.palette,bufferedPalette)) { /* The palette isn't in the buffer */ + if (resourceListCompareId(res.paletteId,bufferedPalette)) { /* The palette isn't in the buffer */ tResource otherPalette; - otherPalette.id=res.palette; + otherPalette.id=res.paletteId; /* Read the palette and load it into memory */ if (mReadFileInDatFileId(&otherPalette)==PR_RESULT_SUCCESS) { - /* All right, it's not so bad, I can handle it! I'll buffer the new palette */ tPaletteListItem e; - e.bits=readPalette(&e.pal,otherPalette.data,otherPalette.size); - applyPalette(&e.pal,&image); - bufferedPalette=otherPalette.id; + /* All right, it's not so bad, I can handle it! I'll buffer the new palette */ + e.pal=currentPalette=getObject(&res,&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 */ } /* else, good, the palette is buffered */ - break; + res.palette=currentPalette; default: + o=getObject(&res,&ok); break; } - o=getObject(&res,&ok); - /* Verbose information */ if (hasFlag(verbose_flag)) { if (ok) { diff --git a/PR/src/lib/layers/reslist.c b/PR/src/lib/layers/reslist.c index b6fb332..4e4010d 100644 --- a/PR/src/lib/layers/reslist.c +++ b/PR/src/lib/layers/reslist.c @@ -140,9 +140,9 @@ void resourceListAddInfo(tResourceList* r,tResource* res) { res->path=NULL; res->desc=NULL; res->name=NULL; - res->palette.value=0; - res->palette.order=0; - memset(res->palette.index,0,5); + res->paletteId.value=0; + res->paletteId.order=0; + memset(res->paletteId.index,0,5); res->number=0; res->type=0; } else { diff --git a/PR/src/lib/xml/search.c b/PR/src/lib/xml/search.c index 581bc1c..461bccb 100644 --- a/PR/src/lib/xml/search.c +++ b/PR/src/lib/xml/search.c @@ -121,11 +121,11 @@ printf("tv=%s ti=%s tag=%s\n",t->value,t->index,t->tag);*/ /* Get the order */ res.id.order=getOrder(t->order); - res.palette.order=getOrder(t->paletteorder); + res.paletteId.order=getOrder(t->paletteorder); /* Copy id and palette id */ search_keepIdAttributes(id,value,index); - search_keepIdAttributesElse(palette,palette,paletteindex,index); + search_keepIdAttributesElse(paletteId,palette,paletteindex,index); /* Copy number, title, desc and path */ search_keepIntAttribute(number,unsigned char); /* Transforms the char* levelnumer/number attribute into a char value, if error, demo level is used */ diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c index 66e9c7d..9f6d2f5 100644 --- a/PR/src/lib/xml/unknown.c +++ b/PR/src/lib/xml/unknown.c @@ -197,7 +197,7 @@ void getFileName(char* vFileext,const char* vDirExt,const tResource* r,const cha filename=parseformat(format,r->id.value,r->id.index,getExtDesc(pos),extarray[pos],unknownFile.typeCount[pos],r->id.order,r->desc,r->name); sprintf(vFileext,"%s/"RES_XML_UNKNOWN_PATH"/%s/%s",vDirExt,vDatFileName,filename); - unknownLogAppend(vDatFileName,r->id,extarray[pos],r->type,vDirExt,r->palette,vFiledat,optionflag,unknownFile.typeCount[pos],r->flags,filename); + unknownLogAppend(vDatFileName,r->id,extarray[pos],r->type,vDirExt,r->paletteId,vFiledat,optionflag,unknownFile.typeCount[pos],r->flags,filename); } else { /* set filename */ sprintf(vFileext,"%s/%s",vDirExt,r->path);