From db098418c2f99b5a34553364bdd978e8b37b2874 Mon Sep 17 00:00:00 2001 From: Norm MacDownlad Date: Mon, 12 Oct 2009 05:25:28 -0500 Subject: changed handling of material in wnd1 --- brlyt.c | 13 +++++++++---- 1 file 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) -- cgit v1.3.1