From a6e2dc795a8ada91ae24a7fcf8e6f0ffad3b66f9 Mon Sep 17 00:00:00 2001 From: ZakatTeamI2P Date: Mon, 18 May 2026 23:08:54 +0400 Subject: [PATCH] Fuck --- CMakeLists.txt | 4 ---- binding-mri/binding-mri.cpp | 3 +++ binding-mri/graphics-binding.cpp | 11 ----------- binding-mri/input-binding.cpp | 3 --- binding-mri/window-binding.cpp | 2 -- scripts/Credits_Message.rb | 6 +++--- scripts/Game_Map.rb | 4 ++-- scripts/Game_Player.rb | 16 ++++++++-------- scripts/Scene_Title.rb | 8 ++++---- scripts/Spriteset_Map.rb | 3 +-- scripts/Window_Base.rb | 1 - scripts/Window_Settings.rb | 2 +- src/input.cpp | 4 +--- src/main.cpp | 17 +++++++++-------- src/screen.cpp | 10 ---------- src/window.cpp | 28 ++-------------------------- src/window.h | 3 +-- 17 files changed, 35 insertions(+), 90 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41a5880..5af90ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,11 +25,7 @@ else() if (MSVC) add_compile_options(/O2 /fp:fast /GA /GL /Gw Qpar /RTCu) else() -<<<<<<< HEAD - add_compile_options(-s -03 -ffast-math -fdevirtualize-speculatively -fspeculatively-call-stored-functions -fipa-pta -fdelete-null-pointer-checks -flimit-function-alignment -faggressive-loop-optimizations) -======= add_compile_options(-O2 -ffast-math -fdevirtualize-speculatively -fspeculatively-call-stored-functions -fipa-pta -fdelete-null-pointer-checks) ->>>>>>> 7760eac (a) endif() endif() ## Setup main source ## diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 9851114..712cc1c 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -75,6 +75,9 @@ void fileIntBindingInit(); void journalBindingInit(); void wallpaperBindingInit(); +#ifdef __linux__ +void wallpaperBindingTerminate(); +#endif void nikoBindingInit(); void oneshotBindingInit(); void SunshineBindingInit(); diff --git a/binding-mri/graphics-binding.cpp b/binding-mri/graphics-binding.cpp index 4f10c16..cc5bff1 100644 --- a/binding-mri/graphics-binding.cpp +++ b/binding-mri/graphics-binding.cpp @@ -169,17 +169,6 @@ RB_METHOD(graphicsReset){ return Qnil; } -RB_METHOD(graphicsPlayMovie){ - RB_UNUSED_PARAM; - - const char *filename; - rb_get_args(argc, argv, "z", &filename RB_ARG_END); - - shState->graphics().playMovie(filename); - - return Qnil; -} - DEF_GRA_PROP_I(FrameRate) DEF_GRA_PROP_I(FrameCount) DEF_GRA_PROP_I(Brightness) diff --git a/binding-mri/input-binding.cpp b/binding-mri/input-binding.cpp index 671459e..a9e0582 100644 --- a/binding-mri/input-binding.cpp +++ b/binding-mri/input-binding.cpp @@ -128,9 +128,6 @@ static buttonCodes[] = { { "MOUSELEFT", Input::MouseLeft }, { "MOUSEMIDDLE", Input::MouseMiddle }, { "MOUSERIGHT", Input::MouseRight }, - - { "LCTRL", Input::LCTRL }, - { "RCTRL", Input::RCTRL }, }; static elementsN(buttonCodes); diff --git a/binding-mri/window-binding.cpp b/binding-mri/window-binding.cpp index 7c40622..0ea04ad 100644 --- a/binding-mri/window-binding.cpp +++ b/binding-mri/window-binding.cpp @@ -43,7 +43,6 @@ RB_METHOD(windowInitialize){ RB_METHOD(windowUpdate){ RB_UNUSED_PARAM; - Window *w = getPrivateData(self); w->update(); @@ -80,7 +79,6 @@ void windowBindingInit(){ _rb_define_method(klass, "initialize", windowInitialize); _rb_define_method(klass, "update", windowUpdate); - INIT_PROP_BIND( Window, Windowskin, "windowskin" ); INIT_PROP_BIND( Window, Contents, "contents" ); INIT_PROP_BIND( Window, Stretch, "stretch" ); diff --git a/scripts/Credits_Message.rb b/scripts/Credits_Message.rb index c67cd98..7c4684f 100644 --- a/scripts/Credits_Message.rb +++ b/scripts/Credits_Message.rb @@ -153,10 +153,10 @@ class Credits_Message else @contents.font.color = Color.new(0, 0, 0, 255) end - - x = (320 - widths[0]) / 2 + + x = ((Graphics.width / 2 ) - widths[0]) / 2 y = 0 - y_top = (240 - widths.length * 24) / 2 + y_top = ((Graphics.height / 2) - widths.length * 24) / 2 @contents.font.size = 16 diff --git a/scripts/Game_Map.rb b/scripts/Game_Map.rb index 12c2518..623fe52 100644 --- a/scripts/Game_Map.rb +++ b/scripts/Game_Map.rb @@ -268,7 +268,7 @@ class Game_Map #-------------------------------------------------------------------------- def scroll_down(distance) if $game_switches[98] == true - @display_y = [@display_y + distance, (self.height - 15) * 128].min + @display_y = [@display_y + distance, (Graphics.height / 28) * 128].min else @display_y += distance end @@ -290,7 +290,7 @@ class Game_Map #-------------------------------------------------------------------------- def scroll_right(distance) if $game_switches[98] == true - @display_x = [@display_x + distance, (self.width - 20) * 128].min + @display_x = [@display_x + distance, (self.width - (Graphics.width / 32)) * 128].min else @display_x += distance end diff --git a/scripts/Game_Player.rb b/scripts/Game_Player.rb index 096df72..401defc 100644 --- a/scripts/Game_Player.rb +++ b/scripts/Game_Player.rb @@ -12,8 +12,8 @@ class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Invariables #-------------------------------------------------------------------------- - CENTER_X = (Graphics.width / 2) - 16 - CENTER_Y = (Graphics.height / 2) - 16 + CENTER_X = ((Graphics.width / 4) - 16) * 4 # Center screen x-coordinate * 4 + CENTER_Y = ((Graphics.height / 4) - 16) * 4 # Center screen y-coordinate * 4 #-------------------------------------------------------------------------- # * Passable Determinants # x : x-coordinate @@ -31,10 +31,10 @@ class Game_Player < Game_Character return false end # If debug mode is ON and ctrl key was pressed - if Window_Settings.DebugIsEnabled and Input.press?(Input::LCTRL) - # Passable - return true - end + #if Window_Settings.DebugIsEnabled and Input.press?(Input::LCTRL) + # Passable + # return true + #end super end #-------------------------------------------------------------------------- @@ -42,8 +42,8 @@ class Game_Player < Game_Character #-------------------------------------------------------------------------- def center(x, y) if $game_switches[98] == true - max_x = ($game_map.width - 20) * 128 - max_y = ($game_map.height - 15) * 128 + 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 diff --git a/scripts/Scene_Title.rb b/scripts/Scene_Title.rb index 0b05d6a..a626f76 100644 --- a/scripts/Scene_Title.rb +++ b/scripts/Scene_Title.rb @@ -83,7 +83,7 @@ class Scene_Title #Debug info like in minecraft Forge :P @menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby #{RUBY_VERSION}")) @menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL #{SDLVer}")) - @menu.bitmap.draw_text(5, 45, 150, 20 tr("Sunshine #{SunshineVer}")) + @menu.bitmap.draw_text(5, 45, 150, 20, tr("Sunshine #{SunshineVer}")) if $game_switches[160] && $game_switches[152] @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("...")) end @@ -100,7 +100,7 @@ class Scene_Title @cursor_pos = 0 # Play title BGM if File.exist?("badend.lock") - #TODO: fix + #TODO: fix audio values Audio.bgm_play("Audio/BGM/MyBurdenIsDead.ogg", 100, 100) else $game_system.bgm_play($data_system.title_bgm) @@ -149,7 +149,7 @@ class Scene_Title @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit")) @menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby #{RUBY_VERSION}")) @menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL #{SDLVer}")) - @menu.bitmap.draw_text(5, 45, 150, 20 tr("Sunshine #{SunshineVer}")) + @menu.bitmap.draw_text(5, 45, 150, 20, tr("Sunshine #{SunshineVer}")) if $game_switches[160] && $game_switches[152] @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("...")) end @@ -196,7 +196,7 @@ class Scene_Title if File.exist?("badend.lock") case @cursor_pos when 0 # Continue - EdText.info(tr("You killed niko.")) + print("You killed niko.") when 1 # Settings command_settings when 2 # Shutdown diff --git a/scripts/Spriteset_Map.rb b/scripts/Spriteset_Map.rb index 3782410..138b8fc 100644 --- a/scripts/Spriteset_Map.rb +++ b/scripts/Spriteset_Map.rb @@ -72,8 +72,7 @@ class Spriteset_Map # Make picture sprites @picture_sprites = [] for i in 1..50 - @picture_sprites.push(Sprite_Picture.new(@viewport_pics, - $game_screen.pictures[i])) + @picture_sprites.push(Sprite_Picture.new(@viewport_pics, $game_screen.pictures[i])) end # Make timer sprite @timer_sprite = Sprite_Timer.new diff --git a/scripts/Window_Base.rb b/scripts/Window_Base.rb index 7fc8321..c24f66d 100644 --- a/scripts/Window_Base.rb +++ b/scripts/Window_Base.rb @@ -16,7 +16,6 @@ class Window_Base < Window super() @windowskin_name = $game_system.windowskin_name self.windowskin = RPG::Cache.windowskin(@windowskin_name) - #self.windowskin_en = RPG::Cache.windowskin("en_normal") self.x = x self.y = y self.width = width diff --git a/scripts/Window_Settings.rb b/scripts/Window_Settings.rb index 09f4910..4ef401e 100644 --- a/scripts/Window_Settings.rb +++ b/scripts/Window_Settings.rb @@ -117,7 +117,7 @@ class Window_Settings @version = Sprite.new(@viewport) @version.bitmap = Bitmap.new(60, 20) @version.x = 10 - @version.y = Graphics.width - 190 + @version.y = Graphics.width / 1.9 @version.opacity = 128 Language.register_text_sprite(self.class.name + "_title", @title) Language.register_text_sprite(self.class.name + "_ver", @version) diff --git a/src/input.cpp b/src/input.cpp index 8cfdc88..37b8d42 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -234,9 +234,7 @@ static const KbBindingData staticKbBindings[] ={ { SDL_SCANCODE_F6, Input::F6 }, { SDL_SCANCODE_F7, Input::F7 }, { SDL_SCANCODE_F8, Input::F8 }, - { SDL_SCANCODE_F9, Input::F9 }, - { SDL_SCANCODE_LCTRL, Input:LCTRL }, - { SDL_SCANCODE_RCTRL, Input:RCTRL } + { SDL_SCANCODE_F9, Input::F9 } }; static elementsN(staticKbBindings); diff --git a/src/main.cpp b/src/main.cpp index 11a23e5..5c7950c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -221,17 +221,18 @@ int main(int argc, char *argv[]){ SDL_SetHint(SDL_HINT_APP_NAME, "Oneshot: Sunshine"); SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME, "Oneshot: sunshine"); SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_ROLE, "Game"); - #if defined(__linux__ || BSD || __sun) && SDL_VERSION_ATLEAST(3, 4, 10) - SDL_SetHint(SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT, "1"); - #endif //X11 work on *BSD,Solaris too! -#if defined(__linux__ || BSD || __sun) + #if defined(__linux__) || defined(BSD) || defined(__sun) SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); -#endif + #if SDL_VERSION_ATLEAST(3, 4, 10) + SDL_SetHint(SDL_HINT_VIDEO_X11_ENABLE_XSYNC_EXT, "1"); + #endif + #endif + /* initialize SDL first */ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD) == false){ - showInitError(std::string("Error initializing SDL: ") + SDL_GetError()) + showInitError(std::string("Error initializing SDL: ") + SDL_GetError()); return 0; } @@ -279,14 +280,14 @@ int main(int argc, char *argv[]){ if (conf.windowTitle.empty()) conf.windowTitle = conf.game.title; - if (TTF_Init() < 0){ + if (TTF_Init() == false){ showInitError(std::string("Error initializing SDL_ttf: ") + SDL_GetError()); SDL_Quit(); return 0; } - if (Sound_Init() == 0){ + if (Sound_Init() == false){ showInitError(std::string("Error initializing SDL_sound: ") + Sound_GetError()); TTF_Quit(); SDL_Quit(); diff --git a/src/screen.cpp b/src/screen.cpp index bccafca..0362dc9 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -53,16 +53,6 @@ int screenMain(Config &conf){ return 0; } - // SDL_WindowShapeMode shapeMode; - // shapeMode.mode = ShapeModeColorKey; - // shapeMode.parameters.colorKey = colorKey; - - //SDL_Surface *surface = SDL_CreateSurface(32, 32, SDL_PIXELFORMAT_INDEX8); - //SDL_PIXELFORMAT_UNKNOWN - 0,0,0,0 ....maybe? - - //SDL_Surface *surface = SDL_CreateSurface(32, 32, SDL_PIXELFORMAT_INDEX8); - //SDL_Surface *shape = SDL_CreateSurface(DEFAULT_WIDTH, DEFAULT_HEIGHT, SDL_PIXELFORMAT_UNKNOWN); - // i have no idea if it works. //SDL_Surface *shape = SDL_CreateRGBSurface(0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 8, 0, 0, 0, 0); SDL_Surface *shape = SDL_CreateSurface(DEFAULT_WIDTH, DEFAULT_HEIGHT, SDL_PixelFormat::SDL_PIXELFORMAT_RGBA32); diff --git a/src/window.cpp b/src/window.cpp index e789793..d0b55fa 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -303,8 +303,7 @@ struct WindowPrivate { if (bgStretch) backgroundVert.count = 1; else - backgroundVert.count = - TileQuads::twoDimCount(128, 128, bgRect.w, bgRect.h); + backgroundVert.count = TileQuads::twoDimCount(128, 128, bgRect.w, bgRect.h); count += backgroundVert.count; @@ -358,9 +357,7 @@ struct WindowPrivate { void updateBaseAlpha(){ /* This is always applied unconditionally */ backgroundVert.setAlpha(backOpacity.norm); - baseTexQuad.setColor(Vec4(1, 1, 1, opacity.norm)); - baseTexDirty = true; } @@ -436,8 +433,7 @@ struct WindowPrivate { /* Cursor */ if (!cursorRect->isEmpty()){ /* Effective cursor rect has 16 xy offset to window */ - IntRect effectRect(cursorRect->x+16, cursorRect->y+16, - cursorRect->width, cursorRect->height); + IntRect effectRect(cursorRect->x+16, cursorRect->y+16, cursorRect->width, cursorRect->height); cursorVert.vert = &vert[i*4]; TileQuads::buildFrameSource(cursorSrc, cursorVert.vert); i += TileQuads::buildFrame(effectRect, cursorVert.vert); @@ -527,15 +523,12 @@ struct WindowPrivate { if (useBaseTex){ shader.setTexSize(Vec2i(baseTex.width, baseTex.height)); - TEX::bind(baseTex.tex); baseTexQuad.draw(); }else{ windowskin->bindTex(shader); TEX::setSmooth(true); - baseQuadArray.draw(); - TEX::setSmooth(false); } } @@ -573,18 +566,14 @@ struct WindowPrivate { /* Draw arrows / cursors */ windowskin->bindTex(shader); TEX::setSmooth(true); - controlsQuadArray.draw(0, controlsQuadCount); - TEX::setSmooth(false); } if (!nullOrDisposed(contents)){ /* Draw contents bitmap */ glState.scissorBox.setIntersect(contentsRect); - shader.setTranslation(efPos + (Vec2i(16) - contentsOffset)); - contents->bindTex(shader); contentsQuad.draw(); } @@ -598,19 +587,15 @@ struct WindowPrivate { if (active && cursorVert.vert){ float alpha = cursorAniAlpha[cursorAniAlphaIdx] / 255.0f; - cursorVert.setAlpha(alpha); - updateArray = true; } if (pause && pauseAniVert.vert){ float alpha = pauseAniAlpha[pauseAniAlphaIdx] / 255.0f; FloatRect frameRect = pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]]; - pauseAniVert.setAlpha(alpha); Quad::setTexRect(pauseAniVert.vert, frameRect); - updateArray = true; } @@ -642,7 +627,6 @@ Window::~Window(){ void Window::update(){ guardDisposed(); - p->updateControls(); p->stepAnimations(); } @@ -650,7 +634,6 @@ void Window::update(){ DEF_ATTR_SIMPLE(Window, X, int, p->position.x) DEF_ATTR_SIMPLE(Window, Y, int, p->position.y) DEF_ATTR_SIMPLE(Window, CursorRect, Rect&, *p->cursorRect) - DEF_ATTR_RD_SIMPLE(Window, Windowskin, Bitmap*, p->windowskin) DEF_ATTR_RD_SIMPLE(Window, Contents, Bitmap*, p->contents) DEF_ATTR_RD_SIMPLE(Window, Stretch, bool, p->bgStretch) @@ -666,9 +649,7 @@ DEF_ATTR_RD_SIMPLE(Window, ContentsOpacity, int, p->contentsOpacity) void Window::setWindowskin(Bitmap *value){ guardDisposed(); - p->windowskin = value; - if (nullOrDisposed(value)) return; @@ -795,7 +776,6 @@ void Window::setContentsOpacity(int value){ void Window::initDynAttribs(){ p->cursorRect = new Rect; - p->refreshCursorRectCon(); } @@ -809,13 +789,11 @@ void Window::onGeometryChange(const Scene::Geometry &geo){ void Window::setZ(int value){ ViewportElement::setZ(value); - p->controlsElement.setZ(value + 2); } void Window::setVisible(bool value){ ViewportElement::setVisible(value); - p->controlsElement.setVisible(value); } @@ -825,8 +803,6 @@ void Window::onViewportChange(){ void Window::releaseResources(){ p->controlsElement.release(); - unlink(); - delete p; } diff --git a/src/window.h b/src/window.h index 98184d1..cedf7b9 100644 --- a/src/window.h +++ b/src/window.h @@ -32,8 +32,7 @@ struct Rect; struct WindowPrivate; -class Window : public ViewportElement, public Disposable -{ +class Window : public ViewportElement, public Disposable{ public: Window(Viewport *viewport = 0); ~Window();