git » fp-git.git » commit 24025db

dropped pop2 16 colors palette (replaced by n colors) type and created pop2Level type

author ecalot
2006-06-15 23:45:49 UTC
committer ecalot
2006-06-15 23:45:49 UTC
parent aad2c0fd31995d23dd35227ed8d0606c8cc9c375

dropped pop2 16 colors palette (replaced by n colors) type and created pop2Level type

PR/src/include/common.h +4 -4
PR/src/lib/actions/export.c +1 -1
PR/src/lib/layers/autodetect.c +15 -11
PR/src/lib/layers/pallist.c +1 -1
PR/src/lib/object/object.c +4 -11
PR/src/lib/object/palette/pop2_256c.c +1 -1

diff --git a/PR/src/include/common.h b/PR/src/include/common.h
index 8262af7..30c37a5 100644
--- a/PR/src/include/common.h
+++ b/PR/src/include/common.h
@@ -80,8 +80,8 @@ common.h: Princed Resources : Defines and prototypes common to all PR code
 #define DEFAULT_BACKUP_EXTENSION "bak"
 
 /* File extensions */
-#define RES_FILE_EXTENSIONS   {"raw","bin","bmp","bmp","bmp","plv","mid","pcs","pal","pal","pal","pal","pal","txt","wav"}
-#define RES_FILE_TYPES        {"autodetect","binary","image","image-mono","image-full","level","mini","pcspeaker","palette-pop1-4bits","palette-pop1-guards","palette-mono","palette-pop2-320cols","palette-pop2-4bits","text","wave"}
+#define RES_FILE_EXTENSIONS   {"raw","bin","bmp","bmp","bmp","plv","mid","pcs","pal","pal","pal","pal","plv","txt","wav"}
+#define RES_FILE_TYPES        {"autodetect","binary","image","image-mono","image-full","pop1level","mini","pcspeaker","palette-pop1-4bits","palette-pop1-guards","palette-mono","palette-pop2-320cols","pop2level","text","wave"}
 #define RES_FILE_TYPES_COUNT  15
 
 typedef enum {
@@ -91,14 +91,14 @@ typedef enum {
 	eResTypeImage16=2,
 	eResTypeImage2=3,
 	eResTypeImage256=4,
-	eResTypeLevel=5,
+	eResTypePop1Level=5,
 	eResTypeMidi=6,
 	eResTypePcspeaker=7,
 	eResTypePop1Palette4bits=8,
 	eResTypePop1PaletteGuards=9,
 	eResTypePop1PaletteMono=10,
 	eResTypePop2PaletteNColors=11,
-	eResTypePop2Palette4bits=12,
+	eResTypePop2Level=12,
 	eResTypeText=13,
 	eResTypeWave=14
 } tResourceType;
diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c
index 34d6af4..623c243 100644
--- a/PR/src/lib/actions/export.c
+++ b/PR/src/lib/actions/export.c
@@ -110,7 +110,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti
 
 				/* handle palette linking */
 				switch (res.type) {
-					case eResTypePop2Palette4bits: 
+					/*case eResTypePop2Palette4bits: */
 					case eResTypePop2PaletteNColors: 
 					case eResTypePop1Palette4bits: { /* save and remember palette file */
 						/*tPaletteListItem e; * deprecated */
diff --git a/PR/src/lib/layers/autodetect.c b/PR/src/lib/layers/autodetect.c
index 288fe08..b5b92f1 100644
--- a/PR/src/lib/layers/autodetect.c
+++ b/PR/src/lib/layers/autodetect.c
@@ -42,8 +42,12 @@ autodetect.c: Princed Resources : Automatic detection resource types
 |                       Item Type Detector                      |
 \***************************************************************/
 
-int verifyLevelHeader(tBinary c) {
-	return (c.size==12025) || (((c.size==2306)||(c.size==2305))&&!(c.data[1697]&0x0F)&&!(c.data[1699]&0x0F)&&!(c.data[1701]&0x0F));
+int verifyPop1LevelHeader(tBinary c) {
+	return (((c.size==2306)||(c.size==2305))&&!(c.data[1697]&0x0F)&&!(c.data[1699]&0x0F)&&!(c.data[1701]&0x0F));
+}
+
+int verifyPop2LevelHeader(tBinary c) {
+	return (c.size==12025);
 }
 
 int verifyImage16Header(tBinary c) {
@@ -121,15 +125,15 @@ int verifyMidiHeader(tBinary c) {
 }
 
 tResourceType verifyHeader(tBinary c) { /* TODO: add the pop version as another parameter to detect types */
-	if (verifyLevelHeader    (c)) return eResTypeLevel;
-	if (verifyMidiHeader     (c)) return eResTypeMidi;
-	if (verifyImage16Header  (c)) return eResTypeImage16;
-	if (verifyImage256Header (c)) return eResTypeImage256;
-	if (verifyPaletteHeaderPop1  (c)) return eResTypePop1Palette4bits;
-	/*if (verifyPaletteHeaderPop2  (c)) return eResTypePop2Palette4bits;*/
-	if (verifyPaletteHeaderPop2  (c)) return eResTypePop2PaletteNColors;
-	if (verifyWaveHeader     (c)) return eResTypeWave;
-	if (verifySpeakerHeader  (c)) return eResTypePcspeaker;
+	if (verifyPop1LevelHeader (c)) return eResTypePop1Level;
+	if (verifyPop2LevelHeader (c)) return eResTypePop2Level;
+	if (verifyMidiHeader      (c)) return eResTypeMidi;
+	if (verifyImage16Header   (c)) return eResTypeImage16;
+	if (verifyImage256Header  (c)) return eResTypeImage256;
+	if (verifyPaletteHeaderPop1 (c)) return eResTypePop1Palette4bits;
+	if (verifyPaletteHeaderPop2 (c)) return eResTypePop2PaletteNColors;
+	if (verifyWaveHeader      (c)) return eResTypeWave;
+	if (verifySpeakerHeader   (c)) return eResTypePcspeaker;
 	return eResTypeBinary;
 }
 
diff --git a/PR/src/lib/layers/pallist.c b/PR/src/lib/layers/pallist.c
index f33d1e2..9c1d0f6 100644
--- a/PR/src/lib/layers/pallist.c
+++ b/PR/src/lib/layers/pallist.c
@@ -149,7 +149,7 @@ printf("first=%p with ",(void*)pl->list_first);
 showobj(pl->list_first->object);
 	
 	while (node && colors>paletteGetColors(node->object))
-	{		node=node->next; printf("next %p\n",node); }
+	{		node=node->next; printf("next %p\n",(void*)node); }
 	
 	return node?node->object:getObject(NULL,&junk);
 }
diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c
index afec329..2fb7fc2 100644
--- a/PR/src/lib/object/object.c
+++ b/PR/src/lib/object/object.c
@@ -52,7 +52,7 @@ tObject getObject(tResource* r, int* error) {
 
 	o.type=r->type;
 	switch (o.type) {
-	case eResTypeLevel:
+	case eResTypePop1Level:
 		o.obj=objLevelCreate(r->content,r->number,r->datfile,r->name,r->desc,r->datAuthor,error); 
 		break;
 	case eResTypeBinary: /* Binary files */
@@ -63,9 +63,6 @@ tObject getObject(tResource* r, int* error) {
 	case eResTypePop1Palette4bits: /* save and remember palette file */
 		o.obj=objPalette_pop1_4bitsCreate(r->content,error);
 		break;
-	case eResTypePop2Palette4bits: /* save and remember palette file */
-		o.obj=objPalette_pop2_4bitsCreate(r->content,error);
-		break;
 	case eResTypePop2PaletteNColors: /* save and remember palette file */
 		o.obj=objPop2PaletteNColorsCreate(r->content,error);
 		break;
@@ -100,7 +97,7 @@ printf("Exception: Unhooked type %d\n",o.type);
 int writeObject(tObject o, const char* file, int optionflag, const char* backupExtension) {
 	int error;
 	switch (o.type) {
-	case eResTypeLevel:
+	case eResTypePop1Level:
 		error=objLevelWrite(o.obj,file,optionflag,backupExtension);
 		break;
 	case eResTypeBinary: /* Binary files */
@@ -147,7 +144,6 @@ int paletteGetBits(tObject pal) {
 	case eResTypePop2PaletteNColors:
 		return 8;
 	case eResTypePop1Palette4bits: 
-	case eResTypePop2Palette4bits: 
 		return 4;
 	case eResTypePop1PaletteMono: 
 		return 1;
@@ -161,7 +157,6 @@ int paletteGetColors(tObject object) { /* TODO: rename to objectGetColors */
 	case eResTypePop2PaletteNColors:
 		return PAL_COLORS_eResTypePop2PaletteNColors; /*256;*/
 	case eResTypePop1Palette4bits: 
-	case eResTypePop2Palette4bits: 
 		return PAL_COLORS_eResTypePop1Palette4bits; /*16;*/
 	case eResTypePop1PaletteMono: 
 		return  PAL_COLORS_eResTypePop1PaletteMono; /*2;*/
@@ -194,8 +189,6 @@ tColor* paletteGetColorArray(tObject pal) {
 	switch (pal.type) {
 	case eResTypePop1Palette4bits: /* save and remember palette file */
 		return objPalette_pop1_4bitsGetColors(pal.obj);
-	case eResTypePop2Palette4bits: /* save and remember palette file */
-		return objPalette_pop2_4bitsGetColors(pal.obj);
 	case eResTypePop2PaletteNColors:
 		return objPalette_pop2_ncolorsGetColors(pal.obj);
 	default:
@@ -209,7 +202,7 @@ tColor* paletteGetColorArray(tObject pal) {
 
 void setObject(tObject o,int *result,tResource* res) {
 	switch (o.type) {
-		case eResTypeLevel:
+		case eResTypePop1Level:
 			/*result=objLevelSet(o.obj,res); TODO */
 			break;
 		case eResTypeImage16:
@@ -240,7 +233,7 @@ tObject readObject(const char* file,tResource* res,int *result) {
 	/* return true if ok, false if error */
 	tObject o;
 	switch (res->type) {
-		case eResTypeLevel:
+		case eResTypePop1Level:
 			/*o.obj=objLevelRead(file,res.content,result); TODO */
 			break;
 		case eResTypeImage16:
diff --git a/PR/src/lib/object/palette/pop2_256c.c b/PR/src/lib/object/palette/pop2_256c.c
index 639a69f..7058d38 100644
--- a/PR/src/lib/object/palette/pop2_256c.c
+++ b/PR/src/lib/object/palette/pop2_256c.c
@@ -71,7 +71,7 @@ void* objPop2PaletteNColorsCreate(tBinary cont, int *error) {
 	}
 	/*if (j!=256 && j!=320) return NULL; *TODO: add free */
 	r->size=j;
-printf("created a palette with %d colors. cs=%d\n",j,cont.size);
+printf("created a palette with %d colors. cs=%ld\n",j,cont.size);
 	
 	return (void*)r;
 }