diff --git a/PORTING.md b/PORTING.md
index fda9b3d..63d7b23 100644
--- a/PORTING.md
+++ b/PORTING.md
@@ -1,37 +1,36 @@
-# Портирование | Porting
-
## Операционные системы | Operating Systems
-
| Платформа
Platform | Завершено
Done % | Состояние
State |
| :--- | :---: | :--- |
| Windows | 100% | Играбельно |
-| Linux | 91% | В работе, но уже играбельно
TODO:
\* Fix Wallpaper manager |
-| *BSD | 15% | в работе |
-| GNU/Hurd | 1% | В работе |
-| Solaris/OpenSolaris | 1% | В работе |
+| Linux | 91% | В работе, но уже играбельно
TODO:
\* Fix Wallpaper manager
+| *BSD | 15% | не в работе |
+| GNU/Hurd | 1% | не в работе |
+| Solaris/OpenSolaris | 1% | не в работе |
| RedoxOS | 0% | Не хватает библеотек |
| Android | 4% | В работе |
-| PS Vita | 1% | В работе |
-| PSP | 1% | В работе |
+| PS Vita | 1% | не в работе |
+| PSP | 1% | не в работе |
| Emspritein(web) | 11% | Нет хватает библеотек
\* Нужно написать порт библеотеки libsigc++2
(А лучше 3 и переписать движок)
\* Проблемы с компиляцией и зависимостями |
-| HaikuOS | 1% | В работе |
+| HaikuOS | 1% | не в работе |
| DOS | 1% | Не в работе |
-| Ubuntu Touch | 61% | Будет почти готово тогда когда Linux порт будет доведён до ума |
-| Аврора ОС | 0% | Возможно, но пока не в работе |
+| Ubuntu Touch | 60% | Будет почти готово тогда когда Linux порт будет доведён до ума |
+| Аврора ОС | 0% | не в работе |
| ChromeOS/ChromiumOS | 0.4% | Неизвестное |
| MacOS | 10.5% | Неизвестное, но работа ведётся |
+| Kyronix | 10% | В работе сторонней командой разработчиков|
## Окружения рабочего стола | Desktop Environments
-
| Окружение
Environments | Завершено
Done % |
| :--- | :---: |
+| X11 standalone window managers | 0% |
+| Wayland standalone window managers | 0% |
| LXDE | 100% |
| XFCE | 10% |
| GNOME | 10% |
| KDE | 10% |
-| LXQt | 0% |
-| MATE | 0% |
+| LXQT | 0% |
+| MATE | 10% |
| Cinnamon | 10% |
| Budgie | 0% |
| Deepin | 10% |
@@ -42,28 +41,7 @@
| Sugar Desktop | 0% |
| ROX Desktop | 0% |
| Fluxbox | 0% |
-| Openbox | 0% |
| Trinity | 0% |
-| Blackbox | 0% |
-| AwesomeWM | 0% |
-| DWM | 0% |
-| hyperland | 0% |
-| niri | 0% |
| Fish | 0% |
| Lumina | 0% |
| IceWM | 0% |
-| Window Maker | 0% |
-| I3 | 0% |
-| Sway | 0% |
-| Wayfire | 0% |
-| bspwm | 0% |
-| herbstluftwm | 0% |
-| xmonad | 0% |
-| qtile | 0% |
-| CDE | 0% |
-| Fvwm95 | 0% |
-| OpenWindows | 0% |
-| Dt | 0% |
-| 9wm | 0% |
-| Twm | 0% |
-| WindowLab | 0% |
diff --git a/changelogs/0.1.1.txt b/changelogs/0.1.1.txt
index 8ab3e07..105733a 100644
--- a/changelogs/0.1.1.txt
+++ b/changelogs/0.1.1.txt
@@ -74,3 +74,8 @@ Extended Office location
Reworked Refuge(WIP)
Updated Game quit common event
Solstice credits updated
+Removed text size limit in Ed Message
+Rewrited Linux build scripts
+Deleted unused maps
+Game maps size fixed
+Big performance fix
diff --git a/make-oneshot-linux.sh b/make-oneshot-linux.sh
index 8b33835..67522b5 100755
--- a/make-oneshot-linux.sh
+++ b/make-oneshot-linux.sh
@@ -1,28 +1,19 @@
-#!/bin/sh
+#!/bin/bash
set -euo pipefail
-cd `dirname $0`
+cd "dirname $0"
# User-configurable variables.
oneshot_id=420530
STEAMWORKS_PATH=$(realpath ..)/steamworks
-# Colors.
-white="\033[0;37m" # White - Regular
-bold="\033[1;37m" # White - Bold
-cyan="\033[1;36m" # Cyan - Bold
-green="\033[1;32m" # Green - Bold
-color_reset="\033[0m" # Reset Colors
-
-echo -e "Compiling ${bold}Sunshine Bandle for Linux...${color_reset}\n"
-
cmake . -B build/
cd build
-make
+make -j$(nproc)
cd ..
mkdir build/bandle
-mkdir build/bandle/Sunshine
-mkdir build/bandle/Sunshine/Data
+mkdir build/bandle
+mkdir build/bandle/Data
# Compile steamshim.
#echo -e "-> ${cyan}Compile steamshim...${color_reset}"
@@ -33,41 +24,30 @@ mkdir build/bandle/Sunshine/Data
#cp "$STEAMWORKS_PATH/redistributable_bin/linux64/libsteam_api.so" .
#make -j${make_threads} > steamshim.make.out
#cd ../..
-
-# Compile Journal.
-echo -e "-> ${cyan}Compile journal...${color_reset}"
pyinstaller journal/unix/journal.spec #--windowed
+ruby rpgscript.rb scripts/ build/bandle/
-# Compile scripts.
-echo -e "-> ${cyan}Compile xScripts.rxdata...${color_reset}"
-ruby rpgscript.rb scripts/ build/bandle/Sunshine/
-
-# Copy results.
-echo -e "-> ${cyan}Install OneShot apps to Steam directory...${color_reset}"
-yes | cp -r dist/_______/* build/bandle/Sunshine/
-yes | cp build/oneshot build/bandle/Sunshine
+cp -r dist/_______/* build/bandle/
+cp build/oneshot build/bandle/
#yes | cp steamshim_parent/build/steamshim "$ONESHOT_PATH"
#echo "$oneshot_id" > "$ONESHOT_PATH/steam_appid.txt"
# Copy libraries.
-echo -e "-> ${cyan}Install OneShot libraries to Steam directory...${color_reset}"
mkdir libs
ldd build/oneshot | ruby libraries.rb
#ldd steamshim_parent/build/steamshim | ruby libraries.rb
-yes | cp libs/* build/bandle/Sunshine
-yes | cp build/oneshot build/bandle/Sunshine
+cp libs/* build/bandle
+cp build/oneshot build/bandle
-cp installer/installer.sh build/bandle/
-cp -r ../SunshineAssets/* build/bandle/Sunshine
-cp oneshot.conf build/bandle/Sunshine
+cp -r ../SunshineAssets/* build/bandle
+cp oneshot.conf build/bandle
cd build
zip -r OneshotSunshine.zip bandle/*
cd ..
# Cleanup.
-echo -e "-> ${cyan}Cleanup files...${color_reset}"
rm -rf journal/unix/__pycache__
#rm -rf build/*
rm -rf dist
diff --git a/scripts/Data_Settings.rb b/scripts/Data_Settings.rb
index 2073816..3fc2a96 100644
--- a/scripts/Data_Settings.rb
+++ b/scripts/Data_Settings.rb
@@ -26,9 +26,6 @@ module Settings
:en_purple_messagebox => true,
:enforce_april_fools => false,
:true_memory_mode => false,
- :pre_solstice_update_content => false,
- :dejavu_mode => false,
- :demo => false,
:oneshot_mode => false,
# Advanced
@@ -138,11 +135,6 @@ class Window_Settings
},
],
tr("Video") => [
- {
- :type => :bool,
- :name => tr('Fullscreen'),
- :parameter => :fullscreen
- },
{
:type => :enum,
:name => tr('Resolution'),
@@ -150,6 +142,11 @@ class Window_Settings
:parameter => Graphics::RESOLUTION_OVERRIDDEN ? nil : :resolution,
:values => Graphics::RESOLUTION_OVERRIDDEN ? ["Resolution is redefined via config"] : Graphics.resolutions_names_list
},
+ {
+ :type => :bool,
+ :name => tr('Fullscreen'),
+ :parameter => :fullscreen
+ },
{
:type => :bool,
:name => tr('Colorblind mode'),
@@ -171,11 +168,6 @@ class Window_Settings
:name => tr('Dynamic Light'),
:parameter => :light,
},
- #{
- # :type => :bool,
- # :name => tr('Shadows'),
- # :parameter => :light_shadows
- #},
],
tr("UI") => [
{
@@ -193,10 +185,16 @@ class Window_Settings
:type => :enum,
:name => tr('FastTravel UI'),
:parameter => :fasttravel_ui,
- :values => [tr("Original"), tr("WME")]
+ :values => [tr("Original"), tr("WME (WIP)")]
},
],
tr("Gameplay") => [
+ {
+ :type => :enum,
+ :name => tr('Default movement'),
+ :parameter => :movement,
+ :values => [tr("Walk"), tr("Run")]
+ },
{
:type => :bool,
:name => tr('Skip Text (R)'),
@@ -204,37 +202,22 @@ class Window_Settings
},
{
:type => :bool,
- :name => tr('Purple message box for Entity(WIP)'),
+ :name => tr('Purple message box for Entity(Not implemented)'),
:parameter => :en_purple_messagebox
},
{
:type => :bool,
- :name => tr('Enforce april fools(WIP)'),
+ :name => tr('Enforce april fools'),
:parameter => :enforce_april_fools
},
{
:type => :bool,
- :name => tr('True Memory Mode(WIP)'),
+ :name => tr('True Memory Mode(Not implemented)'),
:parameter => :true_memory_mode
},
{
:type => :bool,
- :name => tr('Enable Pre-Solstice update content(WIP)'),
- :parameter => :pre_solstice_update_content
- },
- {
- :type => :bool,
- :name => tr('Dejavu mode(WIP)'),
- :parameter => :dejavu_mode
- },
- {
- :type => :bool,
- :name => tr('Demo mode(WIP)'),
- :parameter => :demo
- },
- {
- :type => :bool,
- :name => tr('Freeware Mode(!)'),
+ :name => tr('Freeware Mode(!, WIP)'),
:parameter => :oneshot_mode
},
],
@@ -244,13 +227,6 @@ class Window_Settings
:name => tr('Control LED lighting on gamepads'),
:parameter => :gamepad_led
},
- #{
- # :type => :slider,
- # :name => tr("Gamepad deadzone"),
- # :parameter => :gamepad_deadzone,
- # :min => 0,
- # :max => 10
- #},
{ :type => :sep, :name => tr("Walk") },
{
:type => :key,
diff --git a/scripts/Data_Settings_Classes.rb b/scripts/Data_Settings_Classes.rb
index 2bef4cf..4b35d1b 100644
--- a/scripts/Data_Settings_Classes.rb
+++ b/scripts/Data_Settings_Classes.rb
@@ -318,7 +318,7 @@ class Window_Settings
end
def value
- if (Settings.has?(@parameter))
+ if @parameter && Settings.has?(@parameter)
@value = Settings[@parameter]
end
@value
diff --git a/scripts/Ed_Message.rb b/scripts/Ed_Message.rb
index 4b3950b..2f02dfa 100644
--- a/scripts/Ed_Message.rb
+++ b/scripts/Ed_Message.rb
@@ -1,19 +1,19 @@
# Displays Ed message boxes
class Ed_Message
- HEIGHT = 160
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@sprite_bg = Sprite.new(@viewport)
- @sprite_bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- @sprite_bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 128))
+ @sprite_bg.bitmap = Bitmap.new(1, 1)
+ @sprite_bg.bitmap.fill_rect(0, 0, 1, 1, Color.new(0, 0, 0, 128))
+ @sprite_bg.zoom_x = Graphics.width
+ @sprite_bg.zoom_y = Graphics.height
@sprite_text = Sprite.new(@viewport)
- @contents = Bitmap.new(Graphics.width, HEIGHT)
+ @contents = Bitmap.new(Graphics.width, Graphics.height)
Language.register_text_sprite(self.class.name + "_contents", @contents)
@sprite_text.bitmap = @contents
- @sprite_text.y = (Graphics.height - HEIGHT) / 2
@sprite_bg.z = 0
@sprite_text.z = 1
@viewport.z = 9999
@@ -28,12 +28,26 @@ class Ed_Message
@fade_out = false
@fade_in_text = false
@fade_out_text = false
+
+ @resize_connection = Graphics.viewport_resized do |w, h|
+ @viewport.rect.width = w
+ @viewport.rect.height = h
+
+ @sprite_bg.zoom_x = w
+ @sprite_bg.zoom_y = h
+
+ @contents.dispose
+ @contents = Bitmap.new(w, h)
+ @sprite_text.bitmap = @contents
+ end
+
RPG::Mod.exec_hooks("hooks/Ed_Message/init", binding)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
+ @resize_connection.disconnect
terminate_message
$game_temp.message_window_showing = false
@contents.dispose
@@ -93,7 +107,7 @@ class Ed_Message
widths << x
x = 0
y += 1
- break if y >= 4
+ #break if y >= 4
else
newline = true
end
@@ -105,7 +119,7 @@ class Ed_Message
widths << x
x = 0
y += 1
- break if y >= 4
+ #break if y >= 4
end
# Append word to list
@@ -116,14 +130,14 @@ class Ed_Message
end
x += width + spacewidth
end
- break if y >= 4
+ #break if y >= 4
end
- widths << x if y < 4
+ widths << x# if y < 4
# Prepare renderer
@contents.clear
@contents.font.color = Color.new(255, 255, 255, 255)
- y_top = (HEIGHT - widths.length * 24) / 2
+ y_top = (Graphics.height - widths.length * 24) / 2
x = (Graphics.width - widths[0]) / 2
y = 0
diff --git a/scripts/Game_Map.rb b/scripts/Game_Map.rb
index 6e38592..709f5be 100644
--- a/scripts/Game_Map.rb
+++ b/scripts/Game_Map.rb
@@ -23,6 +23,12 @@ class Game_Map
attr_accessor :battleback_name # battleback file name
attr_accessor :display_x # display x-coordinate * 128
attr_accessor :display_y # display y-coordinate * 128
+ attr_accessor :display_clip_bottom
+ attr_accessor :display_clip_left
+ attr_accessor :display_clip_right
+ attr_accessor :display_clip_top
+ attr_accessor :display_x_fix
+ attr_accessor :display_y_fix
attr_accessor :wrap_x # display x-coordinate * 128 for wrap
attr_accessor :wrap_y # display y-coordinate * 128 for wrap
attr_accessor :need_refresh # refresh request flag
@@ -83,6 +89,12 @@ class Game_Map
@map_id = 0
@display_x = 0
@display_y = 0
+ @display_clip_bottom = 999999
+ @display_clip_left = 0
+ @display_clip_right = 999999
+ @display_clip_top = 0
+ @display_x_fix = nil
+ @display_y_fix = nil
end
#--------------------------------------------------------------------------
# * Setup
@@ -118,6 +130,12 @@ class Game_Map
# Initialize displayed coordinates
@display_x = 0
@display_y = 0
+ @display_clip_bottom = 999999
+ @display_clip_left = 0
+ @display_clip_right = 999999
+ @display_clip_top = 0
+ @display_x_fix = nil
+ @display_y_fix = nil
@wrap_x = 0
@wrap_y = 0
# Clear refresh request flag
@@ -263,36 +281,40 @@ class Game_Map
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_down(distance)
- if self.height < Graphics.height / 28
- @display_y = self.height / 2
- else
- @display_y = [@display_y + distance, (self.height - Graphics.height / 28) * 128].min
- end
+ return if @display_y_fix
+
+ @display_y = [@display_y + distance, (self.height - Graphics.height / 32 - 1) * 128].min
+ @display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
end
#--------------------------------------------------------------------------
# * Scroll Left
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_left(distance)
+ return if @display_x_fix
+
@display_x = [@display_x - distance, 0].max
+ @display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
end
#--------------------------------------------------------------------------
# * Scroll Right
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_right(distance)
+ return if @display_x_fix
+
@display_x = [@display_x + distance, (self.width - (Graphics.width / 32)) * 128].min
+ @display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
end
#--------------------------------------------------------------------------
# * Scroll Up
# distance : scroll distance
#--------------------------------------------------------------------------
def scroll_up(distance)
- if self.height < Graphics.height / 28
- @display_y = self.height / 2
- else
- @display_y = [@display_y - distance, 0].max
- end
+ return if @display_y_fix
+
+ @display_y = [@display_y - distance, 0].max
+ @display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
end
#--------------------------------------------------------------------------
# * Determine Valid Coordinates
@@ -486,6 +508,11 @@ class Game_Map
# * Frame Update
#--------------------------------------------------------------------------
def update
+ @display_clip_top = @display_clip_top || 0
+ @display_clip_left = @display_clip_left || 0
+ @display_clip_right = @display_clip_right || 999999
+ @display_clip_bottom = @display_clip_bottom || 999999
+
# Refresh map if necessary
if $game_map.need_refresh
refresh
@@ -535,6 +562,17 @@ class Game_Map
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
@fog_opacity_duration -= 1
end
+
+ if @display_x_fix
+ @display_x = (@display_x_fix * 128.0).to_i - Graphics.width * 2
+ else
+ @display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
+ end
+ if @display_y_fix
+ @display_y = (@display_y_fix * 128.0).to_i - Graphics.height * 2
+ else
+ @display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
+ end
end
def set_tile(x, y, z, tile)
diff --git a/scripts/Scene_Map.rb b/scripts/Scene_Map.rb
index 71229e1..4f1bc53 100644
--- a/scripts/Scene_Map.rb
+++ b/scripts/Scene_Map.rb
@@ -60,7 +60,6 @@ class Scene_Map
@blackfade.z = 9999
color = GamepadMapColors::COLORS[$game_map.map_id] || GamepadMapColors::SUN
Input.set_led(color.red, color.green, color.blue)
- RPG::Mod.exec_hooks("hooks/Scene_Map/main", binding)
# Transition run
Graphics.transition
diff --git a/scripts/Scene_Title.rb b/scripts/Scene_Title.rb
index 877e4ee..caea9ec 100644
--- a/scripts/Scene_Title.rb
+++ b/scripts/Scene_Title.rb
@@ -115,7 +115,7 @@ class Scene_Title
@cursor.zoom_x = @cursor.zoom_y = 2
@cursor.z += 2
@cursor.x = Graphics.width - MENU_X - 12
- @cursor.y = Graphics.height - MENU_Y + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2 - 2
+ @cursor.y = Graphics.height - MENU_Y + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2 - 3
# Initialize cursor position
@cursor_pos = 0.0
@@ -127,7 +127,7 @@ class Scene_Title
@menu.x = w - MENU_X
@menu.y = h - MENU_Y
@cursor.x = w - MENU_X - 12
- @cursor.y = ((h - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 2)
+ @cursor.y = ((h - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 3)
@sprite.x = w / 2
@sprite.y = h / 2
@@ -198,7 +198,7 @@ class Scene_Title
# Handle cursor movement
if !@window_settings_title.visible
- @cursor.y = ((Graphics.height - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 2) * 0.65 + @cursor.y.to_f * 0.35
+ @cursor.y = ((Graphics.height - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 3) * 0.65 + @cursor.y.to_f * 0.35
update_cursor = false
if Input.trigger?(Input::UP)
if @cursor_pos > 0
diff --git a/scripts/Spriteset_Map.rb b/scripts/Spriteset_Map.rb
index c7d9be9..41a0edb 100644
--- a/scripts/Spriteset_Map.rb
+++ b/scripts/Spriteset_Map.rb
@@ -203,7 +203,7 @@ class Spriteset_Map
else
if @panorama_name == "dark_water"
@panorama.shader = Shader::Water
- @panorama.color.set(0, 0, 127, 0)
+ @panorama.color.set(0, 0, 255, 0)
@panorama.tone.set(0, 0, 255, 63)
@panorama.blend_type = 1
elsif @panorama_name == "green_water"
diff --git a/scripts/Window_Settings.rb b/scripts/Window_Settings.rb
index 3b2143f..df2ac54 100644
--- a/scripts/Window_Settings.rb
+++ b/scripts/Window_Settings.rb
@@ -78,7 +78,7 @@ class Window_Settings
@content.add_parameter(screen_title, BoolParameter.new(@content, screen_index, parameter_index,
parameter_info[:name], parameter_info[:parameter], parameter_info[:default]))
when :switch
- @content.add_parameter(screen_title, BoolParameter.new(@content, screen_index, parameter_index,
+ @content.add_parameter(screen_title, SwitchPatameter.new(@content, screen_index, parameter_index,
parameter_info[:name], parameter_info[:parameter], parameter_info[:default], parameter_info[:switch], parameter_info[:invert]))
when :int
@content.add_parameter(screen_title, IntParameter.new(@content, screen_index, parameter_index,
@@ -91,7 +91,7 @@ class Window_Settings
parameter_info[:name], parameter_info[:parameter], parameter_info[:default], parameter_info[:step], parameter_info[:min], parameter_info[:max]))
when :enum
@content.add_parameter(screen_title, EnumParameter.new(@content, screen_index, parameter_index,
- parameter_info[:name], parameter_info[:parameter], 0, parameter_info[:values]))
+ parameter_info[:name], parameter_info[:parameter], parameter_info[:default], parameter_info[:values]))
when :sep
@content.add_parameter(screen_title, Separator.new(@content, screen_index, parameter_index,
parameter_info[:name]))
diff --git a/src/shader.cpp b/src/shader.cpp
index 7c34b66..ba58591 100644
--- a/src/shader.cpp
+++ b/src/shader.cpp
@@ -301,6 +301,8 @@ void DynamicLightShader::setWallMapResolution(int x, int y){
}
void DynamicLightShader::setCameraPosition(int x, int y){
+ cameraPositionCache.x = x;
+ cameraPositionCache.y = y;
gl.Uniform2f(u_cameraPosition, x, y);
}
@@ -310,21 +312,31 @@ void DynamicLightShader::setTileMapOffset(int x, int y){
void DynamicLightShader::setLightSources(std::vector sources){
int count = 0;
- for(int i = 0; i < sources.size(); i++) {
+ int screenWidth = shState->graphics().width();
+ int screenHeight = shState->graphics().height();
+ for(int i = 0; i < sources.size(); ++i) {
if (count < 64) {
- if (!sources[i].hasEffect())
+ LightSource source = sources[i];
+ if (!source.hasEffect())
continue;
+
+ if (source.x * 32 < cameraPositionCache.x - source.radius * 32
+ || source.y * 32 < cameraPositionCache.y - source.radius * 32
+ || source.x * 32 > cameraPositionCache.x + source.radius * 32 + screenWidth
+ || source.y * 32 > cameraPositionCache.y + source.radius * 32 + screenHeight
+ ) continue;
+
gl.Uniform4f(u_lightSources + count,
- sources[i].x,
- sources[i].y,
- sources[i].power,
- sources[i].radius
+ source.x,
+ source.y,
+ source.power,
+ source.radius
);
gl.Uniform4f(u_lightSourcesColors + count,
- sources[i].color.red / 255.0,
- sources[i].color.green / 255.0,
- sources[i].color.blue / 255.0,
- sources[i].color.alpha / 255.0
+ source.color.red / 255.0,
+ source.color.green / 255.0,
+ source.color.blue / 255.0,
+ source.color.alpha / 255.0
);
count++;
}
diff --git a/src/shader.h b/src/shader.h
index 4b40b96..e9a5308 100644
--- a/src/shader.h
+++ b/src/shader.h
@@ -117,6 +117,7 @@ public:
private:
GLint u_wallMapTexture, u_wallMapResolution, u_cameraPosition, u_tileMapOffset, u_lightSources, u_lightSourcesCount, u_lightSourcesColors, u_ambientLight;
+ Vec2i cameraPositionCache;
};
class SimpleColorShader : public ShaderBase{