mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 14:44:58 +00:00
Improves npc appearance generation algorithm
This commit is contained in:
@@ -87,6 +87,7 @@ end
|
||||
def shiftHairColor(incr)
|
||||
$Trainer.hair_color = 0 if !$Trainer.hair_color
|
||||
$Trainer.hair_color += incr
|
||||
echoln "Hair color: #{$Trainer.hair_color}"
|
||||
refreshPlayerOutfit()
|
||||
end
|
||||
|
||||
@@ -248,20 +249,6 @@ def generateNPCClothedBitmapStatic(trainerAppearance,action = "walk")
|
||||
hatBitmapWrapper = AnimatedBitmap.new(hatFilename, hat_color_shift) if pbResolveBitmap(hatFilename)
|
||||
hat2BitmapWrapper = AnimatedBitmap.new(hat2Filename, hat2_color_shift) if pbResolveBitmap(hat2Filename)
|
||||
|
||||
if hatBitmapWrapper
|
||||
frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed
|
||||
hat_frame_bitmap = duplicateHatForFrames(hatBitmapWrapper.bitmap, frame_count)
|
||||
|
||||
frame_width = baseSprite.bitmap.width / frame_count # Calculate frame width
|
||||
|
||||
frame_count.times do |i|
|
||||
# Calculate offset for each frame
|
||||
frame_offset = [i * frame_width, 0]
|
||||
# Adjust Y offset if frame index is odd
|
||||
frame_offset[1] -= 2 if i.odd?
|
||||
positionHat(baseBitmap, hat_frame_bitmap, frame_offset, i, frame_width)
|
||||
end
|
||||
end
|
||||
|
||||
if hat2BitmapWrapper
|
||||
frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed
|
||||
@@ -278,6 +265,21 @@ def generateNPCClothedBitmapStatic(trainerAppearance,action = "walk")
|
||||
end
|
||||
end
|
||||
|
||||
if hatBitmapWrapper
|
||||
frame_count = 4 # Assuming 4 frames for hair animation; adjust as needed
|
||||
hat_frame_bitmap = duplicateHatForFrames(hatBitmapWrapper.bitmap, frame_count)
|
||||
|
||||
frame_width = baseSprite.bitmap.width / frame_count # Calculate frame width
|
||||
|
||||
frame_count.times do |i|
|
||||
# Calculate offset for each frame
|
||||
frame_offset = [i * frame_width, 0]
|
||||
# Adjust Y offset if frame index is odd
|
||||
frame_offset[1] -= 2 if i.odd?
|
||||
positionHat(baseBitmap, hat_frame_bitmap, frame_offset, i, frame_width)
|
||||
end
|
||||
end
|
||||
|
||||
return baseBitmap
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user