mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Resolved many Rubocop warnings
This commit is contained in:
@@ -44,7 +44,7 @@ class WeakRef
|
||||
@@id_map = {}
|
||||
@@id_rev_map = {}
|
||||
@@final = lambda { |id|
|
||||
__old_status = Thread.critical
|
||||
old_thread_status = Thread.critical
|
||||
Thread.critical = true
|
||||
begin
|
||||
rids = @@id_map[id]
|
||||
@@ -61,7 +61,7 @@ class WeakRef
|
||||
@@id_map.delete(rid) if @@id_map[rid].empty?
|
||||
end
|
||||
ensure
|
||||
Thread.critical = __old_status
|
||||
Thread.critical = old_thread_status
|
||||
end
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class WeakRef
|
||||
|
||||
def __setobj__(obj)
|
||||
@__id = obj.__id__
|
||||
__old_status = Thread.critical
|
||||
old_thread_status = Thread.critical
|
||||
begin
|
||||
Thread.critical = true
|
||||
unless @@id_rev_map.key?(self)
|
||||
@@ -92,7 +92,7 @@ class WeakRef
|
||||
end
|
||||
@@id_map[@__id] = [] unless @@id_map[@__id]
|
||||
ensure
|
||||
Thread.critical = __old_status
|
||||
Thread.critical = old_thread_status
|
||||
end
|
||||
@@id_map[@__id].push self.__id__
|
||||
@@id_rev_map[self.__id__] = @__id
|
||||
@@ -111,7 +111,7 @@ class WeakHashtable
|
||||
include Enumerable
|
||||
|
||||
def initialize
|
||||
@hash={}
|
||||
@hash = {}
|
||||
end
|
||||
|
||||
def clear
|
||||
@@ -277,12 +277,12 @@ end
|
||||
# bitmap is freed when the reference count reaches 0.
|
||||
class Thread
|
||||
def Thread.exclusive
|
||||
_old = Thread.critical
|
||||
old_thread_status = Thread.critical
|
||||
begin
|
||||
Thread.critical = true
|
||||
return yield
|
||||
ensure
|
||||
Thread.critical = _old
|
||||
Thread.critical = old_thread_status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -519,10 +519,10 @@ end
|
||||
# Fades and window activations for sprite hashes
|
||||
#===============================================================================
|
||||
class Game_Temp
|
||||
attr_accessor :fadestate
|
||||
attr_writer :fadestate
|
||||
|
||||
def fadestate
|
||||
return (@fadestate) ? @fadestate : 0
|
||||
return @fadestate || 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ class SpriteWindow < Window
|
||||
attr_reader :skinformat
|
||||
attr_reader :skinrect
|
||||
|
||||
def loadSkinFile(file)
|
||||
def loadSkinFile(_file)
|
||||
if (self.windowskin.width==80 || self.windowskin.width==96) &&
|
||||
self.windowskin.height==48
|
||||
# Body = X, Y, width, height of body rectangle within windowskin
|
||||
@@ -519,9 +519,9 @@ class SpriteWindow < Window
|
||||
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
||||
x+=srcrect.width
|
||||
end
|
||||
y+=srcrect.height
|
||||
end
|
||||
end
|
||||
y+=srcrect.height
|
||||
end
|
||||
end
|
||||
|
||||
def privRefreshCursor
|
||||
contopac=self.contents_opacity
|
||||
@@ -666,8 +666,6 @@ class SpriteWindow < Window
|
||||
startX=@skinrect.x
|
||||
# width of top end of window
|
||||
startY=@skinrect.y
|
||||
backWidth=@skinrect.width
|
||||
backHeight=@skinrect.height
|
||||
cx=@skinrect.x+@skinrect.width # right side of BODY rect
|
||||
cy=@skinrect.y+@skinrect.height # bottom side of BODY rect
|
||||
# width of right end of window
|
||||
@@ -707,8 +705,6 @@ class SpriteWindow < Window
|
||||
end
|
||||
end
|
||||
if @_windowskin && !@_windowskin.disposed?
|
||||
backTrimX=startX+endX
|
||||
backTrimY=startX+endX
|
||||
borderX=startX+endX
|
||||
borderY=startY+endY
|
||||
@sprites["corner0"].x=@x
|
||||
@@ -857,8 +853,6 @@ class SpriteWindow < Window
|
||||
sprite.zoom_x=1.0
|
||||
sprite.oy=0
|
||||
sprite.y=(@y+(@height/2.0)+(@height*ratio*opn)-(@height/2*opn)).floor
|
||||
oldbitmap=sprite.bitmap
|
||||
oldsrcrect=sprite.src_rect.clone
|
||||
end
|
||||
else
|
||||
for k in @spritekeys
|
||||
@@ -1117,7 +1111,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
attr_reader :baseColor
|
||||
attr_reader :shadowColor
|
||||
attr_accessor :letterbyletter
|
||||
attr_reader :lineHeight
|
||||
attr_reader :waitcount
|
||||
|
||||
def initialize(text="")
|
||||
@@ -1291,7 +1284,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
@curchar = 0
|
||||
@drawncurchar = -1
|
||||
@lastDrawnChar = -1
|
||||
oldtext = @text
|
||||
@text = value
|
||||
@textlength = unformattedTextLength(value)
|
||||
@scrollstate = 0
|
||||
@@ -1466,7 +1458,6 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
self.oy = @scrollY
|
||||
numchars = @numtextchars
|
||||
numchars = [@curchar,@numtextchars].min if self.letterbyletter
|
||||
startchar = 0
|
||||
return if busy? && @drawncurchar==@curchar && @scrollstate==0
|
||||
if !self.letterbyletter || !oldcontents.equal?(self.contents)
|
||||
@drawncurchar = -1
|
||||
@@ -1614,7 +1605,6 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
attr_reader :number
|
||||
attr_reader :sign
|
||||
|
||||
def initialize(digits_max)
|
||||
@@ -1643,13 +1633,6 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
@number*(@sign && @negative ? -1 : 1)
|
||||
end
|
||||
|
||||
def sign=(value)
|
||||
@sign=value
|
||||
self.width=@digits_max*24+8+self.borderX+(@sign ? 24 : 0)
|
||||
@index=(@digits_max-1)+(@sign ? 1 : 0)
|
||||
refresh
|
||||
end
|
||||
|
||||
def number=(value)
|
||||
value=0 if !value.is_a?(Numeric)
|
||||
if @sign
|
||||
@@ -1661,13 +1644,19 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
refresh
|
||||
end
|
||||
|
||||
def sign=(value)
|
||||
@sign=value
|
||||
self.width=@digits_max*24+8+self.borderX+(@sign ? 24 : 0)
|
||||
@index=(@digits_max-1)+(@sign ? 1 : 0)
|
||||
refresh
|
||||
end
|
||||
|
||||
def refresh
|
||||
self.contents=pbDoEnsureBitmap(self.contents,
|
||||
self.width-self.borderX,self.height-self.borderY)
|
||||
pbSetSystemFont(self.contents)
|
||||
self.contents.clear
|
||||
s=sprintf("%0*d",@digits_max,@number.abs)
|
||||
x=0
|
||||
if @sign
|
||||
textHelper(0,0,@negative ? "-" : "+",0)
|
||||
end
|
||||
@@ -2080,7 +2069,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
||||
end
|
||||
|
||||
def textWidth(bitmap,text)
|
||||
return tmpbitmap.text_size(i).width
|
||||
return bitmap.text_size(text).width
|
||||
end
|
||||
|
||||
def getAutoDims(commands,dims,width=nil)
|
||||
@@ -2230,7 +2219,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
||||
return @commands ? @commands.length : 0
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
pbSetSystemFont(self.contents) if @starting
|
||||
rect=drawCursor(index,rect)
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,
|
||||
@@ -2344,7 +2333,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
||||
return @commands ? @commands.length : 0
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
pbSetSystemFont(self.contents)
|
||||
rect=drawCursor(index,rect)
|
||||
if toUnformattedText(@commands[index]).gsub(/\n/,"")==@commands[index]
|
||||
|
||||
@@ -111,7 +111,7 @@ class PngAnimatedBitmap
|
||||
@currentFrame
|
||||
end
|
||||
|
||||
def frameDelay(index)
|
||||
def frameDelay(_index)
|
||||
return @frameDelay
|
||||
end
|
||||
|
||||
@@ -259,10 +259,6 @@ class GifBitmap
|
||||
return @gifbitmaps[index]
|
||||
end
|
||||
|
||||
def width; self.bitmap.width; end
|
||||
|
||||
def height; self.bitmap.height; end
|
||||
|
||||
def deanimate
|
||||
for i in 1...@gifbitmaps.length
|
||||
@gifbitmaps[i].dispose
|
||||
@@ -349,7 +345,7 @@ end
|
||||
|
||||
def pbGetTileBitmap(filename, tile_id, hue)
|
||||
return BitmapCache.tileEx(filename, tile_id, hue) { |f|
|
||||
AnimatedBitmap.new("Graphics/Tilesets/"+filename).deanimate;
|
||||
AnimatedBitmap.new("Graphics/Tilesets/"+filename).deanimate
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1000,8 +996,10 @@ class LargePlane < Plane
|
||||
top = (dstrect.y-@__oy/@__sprite.zoom_y).to_i
|
||||
while left>0; left -= srcbitmap.width; end
|
||||
while top>0; top -= srcbitmap.height; end
|
||||
y = top; while y<dstrect.height
|
||||
x = left; while x<dstrect.width
|
||||
y = top
|
||||
while y<dstrect.height
|
||||
x = left
|
||||
while x<dstrect.width
|
||||
dstbitmap.blt(x+@borderX,y+@borderY,srcbitmap,srcrect)
|
||||
x += srcrect.width
|
||||
end
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# Text colours
|
||||
#===============================================================================
|
||||
def ctag(color)
|
||||
ret=(color.red.to_i<<24)
|
||||
ret|=((color.green.to_i)<<16)
|
||||
ret|=((color.blue.to_i)<<8)
|
||||
ret=(color.red.to_i << 24)
|
||||
ret|=((color.green.to_i) << 16)
|
||||
ret|=((color.blue.to_i) << 8)
|
||||
ret|=((color.alpha.to_i))
|
||||
return sprintf("<c=%08X>",ret)
|
||||
end
|
||||
@@ -168,13 +168,9 @@ end
|
||||
|
||||
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||
newlineBreaks=true,explicitBreaksOnly=false)
|
||||
numchars=0
|
||||
x=y=0
|
||||
characters=[]
|
||||
charactersInternal=[]
|
||||
textchunks=[]
|
||||
controls=[]
|
||||
charsonline=0
|
||||
textchunks.push(text)
|
||||
text=textchunks.join("")
|
||||
textchars=text.scan(/./m)
|
||||
@@ -192,19 +188,18 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||
end
|
||||
defaultfontname=defaultfontname.clone
|
||||
havenl=false
|
||||
position=0;while position<textchars.length
|
||||
position=0
|
||||
while position<textchars.length
|
||||
yStart=0
|
||||
xStart=0
|
||||
width=isWaitChar(textchars[position]) ? 0 : bitmap.text_size(textchars[position]).width
|
||||
if textchars[position]=="\n"
|
||||
if newlineBreaks # treat newline as break
|
||||
if true
|
||||
havenl=true
|
||||
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,
|
||||
false,colorclone,nil,false,false,"",8,position,nil,0])
|
||||
y+=1
|
||||
x=0
|
||||
end
|
||||
havenl=true
|
||||
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,
|
||||
false,colorclone,nil,false,false,"",8,position,nil,0])
|
||||
y+=1
|
||||
x=0
|
||||
hadspace=true
|
||||
hadnonspace=false
|
||||
position+=1
|
||||
@@ -223,10 +218,8 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||
elsif isspace
|
||||
hadspace=true
|
||||
end
|
||||
textx=x+xStart # independent of xDst
|
||||
texty=(lineheight*y)+yDst+yStart
|
||||
oldx=x
|
||||
# Push character, textx will be calculated later
|
||||
# Push character
|
||||
if heightDst<0 || yStart<yDst+heightDst
|
||||
havenl=true if isWaitChar(textchars[position])
|
||||
characters.push([
|
||||
@@ -455,11 +448,9 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
dummybitmap.dispose if dummybitmap
|
||||
return ret
|
||||
end
|
||||
numchars=0
|
||||
x=y=0
|
||||
characters=[]
|
||||
charactersInternal=[]
|
||||
charsonline=0
|
||||
realtext=nil
|
||||
realtextStart=""
|
||||
if !explicitBreaksOnly && textchunks.join("").length==0
|
||||
@@ -511,7 +502,8 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
hadspace=false
|
||||
hadnonspace=false
|
||||
havenl=false
|
||||
position=0; while position<textchars.length
|
||||
position=0
|
||||
while position<textchars.length
|
||||
nextline=0
|
||||
graphic=nil
|
||||
graphicX=0
|
||||
@@ -712,11 +704,9 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
elsif isspace
|
||||
hadspace=true
|
||||
end
|
||||
textx=x+xStart # independent of xDst
|
||||
texty=(lineheight*y)+yDst+yStart
|
||||
colors=getLastColors(colorstack,opacitystack,defaultcolors)
|
||||
oldx=x
|
||||
# Push character, textx will be calculated later
|
||||
# Push character
|
||||
if heightDst<0 || texty<yDst+heightDst
|
||||
havenl=true if !graphic && isWaitChar(textchars[position])
|
||||
extraspace=(!graphic && italiccount>0) ? 2+(width/2) : 2
|
||||
@@ -909,7 +899,6 @@ def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
|
||||
reNoMatch=/<c=[^>]+>/
|
||||
return ret if !bitmap || bitmap.disposed? || width<=0
|
||||
textmsg=value.clone
|
||||
lines=0
|
||||
color=Font.default_color
|
||||
while (c = textmsg.slice!(/\n|[^ \r\t\f\n\-]*\-+|(\S*([ \r\t\f]?))/)) != nil
|
||||
break if c==""
|
||||
@@ -1111,7 +1100,7 @@ def coloredToFormattedText(text,baseColor=nil,shadowColor=nil)
|
||||
end
|
||||
|
||||
# Deprecated -- not to be used in new code
|
||||
def drawColoredTextEx(bitmap,x,y,width,text,baseColor=nil,shadowColor=nil)
|
||||
def drawColoredTextEx(bitmap,x,y,width,text,_baseColor=nil,_shadowColor=nil)
|
||||
chars=getFormattedText(bitmap,x,y,width,-1,coloredToFormattedText(text),32)
|
||||
drawFormattedChars(bitmap,chars)
|
||||
end
|
||||
|
||||
@@ -315,12 +315,13 @@ module InterpreterMixin
|
||||
if common_event != nil
|
||||
interp = Interpreter.new
|
||||
interp.setup(common_event.list,0)
|
||||
begin
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
interp.update
|
||||
pbUpdateSceneMap
|
||||
end while interp.running?
|
||||
break if !interp.running?
|
||||
end
|
||||
end
|
||||
else
|
||||
$game_system.battle_interpreter.setup(common_event.list, 0)
|
||||
@@ -705,7 +706,7 @@ class ChooseNumberParams
|
||||
ret=0
|
||||
if @maxDigits>0
|
||||
ret=-((10**@maxDigits)-1)
|
||||
elsif
|
||||
else
|
||||
ret=@minNumber
|
||||
end
|
||||
ret=0 if !@negativeAllowed && ret<0
|
||||
@@ -716,7 +717,7 @@ class ChooseNumberParams
|
||||
ret=0
|
||||
if @maxDigits>0
|
||||
ret=((10**@maxDigits)-1)
|
||||
elsif
|
||||
else
|
||||
ret=@maxNumber
|
||||
end
|
||||
ret=0 if !@negativeAllowed && ret<0
|
||||
@@ -767,9 +768,7 @@ def pbChooseNumber(msgwindow,params)
|
||||
cmdwindow.setSkin(params.skin) if params.skin
|
||||
cmdwindow.sign=params.negativesAllowed # must be set before number
|
||||
cmdwindow.number=defaultNumber
|
||||
curnumber=defaultNumber
|
||||
pbPositionNearMsgWindow(cmdwindow,msgwindow,:right)
|
||||
command=0
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -1007,7 +1006,6 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
oldletterbyletter=msgwindow.letterbyletter
|
||||
msgwindow.letterbyletter=(letterbyletter) ? true : false
|
||||
ret=nil
|
||||
count=0
|
||||
commands=nil
|
||||
facewindow=nil
|
||||
goldwindow=nil
|
||||
@@ -1048,17 +1046,19 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
m = $1.to_i
|
||||
next getSkinColor(msgwindow.windowskin,m,isDarkSkin)
|
||||
}
|
||||
begin
|
||||
loop do
|
||||
last_text = text.clone
|
||||
text.gsub!(/\\v\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
|
||||
end until text == last_text
|
||||
begin
|
||||
break if text == last_text
|
||||
end
|
||||
loop do
|
||||
last_text = text.clone
|
||||
text.gsub!(/\\l\[([0-9]+)\]/i) {
|
||||
linecount = [1,$1.to_i].max
|
||||
next ""
|
||||
}
|
||||
end until text == last_text
|
||||
break if text == last_text
|
||||
end
|
||||
colortag = ""
|
||||
if ($game_message && $game_message.background>0) ||
|
||||
($game_system && $game_system.respond_to?("message_frame") &&
|
||||
@@ -1156,7 +1156,7 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
########## Show text #############################
|
||||
msgwindow.text = text
|
||||
Graphics.frame_reset if Graphics.frame_rate>40
|
||||
begin
|
||||
loop do
|
||||
if signWaitCount>0
|
||||
signWaitCount -= 1
|
||||
if atTop
|
||||
@@ -1256,7 +1256,8 @@ def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)
|
||||
pbUpdateSceneMap
|
||||
msgwindow.update
|
||||
yield if block_given?
|
||||
end until (!letterbyletter || commandProc || commands) && !msgwindow.busy?
|
||||
break if (!letterbyletter || commandProc || commands) && !msgwindow.busy?
|
||||
end
|
||||
Input.update # Must call Input.update again to avoid extra triggers
|
||||
msgwindow.letterbyletter=oldletterbyletter
|
||||
if commands
|
||||
|
||||
@@ -46,7 +46,7 @@ class Window_CharacterEntry < Window_DrawableCommand
|
||||
return @charset.length+3
|
||||
end
|
||||
|
||||
def drawItem(index,count,rect)
|
||||
def drawItem(index,_count,rect)
|
||||
rect=drawCursor(index,rect)
|
||||
if index==@charset.length # -1
|
||||
pbDrawShadowText(self.contents,rect.x,rect.y,rect.width,rect.height,"[ ]",
|
||||
@@ -70,9 +70,9 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class CharacterEntryHelper
|
||||
attr_reader :text
|
||||
attr_reader :maxlength
|
||||
attr_reader :passwordChar
|
||||
attr_reader :text
|
||||
attr_accessor :maxlength
|
||||
attr_reader :passwordChar
|
||||
attr_accessor :cursor
|
||||
|
||||
def initialize(text)
|
||||
@@ -80,12 +80,10 @@ class CharacterEntryHelper
|
||||
@text=text
|
||||
@passwordChar=""
|
||||
@cursor=text.scan(/./m).length
|
||||
ensure
|
||||
end
|
||||
|
||||
def text=(value)
|
||||
@text=value
|
||||
ensure
|
||||
end
|
||||
|
||||
def textChars
|
||||
@@ -100,11 +98,6 @@ class CharacterEntryHelper
|
||||
@passwordChar=value ? value : ""
|
||||
end
|
||||
|
||||
def maxlength=(value)
|
||||
@maxlength=value
|
||||
ensure
|
||||
end
|
||||
|
||||
def length
|
||||
return self.text.scan(/./m).length
|
||||
end
|
||||
@@ -264,7 +257,6 @@ class Window_TextEntry < SpriteWindow_Base
|
||||
end
|
||||
x+=4
|
||||
width=self.width-self.borderX
|
||||
height=self.height-self.borderY
|
||||
cursorcolor=Color.new(16,24,32)
|
||||
textscan=self.text.scan(/./m)
|
||||
scanlength=textscan.length
|
||||
@@ -316,8 +308,6 @@ def getLineBrokenText(bitmap,value,width,dims)
|
||||
column=0
|
||||
return ret if !bitmap || bitmap.disposed? || width<=0
|
||||
textmsg=value.clone
|
||||
lines=0
|
||||
color=Font.default_color
|
||||
ret.push(["",0,0,0,bitmap.text_size("X").height,0,0,0,0])
|
||||
while ((c = textmsg.slice!(/\n|(\S*([ \r\t\f]?))/)) != nil)
|
||||
break if c==""
|
||||
@@ -334,7 +324,6 @@ def getLineBrokenText(bitmap,value,width,dims)
|
||||
ret.push(["",x,y,0,textheight,line,position,column,0])
|
||||
next
|
||||
end
|
||||
textcols=[]
|
||||
words=[ccheck]
|
||||
for i in 0...words.length
|
||||
word=words[i]
|
||||
@@ -355,7 +344,6 @@ def getLineBrokenText(bitmap,value,width,dims)
|
||||
x+=textwidth
|
||||
dims[0]=x if dims && dims[0]<x
|
||||
end
|
||||
color=textcols[i] if textcols[i]
|
||||
end
|
||||
position+=length
|
||||
column+=length
|
||||
@@ -451,87 +439,72 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
|
||||
def getTotalLines
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 1
|
||||
else
|
||||
tchar=textchars[textchars.length-1]
|
||||
return tchar[5]+1
|
||||
end
|
||||
return 1 if textchars.length==0
|
||||
tchar=textchars[textchars.length-1]
|
||||
return tchar[5]+1
|
||||
end
|
||||
|
||||
def getLineY(line)
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 0
|
||||
else
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
maximumY=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
y=textchars[i][2]
|
||||
return y if thisline==line
|
||||
maximumY=y if maximumY<y
|
||||
end
|
||||
return maximumY
|
||||
return 0 if textchars.length==0
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
maximumY=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
y=textchars[i][2]
|
||||
return y if thisline==line
|
||||
maximumY=y if maximumY<y
|
||||
end
|
||||
return maximumY
|
||||
end
|
||||
|
||||
def getColumnsInLine(line)
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 0
|
||||
else
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==line
|
||||
endpos+=thislength
|
||||
end
|
||||
end
|
||||
return endpos
|
||||
return 0 if textchars.length==0
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thislength=textchars[i][8]
|
||||
endpos+=thislength if thisline==line
|
||||
end
|
||||
return endpos
|
||||
end
|
||||
|
||||
def getPosFromLineAndColumn(line,column)
|
||||
textchars=getTextChars
|
||||
if textchars.length==0
|
||||
return 0
|
||||
else
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==line
|
||||
endpos=thispos+thislength
|
||||
# echoln [endpos,thispos+(column-thiscolumn),textchars[i]]
|
||||
if column>=thiscolumn && column<=thiscolumn+thislength && thislength>0
|
||||
return thispos+(column-thiscolumn)
|
||||
end
|
||||
return 0 if textchars.length==0
|
||||
totallines=getTotalLines()
|
||||
line=0 if line<0
|
||||
line=totallines-1 if line>=totallines
|
||||
endpos=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==line
|
||||
endpos=thispos+thislength
|
||||
# echoln [endpos,thispos+(column-thiscolumn),textchars[i]]
|
||||
if column>=thiscolumn && column<=thiscolumn+thislength && thislength>0
|
||||
return thispos+(column-thiscolumn)
|
||||
end
|
||||
end
|
||||
if endpos==0
|
||||
# echoln [totallines,line,column]
|
||||
# echoln textchars
|
||||
end
|
||||
# echoln "endpos=#{endpos}"
|
||||
return endpos
|
||||
end
|
||||
# if endpos==0
|
||||
# echoln [totallines,line,column]
|
||||
# echoln textchars
|
||||
# end
|
||||
# echoln "endpos=#{endpos}"
|
||||
return endpos
|
||||
end
|
||||
|
||||
def getLastVisibleLine
|
||||
textchars=getTextChars()
|
||||
getTextChars()
|
||||
textheight=[1,self.contents.text_size("X").height].max
|
||||
lastVisible=@firstline+((self.height-self.borderY)/textheight)-1
|
||||
return lastVisible
|
||||
@@ -544,13 +517,9 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
@frame=0
|
||||
self.refresh
|
||||
end
|
||||
if @cursorLine<@firstline
|
||||
@firstline=@cursorLine
|
||||
end
|
||||
@firstline=@cursorLine if @cursorLine<@firstline
|
||||
lastVisible=getLastVisibleLine()
|
||||
if @cursorLine>lastVisible
|
||||
@firstline+=(@cursorLine-lastVisible)
|
||||
end
|
||||
@firstline+=(@cursorLine-lastVisible) if @cursorLine>lastVisible
|
||||
end
|
||||
|
||||
def moveCursor(lineOffset, columnOffset)
|
||||
@@ -570,7 +539,6 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
# Will happen if cursor is moved right from the end of a line
|
||||
@cursorLine+=1
|
||||
@cursorColumn=0
|
||||
updateColumns=true
|
||||
end
|
||||
# Ensure column bounds
|
||||
totalColumns=getColumnsInLine(@cursorLine)
|
||||
@@ -688,20 +656,13 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
self.contents=newContents
|
||||
bitmap=self.contents
|
||||
bitmap.clear
|
||||
x=0
|
||||
y=0
|
||||
getTextChars
|
||||
x+=4
|
||||
width=self.width-self.borderX
|
||||
height=self.height-self.borderY
|
||||
cursorcolor=Color.new(0,0,0)
|
||||
textchars=getTextChars()
|
||||
scanlength=@helper.length
|
||||
startY=getLineY(@firstline)
|
||||
lastheight=32
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
textY=textchars[i][2]-startY
|
||||
@@ -712,11 +673,10 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
c=textchars[i][0]
|
||||
# Don't draw spaces
|
||||
next if c==" "
|
||||
textwidth=textchars[i][3]+4 # add 4 to prevent draw_text from stretching text
|
||||
textwidth=textchars[i][3]+4 # add 4 to prevent draw_text from stretching text
|
||||
textheight=textchars[i][4]
|
||||
lastheight=textheight
|
||||
# Draw text
|
||||
pbDrawShadowText(bitmap,textchars[i][1],textY, textwidth, textheight, c,@baseColor,@shadowColor)
|
||||
pbDrawShadowText(bitmap, textchars[i][1], textY, textwidth, textheight, c, @baseColor, @shadowColor)
|
||||
end
|
||||
# Draw cursor
|
||||
if ((@frame/10)&1) == 0
|
||||
@@ -725,7 +685,6 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
cursorX=0
|
||||
for i in 0...textchars.length
|
||||
thisline=textchars[i][5]
|
||||
thispos=textchars[i][6]
|
||||
thiscolumn=textchars[i][7]
|
||||
thislength=textchars[i][8]
|
||||
if thisline==@cursorLine && @cursorColumn>=thiscolumn &&
|
||||
@@ -1560,7 +1519,6 @@ class Interpreter
|
||||
if $game_actors && $data_actors && $data_actors[@parameters[0]] != nil
|
||||
# Set battle abort flag
|
||||
$game_temp.battle_abort = true
|
||||
ret=""
|
||||
pbFadeOutIn {
|
||||
sscene=PokemonEntryScene.new
|
||||
sscreen=PokemonEntry.new(sscene)
|
||||
@@ -1583,7 +1541,6 @@ class Game_Interpreter
|
||||
end
|
||||
if $game_actors && $data_actors && $data_actors[@params[0]] != nil
|
||||
# Set battle abort flag
|
||||
ret=""
|
||||
pbFadeOutIn {
|
||||
sscene=PokemonEntryScene.new
|
||||
sscreen=PokemonEntry.new(sscene)
|
||||
|
||||
Reference in New Issue
Block a user