[Add] You can now specify target graphic different from normal gfx.
This commit is contained in:
parent
61291921fe
commit
6bc5e6d5af
14
src/ship.c
14
src/ship.c
@ -126,16 +126,26 @@ static Ship* ship_parse(xmlNodePtr parent) {
|
|||||||
do {
|
do {
|
||||||
/* Load all the data. */
|
/* Load all the data. */
|
||||||
if(xml_isNode(node,"GFX")) {
|
if(xml_isNode(node,"GFX")) {
|
||||||
|
|
||||||
|
/* Load the base graphic. */
|
||||||
snprintf(str, strlen(xml_get(node)) +
|
snprintf(str, strlen(xml_get(node)) +
|
||||||
sizeof(SHIP_GFX) + sizeof(SHIP_EXT),
|
sizeof(SHIP_GFX) + sizeof(SHIP_EXT),
|
||||||
SHIP_GFX"%s"SHIP_EXT, xml_get(node));
|
SHIP_GFX"%s"SHIP_EXT, xml_get(node));
|
||||||
tmp->gfx_space = gl_newSprite(str, 6, 6);
|
tmp->gfx_space = gl_newSprite(str, 6, 6);
|
||||||
/* Target. */
|
|
||||||
|
xmlr_attr(node, "target", stmp);
|
||||||
|
if(stmp != NULL) {
|
||||||
|
snprintf(str, strlen(stmp) +
|
||||||
|
sizeof(SHIP_GFX)+sizeof(SHIP_TARGET)+sizeof(SHIP_EXT),
|
||||||
|
SHIP_GFX"%s"SHIP_TARGET SHIP_EXT, stmp);
|
||||||
|
tmp->gfx_target = gl_newImage(str);
|
||||||
|
free(stmp);
|
||||||
|
} else { /* Load standard target graphic. */
|
||||||
snprintf(str, strlen(xml_get(node)) +
|
snprintf(str, strlen(xml_get(node)) +
|
||||||
sizeof(SHIP_GFX)+sizeof(SHIP_TARGET)+sizeof(SHIP_EXT),
|
sizeof(SHIP_GFX)+sizeof(SHIP_TARGET)+sizeof(SHIP_EXT),
|
||||||
SHIP_GFX"%s"SHIP_TARGET SHIP_EXT, xml_get(node));
|
SHIP_GFX"%s"SHIP_TARGET SHIP_EXT, xml_get(node));
|
||||||
tmp->gfx_target = gl_newImage(str);
|
tmp->gfx_target = gl_newImage(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
xmlr_strd(node, "GUI", tmp->gui);
|
xmlr_strd(node, "GUI", tmp->gui);
|
||||||
if(xml_isNode(node, "sound"))
|
if(xml_isNode(node, "sound"))
|
||||||
|
Loading…
Reference in New Issue
Block a user