From b94b6aa73111f580bc44c7908173baeb8da05e32 Mon Sep 17 00:00:00 2001 From: DepressedTWM Date: Mon, 29 Jun 2026 18:56:21 +0400 Subject: [PATCH] afef --- PORTING.md | 2 +- binding-mri/bitmap-binding.cpp | 35 ++++++++++++++++++++++++++++++++++ scripts/Game_Map.rb | 34 +++++++++------------------------ scripts/Game_Player.rb | 17 +++++------------ src/bitmap.cpp | 35 ++++++++++++++++++++++++++++++++++ src/bitmap.h | 4 ++++ update_android_project.sh | 4 ++++ 7 files changed, 93 insertions(+), 38 deletions(-) create mode 100755 update_android_project.sh diff --git a/PORTING.md b/PORTING.md index cc10300..9abba91 100644 --- a/PORTING.md +++ b/PORTING.md @@ -4,7 +4,7 @@ | :--- | :---: | :--- | | Windows | 100% | Играбельно | | Linux | 90% | В работе, но уже играбельно
TODO:
 * Fix Wallpaper manager | -| *BSD | 20% | в работе | +| *BSD | 15% | в работе | | GNU/Hurd | 1% | В работе | | Solaris/OpenSolaris | 1% | В работе | | RedoxOS | 0% | Не хватает библеотек | diff --git a/binding-mri/bitmap-binding.cpp b/binding-mri/bitmap-binding.cpp index 9588e4a..e048586 100644 --- a/binding-mri/bitmap-binding.cpp +++ b/binding-mri/bitmap-binding.cpp @@ -304,6 +304,41 @@ RB_METHOD(bitmapGradientFillRect){ return self; } +RB_METHOD(bitmapGradientFillRect4){ + Bitmap *b = getPrivateData(self); + + VALUE color1Obj, color2Obj, color3Obj, color4Obj; + Color *color1, *color2, *color3, *color4; + + if (argc == 4 || argc == 5){ + VALUE rectObj; + Rect *rect; + + rb_get_args(argc, argv, "ooo|b", &rectObj, &color1Obj, &color2Obj, &color3Obj, &color4Obj RB_ARG_END); + + rect = getPrivateDataCheck(rectObj, RectType); + color1 = getPrivateDataCheck(color1Obj, ColorType); + color2 = getPrivateDataCheck(color2Obj, ColorType); + color3 = getPrivateDataCheck(color3Obj, ColorType); + color4 = getPrivateDataCheck(color4Obj, ColorType); + + GUARD_EXC( b->gradientFillRect(rect->toIntRect(), color1->norm, color2->norm, color3->norm, color4->norm); ); + }else{ + int x, y, width, height; + + rb_get_args(argc, argv, "iiiioo|b", &x, &y, &width, &height, &color1Obj, &color2Obj, &color3Obj, &color4Obj RB_ARG_END); + + color1 = getPrivateDataCheck(color1Obj, ColorType); + color2 = getPrivateDataCheck(color2Obj, ColorType); + color3 = getPrivateDataCheck(color3Obj, ColorType); + color4 = getPrivateDataCheck(color4Obj, ColorType); + + GUARD_EXC( b->gradientFillRect(x, y, width, height, color1->norm, color2->norm, color3->norm, color4->norm); ); + } + + return self; +} + RB_METHOD(bitmapClearRect){ Bitmap *b = getPrivateData(self); diff --git a/scripts/Game_Map.rb b/scripts/Game_Map.rb index 40acd98..c89e059 100644 --- a/scripts/Game_Map.rb +++ b/scripts/Game_Map.rb @@ -264,14 +264,10 @@ class Game_Map # distance : scroll distance #-------------------------------------------------------------------------- def scroll_down(distance) - if $game_switches[98] == true - 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 + if self.height < Graphics.height / 28 + @display_y = self.height / 2 else - @display_y += distance + @display_y = [@display_y + distance, (self.height - Graphics.height / 28) * 128].min end end #-------------------------------------------------------------------------- @@ -279,36 +275,24 @@ class Game_Map # distance : scroll distance #-------------------------------------------------------------------------- def scroll_left(distance) - if $game_switches[98] == true - @display_x = [@display_x - distance, 0].max - else - @display_x -= distance - end + @display_x = [@display_x - distance, 0].max end #-------------------------------------------------------------------------- # * Scroll Right # distance : scroll distance #-------------------------------------------------------------------------- def scroll_right(distance) - if $game_switches[98] == true - @display_x = [@display_x + distance, (self.width - (Graphics.width / 32)) * 128].min - else - @display_x += distance - end + @display_x = [@display_x + distance, (self.width - (Graphics.width / 32)) * 128].min end #-------------------------------------------------------------------------- # * Scroll Up # distance : scroll distance #-------------------------------------------------------------------------- def scroll_up(distance) - if $game_switches[98] == true - if self.height < Graphics.height / 28 - @display_y = self.height / 2 - else - @display_y = [@display_y - distance, 0].max - end + if self.height < Graphics.height / 28 + @display_y = self.height / 2 else - @display_y -= distance + @display_y = [@display_y - distance, 0].max end end #-------------------------------------------------------------------------- @@ -553,4 +537,4 @@ class Game_Map @fog_opacity_duration -= 1 end end -end \ No newline at end of file +end diff --git a/scripts/Game_Player.rb b/scripts/Game_Player.rb index 867c6ed..5c71efe 100644 --- a/scripts/Game_Player.rb +++ b/scripts/Game_Player.rb @@ -39,15 +39,10 @@ class Game_Player < Game_Character # * Set Map Display Position to Center of Screen #-------------------------------------------------------------------------- def center(x, y) - if $game_switches[98] == true - max_x = ($game_map.width - (Graphics.width / 32)) * 128 - max_y = ($game_map.height - (Graphics.height / 28)) * 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 + max_x = ($game_map.width - (Graphics.width / 32)) * 128 + max_y = ($game_map.height - (Graphics.height / 28)) * 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 end #-------------------------------------------------------------------------- # * Move to Designated Position @@ -57,9 +52,7 @@ class Game_Player < Game_Character def moveto(x, y) super # Centering - if !$game_switches[100] - center(x, y) - end + center(x, y) end #-------------------------------------------------------------------------- # * Increaase Steps diff --git a/src/bitmap.cpp b/src/bitmap.cpp index a6ae5e2..008dd57 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -526,6 +526,41 @@ void Bitmap::gradientFillRect(const IntRect &rect, const Vec4 &color1, const Vec p->onModified(); } +void Bitmap::gradientFillRect(int x, int y, int width, int height, const Vec4 &color1, const Vec4 &color2, const Vec4 &color3, const Vec4 &color4) { + gradientFillRect(IntRect(x, y, width, height), color1, color2); +} + +void Bitmap::gradientFillRect(const IntRect &rect, const Vec4 &color1, const Vec4 &color2, const Vec4 &color3, const Vec4 &color4) { + guardDisposed(); + + GUARD_MEGA; + + SimpleColorShader &shader = shState->shaders().simpleColor; + shader.bind(); + shader.setTranslation(Vec2i()); + + Quad &quad = shState->gpQuad(); + + quad.vert[0].color = color1; + quad.vert[1].color = color2; + quad.vert[2].color = color3; + quad.vert[3].color = color4; + + quad.setPosRect(rect); + + p->bindFBO(); + p->pushSetViewport(shader); + + p->blitQuad(quad); + + p->popViewport(); + + p->addTaintedArea(rect); + + p->onModified(); +} + + void Bitmap::clearRect(int x, int y, int width, int height){ clearRect(IntRect(x, y, width, height)); } diff --git a/src/bitmap.h b/src/bitmap.h index 9881b43..94e8704 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -60,6 +60,10 @@ public: void gradientFillRect(const IntRect &rect, const Vec4 &color1, const Vec4 &color2, bool vertical = false); + void gradientFillRect(int x, int y, int width, int height, const Vec4 &color1, const Vec4 &color2, const Vec4 &color3, const Vec4 &color4); + + void gradientFillRect(const IntRect &rect, const Vec4 &color1, const Vec4 &color2, const Vec4 &color3, const Vec4 &color4); + void clearRect(int x, int y, int width, int height); void clearRect(const IntRect &rect); diff --git a/update_android_project.sh b/update_android_project.sh new file mode 100755 index 0000000..5be2eee --- /dev/null +++ b/update_android_project.sh @@ -0,0 +1,4 @@ +#/bin/sh +TMP=$(mktemp) +find src > $TMP +python3 create-android-project.py cats.catwindowteam.sunshine --variant symlink --output ./android-project < $TMP