Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Wed Nov 13, 2019 3:57 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sat Oct 20, 2007 7:12 am 
Offline

Joined: Sat Oct 20, 2007 6:10 am
Posts: 5
I wanted to use joystick buttons for camera switch and level restart. I like the external camera most of the time, but I switch to the in-car camera for loop-the-loops, since the external cam is nearly useless. (I might not need that with cspotcode's new camera mode, though; haven't tried it enough yet.)

Also, 'c' is right next to the dangerous space bar, and I normally have both hands on the joystick anyway.

Anyway, it turned out to be pretty easy to figure out the code, esp. with the help of kscope to keep track of what C function I was in. (I really don't like having function bodies not indented.) Here's a patch against the Radium 1.2 mania_drive.c:

Code:
--- mania_drive.c.orig  2006-08-21 17:56:03.000000000 -0300
+++ mania_drive.c~      2007-10-20 02:24:13.000000000 -0300
@@ -2272,7 +2272,8 @@
 
 if(raydium_key_last==1116) draw_debug*=-1;
 
-if(raydium_key_last==1032)
+// PJC- joystick buttons added.
+if(raydium_key_last==1032 || raydium_joy_click == 6)
     create_car();
 
 if(raydium_key_last==1008)
@@ -2282,7 +2283,8 @@
 if(raydium_key_last==1122) { raydium_ode_time_change(10); }
 if(raydium_key_last==1101) { raydium_ode_time_change(100); }
 
-if(raydium_key_last==1000+'c')
+// joystick buttons switch camera
+if(raydium_key_last==1000+'c' || raydium_joy_click == 3)
     {
     if(vue==3)
        raydium_key_last=6;
@@ -2290,7 +2292,7 @@
        raydium_key_last=3;
     }
 
-if(raydium_key_last==5)
+if(raydium_key_last==5 || raydium_joy_click == 1)
 {
 vue=5;
 raydium_projection_near=10;
@@ -2298,7 +2300,7 @@
 raydium_window_view_update();
 }
                                                                                 
-if(raydium_key_last==6)
+if(raydium_key_last==6 || raydium_joy_click == 2)
 {
 vue=6;
 raydium_projection_near=0.05 ;


This is extremely arbitrary. I wrote it for my own use. It's not often you look at your joystick and hard code the numbers written on the buttons into some source code. :P The only problem now is that the X screensaver activates because there's no kbd or mouse input. Raydium should probably take care of that. Or ManiaDrive can maybe simulate a keypress every minute or so. That's more reliable than just disabling the X screensaver (e.g. xset s off), since gnome/kde/xscreensaver are all different. xine (the video player) sends fake events. mplayer disables the x screensaver and dpms, and re-enables on exit (which of course doesn't happen if it crashes).

If you decide to put something like this in the official version, you could make the highest-numbered joystick button be the restart-level button, and all others do the same thing as 'c'.

Anyway, great game. This is the kind of driving game I was looking for. vdrift is fun, but I find it too easy to spin out. OTOH, I don't want something with totally arcade physics. (Being a physicist, I appreciate good physics...) Also, I loved stunt-car racer on the atari ST, and Mania Drive has some similar aspects.

_________________
"The gods confound the man who first found out how to distinguish the hours!
Confound him, too, who in this place set up a sundial, to cut and hack
my day so wretchedly into small pieces!" -- Plautus, 200 BC


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 7:38 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
Good points ! Since the current version of ManiaDrive was created for being played using keyboard (and then don't provides any joystick/joypad/wheel control setup), very few peoples are playing without the keyboard, and you're the first to report the "c-key-is-too-close-to-spacebar" and the screensaver bug.

I'll look at the screensaver trouble soon, and just found a great link about it :
http://www.jwz.org/xscreensaver/faq.html#dvd

Did KDE, Gnome and others all use xscreensaver ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 10:03 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
As a follow-up to my previous message,

With commit 580, Raydium is now supposed to disable screensaver and DPMS for Linux. I've tested this quickly on two computers (WindowMaker & KDE). It's still a bit dirty since it don't enable back SS and DPMS on exit ... :/

Short story: we must check if it works on many systems !


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 3:02 pm 
Offline

Joined: Sat Oct 20, 2007 6:10 am
Posts: 5
Xfennec wrote:
Good points ! Since the current version of ManiaDrive was created for being played using keyboard (and then don't provides any joystick/joypad/wheel control setup), very few peoples are playing without the keyboard, and you're the first to report the "c-key-is-too-close-to-spacebar" and the screensaver bug.


I'm surprised. Driving is so much nicer with analog steering. It lets you take wide corners at high speed.

Quote:
I'll look at the screensaver trouble soon, and just found a great link about it :
http://www.jwz.org/xscreensaver/faq.html#dvd

Did KDE, Gnome and others all use xscreensaver ?


no, there's gnome-screensaver...

_________________
"The gods confound the man who first found out how to distinguish the hours!
Confound him, too, who in this place set up a sundial, to cut and hack
my day so wretchedly into small pieces!" -- Plautus, 200 BC


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 5:54 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
No time for hacking, but this system call should help to solve the gnome problem:

Code:
gconftool-2 --type boolean -s /apps/gnome_settings_daemon/screensaver/start_screensaver false


and for re-enable it
Code:
gconftool-2 --type boolean -s /apps/gnome_settings_daemon/screensaver/start_screensaver true


And maybe this line could be needed at some point:
Code:
killall gnome-screensaver


update:
I just have found a new way to "inhibit" the screensaver while the system call is being launched:
Code:
gnome-screensaver-command -i


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 04, 2007 4:10 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
It should be OK with the current code for Gnome too, since we talk directly to X. MPlayer do it the same way.

Anyone using Gnome can use the latest SVN version and see if screensaver is really disabled when running a Raydium app to confirm this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group