Skip to content

Instantly share code, notes, and snippets.

@Fohlen
Last active May 4, 2021 12:40
Show Gist options
  • Save Fohlen/884eeadd6a59e50f94ea44714d5b59d6 to your computer and use it in GitHub Desktop.
Save Fohlen/884eeadd6a59e50f94ea44714d5b59d6 to your computer and use it in GitHub Desktop.
List textures patch
static hashtable<int, int> *listtextures;
static int maxlisted;
void listtexcube(cube &c)
{
if (!c.children)
loopi(6)
{
int t = c.texture[i];
(*listtextures)[t] = 1;
maxlisted = max(maxlisted, t);
}
else
loopi(8) listtexcube(c.children[i]);
}
//! List the textures actually used
void listtex()
{
listtextures = new hashtable<int, int>;
maxlisted = -1;
loopi(8) listtexcube(worldroot[i]);
loopi(maxlisted+1)
if (listtextures->access(i) && slots.inrange(i))
loopj(slots[i]->sts.length())
printf("%s\r\n", slots[i]->sts[j].name);
delete listtextures;
}
COMMAND(listtex, "");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment