From c540898c71eb667aef4cd9ed2689f9b39c7b876a Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Fri, 8 May 2020 13:41:12 +0200 Subject: [PATCH] revert -O2 when non matching,fix EU compile,disable cursor in fullscreen - O2 caused problems with audio on US builds when targeting generic systems - compiling an EU version previously caused problems due to race condition in the Makefile - not being able to see the cursor on a small window is annoying, only hide on fullscreen --- Makefile | 11 ++++++++--- src/pc/gfx/gfx_sdl2.c | 5 ++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c862063..aa36bc0 100644 --- a/Makefile +++ b/Makefile @@ -254,7 +254,7 @@ endif endif # Use a default opt flag for gcc -ifeq ($(NON_MATCHING),1) +ifeq ($(COMPILER),gcc) OPT_FLAGS := -O2 endif @@ -644,17 +644,22 @@ $(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h t $(CPP) $(VERSION_CFLAGS) $< -o $@ -I text/$*/ $(TEXTCONV) charmap.txt $@ $@ -O_FILES += $(wildcard $(BUILD_DIR)/bin/$(VERSION)/*.o) - ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION) # Make sure build directory exists before compiling anything DUMMY != mkdir -p $(ALL_DIRS) $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h +ifeq ($(VERSION),eu) +$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o +$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o +$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o +O_FILES += $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o +else $(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h +endif ################################################################ # TEXTURE GENERATION # diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index 1df686b..5a782f5 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -80,7 +80,6 @@ const SDL_Scancode scancode_rmapping_nonextended[][2] = { static void gfx_sdl_init(void) { SDL_Init(SDL_INIT_VIDEO); - SDL_ShowCursor(SDL_DISABLE); // Removes the cursor from view when upon the game's window. SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -105,6 +104,7 @@ static void gfx_sdl_init(void) { if (configFullscreen) { SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP); + SDL_ShowCursor(SDL_DISABLE); } SDL_GL_CreateContext(wnd); @@ -159,10 +159,12 @@ static void gfx_sdl_onkeydown(int scancode) { if (!configFullscreen) { SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP); + SDL_ShowCursor(SDL_DISABLE); } else { SDL_SetWindowFullscreen(wnd, 0); + SDL_ShowCursor(SDL_ENABLE); } configFullscreen = !configFullscreen; @@ -170,6 +172,7 @@ static void gfx_sdl_onkeydown(int scancode) { else if (state[SDL_SCANCODE_ESCAPE] && configFullscreen) { SDL_SetWindowFullscreen(wnd, 0); + SDL_ShowCursor(SDL_ENABLE); configFullscreen = false; } }