git » fp-git.git » commit 006578c

improved xml information. Added paletteorder

author ecalot
2005-12-17 05:09:54 UTC
committer ecalot
2005-12-17 05:09:54 UTC
parent 7639b216df5b148bada81598ac50317aeb6674fd

improved xml information. Added paletteorder

PR/src/include/pr.h +1 -0
PR/src/lib/xml/parse.c +5 -1
PR/src/lib/xml/search.c +18 -15
PR/src/xml/resources.xml +5 -5

diff --git a/PR/src/include/pr.h b/PR/src/include/pr.h
index c13bc65..633cb1e 100644
--- a/PR/src/include/pr.h
+++ b/PR/src/include/pr.h
@@ -54,6 +54,7 @@ typedef struct tTag {
 	char* name;
 	char* palette;
 	char* paletteindex;
+	char* paletteorder;
 	char* value;
 	char* index;
 	char* order;
diff --git a/PR/src/lib/xml/parse.c b/PR/src/lib/xml/parse.c
index 1b0df0b..217d612 100644
--- a/PR/src/lib/xml/parse.c
+++ b/PR/src/lib/xml/parse.c
@@ -100,6 +100,7 @@ tTag* getTagStructure() {
 	t->index=NULL;
 	t->order=NULL;
 	t->paletteindex=NULL;
+	t->paletteorder=NULL;
 	t->version=NULL;
 	t->number=NULL;
 	t->flags=NULL;
@@ -122,6 +123,7 @@ void freeTagStructure(tTag* t) {
 	freeAllocation(t->index);
 	freeAllocation(t->order);
 	freeAllocation(t->paletteindex);
+	freeAllocation(t->paletteorder);
 	freeAllocation(t->version);
 	freeAllocation(t->number);
 	freeAllocation(t->flags);
@@ -144,7 +146,7 @@ int attribFill(char* attr,char* val, tTag* t) {
 	FillAttr(t->path,"path");
 	FillAttr(t->file,"file");
 	FillAttr(t->type,"type");
-	FillAttr(t->type,"itemtype"); /* alias fro type */
+	FillAttr(t->type,"itemtype"); /* deprecated alias for type */
 	FillAttr(t->name,"name");
 	FillAttr(t->name,"title"); /* title is a name alias */
 	FillAttr(t->palette,"palette");
@@ -152,6 +154,7 @@ int attribFill(char* attr,char* val, tTag* t) {
 	FillAttr(t->index,"index");
 	FillAttr(t->order,"order");
 	FillAttr(t->paletteindex,"paletteindex");
+	FillAttr(t->paletteorder,"paletteorder");
 	FillAttr(t->version,"version");
 	FillAttr(t->number,"levelnumber"); /* levelnumber is a number alias */
 	FillAttr(t->number,"number");
@@ -373,6 +376,7 @@ tTag* makeTree(char** p,char* name, int* error,tTag* father) {
 
 		TotalInheritance(palette);
 		TotalInheritance(paletteindex);
+		TotalInheritance(paletteorder);
 		TotalInheritance(type);
 		TotalInheritance(file);
 		TotalInheritance(index);
diff --git a/PR/src/lib/xml/search.c b/PR/src/lib/xml/search.c
index ddaeddf..efaa773 100644
--- a/PR/src/lib/xml/search.c
+++ b/PR/src/lib/xml/search.c
@@ -44,6 +44,22 @@ search.c: Princed Resources : specific xml handling functions
 #include <string.h>
 #include "translate.h" /* to translate indexes */
 
+int getOrder(const char* order) {
+	if (order) {
+		if (equalsIgnoreCase(order,"first")) {
+			return 0;
+		} else if (equalsIgnoreCase(order,"second")) {
+			return 1;
+		} else if (equalsIgnoreCase(order,"last")) {
+			return 65535;
+		} else {
+			return atoi(order);
+		}
+	} else {
+		return 0;
+	}
+}
+
 /****************************************************************\
 |                   Tag Tree Searching Functions                 |
 \****************************************************************/
@@ -91,21 +107,8 @@ void workTag(const tTag* t,void* pass) {
 #endif
 
 	/* Get the order */
-	if (t->order) {
-		if (equalsIgnoreCase(t->order,"first")) {
-			res.id.order=0;
-		} else if (equalsIgnoreCase(t->order,"second")) {
-			res.id.order=1;
-		} else if (equalsIgnoreCase(t->order,"last")) {
-			res.id.order=65535;
-		} else {
-			res.id.order=atoi(t->order);
-		}
-	} else {
-		res.id.order=0;
-	}
-
-	res.palette.order=0; /* TODO: all palettes have an order of 0 */
+	res.id.order=getOrder(t->order);
+	res.palette.order=getOrder(t->paletteorder);
 	
 	/* Copy id and palette id */	
 	keepIdAttributes(id,value,index);
diff --git a/PR/src/xml/resources.xml b/PR/src/xml/resources.xml
index 3f407cc..51ee535 100644
--- a/PR/src/xml/resources.xml
+++ b/PR/src/xml/resources.xml
@@ -1409,7 +1409,7 @@ resources.xml: Princed Resources : Resource tree
  <!--
       pop2: bird.dat
   -->
- <folder index="shap" name="the pop2 bird guard" file="bird.dat" type="image" path="bird" palette="750" paletteindex="palc" flags="0x400000">
+ <folder index="shape" name="the pop2 bird guard" file="bird.dat" type="image" path="bird" palette="750" paletteindex="palc" flags="0x400000">
   <item value="750" index="pals" path="bird.pal" type="palette">The bird palette</item>
   <folder path="fighting">
    <item value="751" path="frame01.bmp" type="image">Frame 01 (751)</item>
@@ -1985,9 +1985,9 @@ resources.xml: Princed Resources : Resource tree
  <!--
       pop2: head.dat
   -->
- <folder index="shap" name="head" path="head" file="head.dat" palette="750" paletteindex="palc" flags="0x400000">
+ <folder index="shape" name="head" path="head" file="head.dat" palette="750" paletteindex="palc" flags="0x400000">
   <item value="755" index="" path="binary001.bin" type="binary" flags="0x0">Unknown binary 1</item>
-  <item value="750" index="fram" path="binary002.bin" type="binary" flags="0x0">Unknown binary 2</item>
+  <item value="750" index="frame" path="binary002.bin" type="binary" flags="0x0">Unknown binary 2</item>
   <item value="750" index="palc" path="binary003.bin" type="binary" flags="0x0">Unknown binary 3</item>
   <item value="750" index="pals" path="binary004.bin" type="binary" flags="0x0">The head palette</item>
   <item value="751" index="shap" path="image001.bmp" type="image" flags="0x400000">Unknown image 1</item>
@@ -1995,10 +1995,10 @@ resources.xml: Princed Resources : Resource tree
   <item value="753" index="shap" path="image003.bmp" type="image" flags="0x400000">Unknown image 3</item>
   <item value="754" index="shap" path="image004.bmp" type="image" flags="0x400000">Unknown image 4</item>
   <item value="755" index="shap" path="image005.bmp" type="image" flags="0x400000">Unknown image 5</item>
-  <item value="756" index="shap" path="image006.bmp" type="image" flags="0x400000">Unknown image 6</item>
+  <item value="756" index="shape" path="image006.bmp" type="image" flags="0x400000">Unknown image 6</item>
   <item value="757" index="shap" path="image007.bmp" type="image" flags="0x400000">Unknown image 7</item>
   <item value="758" index="shap" path="image008.bmp" type="image" flags="0x400000">Unknown image 8</item>
-  <item value="759" index="shap" path="image009.bmp" type="image" flags="0x400000">Unknown image 9</item>
+  <item value="759" index="shape" path="image009.bmp" type="image" flags="0x400000">Unknown image 9</item>
   <item value="760" index="shap" path="image010.bmp" type="image" flags="0x400000">Unknown image 10</item>
   <item value="761" index="shap" path="image011.bmp" type="image" flags="0x400000">Unknown image 11</item>
   <item value="762" index="shap" path="image012.bmp" type="image" flags="0x400000">Unknown image 12</item>