Added mp3 support back in, changed layout of townmapgen.html, screenshots now go in Screenshots folder, added "NoName" flag for trainer types

This commit is contained in:
Maruno17
2023-10-14 16:28:37 +01:00
parent d267956c6e
commit 25f85a9a8b
7 changed files with 90 additions and 40 deletions

View File

@@ -108,8 +108,8 @@ end
def pbResolveAudioSE(file) def pbResolveAudioSE(file)
return nil if !file return nil if !file
if RTP.exists?("Audio/SE/" + file, ["", ".wav", ".ogg"]) # ".mp3" if RTP.exists?("Audio/SE/" + file, ["", ".wav", ".ogg", ".mp3", ".wma"])
return RTP.getPath("Audio/SE/" + file, ["", ".wav", ".ogg"]) # ".mp3" return RTP.getPath("Audio/SE/" + file, ["", ".wav", ".ogg", ".mp3", ".wma"])
end end
return nil return nil
end end
@@ -197,7 +197,7 @@ module RTP
end end
def self.getAudioPath(filename) def self.getAudioPath(filename)
return self.getPath(filename, ["", ".wav", ".wma", ".mid", ".ogg", ".midi"]) # ".mp3" return self.getPath(filename, ["", ".wav", ".ogg", ".mp3", ".midi", ".mid", ".wma"])
end end
def self.getPath(filename, extensions = []) def self.getPath(filename, extensions = [])
@@ -261,7 +261,7 @@ end
#=============================================================================== #===============================================================================
module FileTest module FileTest
IMAGE_EXTENSIONS = [".png", ".gif"] # ".jpg", ".jpeg", ".bmp", IMAGE_EXTENSIONS = [".png", ".gif"] # ".jpg", ".jpeg", ".bmp",
AUDIO_EXTENSIONS = [".mid", ".midi", ".ogg", ".wav", ".wma"] # ".mp3" AUDIO_EXTENSIONS = [".wav", ".ogg", ".mp3", ".midi", ".mid", ".wma"]
def self.audio_exist?(filename) def self.audio_exist?(filename)
return RTP.exists?(filename, AUDIO_EXTENSIONS) return RTP.exists?(filename, AUDIO_EXTENSIONS)

View File

@@ -16,7 +16,8 @@ class Trainer
end end
def full_name def full_name
return _INTL("{1} {2}", trainer_type_name, @name) return @name if has_flag?("NoName")
return "#{trainer_type_name} #{@name}"
end end
#============================================================================= #=============================================================================

View File

@@ -611,7 +611,14 @@ end
def pbScreenCapture def pbScreenCapture
t = Time.now t = Time.now
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S.%L") filestart = t.strftime("[%Y-%m-%d] %H_%M_%S.%L")
capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart)) begin
Graphics.screenshot(capturefile) folder_name = "Screenshots"
Dir.create(folder_name) if !Dir.safe?(folder_name)
capturefile = folder_name + "/" + sprintf("%s.png", filestart)
Graphics.screenshot(capturefile)
rescue
capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart))
Graphics.screenshot(capturefile)
end
pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full") pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full")
end end

View File

@@ -508,8 +508,8 @@ module BattleAnimationEditor
ret = false ret = false
pbRgssChdir(File.join("Audio", "SE", "Anim")) do pbRgssChdir(File.join("Audio", "SE", "Anim")) do
animfiles.concat(Dir.glob("*.wav")) animfiles.concat(Dir.glob("*.wav"))
# animfiles.concat(Dir.glob("*.mp3"))
animfiles.concat(Dir.glob("*.ogg")) animfiles.concat(Dir.glob("*.ogg"))
animfiles.concat(Dir.glob("*.mp3"))
animfiles.concat(Dir.glob("*.wma")) animfiles.concat(Dir.glob("*.wma"))
end end
animfiles.uniq! animfiles.uniq!

View File

@@ -613,7 +613,7 @@ def pbImportAllAnimations
Graphics.update Graphics.update
audios = [] audios = []
files = Dir.glob(folder + "/*.*") files = Dir.glob(folder + "/*.*")
["wav", "ogg", "mid", "wma"].each do |ext| # mp3 ["wav", "ogg", "mp3", "midi", "mid", "wma"].each do |ext|
upext = ext.upcase upext = ext.upcase
audios.concat(files.find_all { |f| f[f.length - 3, 3] == ext }) audios.concat(files.find_all { |f| f[f.length - 3, 3] == ext })
audios.concat(files.find_all { |f| f[f.length - 3, 3] == upext }) audios.concat(files.find_all { |f| f[f.length - 3, 3] == upext })

