From c0bf423bbf8d01bdf3b3bb2d9da66a020913d5ba Mon Sep 17 00:00:00 2001 From: Mathew Velasquez Date: Sun, 22 Nov 2015 18:06:34 -0500 Subject: [PATCH] Reorganized files --- scripts/{Footsteps.rb => Data_Footsteps.rb} | 0 scripts/{Item.rb => Data_Item.rb} | 0 ...tData_Data.rb => Data_SpecialEventData.rb} | 12 ++ scripts/Language.rb | 15 --- scripts/Map.rb | 41 ------- scripts/Name.rb | 3 - scripts/Position.rb | 17 --- scripts/{Pixel.rb => Puzzle_Pixel.rb} | 0 scripts/{Sokoban.rb => Puzzle_Sokoban.rb} | 0 scripts/Script Aux.rb | 47 -------- scripts/Script.rb | 111 ++++++++++++++++++ scripts/SpecialEventData.rb | 13 -- scripts/{Light.rb => Sprite_Light.rb} | 0 scripts/_scripts.txt | 36 +++--- .../{Language_Data.rb => i18n_Language.rb} | 14 +++ scripts/{Translator.rb => i18n_Translator.rb} | 0 16 files changed, 153 insertions(+), 156 deletions(-) rename scripts/{Footsteps.rb => Data_Footsteps.rb} (100%) rename scripts/{Item.rb => Data_Item.rb} (100%) rename scripts/{SpecialEventData_Data.rb => Data_SpecialEventData.rb} (83%) delete mode 100644 scripts/Language.rb delete mode 100644 scripts/Map.rb delete mode 100644 scripts/Name.rb delete mode 100644 scripts/Position.rb rename scripts/{Pixel.rb => Puzzle_Pixel.rb} (100%) rename scripts/{Sokoban.rb => Puzzle_Sokoban.rb} (100%) delete mode 100644 scripts/Script Aux.rb create mode 100644 scripts/Script.rb delete mode 100644 scripts/SpecialEventData.rb rename scripts/{Light.rb => Sprite_Light.rb} (100%) rename scripts/{Language_Data.rb => i18n_Language.rb} (91%) rename scripts/{Translator.rb => i18n_Translator.rb} (100%) diff --git a/scripts/Footsteps.rb b/scripts/Data_Footsteps.rb similarity index 100% rename from scripts/Footsteps.rb rename to scripts/Data_Footsteps.rb diff --git a/scripts/Item.rb b/scripts/Data_Item.rb similarity index 100% rename from scripts/Item.rb rename to scripts/Data_Item.rb diff --git a/scripts/SpecialEventData_Data.rb b/scripts/Data_SpecialEventData.rb similarity index 83% rename from scripts/SpecialEventData_Data.rb rename to scripts/Data_SpecialEventData.rb index 731c99d..9862739 100644 --- a/scripts/SpecialEventData_Data.rb +++ b/scripts/Data_SpecialEventData.rb @@ -1,4 +1,16 @@ class SpecialEventData + attr_reader :flags + attr_reader :collision + + def initialize(flags, collision) + @flags = flags + @collision = collision + end + + def self.get(name) + return SPECIAL_EVENTS[name] + end + SPECIAL_EVENTS = { :bigpool => SpecialEventData.new( [:bottom], diff --git a/scripts/Language.rb b/scripts/Language.rb deleted file mode 100644 index 7d83caf..0000000 --- a/scripts/Language.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Language - attr_reader :font - attr_reader :character_table - attr_reader :character_table_height - - def initialize(font, character_table, character_table_height) - @font = font - @character_table = character_table - @character_table_height = character_table_height - end - - def self.get(code = :en) - return LANGUAGES[code] || LANGUAGES[:en] - end -end diff --git a/scripts/Map.rb b/scripts/Map.rb deleted file mode 100644 index e112108..0000000 --- a/scripts/Map.rb +++ /dev/null @@ -1,41 +0,0 @@ -def bg(name) - $game_map.bg_name = name -end - -def particles(type) - $game_map.particles_type = type -end - -def ambient(r, g = -1, b = -1) - g = r if g < 0 - b = r if b < 0 - #$scene.ambient = Color.new(r, g, b) -end - -def clear_ambient - #$scene.ambient = Color.new(255, 255, 255) -end - -def add_light(id, file, intensity, x, y) - #$scene.add_light(id, file, intensity, x, y) -end - -def del_light(id) - #$scene.del_light(id) -end - -def clear_lights - #$scene.clear_lights -end - -def fade_in_bulb - #$scene.fade_in_bulb -end - -def clamp_panorama - $game_map.clamped_panorama = true -end - -def wrap_map - $game_map.wrapping = true -end diff --git a/scripts/Name.rb b/scripts/Name.rb deleted file mode 100644 index fc83378..0000000 --- a/scripts/Name.rb +++ /dev/null @@ -1,3 +0,0 @@ -def enter_name - $game_temp.name_calling = true -end diff --git a/scripts/Position.rb b/scripts/Position.rb deleted file mode 100644 index 385c6a8..0000000 --- a/scripts/Position.rb +++ /dev/null @@ -1,17 +0,0 @@ -def check_exit(min, max, x: -1, y: -1) - result = false - if x >= 0 - if $game_player.x == x - if $game_player.y >= min && $game_player.y <= max - result = true - end - end - elsif y >= 0 - if $game_player.y == y - if $game_player.x >= min && $game_player.x <= max - result = true - end - end - end - Script.tmp_s1 = $game_switches[11] ? false : result -end diff --git a/scripts/Pixel.rb b/scripts/Puzzle_Pixel.rb similarity index 100% rename from scripts/Pixel.rb rename to scripts/Puzzle_Pixel.rb diff --git a/scripts/Sokoban.rb b/scripts/Puzzle_Sokoban.rb similarity index 100% rename from scripts/Sokoban.rb rename to scripts/Puzzle_Sokoban.rb diff --git a/scripts/Script Aux.rb b/scripts/Script Aux.rb deleted file mode 100644 index 9caef44..0000000 --- a/scripts/Script Aux.rb +++ /dev/null @@ -1,47 +0,0 @@ -module Script - def self.px - logpos($game_player.x, $game_player.real_x, $game_player.direction == 6) - end - - def self.py - logpos($game_player.y, $game_player.real_y, $game_player.direction == 2) - end - - # Temporary switch assignment - def self.tmp_s1=(val) - $game_switches[TMP_INDEX+0] = val - end - - def self.tmp_s2=(val) - $game_switches[TMP_INDEX+1] = val - end - - def self.tmp_s3=(val) - $game_switches[TMP_INDEX+2] = val - end - - def self.tmp_v1=(val) - $game_variables[TMP_INDEX+0] = val - end - - def self.tmp_v2=(val) - $game_variables[TMP_INDEX+1] = val - end - - def self.tmp_v3=(val) - $game_variables[TMP_INDEX+2] = val - end - - private - TMP_INDEX = 22 - - def self.logpos(pos, realpos, positive) - bigpos = pos * 128 - if realpos < bigpos - return pos - 1 if positive - elsif realpos > bigpos - return pos + 1 if positive - end - return pos - end -end diff --git a/scripts/Script.rb b/scripts/Script.rb new file mode 100644 index 0000000..c90663d --- /dev/null +++ b/scripts/Script.rb @@ -0,0 +1,111 @@ +module Script + def self.px + logpos($game_player.x, $game_player.real_x, $game_player.direction == 6) + end + + def self.py + logpos($game_player.y, $game_player.real_y, $game_player.direction == 2) + end + + # Temporary switch assignment + def self.tmp_s1=(val) + $game_switches[TMP_INDEX+0] = val + end + + def self.tmp_s2=(val) + $game_switches[TMP_INDEX+1] = val + end + + def self.tmp_s3=(val) + $game_switches[TMP_INDEX+2] = val + end + + def self.tmp_v1=(val) + $game_variables[TMP_INDEX+0] = val + end + + def self.tmp_v2=(val) + $game_variables[TMP_INDEX+1] = val + end + + def self.tmp_v3=(val) + $game_variables[TMP_INDEX+2] = val + end + + private + TMP_INDEX = 22 + + def self.logpos(pos, realpos, positive) + bigpos = pos * 128 + if realpos < bigpos + return pos - 1 if positive + elsif realpos > bigpos + return pos + 1 if positive + end + return pos + end +end + +def enter_name + $game_temp.name_calling = true +end + +def check_exit(min, max, x: -1, y: -1) + result = false + if x >= 0 + if $game_player.x == x + if $game_player.y >= min && $game_player.y <= max + result = true + end + end + elsif y >= 0 + if $game_player.y == y + if $game_player.x >= min && $game_player.x <= max + result = true + end + end + end + Script.tmp_s1 = $game_switches[11] ? false : result +end + +def bg(name) + $game_map.bg_name = name +end + +def particles(type) + $game_map.particles_type = type +end + +def ambient(r, g = -1, b = -1) + g = r if g < 0 + b = r if b < 0 + #$scene.ambient = Color.new(r, g, b) +end + +def clear_ambient + #$scene.ambient = Color.new(255, 255, 255) +end + +def add_light(id, file, intensity, x, y) + #$scene.add_light(id, file, intensity, x, y) +end + +def del_light(id) + #$scene.del_light(id) +end + +def clear_lights + #$scene.clear_lights +end + +def fade_in_bulb + #$scene.fade_in_bulb +end + +def clamp_panorama + $game_map.clamped_panorama = true +end + +def wrap_map + $game_map.wrapping = true +end diff --git a/scripts/SpecialEventData.rb b/scripts/SpecialEventData.rb deleted file mode 100644 index f707050..0000000 --- a/scripts/SpecialEventData.rb +++ /dev/null @@ -1,13 +0,0 @@ -class SpecialEventData - attr_reader :flags - attr_reader :collision - - def initialize(flags, collision) - @flags = flags - @collision = collision - end - - def self.get(name) - return SPECIAL_EVENTS[name] - end -end diff --git a/scripts/Light.rb b/scripts/Sprite_Light.rb similarity index 100% rename from scripts/Light.rb rename to scripts/Sprite_Light.rb diff --git a/scripts/_scripts.txt b/scripts/_scripts.txt index b2c84af..81291f8 100644 --- a/scripts/_scripts.txt +++ b/scripts/_scripts.txt @@ -1,3 +1,6 @@ +# Overrides +RPG + Game_Temp Game_System Game_Switches @@ -28,6 +31,7 @@ Sprite_Character Sprite_Battler Sprite_Picture Sprite_Timer +Sprite_Light Spriteset_Map Window_Base @@ -89,33 +93,25 @@ Scene_Battle 4 Scene_Name Scene_Debug -RPG -Ed_Message - -# Classes -Language -Translator -Light -Particles -SpecialEventData +# Internationalization +i18n_Translator +i18n_Language # Data -Item -Language_Data -Footsteps -SpecialEventData_Data +Data_Item +Data_Footsteps +Data_SpecialEventData # Script Functions -Script Aux -Map -Name -Position +Script # Puzzles -Sokoban -Pixel +Puzzle_Sokoban +Puzzle_Pixel -# Save/Load +# Misc SaveLoad +Ed_Message +Particles Main diff --git a/scripts/Language_Data.rb b/scripts/i18n_Language.rb similarity index 91% rename from scripts/Language_Data.rb rename to scripts/i18n_Language.rb index 951bccb..66716bf 100644 --- a/scripts/Language_Data.rb +++ b/scripts/i18n_Language.rb @@ -1,4 +1,18 @@ class Language + attr_reader :font + attr_reader :character_table + attr_reader :character_table_height + + def initialize(font, character_table, character_table_height) + @font = font + @character_table = character_table + @character_table_height = character_table_height + end + + def self.get(code = :en) + return LANGUAGES[code] || LANGUAGES[:en] + end + LANGUAGES = { :en => Language.new( 'Terminus (TTF)', [ diff --git a/scripts/Translator.rb b/scripts/i18n_Translator.rb similarity index 100% rename from scripts/Translator.rb rename to scripts/i18n_Translator.rb