More or less standardised separator comments in the code

This commit is contained in:
Maruno17
2024-06-27 21:21:26 +01:00
parent 225549bfce
commit 509a414f37
198 changed files with 1907 additions and 1263 deletions

View File

@@ -47,9 +47,6 @@ class Game_Temp
attr_accessor :darkness_sprite # DarknessSprite or nil
attr_accessor :mart_prices
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
# Flags requesting something to happen
@menu_calling = false

View File

@@ -39,6 +39,30 @@ class Game_System
@bgs_position = 0
end
def battle_bgm
return (@battle_bgm) ? @battle_bgm : $data_system.battle_bgm
end
attr_writer :battle_bgm
def battle_end_me
return (@battle_end_me) ? @battle_end_me : $data_system.battle_end_me
end
attr_writer :battle_end_me
def windowskin_name
return $data_system.windowskin_name if @windowskin_name.nil?
return @windowskin_name
end
attr_writer :windowskin_name
def timer
return 0 if !@timer_start || !$stats
return @timer_duration - $stats.play_time + @timer_start
end
#-----------------------------------------------------------------------------
def bgm_play(bgm, track = nil)
@@ -250,32 +274,6 @@ class Game_System
#-----------------------------------------------------------------------------
def battle_bgm
return (@battle_bgm) ? @battle_bgm : $data_system.battle_bgm
end
attr_writer :battle_bgm
def battle_end_me
return (@battle_end_me) ? @battle_end_me : $data_system.battle_end_me
end
attr_writer :battle_end_me
#-----------------------------------------------------------------------------
def windowskin_name
return $data_system.windowskin_name if @windowskin_name.nil?
return @windowskin_name
end
attr_writer :windowskin_name
def timer
return 0 if !@timer_start || !$stats
return @timer_duration - $stats.play_time + @timer_start
end
def update
if Input.trigger?(Input::SPECIAL) && pbCurrentEventCommentInput(1, "Cut Scene")
event = @map_interpreter.get_self

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Map Factory (allows multiple maps to be loaded at once and connected)
# Map Factory (allows multiple maps to be loaded at once and connected).
#===============================================================================
class PokemonMapFactory
attr_reader :maps
@@ -384,12 +384,14 @@ module MapFactoryHelper
@@MapConnections = nil
@@MapDims = nil
def self.clear
module_function
def clear
@@MapConnections = nil
@@MapDims = nil
end
def self.getMapConnections
def getMapConnections
if !@@MapConnections
@@MapConnections = []
conns = load_data("Data/map_connections.dat")
@@ -427,26 +429,26 @@ module MapFactoryHelper
return @@MapConnections
end
def self.hasConnections?(id)
def hasConnections?(id)
conns = MapFactoryHelper.getMapConnections
return conns[id] ? true : false
end
def self.mapsConnected?(id1, id2)
def mapsConnected?(id1, id2)
MapFactoryHelper.eachConnectionForMap(id1) do |conn|
return true if conn[0] == id2 || conn[3] == id2
end
return false
end
def self.eachConnectionForMap(id)
def eachConnectionForMap(id)
conns = MapFactoryHelper.getMapConnections
return if !conns[id]
conns[id].each { |conn| yield conn }
end
# Gets the height and width of the map with id
def self.getMapDims(id)
# Gets the height and width of the map with id.
def getMapDims(id)
# Create cache if doesn't exist
@@MapDims = [] if !@@MapDims
# Add map to cache if can't be found
@@ -464,7 +466,7 @@ module MapFactoryHelper
# Returns the X or Y coordinate of an edge on the map with id.
# Considers the special strings "N","W","E","S"
def self.getMapEdge(id, edge)
def getMapEdge(id, edge)
return 0 if ["N", "W"].include?(edge)
dims = getMapDims(id) # Get dimensions
return dims[0] if edge == "E"
@@ -472,7 +474,7 @@ module MapFactoryHelper
return dims[0] # real dimension (use width)
end
def self.mapInRange?(map)
def mapInRange?(map)
range = 6 # Number of tiles
dispx = map.display_x
dispy = map.display_y
@@ -483,7 +485,7 @@ module MapFactoryHelper
return true
end
def self.mapInRangeById?(id, dispx, dispy)
def mapInRangeById?(id, dispx, dispy)
range = 6 # Number of tiles
dims = MapFactoryHelper.getMapDims(id)
return false if dispx >= (dims[0] + range) * Game_Map::REAL_RES_X

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class Game_Character
attr_reader :id
attr_reader :original_x
@@ -194,9 +197,10 @@ class Game_Character
@direction = @prelock_direction if !@direction_fix && @prelock_direction != 0
end
#=============================================================================
#-----------------------------------------------------------------------------
# Information from map data
#=============================================================================
#-----------------------------------------------------------------------------
def map
return (@map) ? @map : $game_map
end
@@ -242,9 +246,10 @@ class Game_Character
return 0
end
#=============================================================================
#-----------------------------------------------------------------------------
# Passability
#=============================================================================
#-----------------------------------------------------------------------------
def passable?(x, y, dir, strict = false)
new_x = x + (dir == 6 ? 1 : dir == 4 ? -1 : 0)
new_y = y + (dir == 2 ? 1 : dir == 8 ? -1 : 0)
@@ -313,9 +318,10 @@ class Game_Character
return can_move_from_coordinate?(@x, @y, dir, strict)
end
#=============================================================================
#-----------------------------------------------------------------------------
# Screen position of the character
#=============================================================================
#-----------------------------------------------------------------------------
def screen_x
ret = ((@real_x.to_f - self.map.display_x) / Game_Map::X_SUBPIXELS).round
ret += @width * Game_Map::TILE_WIDTH / 2
@@ -353,9 +359,10 @@ class Game_Character
return z + ((height > Game_Map::TILE_HEIGHT) ? Game_Map::TILE_HEIGHT - 1 : 0)
end
#=============================================================================
#-----------------------------------------------------------------------------
# Movement
#=============================================================================
#-----------------------------------------------------------------------------
def moving?
return !@move_timer.nil?
end
@@ -410,9 +417,10 @@ class Game_Character
triggerLeaveTile
end
#=============================================================================
#-----------------------------------------------------------------------------
# Movement commands
#=============================================================================
#-----------------------------------------------------------------------------
def move_type_random
case rand(6)
when 0..3 then move_random
@@ -906,9 +914,10 @@ class Game_Character
end
end
#=============================================================================
#-----------------------------------------------------------------------------
# Updating
#=============================================================================
#-----------------------------------------------------------------------------
def update
return if $game_temp.in_menu
time_now = System.uptime

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
class Game_Event < Game_Character
attr_reader :map_id
attr_reader :trigger