aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorm MacDownlad <megazig@megazig-desktop.(none)>2009-10-12 05:25:28 -0500
committerNorm MacDownlad <megazig@megazig-desktop.(none)>2009-10-12 05:25:28 -0500
commitdb098418c2f99b5a34553364bdd978e8b37b2874 (patch)
tree77fd1974c6c92b363ca8d5d11fcf98ad6c455e2d
parent6826c2c5b40ececff94548d5fc9e8444e5767ce9 (diff)
changed handling of material in wnd1
Diffstat (limited to '')
-rw-r--r--brlyt.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/brlyt.c b/brlyt.c
index 55a11ff..1e8b3f6 100644
--- a/brlyt.c
+++ b/brlyt.c
@@ -626,7 +626,7 @@ void PrintBRLYTEntry_wnd1(brlyt_entry entry, u8* brlyt_file, mxml_node_t *tag)
colors = mxmlNewElement(wnddd, "color"); mxmlNewTextf(colors, 0, "%08x", int_swap_bytes(wndy1.colors[i]));
}
- material = mxmlNewElement(wnddd, "material"); mxmlNewTextf(material, 0, "%04x", short_swap_bytes(wndy1.material));
+ material = mxmlNewElement(wnddd, "material"); mxmlElementSetAttrf(material, "name", "%s", getMaterial(short_swap_bytes(wndy1.material)));
count = mxmlNewElement(wnddd, "CoordinateCount"); mxmlNewTextf(count, 0, "%02x", short_swap_bytes(wndy1.coordinate_count));
padding = mxmlNewElement(wnddd, "padding"); mxmlNewTextf(padding, 0, "%02x", short_swap_bytes(wndy1.padding));
@@ -2897,9 +2897,14 @@ void WriteBRLYTEntry( mxml_node_t * tree , mxml_node_t * node , u8** tagblob , u
subsubnode = mxmlFindElement(subnode, subnode, "material", NULL, NULL, MXML_DESCEND);
if (subnode != NULL)
{
- char tempCoord[256];
- get_value(subsubnode, tempCoord, 256);
- wndy1.material = short_swap_bytes(strtoul(tempCoord, NULL, 16));
+ char temp[256];
+ if(mxmlElementGetAttr(subsubnode, "name") != NULL)
+ strcpy(temp, mxmlElementGetAttr(subsubnode, "name"));
+ else{
+ printf("No name attribute found!\nQuitting!\n");
+ exit(1);
+ }
+ wndy1.material = short_swap_bytes(findMatOffset(temp));
}
subsubnode = mxmlFindElement(subnode, subnode, "CoordinateCount", NULL, NULL, MXML_DESCEND);
if (subsubnode != NULL)