This commit is contained in:
ZakatTeamI2P 2026-05-18 23:08:54 +04:00
parent a4d86310d8
commit a6e2dc795a
17 changed files with 35 additions and 90 deletions

View file

@ -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 ##

View file

@ -75,6 +75,9 @@ void fileIntBindingInit();
void journalBindingInit();
void wallpaperBindingInit();
#ifdef __linux__
void wallpaperBindingTerminate();
#endif
void nikoBindingInit();
void oneshotBindingInit();
void SunshineBindingInit();

View file

@ -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)

View file

@ -128,9 +128,6 @@ static buttonCodes[] = {
{ "MOUSELEFT", Input::MouseLeft },
{ "MOUSEMIDDLE", Input::MouseMiddle },
{ "MOUSERIGHT", Input::MouseRight },
{ "LCTRL", Input::LCTRL },
{ "RCTRL", Input::RCTRL },
};
static elementsN(buttonCodes);

View file

@ -43,7 +43,6 @@ RB_METHOD(windowInitialize){
RB_METHOD(windowUpdate){
RB_UNUSED_PARAM;
Window *w = getPrivateData<Window>(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" );

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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);

View file

@ -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();

View file

@ -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);

View file

@ -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;
}

View file

@ -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();