Skip to content

Commit 111a035

Browse files
committed
Bump yquake2 to 8.50
Uses GLES1 renderer where available Applies patch to enable Hotkey + Start to quit game Also applies patch to convert from SDL3 joy controls to SDL2 Default config file added, and renamed game expansions for ordering
1 parent 247d203 commit 111a035

File tree

4 files changed

+202
-16
lines changed

4 files changed

+202
-16
lines changed

scriptmodules/ports/yquake2.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
rp_module_id="yquake2"
1313
rp_module_desc="yquake2 - The Yamagi Quake II client"
1414
rp_module_licence="GPL2 https://raw.githubusercontent.com/yquake2/yquake2/master/LICENSE"
15-
rp_module_repo="git https://github.com/yquake2/yquake2.git QUAKE2_8_41"
15+
rp_module_repo="git https://github.com/yquake2/yquake2.git QUAKE2_8_50"
1616
rp_module_section="exp"
17-
rp_module_flags=""
17+
rp_module_flags="sdl2"
1818

1919
function depends_yquake2() {
2020
local depends=(libgl1-mesa-dev libglu1-mesa-dev libogg-dev libopenal-dev libsdl2-dev libvorbis-dev zlib1g-dev libcurl4-openssl-dev)
@@ -25,13 +25,17 @@ function depends_yquake2() {
2525
function sources_yquake2() {
2626
gitPullOrClone
2727
# get the add-ons sources
28-
gitPullOrClone "$md_build/xatrix" "https://github.com/yquake2/xatrix" "XATRIX_2_13"
29-
gitPullOrClone "$md_build/rogue" "https://github.com/yquake2/rogue" "ROGUE_2_12"
28+
gitPullOrClone "$md_build/xatrix" "https://github.com/yquake2/xatrix" "XATRIX_2_14"
29+
gitPullOrClone "$md_build/rogue" "https://github.com/yquake2/rogue" "ROGUE_2_13"
30+
31+
# 1st enables Guide+Start to quit. 2nd restores buttons to SDL2 style (from SDL3).
32+
applyPatch "$md_data/hotkey_exit.diff"
33+
applyPatch "$md_data/sdl2_joylabels.diff"
3034
}
3135

3236
function build_yquake2() {
3337
make clean
34-
make
38+
make with_gles1
3539
# build the add-ons source
3640
local repo
3741
for repo in 'xatrix' 'rogue'; do
@@ -50,6 +54,8 @@ function install_yquake2() {
5054
'release/quake2'
5155
'release/ref_gl1.so'
5256
'release/ref_gl3.so'
57+
'release/ref_gles1.so'
58+
'release/ref_gles3.so'
5359
'release/ref_soft.so'
5460
'LICENSE'
5561
'README.md'
@@ -61,17 +67,15 @@ function install_yquake2() {
6167
function add_games_yquake2() {
6268
local cmd="$1"
6369
declare -A games=(
64-
['baseq2/pak0']="Quake II"
65-
['rogue/pak0']="Quake II - Ground Zero"
66-
['xatrix/pak0']="Quake II - The Reckoning"
70+
['baseq2']="Quake II"
71+
['xatrix']="Quake II XP1 - The Reckoning"
72+
['rogue']="Quake II XP2 - Ground Zero"
6773
)
6874

6975
local game
70-
local pak
7176
for game in "${!games[@]}"; do
72-
pak="$romdir/ports/quake2/$game.pak"
73-
if [[ -f "$pak" ]]; then
74-
addPort "$md_id" "quake2" "${games[$game]}" "$cmd" "${game%%/*}"
77+
if [[ -f "$romdir/ports/quake2/$game/pak0.pak" ]]; then
78+
addPort "$md_id" "quake2" "${games[$game]}" "$cmd" "$game"
7579
fi
7680
done
7781
}
@@ -96,19 +100,19 @@ function configure_yquake2() {
96100

97101
if isPlatform "gl3"; then
98102
params+=("+set vid_renderer gl3")
103+
elif isPlatform "gles"; then
104+
params+=("+set vid_renderer gles1")
99105
elif isPlatform "gl" || isPlatform "mesa"; then
100106
params+=("+set vid_renderer gl1")
101107
else
102108
params+=("+set vid_renderer soft")
103109
fi
104110

105-
if isPlatform "kms"; then
106-
params+=("+set r_mode -1" "+set r_customwidth %XRES%" "+set r_customheight %YRES%" "+set r_vsync 1")
107-
fi
108-
109111
mkRomDir "ports/quake2"
110112

111113
moveConfigDir "$home/.yq2" "$md_conf_root/quake2/yquake2"
114+
mkUserDir "$md_conf_root/quake2/yquake2/baseq2"
115+
copyDefaultConfig "$md_data/yq2.cfg" "$md_conf_root/quake2/yquake2/baseq2/yq2.cfg"
112116

113117
[[ "$md_mode" == "install" ]] && game_data_yquake2
114118
add_games_yquake2 "$md_inst/quake2 -datadir $romdir/ports/quake2 ${params[*]} +set game %ROM%"
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c
2+
index 7ea263a4..4e16892e 100644
3+
--- a/src/client/input/sdl2.c
4+
+++ b/src/client/input/sdl2.c
5+
@@ -79,11 +79,12 @@ typedef enum
6+
// IN_Update() called at the beginning of a frame to the
7+
// actual movement functions called at a later time.
8+
static float mouse_x, mouse_y;
9+
-static unsigned char joy_escbutton = SDL_CONTROLLER_BUTTON_START;
10+
static int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y;
11+
static float gyro_yaw, gyro_pitch;
12+
static qboolean mlooking;
13+
14+
+static qboolean hotkey_back = false; // RetroPie Hotkey is Back instead of Guide
15+
+
16+
// The last time input events were processed.
17+
// Used throughout the client.
18+
int sys_frame_time;
19+
@@ -652,6 +653,7 @@ IN_Update(void)
20+
static qboolean left_trigger = false;
21+
static qboolean right_trigger = false;
22+
static qboolean left_stick[4] = {false, false, false, false}; // left, right, up, down virtual keys
23+
+ static qboolean hotkey_pressed = false; // is Hotkey in RetroPie pressed
24+
25+
static int consoleKeyCode = 0;
26+
27+
@@ -852,9 +854,22 @@ IN_Update(void)
28+
qboolean down = (event.type == SDL_CONTROLLERBUTTONDOWN);
29+
unsigned char btn = event.cbutton.button;
30+
31+
- // Handle Esc button first, to override its original key
32+
- Key_Event( (btn == joy_escbutton)? K_ESCAPE : K_JOY_FIRST_BTN + btn,
33+
- down, true );
34+
+ switch (btn)
35+
+ {
36+
+ case SDL_CONTROLLER_BUTTON_START:
37+
+ if (hotkey_pressed && down)
38+
+ Cbuf_AddText("quit");
39+
+ else
40+
+ Key_Event( K_ESCAPE, down, true );
41+
+ break;
42+
+
43+
+ case SDL_CONTROLLER_BUTTON_BACK:
44+
+ if (hotkey_back)
45+
+ case SDL_CONTROLLER_BUTTON_GUIDE:
46+
+ hotkey_pressed = down;
47+
+ default:
48+
+ Key_Event( K_JOY_FIRST_BTN + btn, down, true );
49+
+ }
50+
break;
51+
}
52+
53+
@@ -2204,22 +2219,6 @@ IN_Controller_Init(qboolean notify_user)
54+
SDL_Joystick *joystick = NULL;
55+
SDL_bool is_controller = SDL_FALSE;
56+
57+
- cvar = Cvar_Get("joy_escbutton", "0", CVAR_ARCHIVE);
58+
- if (cvar)
59+
- {
60+
- switch ((int)cvar->value)
61+
- {
62+
- case 1:
63+
- joy_escbutton = SDL_CONTROLLER_BUTTON_BACK;
64+
- break;
65+
- case 2:
66+
- joy_escbutton = SDL_CONTROLLER_BUTTON_GUIDE;
67+
- break;
68+
- default:
69+
- joy_escbutton = SDL_CONTROLLER_BUTTON_START;
70+
- }
71+
- }
72+
-
73+
cvar = Cvar_Get("in_initjoy", "1", CVAR_NOSET);
74+
if (!cvar->value)
75+
{
76+
@@ -2365,6 +2364,7 @@ IN_Controller_Init(qboolean notify_user)
77+
78+
show_gamepad = true;
79+
Com_Printf("Enabled as Game Controller, settings:\n%s\n", SDL_GameControllerMapping(controller));
80+
+ hotkey_back = ( !strstr(SDL_GameControllerMapping(controller), "guide:") );
81+
82+
#ifndef NO_SDL_GYRO
83+
84+
@@ -2540,6 +2540,7 @@ IN_Controller_Shutdown(qboolean notify_user)
85+
show_gamepad = show_gyro = show_haptic = false;
86+
joystick_left_x = joystick_left_y = joystick_right_x = joystick_right_y = 0;
87+
gyro_yaw = gyro_pitch = 0;
88+
+ hotkey_back = false;
89+
90+
#ifdef NO_SDL_GYRO
91+
if (imu_joystick)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/src/client/cl_keyboard.c b/src/client/cl_keyboard.c
2+
index 20ba3fcc..c9b24c41 100644
3+
--- a/src/client/cl_keyboard.c
4+
+++ b/src/client/cl_keyboard.c
5+
@@ -216,10 +216,10 @@ static char *gamepadbtns[] =
6+
// It is imperative that this list of buttons follow EXACTLY the order they
7+
// appear in QKEYS enum in keyboard.h, which in turn is the same order as
8+
// they appear in SDL_GamepadButton / SDL_GameControllerButton enum.
9+
- "BTN_SOUTH",
10+
- "BTN_EAST",
11+
- "BTN_WEST",
12+
- "BTN_NORTH",
13+
+ "BTN_A",
14+
+ "BTN_B",
15+
+ "BTN_X",
16+
+ "BTN_Y",
17+
"BTN_BACK",
18+
"BTN_GUIDE",
19+
"BTN_START",
20+
@@ -245,10 +245,10 @@ static char *gamepadbtns[] =
21+
"TRIG_LEFT",
22+
"TRIG_RIGHT",
23+
// Same with _ALT buttons ( button + 'alt modifier' pressed )
24+
- "BTN_SOUTH_ALT",
25+
- "BTN_EAST_ALT",
26+
- "BTN_WEST_ALT",
27+
- "BTN_NORTH_ALT",
28+
+ "BTN_A_ALT",
29+
+ "BTN_B_ALT",
30+
+ "BTN_X_ALT",
31+
+ "BTN_Y_ALT",
32+
"BTN_BACK_ALT",
33+
"BTN_GUIDE_ALT",
34+
"BTN_START_ALT",
35+
diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c
36+
index a4fa5e25..8a4fa52f 100644
37+
--- a/src/client/input/sdl2.c
38+
+++ b/src/client/input/sdl2.c
39+
@@ -2467,8 +2467,8 @@ IN_Init(void)
40+
joy_forwardsensitivity = Cvar_Get("joy_forwardsensitivity", "1.0", CVAR_ARCHIVE);
41+
joy_sidesensitivity = Cvar_Get("joy_sidesensitivity", "1.0", CVAR_ARCHIVE);
42+
43+
- joy_labels = Cvar_Get("joy_labels", "-1", CVAR_ARCHIVE);
44+
- joy_confirm = Cvar_Get("joy_confirm", "-1", CVAR_ARCHIVE);
45+
+ joy_labels = Cvar_Get("joy_labels", "0", CVAR_ARCHIVE);
46+
+ joy_confirm = Cvar_Get("joy_confirm", "0", CVAR_ARCHIVE);
47+
joy_layout = Cvar_Get("joy_layout", "0", CVAR_ARCHIVE);
48+
joy_left_expo = Cvar_Get("joy_left_expo", "2.0", CVAR_ARCHIVE);
49+
joy_left_snapaxis = Cvar_Get("joy_left_snapaxis", "0.15", CVAR_ARCHIVE);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Default gamepad controls
2+
bind SHOULDR_LEFT "+movedown"
3+
bind TRIG_LEFT "+moveup"
4+
bind SHOULDR_RIGHT "+joyaltselector"
5+
bind TRIG_RIGHT "+attack"
6+
7+
bind BTN_A "+movedown"
8+
bind BTN_B "+moveup"
9+
bind BTN_X "weapprev"
10+
bind BTN_Y "weapnext"
11+
bind BTN_BACK "cmd help"
12+
bind BTN_GUIDE "+joyaltselector"
13+
bind STICK_LEFT "+gyroaction"
14+
bind STICK_RIGHT "centerview"
15+
bind DP_UP "cycleweap weapon_plasmabeam weapon_boomer weapon_chaingun weapon_etf_rifle weapon_machinegun weapon_blaster"
16+
bind DP_DOWN "cycleweap weapon_supershotgun weapon_shotgun weapon_chainfist"
17+
bind DP_LEFT "cycleweap weapon_phalanx weapon_rocketlauncher weapon_proxlauncher weapon_grenadelauncher ammo_grenades"
18+
bind DP_RIGHT "cycleweap weapon_bfg weapon_disintegrator weapon_railgun weapon_hyperblaster ammo_tesla ammo_trap"
19+
20+
bind BTN_X_ALT "invdrop"
21+
bind BTN_Y_ALT "invuse"
22+
bind BTN_BACK_ALT "inven"
23+
bind DP_UP_ALT "invprev"
24+
bind DP_DOWN_ALT "invnext"
25+
bind DP_LEFT_ALT "invprev"
26+
bind DP_RIGHT_ALT "invnext"
27+
28+
// Gameplay options, check YQ2 documentation
29+
set cl_run "1"
30+
set aimfix "1"
31+
set g_machinegun_norecoil "1"
32+
set g_quick_weap "1"
33+
set g_swap_speed "2"
34+
35+
// Audio options
36+
set s_openal "0"
37+
set ogg_ignoretrack0 "1"
38+
39+
// Video options
40+
set gl1_discardfb "1"
41+
set gl1_lightmapcopies "1"
42+
set r_mode "-2"

0 commit comments

Comments
 (0)