Had a look in the code, and I think the easiest way to do this would be as follows:
- After dungen_special_loop finishes, right now it changes state to dungen_rooms_assign_biomes.
- Instead, you'd want it to change state to a new state, for finding things like corridors and corner rooms.
- The idea is that you loop through the entire global.grid_roomtype, checking for "rt_NORMAL" rooms. If you find one, check the four surrounding cells as well, and set its type to a corridor / corner based on which neighbors exist. (You'd create one new room type for each new type you'd add, each with a new sprite). There's 4 types of corners, 2 corridors and 4 T-junctions in total. Since you can flip sprites' orientation but not rotate them, you need 1 corner sprite, separate horizontal and vertical corridor sprites, and separate horizontal and vertical T-junction sprites (5 new sprites in total).
- dungen_render_room currently randomly flips the room ("exdir" variable), this of course won't work for corners. You'd need to check the room type (global.grid_roomtype, check at the cell coordinates in argument2/3) and have different behavior for types that can't be rotated. On the plus side, you could reuse corner sprites this way: use the same roomsprite for all corners, and just always mirror them the same way in this step.
- (The reason we insert this new state after the special loop is because the special loop can create new rooms, so we could base the room shape on inaccurate info if we do this earlier).
- (When this new state finishes its loop, you'd continue at dungen_rooms_assign_biomes)