mirror of
https://github.com/RGBCube/serenity
synced 2025-07-31 17:37:46 +00:00
Ports: Add GLTron
The patches mainly convert this SDL1 game to SDL2. It has some graphical artifacts, but it's playable!
This commit is contained in:
parent
1c2e07d42a
commit
c7e021c1f1
10 changed files with 234 additions and 0 deletions
11
Ports/gltron/patches/config.sub.patch
Normal file
11
Ports/gltron/patches/config.sub.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- gltron-0.70/config.sub 2002-03-23 17:40:17.000000000 +0000
|
||||
+++ gltron-0.70-patched/config.sub 2022-01-09 23:05:14.342418312 +0000
|
||||
@@ -1070,7 +1070,7 @@
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
- | -os2* | -vos*)
|
||||
+ | -os2* | -vos* | -serenity*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
29
Ports/gltron/patches/configure.patch
Normal file
29
Ports/gltron/patches/configure.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
--- gltron-0.70/configure 2003-12-14 09:00:19.000000000 +0000
|
||||
+++ gltron-0.70-patched/configure 2022-01-10 00:11:14.467260522 +0000
|
||||
@@ -2805,7 +2805,7 @@
|
||||
RANLIB="$ac_cv_prog_RANLIB"
|
||||
fi
|
||||
|
||||
-CFLAGS="-DSEPARATOR=\"'/'\""
|
||||
+CFLAGS="$CFLAGS -DSEPARATOR=\"'/'\""
|
||||
|
||||
# Check whether --enable-warn or --disable-warn was given.
|
||||
if test "${enable_warn+set}" = set; then
|
||||
@@ -3130,7 +3130,7 @@
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
-LIBS="-lGL $LIBS"
|
||||
+LIBS="-lgl $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line 3135 "configure"
|
||||
#include "confdefs.h"
|
||||
@@ -3171,7 +3171,7 @@
|
||||
#define HAVE_LIBGL 1
|
||||
EOF
|
||||
|
||||
- LIBS="-lGL $LIBS"
|
||||
+ LIBS="-lgl $LIBS"
|
||||
|
||||
else
|
||||
{ { echo "$as_me:3177: error: OpenGL is not installed" >&5
|
10
Ports/gltron/patches/game_init_sdl_c.patch
Normal file
10
Ports/gltron/patches/game_init_sdl_c.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- gltron-0.70/src/game/init_sdl.c 2003-07-13 13:47:58.000000000 +0000
|
||||
+++ gltron-0.70-patched/src/game/init_sdl.c 2022-01-10 00:57:00.255732917 +0000
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
void inputInit(void) {
|
||||
/* keyboard */
|
||||
- SDL_EnableKeyRepeat(0, 0); /* turn keyrepeat off */
|
||||
|
||||
/* joystick */
|
||||
if(SDL_Init(SDL_INIT_JOYSTICK) >= 0) {
|
22
Ports/gltron/patches/lua_makefile_in.patch
Normal file
22
Ports/gltron/patches/lua_makefile_in.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- gltron-0.70/lua/src/lib/Makefile.in 2003-12-14 09:00:20.000000000 +0000
|
||||
+++ gltron-0.70-patched/lua/src/lib/Makefile.in 2022-01-10 00:05:42.499282291 +0000
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
DEFS =
|
||||
CPPFLAGS =
|
||||
-CFLAGS = -ansi -pedantic -Wall -I$(srcdir)/.. -I$(top_srcdir)/lua/include
|
||||
+CFLAGS = -pedantic -Wall -I$(srcdir)/.. -I$(top_srcdir)/lua/include
|
||||
LDFLAGS =
|
||||
LIBS = -lm
|
||||
|
||||
--- gltron-0.70/lua/src/Makefile.in 2003-12-14 09:00:20.000000000 +0000
|
||||
+++ gltron-0.70-patched/lua/src/Makefile.in 2022-01-10 00:05:33.643271402 +0000
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
DEFS =
|
||||
AM_CPPFLAGS =
|
||||
-AM_CFLAGS = -ansi -pedantic -Wall -I$(srcdir) -I$(top_srcdir)/lua/include
|
||||
+AM_CFLAGS = -pedantic -Wall -I$(srcdir) -I$(top_srcdir)/lua/include
|
||||
LDFLAGS =
|
||||
LIBS = -lm
|
||||
|
25
Ports/gltron/patches/nebu_input_system_c.patch
Normal file
25
Ports/gltron/patches/nebu_input_system_c.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
--- gltron-0.70/nebu/input/input_system.c 2003-07-16 20:23:38.000000000 +0000
|
||||
+++ gltron-0.70-patched/nebu/input/input_system.c 2022-01-10 00:40:05.362550537 +0000
|
||||
@@ -6,18 +6,19 @@
|
||||
#include "SDL.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
+extern SDL_Window* window;
|
||||
static float joystick_threshold = 0;
|
||||
|
||||
void SystemGrabInput() {
|
||||
- SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
+ SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
}
|
||||
|
||||
void SystemUngrabInput() {
|
||||
- SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
+ SDL_SetWindowGrab(window, SDL_FALSE);
|
||||
}
|
||||
|
||||
void SystemWarpPointer(int x, int y) {
|
||||
- SDL_WarpMouse(x, y);
|
||||
+ SDL_WarpMouseInWindow(window, x, y);
|
||||
}
|
||||
|
||||
void SystemHidePointer() {
|
15
Ports/gltron/patches/nebu_scripting_h.patch
Normal file
15
Ports/gltron/patches/nebu_scripting_h.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
--- gltron-0.70/nebu/include/scripting/nebu_scripting.h 2003-12-12 09:01:13.000000000 +0000
|
||||
+++ gltron-0.70-patched/nebu/include/scripting/nebu_scripting.h 2022-01-10 00:21:06.346024766 +0000
|
||||
@@ -18,9 +18,9 @@
|
||||
extern int scripting_CopyStringResult(char *s, int len);
|
||||
|
||||
|
||||
-extern void scripting_RunFile(const char *name);
|
||||
-extern void scripting_Run(const char *command);
|
||||
-extern void scripting_RunFormat(const char *format, ...);
|
||||
+extern void scripting_RunFile(char *name);
|
||||
+extern void scripting_Run(char *command);
|
||||
+extern void scripting_RunFormat(char *format, ...);
|
||||
extern void scripting_RunGC();
|
||||
extern void scripting_Register(const char *name, int(*func) (lua_State *L));
|
||||
|
63
Ports/gltron/patches/nebu_video_system_c.patch
Normal file
63
Ports/gltron/patches/nebu_video_system_c.patch
Normal file
|
@ -0,0 +1,63 @@
|
|||
--- gltron-0.70/nebu/video/video_system.c 2003-07-21 08:18:57.000000000 +0000
|
||||
+++ gltron-0.70-patched/nebu/video/video_system.c 2022-01-10 00:39:53.078575380 +0000
|
||||
@@ -1,16 +1,17 @@
|
||||
#include "Nebu_video.h"
|
||||
|
||||
-#include "SDL.h"
|
||||
+#include "SDL.h"
|
||||
#include "SDL_opengl.h"
|
||||
|
||||
-static SDL_Surface *screen;
|
||||
+SDL_Window* window;
|
||||
+static SDL_GLContext glcontext;
|
||||
static int width, height;
|
||||
static int flags;
|
||||
static int fullscreen;
|
||||
extern int video_initialized;
|
||||
|
||||
void SystemSwapBuffers() {
|
||||
- SDL_GL_SwapBuffers();
|
||||
+ SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
||||
void SystemInitWindow(int x, int y, int w, int h) {
|
||||
@@ -50,21 +51,22 @@
|
||||
}
|
||||
|
||||
void SystemSetGamma(float red, float green, float blue) {
|
||||
- SDL_SetGamma(red, green, blue);
|
||||
+ SDL_SetWindowBrightness(window, (red + green + blue) / 3);
|
||||
}
|
||||
|
||||
int SystemCreateWindow(char *name) {
|
||||
- int f = SDL_OPENGL;
|
||||
+ int f = SDL_WINDOW_OPENGL;
|
||||
if(fullscreen & SYSTEM_FULLSCREEN)
|
||||
- f |= SDL_FULLSCREEN;
|
||||
- if( (screen = SDL_SetVideoMode( width, height, 0, f )) == NULL ) {
|
||||
+ f |= SDL_WINDOW_FULLSCREEN;
|
||||
+ if( (window = SDL_CreateWindow("GLTron", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, f )) == NULL ) {
|
||||
fprintf(stderr, "[system] Couldn't set GL mode: %s\n", SDL_GetError());
|
||||
exit(1); /* OK: critical, no visual */
|
||||
}
|
||||
- SDL_WM_SetCaption("GLtron", "");
|
||||
- glClearColor(0,0,0,0);
|
||||
- glClear(GL_COLOR_BUFFER_BIT);
|
||||
- SDL_GL_SwapBuffers();
|
||||
+ glcontext = SDL_GL_CreateContext(window);
|
||||
+ SDL_SetWindowTitle(window, "GLtron");
|
||||
+ glClearColor(0,0,0,0);
|
||||
+ glClear(GL_COLOR_BUFFER_BIT);
|
||||
+ SDL_GL_SwapWindow(window);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -76,7 +78,7 @@
|
||||
/* there used to be some problems (memory leaks, unprober driver unloading)
|
||||
* caused by this, but I can't remember what they where
|
||||
*/
|
||||
-
|
||||
+ SDL_GL_DeleteContext(glcontext);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
video_initialized = 0;
|
||||
}
|
31
Ports/gltron/patches/scripts_config_lua.patch
Normal file
31
Ports/gltron/patches/scripts_config_lua.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
--- gltron-0.70/scripts/config.lua 2003-12-12 09:01:14.000000000 +0000
|
||||
+++ gltron-0.70-patched/scripts/config.lua 2022-01-11 01:05:39.007703324 +0000
|
||||
@@ -90,18 +90,18 @@
|
||||
|
||||
settings.keys = {
|
||||
{ -- player 1
|
||||
- left = 97, -- lower case 'a'
|
||||
- right = 115, -- lower case 's'
|
||||
- glance_left = 113, -- lower case 'q'
|
||||
- glance_right = 119, -- lower case 'w'
|
||||
- boost = 101, -- lower case 'd'
|
||||
+ left = 65, -- lower case 'a'
|
||||
+ right = 83, -- lower case 's'
|
||||
+ glance_left = 81, -- lower case 'q'
|
||||
+ glance_right = 87, -- lower case 'w'
|
||||
+ boost = 68, -- lower case 'd'
|
||||
},
|
||||
{ -- player 2
|
||||
- left = 106, -- lower case 'j'
|
||||
- right = 107, -- lower case 'k'
|
||||
- glance_left = 117, -- lower case 'u'
|
||||
- glance_right = 105, -- lower case 'i'
|
||||
- boost = 108, -- lower case 'l'
|
||||
+ left = 74, -- lower case 'j'
|
||||
+ right = 75, -- lower case 'k'
|
||||
+ glance_left = 85, -- lower case 'u'
|
||||
+ glance_right = 73, -- lower case 'i'
|
||||
+ boost = 76, -- lower case 'l'
|
||||
},
|
||||
{ -- player 3
|
||||
left = 276, -- cursor left
|
Loading…
Add table
Add a link
Reference in a new issue