mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Credits screen now renders text in multiple smaller bitmaps rather than one tall one
This commit is contained in:
@@ -37,8 +37,8 @@ class Scene_Credits
|
|||||||
# Backgrounds to show in credits. Found in Graphics/Titles/ folder
|
# Backgrounds to show in credits. Found in Graphics/Titles/ folder
|
||||||
BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"]
|
BACKGROUNDS_LIST = ["credits1", "credits2", "credits3", "credits4", "credits5"]
|
||||||
BGM = "Credits"
|
BGM = "Credits"
|
||||||
SCROLL_SPEED = 2
|
SCROLL_SPEED = 40 # Pixels per second
|
||||||
SECONDS_PER_BACKGROUND = 9
|
SECONDS_PER_BACKGROUND = 11
|
||||||
TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255)
|
TEXT_OUTLINE_COLOR = Color.new(0, 0, 128, 255)
|
||||||
TEXT_BASE_COLOR = Color.new(255, 255, 255, 255)
|
TEXT_BASE_COLOR = Color.new(255, 255, 255, 255)
|
||||||
TEXT_SHADOW_COLOR = Color.new(0, 0, 0, 100)
|
TEXT_SHADOW_COLOR = Color.new(0, 0, 0, 100)
|
||||||
@@ -70,12 +70,13 @@ Boushy<s>MiDas Mike
|
|||||||
Brother1440<s>Near Fantastica
|
Brother1440<s>Near Fantastica
|
||||||
FL.<s>PinkMan
|
FL.<s>PinkMan
|
||||||
Genzai Kawakami<s>Popper
|
Genzai Kawakami<s>Popper
|
||||||
help-14<s>Rataime
|
Golisopod User<s>Rataime
|
||||||
IceGod64<s>Savordez
|
help-14<s>Savordez
|
||||||
Jacob O. Wobbrock<s>SoundSpawn
|
IceGod64<s>SoundSpawn
|
||||||
KitsuneKouta<s>the__end
|
Jacob O. Wobbrock<s>the__end
|
||||||
Lisa Anthony<s>Venom12
|
KitsuneKouta<s>Venom12
|
||||||
Luka S.J.<s>Wachunga
|
Lisa Anthony<s>Wachunga
|
||||||
|
Luka S.J.<s>
|
||||||
and everyone else who helped out
|
and everyone else who helped out
|
||||||
|
|
||||||
"mkxp-z" by:
|
"mkxp-z" by:
|
||||||
@@ -90,6 +91,8 @@ The Pokémon Company
|
|||||||
Nintendo
|
Nintendo
|
||||||
Affiliated with Game Freak
|
Affiliated with Game Freak
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This is a non-profit fan-made game.
|
This is a non-profit fan-made game.
|
||||||
No copyright infringements intended.
|
No copyright infringements intended.
|
||||||
Please support the official games!
|
Please support the official games!
|
||||||
@@ -101,19 +104,19 @@ _END_
|
|||||||
#-------------------------------
|
#-------------------------------
|
||||||
# Animated Background Setup
|
# Animated Background Setup
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
@sprite = IconSprite.new(0,0)
|
@counter = 0.0 # Counts time elapsed since the background image changed
|
||||||
@backgroundList = BACKGROUNDS_LIST
|
@bg_index = 0
|
||||||
@frameCounter = 0
|
@bitmap_height = Graphics.height # For a single credits text bitmap
|
||||||
|
@trim = Graphics.height / 10
|
||||||
# Number of game frames per background frame
|
# Number of game frames per background frame
|
||||||
@framesPerBackground = SECONDS_PER_BACKGROUND * Graphics.frame_rate
|
@realOY = -(Graphics.height - @trim)
|
||||||
@sprite.setBitmap("Graphics/Titles/"+@backgroundList[0])
|
#-------------------------------
|
||||||
#------------------
|
|
||||||
# Credits text Setup
|
# Credits text Setup
|
||||||
#------------------
|
#-------------------------------
|
||||||
plugin_credits = ""
|
plugin_credits = ""
|
||||||
PluginManager.plugins.each do |plugin|
|
PluginManager.plugins.each do |plugin|
|
||||||
pcred = PluginManager.credits(plugin)
|
pcred = PluginManager.credits(plugin)
|
||||||
plugin_credits << "\"#{plugin}\" version #{PluginManager.version(plugin)}\n"
|
plugin_credits << "\"#{plugin}\" v.#{PluginManager.version(plugin)} by:\n"
|
||||||
if pcred.size >= 5
|
if pcred.size >= 5
|
||||||
plugin_credits << pcred[0] + "\n"
|
plugin_credits << pcred[0] + "\n"
|
||||||
i = 1
|
i = 1
|
||||||
@@ -122,56 +125,63 @@ _END_
|
|||||||
i += 2
|
i += 2
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
pcred.each do |name|
|
pcred.each { |name| plugin_credits << name + "\n" }
|
||||||
plugin_credits << name + "\n"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
plugin_credits << "\n"
|
plugin_credits << "\n"
|
||||||
end
|
end
|
||||||
CREDIT.gsub!(/\{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE\}/, plugin_credits)
|
CREDIT.gsub!(/\{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE\}/, plugin_credits)
|
||||||
credit_lines = CREDIT.split(/\n/)
|
credit_lines = CREDIT.split(/\n/)
|
||||||
credit_bitmap = Bitmap.new(Graphics.width,32 * credit_lines.size)
|
#-------------------------------
|
||||||
credit_lines.each_index do |i|
|
# Make background and text sprites
|
||||||
line = credit_lines[i]
|
#-------------------------------
|
||||||
line = line.split("<s>")
|
text_viewport = Viewport.new(0, @trim, Graphics.width, Graphics.height - (@trim * 2))
|
||||||
# LINE ADDED: If you use in your own game, you should remove this line
|
text_viewport.z = 99999
|
||||||
pbSetSystemFont(credit_bitmap) # <--- This line was added
|
@background_sprite = IconSprite.new(0, 0)
|
||||||
xpos = 0
|
@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[0])
|
||||||
align = 1 # Centre align
|
@credit_sprites = []
|
||||||
linewidth = Graphics.width
|
@total_height = credit_lines.size * 32
|
||||||
for j in 0...line.length
|
lines_per_bitmap = @bitmap_height / 32
|
||||||
if line.length>1
|
num_bitmaps = (credit_lines.size.to_f / lines_per_bitmap).ceil
|
||||||
xpos = (j==0) ? 0 : 20 + Graphics.width/2
|
for i in 0...num_bitmaps
|
||||||
align = (j==0) ? 2 : 0 # Right align : left align
|
credit_bitmap = Bitmap.new(Graphics.width, @bitmap_height)
|
||||||
linewidth = Graphics.width/2 - 20
|
pbSetSystemFont(credit_bitmap)
|
||||||
|
for j in 0...lines_per_bitmap
|
||||||
|
line = credit_lines[i * lines_per_bitmap + j]
|
||||||
|
next if !line
|
||||||
|
line = line.split("<s>")
|
||||||
|
xpos = 0
|
||||||
|
align = 1 # Centre align
|
||||||
|
linewidth = Graphics.width
|
||||||
|
for k in 0...line.length
|
||||||
|
if line.length > 1
|
||||||
|
xpos = (k == 0) ? 0 : 20 + Graphics.width / 2
|
||||||
|
align = (k == 0) ? 2 : 0 # Right align : left align
|
||||||
|
linewidth = Graphics.width / 2 - 20
|
||||||
|
end
|
||||||
|
credit_bitmap.font.color = TEXT_SHADOW_COLOR
|
||||||
|
credit_bitmap.draw_text(xpos, j * 32 + 8, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.font.color = TEXT_OUTLINE_COLOR
|
||||||
|
credit_bitmap.draw_text(xpos + 2, j * 32 - 2, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos, j * 32 - 2, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos - 2, j * 32 - 2, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos + 2, j * 32, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos - 2, j * 32, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos + 2, j * 32 + 2, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos, j * 32 + 2, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.draw_text(xpos - 2, j * 32 + 2, linewidth, 32, line[k], align)
|
||||||
|
credit_bitmap.font.color = TEXT_BASE_COLOR
|
||||||
|
credit_bitmap.draw_text(xpos, j * 32, linewidth, 32, line[k], align)
|
||||||
end
|
end
|
||||||
credit_bitmap.font.color = TEXT_SHADOW_COLOR
|
|
||||||
credit_bitmap.draw_text(xpos,i * 32 + 8,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.font.color = TEXT_OUTLINE_COLOR
|
|
||||||
credit_bitmap.draw_text(xpos + 2,i * 32 - 2,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos,i * 32 - 2,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos - 2,i * 32 - 2,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos + 2,i * 32,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos - 2,i * 32,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos + 2,i * 32 + 2,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos,i * 32 + 2,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.draw_text(xpos - 2,i * 32 + 2,linewidth,32,line[j],align)
|
|
||||||
credit_bitmap.font.color = TEXT_BASE_COLOR
|
|
||||||
credit_bitmap.draw_text(xpos,i * 32,linewidth,32,line[j],align)
|
|
||||||
end
|
end
|
||||||
|
credit_sprite = Sprite.new(text_viewport)
|
||||||
|
credit_sprite.bitmap = credit_bitmap
|
||||||
|
credit_sprite.z = 9998
|
||||||
|
credit_sprite.oy = @realOY - @bitmap_height * i
|
||||||
|
@credit_sprites[i] = credit_sprite
|
||||||
end
|
end
|
||||||
@trim = Graphics.height/10
|
#-------------------------------
|
||||||
@realOY = -(Graphics.height-@trim) # -430
|
|
||||||
@oyChangePerFrame = SCROLL_SPEED*20.0/Graphics.frame_rate
|
|
||||||
@credit_sprite = Sprite.new(Viewport.new(0,@trim,Graphics.width,Graphics.height-(@trim*2)))
|
|
||||||
@credit_sprite.bitmap = credit_bitmap
|
|
||||||
@credit_sprite.z = 9998
|
|
||||||
@credit_sprite.oy = @realOY
|
|
||||||
@bg_index = 0
|
|
||||||
@last_flag = false
|
|
||||||
#--------
|
|
||||||
# Setup
|
# Setup
|
||||||
#--------
|
#-------------------------------
|
||||||
# Stops all audio but background music
|
# Stops all audio but background music
|
||||||
previousBGM = $game_system.getPlayingBGM
|
previousBGM = $game_system.getPlayingBGM
|
||||||
pbMEStop
|
pbMEStop
|
||||||
@@ -186,9 +196,12 @@ _END_
|
|||||||
update
|
update
|
||||||
break if $scene != self
|
break if $scene != self
|
||||||
end
|
end
|
||||||
|
pbBGMFade(2.0)
|
||||||
Graphics.freeze
|
Graphics.freeze
|
||||||
@sprite.dispose
|
Graphics.transition(20, "fadetoblack")
|
||||||
@credit_sprite.dispose
|
@background_sprite.dispose
|
||||||
|
@credit_sprites.each { |s| s.dispose if s }
|
||||||
|
text_viewport.dispose
|
||||||
$PokemonGlobal.creditsPlayed = true
|
$PokemonGlobal.creditsPlayed = true
|
||||||
pbBGMPlay(previousBGM)
|
pbBGMPlay(previousBGM)
|
||||||
end
|
end
|
||||||
@@ -205,7 +218,7 @@ _END_
|
|||||||
|
|
||||||
# Checks if credits bitmap has reached its ending point
|
# Checks if credits bitmap has reached its ending point
|
||||||
def last?
|
def last?
|
||||||
if @realOY > @credit_sprite.bitmap.height + @trim
|
if @realOY > @total_height + @trim
|
||||||
$scene = ($game_map) ? Scene_Map.new : nil
|
$scene = ($game_map) ? Scene_Map.new : nil
|
||||||
pbBGMFade(2.0)
|
pbBGMFade(2.0)
|
||||||
return true
|
return true
|
||||||
@@ -214,17 +227,18 @@ _END_
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@frameCounter += 1
|
delta = Graphics.delta_s
|
||||||
|
@counter += delta
|
||||||
# Go to next slide
|
# Go to next slide
|
||||||
if @frameCounter >= @framesPerBackground
|
if @counter >= SECONDS_PER_BACKGROUND
|
||||||
@frameCounter -= @framesPerBackground
|
@counter -= SECONDS_PER_BACKGROUND
|
||||||
@bg_index += 1
|
@bg_index += 1
|
||||||
@bg_index = 0 if @bg_index >= @backgroundList.length
|
@bg_index = 0 if @bg_index >= BACKGROUNDS_LIST.length
|
||||||
@sprite.setBitmap("Graphics/Titles/"+@backgroundList[@bg_index])
|
@background_sprite.setBitmap("Graphics/Titles/" + BACKGROUNDS_LIST[@bg_index])
|
||||||
end
|
end
|
||||||
return if cancel?
|
return if cancel?
|
||||||
return if last?
|
return if last?
|
||||||
@realOY += @oyChangePerFrame
|
@realOY += SCROLL_SPEED * delta
|
||||||
@credit_sprite.oy = @realOY
|
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - @bitmap_height * i }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user