Enhance blood stain handling: combine existing and new blood surfaces for better accumulation and add surface management

This commit is contained in:
Matteo Benedetto
2025-08-13 23:50:21 +02:00
parent 243bb6d9bd
commit a4b6703d12
2 changed files with 105 additions and 11 deletions
+17 -4
View File
@@ -47,11 +47,24 @@ class Graphics():
if not hasattr(self, 'blood_stains'):
self.blood_stains = {}
# Generate blood surface
blood_surface = self.render_engine.generate_blood_surface()
self.blood_stains[position] = blood_surface
# Generate new blood surface
new_blood_surface = self.render_engine.generate_blood_surface()
# Regenerate background to include the new blood stain
if position in self.blood_stains:
# If there's already a blood stain at this position, combine them
existing_surface = self.blood_stains[position]
combined_surface = self.render_engine.combine_blood_surfaces(existing_surface, new_blood_surface)
# Free the old surfaces
self.render_engine.free_surface(existing_surface)
self.render_engine.free_surface(new_blood_surface)
self.blood_stains[position] = combined_surface
else:
# First blood stain at this position
self.blood_stains[position] = new_blood_surface
# Regenerate background to include the updated blood stain
self.regenerate_background()
def scroll_cursor(self, x=0, y=0):