It's in gen-room.c in the build_room_template() function. (Also, I'm sorry to inform you that I did all the code to implement templated rooms, but actually have no idea how it works, it's all just cribbed from the pre-existing vault code with a few add-ons to create more randomisation.)
Incidentally, my aim with the room templates was to get the maximum flexible reuse out of each individual template, so I'd suggest rather than a fixed colour map defining say, "these squares always yellow, these squares red", what you want is just a colour map that says "colour #1 goes here, colour #2 goes here" that you can then apply any number of different colour schemes to, whether "1=red, 2=yellow" or "1=blue, 2=green", etc. (Which would also facilitate applying the same set of theme colours to entire levels.)
Also, while you could potentially do it by adding a set of C: lines for every single room in room_template.txt (which would be a real bugger, since there are currently 500), I feel like the more efficient way would be to add 'accent squares' to the existing rooms, defining specific floor and wall tiles to be a different colour from the default applied to the others. And there are actually already some "special symbols" in there that you can potentially make use of without having to make any changes to room_template.txt at all.
For instance, as part of the efforts to generate multiple variant rooms from a single template, I added code for "optional walls". Those are the x squares here:
The code "flips a coin" in the shape of a Boolean called "rndwalls" which gives you a fifty-fifty chance of generating those x squares as floor, giving you this room:
Or walls, giving you this one:
You could, however, potentially give them a double purpose and add code so that x squares (whether they're generated as either walls or floor) are a different colour from the rest of the room, allowing you to apply your different colour schemes to various effects:
I mean, hopefully less... bad, but you get the general idea.
There are also a bunch of other special symbols that are instructing the code what to do without affecting the look of the room that you could repurpose to implement various colour effects. For instance, numbers 1-6 are random doors - one number will be picked and used for door positions, while the others are converted to walls - so you could make those walls a distinct colour from the others. Or you could make connecting wall squares (%) on the outside of a room a different colour from standard wall squares (#) on the inside. Nearly all of the layout templates are symmetrical, so tweaking the colours of any of this stuff should create fairly balanced, tidy patterns.
(Of course, I leave the matter of how to get the parser to colourise those squares differently as an exercise for the reader. )
Incidentally, my aim with the room templates was to get the maximum flexible reuse out of each individual template, so I'd suggest rather than a fixed colour map defining say, "these squares always yellow, these squares red", what you want is just a colour map that says "colour #1 goes here, colour #2 goes here" that you can then apply any number of different colour schemes to, whether "1=red, 2=yellow" or "1=blue, 2=green", etc. (Which would also facilitate applying the same set of theme colours to entire levels.)
Also, while you could potentially do it by adding a set of C: lines for every single room in room_template.txt (which would be a real bugger, since there are currently 500), I feel like the more efficient way would be to add 'accent squares' to the existing rooms, defining specific floor and wall tiles to be a different colour from the default applied to the others. And there are actually already some "special symbols" in there that you can potentially make use of without having to make any changes to room_template.txt at all.
For instance, as part of the efforts to generate multiple variant rooms from a single template, I added code for "optional walls". Those are the x squares here:
Code:
D:%%%%%%%%%%%%%%%%% D:%...............% D:%.xx...#1#...xx.% D:%.x...##.##...x.% D:%....##...##....% D:#...##..9..##...# D:%....##...##....% D:%.x...##.##...x.% D:%.xx...#2#...xx.% D:%...............% D:%%%%%%%%%%%%%%%%%
Code:
[bc=black]################# #...............# #......#[color=#C08040]+[/color]#......# #.....##.##.....# #....##...##....# #...##.....##...# #....##...##....# #.....##.##.....# #......###......# #...............# ################# [/bc]
Code:
[bc=black]################# #...............# #.##...#[color=#C08040]+[/color]#...##.# #.#...##.##...#.# #....##...##....# #...##.....##...# #....##...##....# #.#...##.##...#.# #.##...###...##.# #...............# ################# [/bc]
Code:
[bc=black][color=green]################# #...............# #.[color=cyan]##[/color]...#[color=#C08040]+[/color]#...[color=cyan]##[/color].# #.[color=cyan]#[/color]...##.##...[color=cyan]#[/color].# #....##...##....# #...##.....##...# #....##...##....# #.[color=cyan]#[/color]...##.##...[color=cyan]#[/color].# #.[color=cyan]##[/color]...###...[color=cyan]##[/color].# #...............# ################# [/color] [color=#3333ff][color=#8888CC]#################[/color] [color=#8888CC]#[/color]...............[color=#8888CC]#[/color] [color=#8888CC]#[/color].[color=lightgreen]..[/color]...[color=#8888CC]#[/color][color=#C08040]+[/color][color=#8888CC]#[/color]...[color=lightgreen]..[/color].[color=#8888CC]#[/color] [color=#8888CC]#[/color].[color=lightgreen].[/color]...[color=#8888CC]##[/color].[color=#8888CC]##[/color]...[color=lightgreen].[/color].[color=#8888CC]#[/color] [color=#8888CC]#[/color]....[color=#8888CC]##[/color]...[color=#8888CC]##[/color]....[color=#8888CC]#[/color] [color=#8888CC]#[/color]...[color=#8888CC]##[/color].....[color=#8888CC]##[/color]...[color=#8888CC]#[/color] [color=#8888CC]#[/color]....[color=#8888CC]##[/color]...[color=#8888CC]##[/color]....[color=#8888CC]#[/color] [color=#8888CC]#[/color].[color=lightgreen].[/color]...[color=#8888CC]##[/color].[color=#8888CC]##[/color]...[color=lightgreen].[/color].[color=#8888CC]#[/color] [color=#8888CC]#[/color].[color=lightgreen]..[/color]...[color=#8888CC]###[/color]...[color=lightgreen]..[/color].[color=#8888CC]#[/color] [color=#8888CC]#[/color]...............[color=#8888CC]#[/color] [color=#8888CC]#################[/color] [/color][/bc][color=#3333ff][/color] etc.
There are also a bunch of other special symbols that are instructing the code what to do without affecting the look of the room that you could repurpose to implement various colour effects. For instance, numbers 1-6 are random doors - one number will be picked and used for door positions, while the others are converted to walls - so you could make those walls a distinct colour from the others. Or you could make connecting wall squares (%) on the outside of a room a different colour from standard wall squares (#) on the inside. Nearly all of the layout templates are symmetrical, so tweaking the colours of any of this stuff should create fairly balanced, tidy patterns.
(Of course, I leave the matter of how to get the parser to colourise those squares differently as an exercise for the reader. )
Comment