View File

@@ -213,11 +213,12 @@ class MusicFileLister
folder = (@bgm) ? "Audio/BGM/" : "Audio/ME/" folder = (@bgm) ? "Audio/BGM/" : "Audio/ME/"
@commands.clear @commands.clear
Dir.chdir(folder) do Dir.chdir(folder) do
# Dir.glob("*.mp3") { |f| @commands.push(f) }
Dir.glob("*.ogg") { |f| @commands.push(f) }
Dir.glob("*.wav") { |f| @commands.push(f) } Dir.glob("*.wav") { |f| @commands.push(f) }
Dir.glob("*.mid") { |f| @commands.push(f) } Dir.glob("*.ogg") { |f| @commands.push(f) }
Dir.glob("*.mp3") { |f| @commands.push(f) }
Dir.glob("*.midi") { |f| @commands.push(f) } Dir.glob("*.midi") { |f| @commands.push(f) }
Dir.glob("*.mid") { |f| @commands.push(f) }
Dir.glob("*.wma") { |f| @commands.push(f) }
end end
@commands.uniq! @commands.uniq!
@commands.sort! { |a, b| a.downcase <=> b.downcase } @commands.sort! { |a, b| a.downcase <=> b.downcase }

View File

@@ -1,49 +1,80 @@
<body> <body>
<div id="map"> <div>
<img name="map" src="Graphics/Pictures/mapRegion0.png" alt="" width="480" height="320"/> <u>Town Map Generator</u>
</div> </div>
<form name="mf" action="javascript:void(null)"> <form name="mf" action="javascript:void(null)">
<div>
Map Filename (in Graphics/Pictures/): <input type="text" name="filename" value="mapRegion0.png"/>&nbsp;
<input type="button" name="btnChange" value="Change"/><br/ >
Square width: <input type="text" name="sqwidth" size="4" min="1" max="16" value="16"/>&nbsp;
Square height: <input type="text" name="sqheight" size="4" min="1" max="16" value="16"/>&nbsp;
<input type="button" name="btnRefresh" value="Refresh"/><br/ >
Region Name: <input type="text" name="name" value="Sample Region"/>&nbsp;
<input type="button" name="btnChange2" value="Change"/>
</div>
</form>
<hr/>
<form name="f" action="javascript:void(null)">
<table> <table>
<tr> <tr>
<td>Current Position:</td> <td>Filename:</td>
<td><input type="text" name="curpos" readonly="readonly"/></td> <td><input type="text" name="filename" value="mapRegion0.png"/></td>
<td><input type="button" name="btnChange" value="Change"/></td>
<td>Name of the region graphic (in Graphics/UI/Town Map/)</td>
</tr> </tr>
<tr> <tr>
<td>Name:</td> <td>Name:</td>
<td><input type="text" name="locname"/><td> <td><input type="text" name="name" value="Sample Region"/></td>
<td><input type="button" name="btnChange2" value="Change"/></td>
<td>Name of the region</td>
</tr> </tr>
<tr> <tr>
<td>Point of Interest:</td> <td>Square width:</td>
<td><input type="text" name="poi"/><td> <td><input type="text" name="sqwidth" size="4" min="1" max="16" value="16"/></td>
<td><input type="button" name="btnRefreshWidth" value="Refresh"/></td>
<td>Width of each point in the Town Map (in pixels)</td>
</tr> </tr>
<tr> <tr>
<td>Fly Destination:</td> <td>Square height:</td>
<td><input type="text" name="healing"/><td> <td><input type="text" name="sqheight" size="4" min="1" max="16" value="16"/></td>
<td><input type="button" name="btnRefreshHeight" value="Refresh"/></td>
<td>Height of each point in the Town Map (in pixels)</td>
</tr>
</table>
</form>
<hr/>
<div>
<u>Edit point properties</u><br />
Click on a point in the Town Map to edit its properties.
</div>
<div id="map">
<img name="map" src="Graphics/UI/Town Map/mapRegion0.png" alt="" width="480" height="320"/>
</div>
<form name="f" action="javascript:void(null)">
<table>
<tr>
<td>Co-ordinates:</td>
<td><input type="text" name="curpos" readonly="readonly"/></td>
<td>X and Y co-ordinates of this point in the Town Map (click in the map above)</td>
</tr>
<tr>
<td>Name:</td>
<td><input type="text" name="locname"/></td>
<td>Name of this location</td>
</tr>
<tr>
<td>Landmark:</td>
<td><input type="text" name="poi"/></td>
<td>Name of a landmark found in this location</td>
</tr>
<tr>
<td>Fly destination:</td>
<td><input type="text" name="healing"/></td>
<td>Map ID, X and Y tile co-ordinates the player will appear at when Flying to this location</td>
</tr> </tr>
<tr> <tr>
<td>Switch:</td> <td>Switch:</td>
<td><input type="text" name="swtch"/><td> <td><input type="text" name="swtch"/></td>
<td>Number of a Game Switch that needs to be ON to see this point's name/landmark and to Fly to this location</td>
</tr> </tr>
</table> </table>
<div> <div>
<input type="button" name="btnSave" value="Save" disabled="disabled"/> <input type="button" name="btnSave" value="Save" disabled="disabled"/>
<input type="button" name="btnCancel" value="Cancel"/><br/ > <input type="button" name="btnCancel" value="Cancel"/><br/ >
Single section from townmap.txt (without section heading):<br/ > <hr/>
<u>PBS file "town_map.txt" text for this region</u><br />
<textarea name="data" rows="10" cols="70"></textarea><br/ > <textarea name="data" rows="10" cols="70"></textarea><br/ >
<input type="button" name="btnLoad" value="Load"/> (To load data into the editor)<br/ > <input type="button" name="btnLoad" value="Load into map"/>&nbsp;
Copy the data above into townmap.txt when you're done. Apply the data in this box to the map above<br/ >
When you're done, copy this text into "town_map.txt". Remember that it needs a section line (a number in square brackets).
</div> </div>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
@@ -188,13 +219,18 @@
for(var i=0;i<lines.length;i++){ for(var i=0;i<lines.length;i++){
lines[i]=lines[i].replace(/\s+$/,"") lines[i]=lines[i].replace(/\s+$/,"")
if(!/^\#/.test(lines[i])&&!/^\s*$/.test(lines[i])){ if(!/^\#/.test(lines[i])&&!/^\s*$/.test(lines[i])){
esec=/^\s*\[\s*\d+\s*\]\s*$/.exec(lines[i])
if(esec){
continue;
}
e=/^\s*(\w+)\s*=\s*(.*)$/.exec(lines[i]) e=/^\s*(\w+)\s*=\s*(.*)$/.exec(lines[i])
if(!e){ if(!e){
alert("Bad line syntax in line "+(i+1)) alert("Bad line syntax in line "+(i+1))
} }
if(e[1]=="Filename"){ if(e[1]=="Filename"){
o=document.getElementById("map") o=document.getElementById("map")
o.innerHTML='<img name="map" src="Graphics/Pictures/'+e[2]+'" alt="" width="480" height="320"/'+'>' o.innerHTML='<img name="map" src="Graphics/UI/Town Map/'+e[2]+'" alt="" width="480" height="320"/'+'>'
document.mf.filename.value=e[2]
} else if(e[1]=="Name"){ } else if(e[1]=="Name"){
document.mf.name.value=e[2] document.mf.name.value=e[2]
} else if(e[1]=="Point"){ } else if(e[1]=="Point"){
@@ -356,7 +392,7 @@
showMapPoints() showMapPoints()
}) })
attachEvent(document.mf.btnChange,"click",function(e){ attachEvent(document.mf.btnChange,"click",function(e){
document.images.map.src="Graphics/Pictures/"+document.mf.filename.value document.images.map.src="Graphics/UI/Town Map/"+document.mf.filename.value
genMapPoints() genMapPoints()
showMapPoints() showMapPoints()
}) })
@@ -364,7 +400,12 @@
genMapPoints() genMapPoints()
showMapPoints() showMapPoints()
}) })
attachEvent(document.mf.btnRefresh,"click",function(e){ attachEvent(document.mf.btnRefreshWidth,"click",function(e){
choiceX=choiceY=-1
document.f.curpos.value=""
showMapPoints()
})
attachEvent(document.mf.btnRefreshHeight,"click",function(e){
choiceX=choiceY=-1 choiceX=choiceY=-1
document.f.curpos.value="" document.f.curpos.value=""
showMapPoints() showMapPoints()