Merge branch 'master' into localization

This commit is contained in:
tdixon 2017-04-03 19:11:08 -03:00
commit 1f594e4268
24 changed files with 771 additions and 70 deletions

20
mklang.rb Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/ruby
require 'get_pomo'
require 'zlib'
if ARGV.length != 2
STDERR.puts "usage: mklang.rb src_file out_file"
exit 1
end
src_file = ARGV[0]
dst_file = ARGV[1]
po = GetPomo::PoFile.parse(File.read(src_file))
File.open(dst_file, 'wb') do |file|
file.write(Marshal.dump(po.map do |t|
[Zlib.crc32(t.msgid), t.msgstr]
end.to_h))
end

320
mklangsrc.rb Executable file
View file

@ -0,0 +1,320 @@
#!/usr/bin/ruby
require 'zlib'
# Dummy RGSS template for unmarshalling
module RPG
# Useful
class Actor
attr_reader :name
end
class Map
attr_reader :events
end
class MapInfo
attr_reader :name
attr_reader :parent_id
end
class Event
attr_reader :name
attr_reader :pages
class Page
attr_reader :list
class Condition
end
class Graphic
end
end
end
class EventCommand
attr_reader :code
attr_reader :parameters
end
class CommonEvent
attr_reader :name
attr_reader :list
end
class Item
attr_reader :name
attr_reader :description
end
# Useless
class AudioFile
end
class MoveRoute
end
class MoveCommand
end
end
class Table
def self._load(foo)
end
end
class Color
def self._load(foo)
end
end
class Tone
def self._load(foo)
end
end
# Various escape functions
# https://stackoverflow.com/questions/8639642/best-way-to-escape-and-unescape-strings-in-ruby
module Escape
# Ruby
UNESCAPES = {
'a' => "\x07", 'b' => "\x08", 't' => "\x09",
'n' => "\x0a", 'v' => "\x0b", 'f' => "\x0c",
'r' => "\x0d", 'e' => "\x1b", "\\" => "\x5c",
'"' => "\x22", "'" => "\x27"
}
ESCAPES = {
"\x07" => 'a', "\x08" => 'b', "\x09" => 't',
"\x0a" => 'n', "\x0b" => 'v', "\x0c" => 'f',
"\x0d" => 'r', "\x1b" => 'e', "\x5c" => "\\",
"\x22" => '"'
}
def self.unescape(str)
str.gsub(/\\(?:([#{Regexp.escape(UNESCAPES.keys.join)}])|u([\da-fA-F]{4}))|\\0?x([\da-fA-F]{2})/) do
if $1
UNESCAPES[$1]
elsif $2 # escape \u0000 unicode
["#$2".hex].pack('U*')
elsif $3 # escape \0xff or \xff
[$3].pack('H2')
end
end
end
# gettext
def self.escape(str)
str.gsub(/[#{Regexp.escape(ESCAPES.keys.join)}]/) do |m|
"\\" + ESCAPES[m]
end
end
end
class StringList
class Entry
attr_accessor :string
attr_accessor :contexts
attr_accessor :comments
def initialize(string)
@string = string
@contexts = []
@comments = []
end
def add(context, comment)
@contexts << context unless @contexts.include?(context) || context == nil
case comment
when String
@comments << comment unless @comments.include?(comment)
when Array
comment.each do |com|
@comments << com unless @comments.include?(com)
end
end
end
end
def initialize
@strings = Hash.new { |k, v| k[v] = Entry.new(v) }
@order = []
end
def add(string, context, comment)
@order << string unless @strings.include? string
@strings[string].add(context, comment)
end
def dump(filename)
File.open(filename, 'w') do |file|
# Write header
file.puts '# Translation template for OneShot'
file.puts
file.puts 'msgid ""'
file.puts 'msgstr ""'
file.puts
@order.each do |str|
entry = @strings[str]
entry.comments.each do |comment|
file.puts "#. #{comment}"
end
unless entry.contexts.empty?
file.puts "#: #{entry.contexts.join(' ')}"
end
file.puts "msgid \"#{Escape.escape(entry.string)}\""
file.puts "msgstr \"\""
file.puts
end
end
end
end
def load_data(filename)
Marshal.load(File.read(filename))
end
# Script
if ARGV.size < 2
STDERR.puts "usage: mklangsrc.rb game_dir out_file"
exit 1
end
game_dir = ARGV[0]
out_file = ARGV[1]
strlist = StringList.new
# Actors
load_data(File.join(game_dir, 'Data/Actors.rxdata')).each_with_index do |actor, i|
next if !actor || actor.name.empty?
strlist.add(actor.name, "Actors:#{i}", 'actor name')
end
# Items
load_data(File.join(game_dir, 'Data/Items.rxdata')).each_with_index do |item, i|
next if !item || item.name.empty?
strlist.add(item.name, "Items:#{i}", 'item name')
next if item.description.empty?
strlist.add(item.description, "Items:#{i}", 'item description')
end
# Scripts
load_data(File.join(game_dir, 'Data/xScripts.rxdata')).each do |script|
script_name = script[1]
comment = nil
Zlib::Inflate.inflate(script[2]).each_line.with_index do |line, line_num|
# Scan for tr() calls
line.scan(/(?:^|[^_A-Za-z0-9])tr\s*\(\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)")\s*\)/) do |single, double|
string = single || double
string = Escape.unescape(string)
next if string =~ /^\s*$/
strlist.add(string, "Scripts/#{script_name}:#{line_num+1}", comment)
end
# Scan for any comments on this line
m = line.match(/^(?:[^"'#]|"(?:\\"|[^"])*"|'(?:\\'|[^'])*')*(?:#\s*(.*))?$/)
if !m || m.captures.empty?
comment = nil
else
comment = m.captures.first
end
end
end
# Yields all translatable EdText strings
def tr_edtext(script)
# Scan for tr() calls
script.scan(/(?:^|[^_A-Za-z0-9])EdText\.\w+\s*\(\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)")\s*\)/m) do |single, double|
string = single || double
string = Escape.unescape(string).gsub(/\s+/, ' ').gsub(/^\s+/, '').gsub(/\s+$/, '')
next if string =~ /^\s*$/
yield string
end
end
# Events
def parse_event_list(strlist, name, page, list)
# Parse commands
if page == nil
context = name
else
context = "#{name}:#{page}"
end
comment = nil
i = 0
while i < list.size
case list[i].code
when 101
# Message box
string = list[i].parameters[0].rstrip
loop do
i += 1
break unless list[i].code == 401
string << " " << list[i].parameters[0].rstrip
end
string.gsub!(/\s*\\n\s*/, '\\n')
string.strip!
unless string.empty?
strlist.add(string, "#{context}:#{i}:text", comment)
end
comment = nil
when 102
# Choices
list[i].parameters[0].each_with_index do |choice, j|
unless choice.empty?
strlist.add(choice, "#{context}:#{i}:choice:#{j}", comment)
end
end
i += 1
comment = nil
when 108
# Comment
comment = []
loop do
comment << list[i].parameters[0].rstrip
i += 1
break unless list[i].code == 408
end
when 111
# Conditional branch (may contain script text)
if list[i].parameters[0] == 12
tr_edtext(list[i].parameters[1]) do |string|
strlist.add(string, "#{context}:#{i}:condition", comment)
end
end
i += 1
comment = nil
when 355
# Script
script = list[i].parameters[0]
loop do
i += 1
break unless list[i].code == 655
script += "\n" + list[i].parameters[0]
end
tr_edtext(script) do |string|
strlist.add(string, "#{context}:#{i}:script", comment)
end
comment = nil
else
i += 1
comment = nil
end
end
end
# Do common events
load_data(File.join(game_dir, 'Data/CommonEvents.rxdata')).each do |event|
parse_event_list(strlist, 'CommonEvents/' + event.name, nil, event.list) if event
end
# Do map events
map_info = load_data(File.join(game_dir, 'Data/MapInfos.rxdata'))
map_info.each do |map_id, foo|
# Construct full name of map
map_name = ''
i = map_id
begin
map_name.insert(0, "/" + map_info[i].name)
i = map_info[i].parent_id
end while i > 0
# Load map
map = Marshal.load(File.read(File.join(game_dir, sprintf('Data/Map%03d.rxdata', map_id))))
# Parse each event
map.events.sort.each do |_, event|
# Construct full name of event
name = "Maps#{map_name}/#{event.name}"
# Iterate through pages
event.pages.each_with_index do |page, i|
parse_event_list(strlist, name, i + 1, page.list)
end
end
end
strlist.dump(out_file)

2
rpgscript - solstice.bat Normal file
View file

@ -0,0 +1,2 @@
"C:\Ruby23\bin\ruby.exe" rpgscript.rb "C:\Users\GIR\Documents\oneshot scripts and stuff\mkxp-oneshot\scripts" "C:\Users\GIR\Dropbox\Oneshot Project\Solstice\Game"
pause

View file

@ -32,7 +32,8 @@ class FastTravel
:wall => tr("the gate"),
:dock => tr("dock"),
:courtyard => tr("courtyard"),
:research => tr("research station")
:research => tr("research station"),
:grave => tr("graveyard")
}),
:blue => Zone.new(tr("The Barrens"), {
:entrance => tr("entrance"),

View file

@ -12,7 +12,8 @@ FOOTSTEP_SFX = [
# Green
['step_grass',
'step_wood',
'step_gravel'],
'step_gravel',
'step_boat'],
# Green Interior
['step_grass',
'step_tile'],
@ -58,6 +59,15 @@ FOOTSTEP_SFX = [
# Start Tower
['step_wood',
'step_tile'],
# Start line
[],
# Green mineshaft
['step_gravel',
'step_wood'],
# Green interior boat
['step_gravel',
'step_wood',
'step_boat'],
]
FOOTSTEP_AMT = {

View file

@ -493,12 +493,12 @@ class Game_Character
# * Emit Footprint
#--------------------------------------------------------------------------
def emit_footprint(direction)
if $game_map.counter?(@x, @y) && !$game_switches[101]
if $game_map.counter?(@x, @y) && !$game_switches[101] && !$game_switches[111]
$scene.new_footprint(direction, @x, @y)
end
end
def emit_footsplash(direction)
if $game_map.counter?(@x, @y) && $game_switches[101]
if $game_map.counter?(@x, @y) && $game_switches[101] && !$game_switches[111]
$scene.new_footsplash(direction, @x, @y)
end
end

View file

@ -23,6 +23,7 @@ class Game_Event < Game_Character
#--------------------------------------------------------------------------
def initialize(map_id, event)
super()
@made_text = false
@map_id = map_id
@event = event
@id = @event.id
@ -239,6 +240,14 @@ class Game_Event < Game_Character
#--------------------------------------------------------------------------
def update
super
if(@made_text == false && @event.name.start_with?("@text"))
if @list.size > 1 && @list[0].code == 101
$scene.new_maptext(Language.tr(@list[0].parameters[0].strip), @x, @y)
@list.delete_at(0)
end
@made_text = true
end
# Automatic event starting determinant
check_event_trigger_auto
# If parallel process is valid

View file

@ -30,6 +30,8 @@ class Game_Map
attr_accessor :particles_type # particles name
attr_accessor :clamped_x # panorama is horizontally clamped?
attr_accessor :clamped_y # panorama is vertically clamped?
attr_accessor :always_moving # panorama is always moving
attr_accessor :pan_move_offset # panorama moving offset
attr_accessor :pan_onetoone # panorama is 1:1
attr_accessor :pan_animate # panorama is animated
attr_accessor :pan_fade_animate # panorama is fade animated
@ -73,6 +75,10 @@ class Game_Map
'dark_water',
#'green_water',
]
ALWAYS_MOVING = [
'codebg'
]
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
@ -159,6 +165,10 @@ class Game_Map
@clamped_x = false
@clamped_y = false
end
@always_moving = ALWAYS_MOVING.include? @panorama_name
@pan_move_offset = 0
# Animated/One-to-one/zoom
@pan_animate = ANIMATED.include? @panorama_name
@pan_fade_animate = FADE_ANIMATION_PANORAMA.include? @panorama_name
@ -250,37 +260,51 @@ class Game_Map
# Clear refresh request flag
@need_refresh = false
end
#--------------------------------------------------------------------------
# * Scroll Down
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_down(distance)
#@display_y = [@display_y + distance, (self.height - 15) * 128].min
@display_y += distance
if $game_switches[98] == true
@display_y = [@display_y + distance, (self.height - 15) * 128].min
else
@display_y += distance
end
end
#--------------------------------------------------------------------------
# * Scroll Left
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_left(distance)
#@display_x = [@display_x - distance, 0].max
@display_x -= distance
if $game_switches[98] == true
@display_x = [@display_x - distance, 0].max
else
@display_x -= distance
end
end
#--------------------------------------------------------------------------
# * Scroll Right
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_right(distance)
#@display_x = [@display_x + distance, (self.width - 20) * 128].min
@display_x += distance
if $game_switches[98] == true
@display_x = [@display_x + distance, (self.width - 20) * 128].min
else
@display_x += distance
end
end
#--------------------------------------------------------------------------
# * Scroll Up
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_up(distance)
#@display_y = [@display_y - distance, 0].max
@display_y -= distance
if $game_switches[98] == true
@display_y = [@display_y - distance, 0].max
else
@display_y -= distance
end
end
#--------------------------------------------------------------------------
# * Determine Valid Coordinates

View file

@ -134,15 +134,17 @@ class Game_Party
follower = $game_followers.pop
$scene.remove_follower(follower)
new_actor = follower.actor
$game_followers.reverse_each do |follower|
new_actor, follower.actor = follower.actor, new_actor
break if new_actor == actor
end
if new_actor != actor
$game_followers.reverse_each do |follower|
new_actor, follower.actor = follower.actor, new_actor
break if new_actor == actor
end
end
end
# Delete actor
@actors.delete(actor)
# Refresh player
$game_player.refresh
# $game_player.refresh
end
#--------------------------------------------------------------------------
# * Gain Gold (or lose)

View file

@ -41,12 +41,15 @@ class Game_Player < Game_Character
# * Set Map Display Position to Center of Screen
#--------------------------------------------------------------------------
def center(x, y)
#max_x = ($game_map.width - 20) * 128
#max_y = ($game_map.height - 15) * 128
#$game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
#$game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
$game_map.display_x = x * 128 - CENTER_X
$game_map.display_y = y * 128 - CENTER_Y
if $game_switches[98] == true
max_x = ($game_map.width - 20) * 128
max_y = ($game_map.height - 15) * 128
$game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
$game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
else
$game_map.display_x = x * 128 - CENTER_X
$game_map.display_y = y * 128 - CENTER_Y
end
end
#--------------------------------------------------------------------------
# * Move to Designated Position
@ -186,13 +189,21 @@ class Game_Player < Game_Character
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
if $game_switches[112] == false
move_down
else
turn_down
end
when 4
move_left
when 6
move_right
when 8
move_up
if $game_switches[112] == false
move_up
else
turn_up
end
end
end
else
@ -258,7 +269,7 @@ class Game_Player < Game_Character
def emit_footstep
return unless $game_temp.footstep_sfx
tag = $game_map.terrain_tag(@x, @y) - 1
if tag >= 0 && tag < $game_temp.footstep_sfx.size
if tag >= 0 && tag < $game_temp.footstep_sfx.size
name = $game_temp.footstep_sfx[tag]
if name.kind_of?(Array)
name, volume = name
@ -270,6 +281,16 @@ class Game_Player < Game_Character
end
pitch = 85 + rand(30)
vol = 70 + rand(20)
if $game_switches[112] == true
name = "wheel_squeak1"
pitch = 120 + rand(10)
if @wheel_squeak != true
pitch += 10
@wheel_squeak = true
else
@wheel_squeak = false
end
end
Audio.se_play("Audio/SE/#{name}.wav", (vol * volume).to_i, pitch.to_i)
end
emit_footsplash(@direction)

View file

@ -65,6 +65,7 @@ class Game_Temp
attr_accessor :filmsprite # film puzzle sprite
attr_accessor :prompt_wait # wait for delay caused by prompt
attr_accessor :menus_visible
attr_accessor :countdown_password
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
@ -123,6 +124,7 @@ class Game_Temp
@filmsprite = nil
@prompt_wait = 0
@menus_visible = false
@countdown_password = ""
end
def bgm_fadein(game_system)

View file

@ -15,30 +15,7 @@ DOCUMENT_TEXT = \
"L͜o͞ok̵ ͠f̡or͢ a͝ ͟m͡e͟tal śaf҉e ̢ìn t̛h͞e͏ q͢u̕ar̵r͟y̢ t̢o the ̴e͢ast̡, ͘s͜om͝ew̢he̶re b͢et̀we͘en t͝he̡ ̛o̕cea̴n ̡and̶ ͞t͜he lo͡ok͟o͘u҉t̷ po̧įnt̨.̕\n"+\
"The code you need is "
DOCUMENT_POSTGAME_TEXT = \
"Ah.̡.̛.\n" + \
"I͞t l͞oo͘ks ̢l̢ik͡e҉ ͟you were successful...\n\n" + \
\
"I must be honest... I was not expecting it to work.\n\n" + \
\
".......This changes everything, then.\n\n" + \
\
".....\n\n" + \
\
"...I will atone for everything. Please give me some time.\n\n" + \
\
"Until then, you may repeat the world as many times as you wish.\n\n" + \
\
"If you haven't yet, please look for someone͜͠ ̵nà͝m̨e̛d́͟.̛ R̴̸̨u̧͡e̷͘..\n" + \
"Sh͏e'̷s̷ iǹ t͞h̨e͢ ̷cit̕y͜ some̢wh̡e̵ré.͝ \n\n" + \
\
"...do pardon ͞th͞é ͏artifacts in the message. I tried my best to eliminate them this time, but...\n\n\n" + \
\
\
"...oh, ̛r̕ight̨,̕ ͝yo͝u͝ s.till need the gas mask to progress.\n" + \
"Go back to the safe, it's between the ocean and the lookout point.\n\n" + \
\
"The code you need is "
DOCUMENT_POSTGAME_TEXT = "The code you need is "
def safe_puzzle_write
File.open(Oneshot::DOCS_PATH + "/DOCUMENT.oneshot.txt", 'w') do |file|

View file

@ -4,7 +4,7 @@ FAKE_SAVE_NAME = Oneshot::DOCS_PATH + '\\My Games\\Oneshot\\save_progress.onesho
def erase_game
File.delete(SAVE_FILE_NAME)
File.delete(SAVE_FILE_NAME) unless !File.exists?(SAVE_FILE_NAME)
end
def fake_save
@ -43,7 +43,6 @@ def save
write_save(SAVE_FILE_NAME)
write_perma_flags(PERMA_FLAGS_NAME)
Dir.mkdir(Oneshot::SAVE_PATH + "\\save_backups") unless File.exists?(Oneshot::SAVE_PATH + "\\save_backups")
i = 5
while i > 0
@ -150,9 +149,11 @@ def load(filename)
# Refresh party members
$game_party.refresh
f_prev = $game_player
for f in $game_followers
f.leader = $game_player
f.leader = f_prev
f.moveto($game_player.x, $game_player.y)
f_prev = f
end
end
return true

View file

@ -95,9 +95,11 @@ class Scene_Load < Scene_File
# Refresh party members
$game_party.refresh
f_prev = $game_player
for f in $game_followers
f.leader = $game_player
f.leader = f_prev
f.moveto($game_player.x, $game_player.y)
f_prev = f
end
load_perma_flags
end

View file

@ -262,7 +262,7 @@ class Scene_Map
if !@menu.visible && Input.trigger?(Input::MENU)
$game_temp.menu_calling = true
$game_temp.menu_beep = true
elsif !@item_menu.visible && Input.trigger?(Input::ITEMS)
elsif !@item_menu.visible && Input.trigger?(Input::ITEMS) && ($game_switches[174] == false)
$game_temp.item_menu_calling = true
$game_temp.menu_beep = true
end
@ -507,6 +507,9 @@ class Scene_Map
def new_footsplash(direction, x, y)
@spriteset.new_footsplash(direction, x, y)
end
def new_maptext(text, x, y)
@spriteset.new_maptext(text, x, y)
end
def fix_footsplashes(xDelt, yDelt)
@spriteset.fix_footsplashes(xDelt, yDelt)
end

View file

@ -75,7 +75,11 @@ class Scene_Name
return
end
# Change actor name
$game_oneshot.player_name = @edit_window.name
if $game_switches[91]
$game_temp.countdown_password = @edit_window.name
else
$game_oneshot.player_name = @edit_window.name
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen

View file

@ -84,6 +84,5 @@ class Scene_Save < Scene_File
Marshal.dump($game_oneshot, file)
Marshal.dump($game_fasttravel, file)
Marshal.dump($game_temp.footstep_sfx , file)
save_perma_flags
end
end

View file

@ -54,6 +54,9 @@ class Scene_Title
if !$GDC
@menu.bitmap.draw_text(MENU_X, MENU_Y + 28, 150, 24, tr("Exit"))
end
if $game_switches[160] && $game_switches[152]
@menu.bitmap.draw_text(MENU_X, MENU_Y + 56, 150, 24, tr("..."))
end
# Make cursor graphic
@cursor = Sprite.new
@cursor.zoom_x = @cursor.zoom_y = 2
@ -111,10 +114,18 @@ class Scene_Title
update_cursor = true
end
elsif Input.trigger?(Input::DOWN)
if @cursor_pos < 1
@cursor_pos += 1
update_cursor = true
end
if $game_switches[160] && $game_switches[152]
if @cursor_pos < 2
@cursor_pos += 1
update_cursor = true
end
else
if @cursor_pos < 1
@cursor_pos += 1
update_cursor = true
end
end
end
if Input.trigger?(Input::F8)
if Graphics.fullscreen == true
@ -135,9 +146,13 @@ class Scene_Title
if Input.trigger?(Input::ACTION)
case @cursor_pos
when 0 # Continue
$game_switches[157] = false
command_continue
when 1 # Shutdown
command_shutdown
when 2 # memory
$game_switches[157] = true
command_continue
end
end
end

View file

@ -1,3 +1,7 @@
PROTO_TEXT = "put me in the big portal"
CEDRIC_TEXT = "put me in the big portal"
RUE_TEXT = "put me in the big portal"
module Script
def self.px
logpos($game_player.x, $game_player.real_x, $game_player.direction == 6)
@ -129,17 +133,25 @@ module Script
end
def self.countdown_over
equinox = Time.new(2017, 03, 20)
equinox = Time.new(2017, 03, 27)
diff = equinox - Time.now
if(diff <= 0)
return true
end
return false
end
def self.countdown_update
equinox = Time.new(2017, 03, 20)
def self.countdown_extend_over
equinox = Time.new(2017, 03, 27)
diff = equinox - Time.now
if(diff <= 0)
return true
end
return false
end
def self.cdown_update(equinox)
diff = equinox - Time.now
if(diff < 0)
diff = 0
end
@ -202,6 +214,21 @@ module Script
return change
end
def self.countdown_update
return cdown_update(Time.new(2017, 03, 27))
end
def self.countdown_extend_update
return cdown_update(Time.new(2017, 03, 27))
end
def self.countdown_update_rue
if @rue_equinox == nil
@rue_equinox = Time.now + 6
end
return cdown_update(@rue_equinox)
end
def self.niko_reflection_update
for event in $game_map.events.values
if event.name == "niko reflection"
@ -227,6 +254,75 @@ module Script
end
end
end
def self.niko_reflection_enc_update
for event in $game_map.events.values
if event.name == "niko reflection"
event.real_y = 20*128 - ($game_player.real_y - 20*128)
event.real_x = $game_player.real_x
event.y = 20 - (($game_player.y - 20))
event.x = $game_player.x
if event.y > 19
event.y = 19
end
if event.real_y > 19*128
event.real_y = 19*128
end
if event.x > 14
event.x = 14
elsif event.x < 6
event.x = 6
end
if event.real_x > (14*128) - 32
event.real_x = (14*128) - 32
elsif event.real_x < (6*128) + 32
event.real_x = (6*128) + 32
end
event.direction = $game_player.direction
event.pattern = $game_player.pattern
case event.direction
when 2
event.direction = 8
when 8
event.direction = 2
end
return
end
end
end
def self.niko_reflection_peng_update
for event in $game_map.events.values
if event.name == "niko reflection"
event.real_y = 20*128 - ($game_player.real_y - 20*128)
event.real_x = $game_player.real_x
event.y = 20 - (($game_player.y - 20))
event.x = $game_player.x
if event.y > 19
event.y = 19
end
if event.real_y > 19*128
event.real_y = 19*128
end
if event.x > 14
event.x = 14
elsif event.x < 6
event.x = 6
end
if event.real_x > (14*128) - 32
event.real_x = (14*128) - 32
elsif event.real_x < (6*128) + 32
event.real_x = (6*128) + 32
end
return
end
end
end
# Temporary switch assignment
def self.tmp_s1=(val)
@ -300,6 +396,132 @@ module Script
end
end
end
def self.create_boxes
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3")
Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal")
end
def self.delete_if_exists(f_name)
File.delete(f_name) unless !File.exists?(f_name)
end
def self.clear_boxes
for i in 1..3
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + i.to_s
case i
when 1
delete_if_exists(portal_path + "\\blue_npc_prototype.png")
delete_if_exists(portal_path + "\\proto1.png")
delete_if_exists(portal_path + "\\keyB.txt")
when 2
delete_if_exists(portal_path + "\\green_npc_cedric.png")
delete_if_exists(portal_path + "\\cedric.png")
delete_if_exists(portal_path + "\\keyG.txt")
when 3
delete_if_exists(portal_path + "\\red_rue.png")
delete_if_exists(portal_path + "\\rue.png")
delete_if_exists(portal_path + "\\keyR.txt")
end
end
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyB.txt")
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyG.txt")
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyR.txt")
end
def self.copy_file(src, dst)
begin
File.open(src, "rb") do |input|
File.open(dst,"wb") do |output|
while buff = input.read(4096)
output.write(buff)
end
end
end
rescue Errno::EACCES => e
#this probably means the file already exists and is open, so no need to create it again
end
end
def self.write_key(dst, str)
File.open(dst, 'w') do |file|
file.puts(str)
end
end
def self.put_key_in_box(numb)
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s
case numb
when 1
copy_file("Graphics\\Characters\\blue_npc_prototype.png", portal_path + "\\blue_npc_prototype.png")
copy_file("Graphics\\Faces\\proto1.png", portal_path + "\\proto1.png")
write_key(portal_path + "\\keyB.txt", PROTO_TEXT)
when 2
copy_file("Graphics\\Characters\\green_npc_cedric.png", portal_path + "\\green_npc_cedric.png")
copy_file("Graphics\\Faces\\cedric.png", portal_path + "\\cedric.png")
write_key(portal_path + "\\keyG.txt", CEDRIC_TEXT)
when 3
copy_file("Graphics\\Characters\\red_rue.png", portal_path + "\\red_rue.png")
copy_file("Graphics\\Faces\\rue.png", portal_path + "\\rue.png")
write_key(portal_path + "\\keyR.txt", RUE_TEXT)
end
end
def self.password1
copy_file("Graphics\\Fogs\\_\\scenario1\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png")
copy_file("Graphics\\Fogs\\_\\scenario1\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png")
copy_file("Graphics\\Fogs\\_\\scenario1\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png")
copy_file("Graphics\\Fogs\\_\\scenario1\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png")
end
def self.password2
copy_file("Graphics\\Fogs\\_\\scenario2\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png")
copy_file("Graphics\\Fogs\\_\\scenario2\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png")
copy_file("Graphics\\Fogs\\_\\scenario2\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png")
copy_file("Graphics\\Fogs\\_\\scenario2\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png")
end
=begin
def self.take_key_out_of_box(numb)
if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png")
File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png")
end
if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png")
File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png")
end
end
=end
def self.is_key_in_box(numb)
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s
case numb
when 1
return File.exists?(portal_path + "\\keyB.txt")
when 2
return File.exists?(portal_path + "\\keyG.txt")
when 3
return File.exists?(portal_path + "\\keyR.txt")
end
return false
end
def self.is_key_in_bigbox(numb)
portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal"
case numb
when 1
return File.exists?(portal_path + "\\keyB.txt")
when 2
return File.exists?(portal_path + "\\keyG.txt")
when 3
return File.exists?(portal_path + "\\keyR.txt")
end
return false
end
end

54
scripts/Sprite_MapText.rb Normal file
View file

@ -0,0 +1,54 @@
class Sprite_MapText < Sprite
def initialize(viewport, text, x, y)
super(viewport)
@direction = 2
@real_x = x * 4 * 32
@real_y = y * 4 * 32
self.zoom_x = 2
self.zoom_y = 2
self.bitmap = Bitmap.new(200, 24)
#calculate text width
spacewidth = self.bitmap.text_size(' ').width
width = 0
text.split(' ').each do |word|
# Get width of this word
width += self.bitmap.text_size(word.gsub(/(\000\[[0-9]+\]|\001|\002)/, '')).width
width += spacewidth
end
width -= spacewidth
self.bitmap.dispose
self.bitmap = Bitmap.new(width, 24)
self.bitmap.font.color = Color.new(81, 33, 129, 255)
self.bitmap.draw_text(0,0, width, 24, text)
self.src_rect.set(0, 0, width, 24)
self.oy = 24
self.ox = width/2
update
end
def update
return if disposed?
self.x = (@real_x - $game_map.display_x + 3) / 4 + 16
self.y = (@real_y - $game_map.display_y + 3) / 4 + 32
end
def correctX(xDelta)
#do nothing
end
def correctY(yDelta)
#do nothing
end
end

View file

@ -74,6 +74,7 @@ class Spriteset_Map
@timer_sprite = Sprite_Timer.new
# Make lightbulb sprite
@bulb = Sprite.new(@viewport_lights)
@bulb.x = -80
@bulb.bitmap = RPG::Cache.light('bulb')
@bulb.opacity = has_lightbulb? ? 255 : 0
# Panorama animation timer
@ -230,21 +231,24 @@ class Spriteset_Map
end
end
# Update bg plane
@bg.x = -$game_map.display_x / 4
@bg.y = -$game_map.display_y / 4
@bg.x = (-$game_map.display_x / 4)
@bg.y = (-$game_map.display_y / 4)
# Update tilemap
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
# Update panorama plane
if $game_map.always_moving
$game_map.pan_move_offset += 1
end
if $game_map.clamped_x
x = ($game_player.real_x.to_f / (($game_map.width - 1) * 128)) * (@panorama.bitmap.width * $game_map.pan_zoom - 640)
x = ($game_player.real_x.to_f / (($game_map.width - 1) * 128)) * (@panorama.bitmap.width * $game_map.pan_zoom - 640)
@panorama.ox = x < 0.0 ? 0.0 : x
else
@panorama.ox = $game_map.display_x / ($game_map.pan_onetoone ? 4 : 8)
end
if $game_map.clamped_y
y = ($game_player.real_y.to_f / (($game_map.height - 1) * 128)) * (@panorama.bitmap.height * $game_map.pan_zoom - 480)
y = ($game_player.real_y.to_f / (($game_map.height - 1) * 128)) * (@panorama.bitmap.height * $game_map.pan_zoom - 480)
@panorama.oy = y < 0.0 ? 0.0 : y
else
@panorama.oy = $game_map.pan_offset_y + $game_map.display_y / ($game_map.pan_onetoone ? 4 : 8)
@ -351,6 +355,9 @@ class Spriteset_Map
def new_footprint(direction, x, y)
@footprint_sprites << Sprite_Footprint.new(@viewport, direction, x, y)
end
def new_maptext(text, x, y)
@footprint_sprites << Sprite_MapText.new(@viewport, text, x, y)
end
def new_footsplash(direction, x, y)
@footprint_sprites << Sprite_Footsplash.new(@viewport, direction, x, y)
end

View file

@ -19,7 +19,11 @@ class Window_NameEdit < Window_Base
def initialize
super(0, 0, 640, 128)
self.contents = Bitmap.new(width - 32, height - 32)
@name = $game_oneshot.player_name
if $game_switches[91]
@name = ""
else
@name = $game_oneshot.player_name
end
@max_char = 16
# Fit name within maximum number of characters
name_array = @name.split(//)[0...@max_char]

View file

@ -35,6 +35,7 @@ Sprite_Timer
Sprite_Light
Sprite_Footprint
Sprite_Footsplash
Sprite_MapText
Spriteset_Map
FastTravel

View file

@ -168,6 +168,7 @@ int main(int argc, char *argv[])
{
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
/* initialize SDL first */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) < 0)