Hunt-and-kill algorithm rocks. It handles everything I need for map gen, including spawn points, room placement, and the maze like map.
This commit is contained in:
parent
0f8e61797f
commit
a0b785cb2a
8 changed files with 62 additions and 336 deletions
|
@ -25,6 +25,16 @@ union ColorConv {
|
|||
uint32_t as_int;
|
||||
};
|
||||
|
||||
inline uint32_t old_lighting(uint32_t pixel, float dist, int level) {
|
||||
(void)level;
|
||||
ColorConv conv{.as_int=pixel};
|
||||
conv.as_color.r /= dist;
|
||||
conv.as_color.g /= dist;
|
||||
conv.as_color.b /= dist;
|
||||
|
||||
return conv.as_int;
|
||||
}
|
||||
|
||||
/* It's hard to believe, but this is faster than any bitfiddling
|
||||
* I could devise. Just use a union with a struct, do the math
|
||||
* and I guess the compiler can handle it better than shifting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue