Use readable RUS2 font for NPC hit labels
This commit is contained in:
1 parent
89060d79ce
commit
597edd72a9
1 file changed
+19
-12
@@ -6,9 +6,9 @@
|
|||||||
module MobHitBars
|
module MobHitBars
|
||||||
WIDTH = 42
|
WIDTH = 42
|
||||||
INNER_WIDTH = WIDTH - 2
|
INNER_WIDTH = WIDTH - 2
|
||||||
BITMAP_WIDTH = 160
|
BITMAP_WIDTH = 220
|
||||||
BAR_X = (BITMAP_WIDTH - WIDTH) / 2
|
BAR_X = (BITMAP_WIDTH - WIDTH) / 2
|
||||||
HEIGHT = 25
|
HEIGHT = 37
|
||||||
VISIBLE_FRAMES = 150
|
VISIBLE_FRAMES = 150
|
||||||
FADE_FRAMES = 30
|
FADE_FRAMES = 30
|
||||||
Y_OFFSET = 7
|
Y_OFFSET = 7
|
||||||
@@ -17,6 +17,9 @@ module MobHitBars
|
|||||||
BORDER_COLOR = Color.new(210, 210, 210, 220)
|
BORDER_COLOR = Color.new(210, 210, 210, 220)
|
||||||
STAMINA_COLOR = Color.new(255, 220, 20, 255)
|
STAMINA_COLOR = Color.new(255, 220, 20, 255)
|
||||||
HEALTH_COLOR = Color.new(225, 35, 35, 255)
|
HEALTH_COLOR = Color.new(225, 35, 35, 255)
|
||||||
|
LABEL_BACK_COLOR = Color.new(0, 0, 0, 180)
|
||||||
|
LABEL_FONT = "AuX DotBitC Xtra Bold"
|
||||||
|
LABEL_FONT_SIZE = 20
|
||||||
|
|
||||||
def self.npc_actor(character)
|
def self.npc_actor(character)
|
||||||
return nil unless character.is_a?(Game_Event)
|
return nil unless character.is_a?(Game_Event)
|
||||||
@@ -145,23 +148,27 @@ class Sprite_Character < Sprite_Base
|
|||||||
|
|
||||||
def redraw_mob_hit_bars(bitmap, hp, hp_max, sta, sta_max, npc_name, npc_level)
|
def redraw_mob_hit_bars(bitmap, hp, hp_max, sta, sta_max, npc_name, npc_level)
|
||||||
bitmap.clear
|
bitmap.clear
|
||||||
bitmap.font.name = FONT_MOD::MENU_M if defined?(FONT_MOD::MENU_M)
|
bitmap.font.name = MobHitBars::LABEL_FONT
|
||||||
bitmap.font.size = 14
|
bitmap.font.size = MobHitBars::LABEL_FONT_SIZE
|
||||||
bitmap.font.bold = true
|
bitmap.font.bold = false
|
||||||
bitmap.font.outline = false
|
bitmap.font.outline = false
|
||||||
bitmap.font.color = Color.new(255, 255, 255, 255)
|
bitmap.font.color = Color.new(255, 255, 255, 255)
|
||||||
bitmap.draw_text(0, 0, MobHitBars::BITMAP_WIDTH, 15, "#{npc_name} Ур. #{npc_level}", 1)
|
label = "#{npc_name} Ур. #{npc_level}"
|
||||||
|
label_width = [bitmap.text_size(label).width + 10, MobHitBars::BITMAP_WIDTH].min
|
||||||
|
label_x = (MobHitBars::BITMAP_WIDTH - label_width) / 2
|
||||||
|
bitmap.fill_rect(label_x, 1, label_width, 24, MobHitBars::LABEL_BACK_COLOR)
|
||||||
|
bitmap.draw_text(0, 0, MobHitBars::BITMAP_WIDTH, 25, label, 1)
|
||||||
|
|
||||||
x = MobHitBars::BAR_X
|
x = MobHitBars::BAR_X
|
||||||
bitmap.fill_rect(x, 16, MobHitBars::WIDTH, 4, MobHitBars::BORDER_COLOR)
|
bitmap.fill_rect(x, 28, MobHitBars::WIDTH, 4, MobHitBars::BORDER_COLOR)
|
||||||
bitmap.fill_rect(x + 1, 17, MobHitBars::INNER_WIDTH, 2, MobHitBars::BACK_COLOR)
|
bitmap.fill_rect(x + 1, 29, MobHitBars::INNER_WIDTH, 2, MobHitBars::BACK_COLOR)
|
||||||
sta_width = (MobHitBars::INNER_WIDTH * MobHitBars.ratio(sta, sta_max)).round
|
sta_width = (MobHitBars::INNER_WIDTH * MobHitBars.ratio(sta, sta_max)).round
|
||||||
bitmap.fill_rect(x + 1, 17, sta_width, 2, MobHitBars::STAMINA_COLOR) if sta_width > 0
|
bitmap.fill_rect(x + 1, 29, sta_width, 2, MobHitBars::STAMINA_COLOR) if sta_width > 0
|
||||||
|
|
||||||
bitmap.fill_rect(x, 21, MobHitBars::WIDTH, 4, MobHitBars::BORDER_COLOR)
|
bitmap.fill_rect(x, 33, MobHitBars::WIDTH, 4, MobHitBars::BORDER_COLOR)
|
||||||
bitmap.fill_rect(x + 1, 22, MobHitBars::INNER_WIDTH, 2, MobHitBars::BACK_COLOR)
|
bitmap.fill_rect(x + 1, 34, MobHitBars::INNER_WIDTH, 2, MobHitBars::BACK_COLOR)
|
||||||
hp_width = (MobHitBars::INNER_WIDTH * MobHitBars.ratio(hp, hp_max)).round
|
hp_width = (MobHitBars::INNER_WIDTH * MobHitBars.ratio(hp, hp_max)).round
|
||||||
bitmap.fill_rect(x + 1, 22, hp_width, 2, MobHitBars::HEALTH_COLOR) if hp_width > 0
|
bitmap.fill_rect(x + 1, 34, hp_width, 2, MobHitBars::HEALTH_COLOR) if hp_width > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_mob_hit_bars_tracking
|
def reset_mob_hit_bars_tracking
|
||||||
|
|||||||
Reference in new issue
Block a user