diff --git a/CMakeLists.txt b/CMakeLists.txt index cb7461f..d4a47fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.9) project(quake2global) add_compile_definitions(__i386__) +add_compile_definitions(C_ONLY) add_subdirectory(src/quake2) diff --git a/src/game_baseq2/CMakeLists.txt b/src/game_baseq2/CMakeLists.txt index 6494101..40c623b 100644 --- a/src/game_baseq2/CMakeLists.txt +++ b/src/game_baseq2/CMakeLists.txt @@ -51,5 +51,3 @@ add_library(game_baseq2 SHARED p_weapon.c q_shared.c ) - -set_target_properties(game_baseq2 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") diff --git a/src/quake2/CMakeLists.txt b/src/quake2/CMakeLists.txt index 95bc782..6b3c772 100644 --- a/src/quake2/CMakeLists.txt +++ b/src/quake2/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.9) -project(quake2 C ASM) +project(quake2 C) -set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") +#set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") add_executable(quake2 ../game_baseq2/m_flash.c @@ -32,7 +32,7 @@ add_executable(quake2 linux/net_udp.c linux/q_shlinux.c linux/snd_linux.c - linux/snd_mixa.s + #linux/snd_mixa.s linux/sys_linux.c linux/vid_menu.c linux/vid_so.c @@ -57,6 +57,4 @@ add_executable(quake2 server/sv_world.c ) -set_target_properties(quake2 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") - target_link_libraries(quake2 dl m) diff --git a/src/quake2/client/snd_mix.c b/src/quake2/client/snd_mix.c index 00f201d..bd90563 100644 --- a/src/quake2/client/snd_mix.c +++ b/src/quake2/client/snd_mix.c @@ -30,7 +30,7 @@ short *snd_out; void S_WriteLinearBlastStereo16 (void); -#if !(defined __linux__ && defined __i386__) +#if !(defined __linux__ && defined __i386__ && id386) #if !id386 void S_WriteLinearBlastStereo16 (void) @@ -362,7 +362,7 @@ void S_InitScaletable (void) } -#if !(defined __linux__ && defined __i386__) +#if !(defined __linux__ && defined __i386__ && id386) #if !id386 void S_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int offset) diff --git a/src/quake2/linux/q_shlinux.c b/src/quake2/linux/q_shlinux.c index eeeef72..76e983a 100644 --- a/src/quake2/linux/q_shlinux.c +++ b/src/quake2/linux/q_shlinux.c @@ -1,3 +1,5 @@ +#define _GNU_SOURCE + #include #include #include @@ -13,18 +15,18 @@ //=============================================================================== -byte *membase; -int maxhunksize; -int curhunksize; +static byte *membase; +static int maxhunksize; +static int curhunksize; void *Hunk_Begin (int maxsize) { // reserve a huge chunk of memory, but don't commit any yet maxhunksize = maxsize + sizeof(int); curhunksize = 0; - membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, + membase = mmap(NULL, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - if (membase == NULL || membase == (byte *)-1) + if (membase == NULL || membase == MAP_FAILED) Sys_Error("unable to virtual allocate %d bytes", maxsize); *((int *)membase) = curhunksize; diff --git a/src/ref_gl/CMakeLists.txt b/src/ref_gl/CMakeLists.txt index ef04d0b..e2c8125 100644 --- a/src/ref_gl/CMakeLists.txt +++ b/src/ref_gl/CMakeLists.txt @@ -25,6 +25,4 @@ add_library(ref_gl SHARED gl_warp.c ) -set_target_properties(ref_gl PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") - target_link_libraries(ref_gl GL) # {OPENGL_LIBRARIES} doesn't seem to play well with -m32 diff --git a/src/ref_soft/CMakeLists.txt b/src/ref_soft/CMakeLists.txt index 0d184e7..310e77c 100644 --- a/src/ref_soft/CMakeLists.txt +++ b/src/ref_soft/CMakeLists.txt @@ -1,25 +1,25 @@ cmake_minimum_required(VERSION 3.9) -project(ref_soft C ASM) +project(ref_soft C) -set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") +#set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") add_library(ref_soft SHARED ../game_baseq2/q_shared.c - ../quake2/linux/d_polysa.s + #../quake2/linux/d_polysa.s ../quake2/linux/glob.c - ../quake2/linux/r_aclipa.s - ../quake2/linux/r_draw16.s - ../quake2/linux/r_drawa.s - ../quake2/linux/r_edgea.s - ../quake2/linux/r_scana.s - ../quake2/linux/r_spr8.s - ../quake2/linux/r_surf8.s - ../quake2/linux/math.s + #../quake2/linux/r_aclipa.s + #../quake2/linux/r_draw16.s + #../quake2/linux/r_drawa.s + #../quake2/linux/r_edgea.s + #../quake2/linux/r_scana.s + #../quake2/linux/r_spr8.s + #../quake2/linux/r_surf8.s + #../quake2/linux/math.s ../quake2/linux/q_shlinux.c - ../quake2/linux/r_varsa.s + #../quake2/linux/r_varsa.s ../quake2/linux/rw_x11.c - ../quake2/linux/sys_dosa.s + #../quake2/linux/sys_dosa.s r_aclip.c r_alias.c @@ -40,6 +40,4 @@ add_library(ref_soft SHARED r_surf.c ) -set_target_properties(ref_soft PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") - target_link_libraries(ref_soft X11 Xext) diff --git a/src/ref_soft/r_misc.c b/src/ref_soft/r_misc.c index ce6837c..ea1a8bd 100644 --- a/src/ref_soft/r_misc.c +++ b/src/ref_soft/r_misc.c @@ -206,7 +206,7 @@ void R_TransformFrustum (void) } -#if !(defined __linux__ && defined __i386__) +#if !(defined __linux__ && defined __i386__ && id386) #if !id386 /*