Skip to content

Commit

Permalink
Fixed a crash when a mob is in a sector that fades to the void.
Browse files Browse the repository at this point in the history
  • Loading branch information
Espyo committed Jan 7, 2025
1 parent 93f151e commit 914f0c7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
1 change: 0 additions & 1 deletion source/documents/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Next tasks (roughly sorted most important first)
--- 0.26 ---
Add a "Play" or "Make" label in the corresponding main menu sub-menus
Test -S-'s get_onion_info branch
https://github.com/Helodity/Pikifen/tree/throwing-improvements-port
Find a way to manage the installed packs
Allow pack thumbnails
Only load the thumbnails when you enter the pack management screen, and don't use game.content.bitmaps, since they are not game content. Unload when the screen is exited
Expand Down
26 changes: 23 additions & 3 deletions source/source/mobs/mob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,12 +2188,32 @@ void mob::get_sprite_bitmap_effects(
closest_dist[n] = closest_dist[n] <= d ? closest_dist[n] : d;
}
}
float total_brightness = texture_sector[1]->brightness * (closest_dist[0].to_float() / (closest_dist[0].to_float() + closest_dist[1].to_float()));
total_brightness += texture_sector[0]->brightness * (closest_dist[1].to_float() / (closest_dist[0].to_float() + closest_dist[1].to_float()));
float total_brightness = 0;
if(texture_sector[0]) {
total_brightness +=
texture_sector[0]->brightness *
(
closest_dist[1].to_float() /
(
closest_dist[0].to_float() +
closest_dist[1].to_float()
)
);
}
if(texture_sector[1]) {
total_brightness +=
texture_sector[1]->brightness *
(
closest_dist[0].to_float() /
(
closest_dist[0].to_float() +
closest_dist[1].to_float()
)
);
}
brightness = total_brightness / 255.0;
}


info->tint_color.r *= brightness;
info->tint_color.g *= brightness;
info->tint_color.b *= brightness;
Expand Down

0 comments on commit 914f0c7

Please sign in to comment.