[Change] Load gfx_exterior for planets only on demand.
This commit is contained in:
parent
11b31c9be7
commit
11e5607477
@ -60,6 +60,7 @@ static unsigned int land_visited = 0;
|
|||||||
/* Land variables. */
|
/* Land variables. */
|
||||||
int landed = 0;
|
int landed = 0;
|
||||||
Planet* land_planet = NULL;
|
Planet* land_planet = NULL;
|
||||||
|
static glTexture* gfx_exterior = NULL;
|
||||||
|
|
||||||
/* Mission computer stack. */
|
/* Mission computer stack. */
|
||||||
static Mission* mission_computer = NULL;
|
static Mission* mission_computer = NULL;
|
||||||
@ -1021,11 +1022,13 @@ void land(Planet* p) {
|
|||||||
/* Change music. */
|
/* Change music. */
|
||||||
music_choose("land");
|
music_choose("land");
|
||||||
|
|
||||||
|
/* Load stuff. */
|
||||||
land_planet = p;
|
land_planet = p;
|
||||||
|
gfx_exterior = gl_newImage(p->gfx_exterior);
|
||||||
land_wid = window_create(p->name, -1, -1, LAND_WIDTH, LAND_HEIGHT);
|
land_wid = window_create(p->name, -1, -1, LAND_WIDTH, LAND_HEIGHT);
|
||||||
|
|
||||||
/* Pretty display. */
|
/* Pretty display. */
|
||||||
window_addImage(land_wid, 20, -40, "imgPlanet", p->gfx_exterior, 1);
|
window_addImage(land_wid, 20, -40, "imgPlanet", gfx_exterior, 1);
|
||||||
window_addText(land_wid, 440, 80, LAND_WIDTH-460, 460, 0,
|
window_addText(land_wid, 440, 80, LAND_WIDTH-460, 460, 0,
|
||||||
"txtPlanetDesc", &gl_smallFont, &cBlack, p->description);
|
"txtPlanetDesc", &gl_smallFont, &cBlack, p->description);
|
||||||
/* Buttons. */
|
/* Buttons. */
|
||||||
@ -1124,6 +1127,10 @@ void takeoff(void) {
|
|||||||
save_all(); /* Must be before cleaning up planet. Duh! */
|
save_all(); /* Must be before cleaning up planet. Duh! */
|
||||||
land_planet = NULL;
|
land_planet = NULL;
|
||||||
window_destroy(land_wid);
|
window_destroy(land_wid);
|
||||||
|
if(gfx_exterior != NULL) {
|
||||||
|
gl_freeTexture(gfx_exterior);
|
||||||
|
gfx_exterior = NULL;
|
||||||
|
}
|
||||||
landed = 0;
|
landed = 0;
|
||||||
land_visited = 0;
|
land_visited = 0;
|
||||||
hooks_run("takeoff");
|
hooks_run("takeoff");
|
||||||
|
@ -489,9 +489,9 @@ static Planet* planet_pull(const char* name) {
|
|||||||
}
|
}
|
||||||
else if(xml_isNode(cur, "exterior")) {
|
else if(xml_isNode(cur, "exterior")) {
|
||||||
/* Load land gfx. */
|
/* Load land gfx. */
|
||||||
snprintf(str, strlen(xml_get(cur))+sizeof(PLANET_GFX_EXTERIOR),
|
tmp->gfx_exterior = malloc(strlen(xml_get(cur))+sizeof(PLANET_GFX_EXTERIOR));
|
||||||
|
snprintf(tmp->gfx_exterior, strlen(xml_get(cur))+sizeof(PLANET_GFX_EXTERIOR),
|
||||||
PLANET_GFX_EXTERIOR"%s", xml_get(cur));
|
PLANET_GFX_EXTERIOR"%s", xml_get(cur));
|
||||||
tmp->gfx_exterior = gl_newImage(str);
|
|
||||||
}
|
}
|
||||||
} while(xml_nextNode(cur));
|
} while(xml_nextNode(cur));
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ typedef struct Planet_ {
|
|||||||
int tech[PLANET_TECH_MAX];
|
int tech[PLANET_TECH_MAX];
|
||||||
|
|
||||||
glTexture* gfx_space; /* Graphics in space. */
|
glTexture* gfx_space; /* Graphics in space. */
|
||||||
glTexture* gfx_exterior; /* Graphics in the exterior. */
|
char* gfx_exterior; /* Don't actually load the texture. */
|
||||||
} Planet;
|
} Planet;
|
||||||
|
|
||||||
/* Star system flags. */
|
/* Star system flags. */
|
||||||
|
Loading…
Reference in New Issue
Block a user