summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-06-03 11:54:16 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-06-03 11:54:16 -0400
commit47c584d8a583bab3a71333e9993b72cf481bca2f (patch)
tree7e62bf67a0ccb49a86317f4be9b31807c837f3cb /src/main.cpp
parent9ee8022798235c640f13271d4dfad067dbd6542e (diff)
downloadether-47c584d8a583bab3a71333e9993b72cf481bca2f.tar.gz
ether-47c584d8a583bab3a71333e9993b72cf481bca2f.tar.bz2
ether-47c584d8a583bab3a71333e9993b72cf481bca2f.zip
decreased dust light radius
this makes it less likely that dropping a lamp will cause cave-ins.

also slowed down the propagation of dust slightly.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 24f3829..2daf153 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -358,11 +358,13 @@ void recalculateLighting(Game& game, fov_settings_type* fov)
358 358
359 fov_settings_set_apply_lighting_function( 359 fov_settings_set_apply_lighting_function(
360 fov, 360 fov,
361 [] (void* data, int x, int y, int dx, int dy, void*) { 361 [] (void* data, int x, int y, int dx, int dy, void* source) {
362 Game& game = *static_cast<Game*>(data); 362 Game& game = *static_cast<Game*>(data);
363 363
364 if (game.map.inBounds(x, y)) 364 if (game.map.inBounds(x, y))
365 { 365 {
366 double lightRadius = static_cast<double>(*static_cast<int*>(source));
367
366 if (!game.map.at(x,y).lit) 368 if (!game.map.at(x,y).lit)
367 { 369 {
368 game.litSpots++; 370 game.litSpots++;
@@ -375,7 +377,7 @@ void recalculateLighting(Game& game, fov_settings_type* fov)
375 std::pow( 377 std::pow(
376 std::max( 378 std::max(
377 0.0, 379 0.0,
378 1.0 - std::sqrt(dx * dx + dy * dy) / static_cast<double>(RADIUS)), 380 1.0 - std::sqrt(dx * dx + dy * dy) / lightRadius),
379 1.0/3.0)); 381 1.0/3.0));
380 } 382 }
381 }); 383 });
@@ -388,7 +390,24 @@ void recalculateLighting(Game& game, fov_settings_type* fov)
388 game.map.at(x,y).tile == Tile::Dust || 390 game.map.at(x,y).tile == Tile::Dust ||
389 game.map.at(x,y).tile == Tile::Lamp) 391 game.map.at(x,y).tile == Tile::Lamp)
390 { 392 {
391 fov_circle(fov, static_cast<void*>(&game), nullptr, x, y, RADIUS); 393 int lightRadius;
394
395 if ((game.player_x == x && game.player_y == y && game.renderPlayer) ||
396 game.map.at(x,y).tile == Tile::Lamp)
397 {
398 lightRadius = RADIUS;
399 } else if (game.map.at(x,y).tile == Tile::Dust)
400 {
401 lightRadius = 2;
402 }
403
404 fov_circle(
405 fov,
406 static_cast<void*>(&game),
407 static_cast<void*>(&lightRadius),
408 x,
409 y,
410 lightRadius);
392 411
393 game.map.at(x,y).lit = true; 412 game.map.at(x,y).lit = true;
394 game.map.at(x,y).visibility = 1.0; 413 game.map.at(x,y).visibility = 1.0;
@@ -646,7 +665,7 @@ int main(int, char**)
646 Input keystate; 665 Input keystate;
647 SDL_Event e; 666 SDL_Event e;
648 667
649 size_t dustDt = 30; 668 size_t dustDt = 40;
650 size_t dustAcc = 0; 669 size_t dustAcc = 0;
651 670
652 size_t inputDt = 50; 671 size_t inputDt = 50;