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

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
module PBDebug
@@log = []

View File

@@ -1,6 +1,8 @@
#===============================================================================
# To use the console, use the executable explicitly built with the console
# enabled on Windows. On Linux and macOS, just launch the executable directly
# from a terminal.
#===============================================================================
module Console
def self.setup_console
return unless $DEBUG
@@ -33,6 +35,9 @@ module Console
end
end
#===============================================================================
#
#===============================================================================
module Kernel
def echo(string)
return unless $DEBUG
@@ -48,14 +53,15 @@ end
Console.setup_console
#===============================================================================
# Console message formatting
# Console message formatting
#===============================================================================
module Console
module_function
#-----------------------------------------------------------------------------
# echo string into console (example shorthand for common options)
# echo string into console (example shorthand for common options)
#-----------------------------------------------------------------------------
# heading 1
def echo_h1(msg)
echoln markup_style("*** #{msg} ***", text: :brown)
@@ -130,6 +136,7 @@ module Console
#-----------------------------------------------------------------------------
# Markup options
#-----------------------------------------------------------------------------
def string_colors
{
default: "38", black: "30", red: "31", green: "32", brown: "33",

View File

@@ -4,6 +4,9 @@
class Reset < Exception
end
#===============================================================================
#
#===============================================================================
class EventScriptError < Exception
attr_accessor :event_message
@@ -13,6 +16,9 @@ class EventScriptError < Exception
end
end
#===============================================================================
#
#===============================================================================
def pbGetExceptionMessage(e, _script = "")
return e.event_message.dup if e.is_a?(EventScriptError) # Message with map/event ID generated elsewhere
emessage = e.message.dup

View File

@@ -1,4 +1,6 @@
#===============================================================================
# The Kernel module is extended to include the validate method.
#===============================================================================
module Kernel
private

View File

@@ -1,5 +1,7 @@
#===============================================================================
# The Deprecation module is used to warn game & plugin creators of deprecated
# methods.
#===============================================================================
module Deprecation
module_function
@@ -19,7 +21,10 @@ module Deprecation
end
end
# The Module class is extended to allow easy deprecation of instance and class methods.
#===============================================================================
# The Module class is extended to allow easy deprecation of instance and class
# methods.
#===============================================================================
class Module
private

View File

@@ -1,5 +1,7 @@
#===============================================================================
# Using mkxp-z v2.4.2/c9378cf - built 2023-07-07
# https://github.com/mkxp-z/mkxp-z/actions/runs/5482601942
#===============================================================================
$VERBOSE = nil
Font.default_shadow = false if Font.respond_to?(:default_shadow)
Encoding.default_internal = Encoding::UTF_8
@@ -9,6 +11,23 @@ def pbSetWindowText(string)
System.set_window_title(string || System.game_title)
end
def pbSetResizeFactor(factor)
if !$ResizeInitialized
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
$ResizeInitialized = true
end
if factor < 0 || factor == 4
Graphics.fullscreen = true if !Graphics.fullscreen
else
Graphics.fullscreen = false if Graphics.fullscreen
Graphics.scale = (factor + 1) * 0.5
Graphics.center
end
end
#===============================================================================
#
#===============================================================================
class Bitmap
attr_accessor :text_offset_y
@@ -27,20 +46,9 @@ class Bitmap
end
end
def pbSetResizeFactor(factor)
if !$ResizeInitialized
Graphics.resize_screen(Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT)
$ResizeInitialized = true
end
if factor < 0 || factor == 4
Graphics.fullscreen = true if !Graphics.fullscreen
else
Graphics.fullscreen = false if Graphics.fullscreen
Graphics.scale = (factor + 1) * 0.5
Graphics.center
end
end
#===============================================================================
#
#===============================================================================
if System::VERSION != Essentials::MKXPZ_VERSION
printf(sprintf("\e[1;33mWARNING: mkxp-z version %s detected, but this version of Pokémon Essentials was designed for mkxp-z version %s.\e[0m\r\n",
System::VERSION, Essentials::MKXPZ_VERSION))

View File

@@ -1,5 +1,5 @@
#===============================================================================
# Reads files of certain format from a directory
# Reads files of certain format from a directory
#===============================================================================
class Dir
# Reads all files in a directory

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
module FileInputMixin
def fgetb
ret = 0
@@ -85,6 +88,9 @@ module FileInputMixin
end
end
#===============================================================================
#
#===============================================================================
module FileOutputMixin
def fputb(b)
b &= 0xFF
@@ -108,6 +114,9 @@ module FileOutputMixin
end
end
#===============================================================================
#
#===============================================================================
class File < IO
# unless defined?(debugopen)
# class << self
@@ -128,6 +137,9 @@ class File < IO
include FileOutputMixin
end
#===============================================================================
#
#===============================================================================
class StringInput
include FileInputMixin
@@ -144,6 +156,9 @@ class StringInput
def binmode; end
end
#===============================================================================
#
#===============================================================================
class StringOutput
include FileOutputMixin
end

View File

@@ -211,6 +211,8 @@ module Translator
end
end
#-----------------------------------------------------------------------------
def normalize_value(value)
if value[/[\r\n\t\x01]|^[\[\]]/]
ret = value.dup
@@ -709,51 +711,53 @@ module MessageTypes
POKEMON_NICKNAMES = 30
@@messages = Translation.new
def self.load_default_messages
module_function
def load_default_messages
@@messages.load_default_messages
end
def self.load_message_files(filename)
def load_message_files(filename)
@@messages.load_message_files(filename)
end
def self.save_default_messages
def save_default_messages
@@messages.save_default_messages
end
def self.setMessages(type, array)
def setMessages(type, array)
@@messages.setMessages(type, array)
end
def self.addMessages(type, array)
def addMessages(type, array)
@@messages.addMessages(type, array)
end
def self.setMessagesAsHash(type, array)
def setMessagesAsHash(type, array)
@@messages.setMessagesAsHash(type, array)
end
def self.addMessagesAsHash(type, array)
def addMessagesAsHash(type, array)
@@messages.addMessagesAsHash(type, array)
end
def self.setMapMessagesAsHash(type, array)
def setMapMessagesAsHash(type, array)
@@messages.setMapMessagesAsHash(type, array)
end
def self.addMapMessagesAsHash(type, array)
def addMapMessagesAsHash(type, array)
@@messages.addMapMessagesAsHash(type, array)
end
def self.get(type, id)
def get(type, id)
return @@messages.get(type, id)
end
def self.getFromHash(type, key)
def getFromHash(type, key)
return @@messages.getFromHash(type, key)
end
def self.getFromMapHash(type, key)
def getFromMapHash(type, key)
return @@messages.getFromMapHash(type, key)
end
end

View File

@@ -1,3 +1,6 @@
#===============================================================================
#
#===============================================================================
module Input
USE = C
BACK = B
@@ -20,11 +23,12 @@ module Input
end
end
#===============================================================================
#
#===============================================================================
module Mouse
module_function
# Returns the position of the mouse relative to the game window.
def getMousePos(catch_anywhere = false)
def self.getMousePos(catch_anywhere = false)
return nil unless Input.mouse_in_window || catch_anywhere
return Input.mouse_x, Input.mouse_y
end

View File

@@ -102,7 +102,6 @@
#------------------------------------------------------------------------------#
# Please give credit when using this. #
#==============================================================================#
module PluginManager
# Holds all registered plugin data.
@@Plugins = {}