Even if this took hours and hours and hours in the last few days, I’ve written something like three lines of stupid code.
I’ve simply merged the content of the ASCII png into the tileset png so we just load one. Then used this chunk of code written by someone else to retrieve symbol+color of an object:
bool fuck = false;
long sym = 0;
nc_color col = c_white;
if (it == tile_ids->end()) {
if (category == "furniture") {
if (furnmap.count(id) > 0) {
const furn_t &f = furnmap[id];
sym = f.sym;
col = f.color;
fuck = true;
}
} else if (category == "terrain") {
if (termap.count(id) > 0) {
const ter_t &t = termap[id];
sym = t.sym;
col = t.color;
fuck = true;
}
} else if (category == "monster") {
if (MonsterGenerator::generator().has_mtype(id)) {
const mtype *m = MonsterGenerator::generator().get_mtype(id);
sym = m->sym;
col = m->color;
fuck = true;
}
} else if (category == "vehicle_part") {
if (vehicle_part_types.count(id.substr(3)) > 0) {
const vpart_info &v = vehicle_part_types[id.substr(3)];
sym = v.sym;
col = v.color;
fuck = true;
}
} else if (category == "field") {
for(int i = 0; i < num_fields; i++) {
if(field_names[i] == id) {
sym = fieldlist[i].sym;
col = fieldlist[i].color[0];
fuck = true;
}
}
} else if (category == "item") {
if (item_controller->has_template(id)) {
const itype *i = item_controller->find_template(id);
sym = i->sym;
col = i->color;
fuck = true;
}
}
}
It basically goes through the categories and takes out the values. Since I didn’t know those structures were available, or even existed, I couldn’t have written that piece of code.
Then I simply override the tile value before the draw function is called:
if (fuck) {
int whatc = color_to_int(col);
if(sym > 256 || sym < 0) sym = 666;
if(whatc > 15) whatc = whatc % 16;
display_tile->fg = 1744 + sym + (256 * whatc);
display_tile->bg = 0;
if(sym == 666){
display_tile->fg = 54;
}
}
This last bit is the piece of code I made. The basic formula takes 1744 (where the ASCII tile starts), the symbol which is the number of the ASCII, and then 256*whatc that is basically an offset for the color.
So right now the ASCII fallback itself would only work on the tileset I use. If you load a different tileset it wouldn’t have an ASCII png and wouldn’t work properly. Even if you added ASCII into a tileset it wouldn’t work because the code uses hardcoded numbers.
I doubt this will be included in mainline anytime soon, because the code needs to be fixed and they didn’t even like how I made it work.
The “history” of this thing is here: https://github.com/CleverRaven/Cataclysm-DDA/issues/4236