A few patches for 1.6.58

D2X-XL - Descent II update for modern systems with many new features and enhanced graphics. Home Page

Moderators: Grendel, Aus-RED-5

Locked
zelurker
DBB Cadet
DBB Cadet
Posts: 8
Joined: Wed Jun 07, 2006 2:00 pm

A few patches for 1.6.58

Post by zelurker »

these patches are mainly for linux, my little contribution to the fabulous d2x-xl ! :)
Get them from here : http://www.rainemu.com/html/archive/tux/d2xl/d2x.html

Changes :
- avoid random crashes when running in x86-64 where sizeof(long)=8 :
- allow the digital midi music to really loop when playing with timidity and sdl_mixer in linux :
- The international keyboards :
A big one for the keyboard now : I am a french user, and I get frustrated not to be able to use the normal keys for weapons. So this patches adresses this, and changes the way to handle keyboard (no more loop from 0 to 255 for each key pressed, it's faster now, direct access and all keys are recognized). There is a part to add the translation for the weapon keys in french keyboards with a comment just before (French translations), maybe this part should be executed only if some command line switch is passed, or maybe it won't hurt anyone, I don't know. This one also includes the modifications from the win32 source to have the special windows keys mapped (not really usefull anyway now since every key is mapped) :

Now there is a patch for sdl_mixer-1.2.7 also because if you use the extra ps1 movies for descent 1 and use timidity digital midi, then you'll have a crash just after the intro movie, even before selecting a pilot. This is because the audio is closed and then reopened, and the timidity support in sdl_mixer doesn't support this. The patch is very short anyway :

About audio for briefings from the ps1 version : I have resampled them so that they now sound better. But with the music playing at the same time, it's far from perfect. I hesitate to convert them to ogg, and play them instead of the music when they are available, or just lower the volume of the music while playing them in wav format. No patch for now then, if you want the resampled version, I'll send them in ogg format because it's 1/10 of the wav size !
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Thank you very much. Please send the complete sdl\\key.c to karx11erx at hotmail dot com. I cannot interprete your diff here.

You also shouldn't delete this statement:

if (key == KEY_CTRLED+KEY_ALTED+KEY_ENTER) exit (0);

because that is the key combo to immediately terminate the program.

You also shouldn't delete:

int b = gameOpts->legacy.bInput;
gameOpts->legacy.bInput = 1;
...
gameOpts->legacy.bInput = b;

because this makes sure a key is read.
zelurker
DBB Cadet
DBB Cadet
Posts: 8
Joined: Wed Jun 07, 2006 2:00 pm

Post by zelurker »

Ok, mail sent, I hope hotmail can handle 2 Mb attachements because I sent the whole source tree for simplicity !

The patch has evolved now :
- took back the Ctrl+Alt+Enter shortcut to quit immediately
- fixed a ton of warnings with gcc-4 (and a tons of warning are left to fix)
- fixed a stupid bug with chdir which prevented the display of the date when loading a savegame
- fixed the audio briefings not playing for secret levels in descent 1
- now pressing shift F4 in a descent 1 mine creates the guide bot, even if its behaviour is a little different in descent 1 mine, it can be very usefull, and it's definetely not a cheat here, just a feature ! :)
- enabling missile view in the gui now also works for descent 1 levels (there was no reason to forbid this)
zelurker
DBB Cadet
DBB Cadet
Posts: 8
Joined: Wed Jun 07, 2006 2:00 pm

Post by zelurker »

Actually the patch now applies to 1.6.70, and edited all my messages, removing the patches from the forum and installed them in a quick web page.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

zelurker,

I appreciate your help, but since I have been changing the D2X-XL source code myself since v1.6.70, I cannot and will not simply copy your source tree over mine.

So please send diffs for small and only the affected source file(s) for big changes.

I also will not allow the Guidebot or missile view in D1, as that is not D1, and most D1 players want D1 as close as possible to the original.
zelurker
DBB Cadet
DBB Cadet
Posts: 8
Joined: Wed Jun 07, 2006 2:00 pm

Post by zelurker »

Yeah so they just uncheck \"missile view\" and avoid to press Shift+F4 and so they have the original descent.

For the diffs, well it's very easy to edit a diff file and choose the part you want.
If you don't want to do that, well I guess I'll update my patch when you'll release something new !
Sorry but I am doing this for fun too, and it's much harder to maintain lots of little patches than a big one, especially with the warning fixing stuff which spreads on many source files. And since you will probably never want to include all the patches, I'll have to maintain them, so I'd better choose an easy way of doing it, and the easy way is to have 1 big patch, and let you choose the parts you want inside.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

#1 I don't want to you to create and offer a parallel D2X-XL to my version.

#2 I am interested in your fixes, but I will not do a diff over all the source code everytime you supply some changes if you know exactly which files you have changed.

Currently I don't have a source version control system running, so the only way to go for the time being is diffs.
zelurker
DBB Cadet
DBB Cadet
Posts: 8
Joined: Wed Jun 07, 2006 2:00 pm

Post by zelurker »

This forum is completely broken, this is the 2nd time I need to type this message because of a stupid sql error when inserting the search words.
Time to move on ?

Anyway... don't worry for a version control system, diffs are ok as long as they don't get too big, and for now my patch is only 28k, you could say it weights nothing ! And diffs are very readable, just try to open them in vim, and you'll get colored versions for more readability. Just copy and paste the part you are interested in, and then apply to your source, and it's ok.

By the way, a last little one which fixes entrance in secret levels in descent 1 when you keep the mouse button pressed in the briefing (see comment) :

Code: Select all

*** d2xl/main/gameseq.c 2006-06-08 03:50:06.000000000 +0200
--- d2xl-new/main/gameseq.c     2006-06-14 15:22:30.000000000 +0200
***************
*** 1514,1519 ****
--- 1514,1522 ----
        gameStates.render.bDoAppearanceEffect = 1;
        ai_reset_all_paths();
        // -- NO? -- reset_time();
+       reset_time(); // yes : when you keep the mouse button pressed after
+       // the briefing your ship fires all its energy in a single shot if
+       // you don't call this
        reset_rear_view();
        gameData.app.fusion.xAutoFireTime = 0;
        gameData.app.fusion.xCharge = 0;
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

zelurker,

please send me diffs. I will not do them myself.

Where's that web site of yours?

Edit: Found it. You have made a hell of a lot of superfluous changes to the source code, like adding extra brackets to conditional statements (probably because the idiotic GNU compiler doesn't think one bracket is enough), or adding curly brackets where they're not really needed, like e.g. here:

while ((c = *text_ptr)) {

That doesn't make it any easier to extract the functional changes/bug fixes from your source code.

You also have been removing data declarations that aren't needed for Linux, but for Win32.

This is wrong:

Warning (\"%s %s. %s, TXT_LOAD_FAILED, D1_PIGFILE, TXT_D1_SUPPORT\");

and should be

Warning (\"%s %s. %s\", TXT_LOAD_FAILED, D1_PIGFILE, TXT_D1_SUPPORT);

I will/can also not integrate your key handling changes, as

a) They're not general enough to work for all/most common languages
b) I cannot see from the diff what I have to change

I think you should stop changing with the D2X-XL source code w/o consulting me about it, and stop messing with things you haven't studied thoroughly enough to understand them.
zelurker
DBB Cadet
DBB Cadet
Posts: 8
Joined: Wed Jun 07, 2006 2:00 pm

Post by zelurker »

Diedel wrote:zelurker,

Edit: Found it. You have made a hell of a lot of superfluous changes to the source code, like adding extra brackets to conditional statements (probably because the idiotic GNU compiler doesn't think one bracket is enough), or adding curly brackets where they're not really needed, like e.g. here:

while ((c = *text_ptr)) {

This kind of subject is better discussed by mail, but yes it's only because of the annoying warnings of gcc4. You have to clean them all if you want to start to see something in what happens.
And in the mess of all the useless fixes, a very few can be usefull.
It's boring but usefull in the end.
This is wrong:

Warning ("%s %s. %s, TXT_LOAD_FAILED, D1_PIGFILE, TXT_D1_SUPPORT");

and should be

Warning ("%s %s. %s", TXT_LOAD_FAILED, D1_PIGFILE, TXT_D1_SUPPORT);
Well without the ", it can't compile for me.
I will/can also not integrate your key handling changes, as

a) They're not general enough to work for all/most common languages
Wrong, just try it and you'll see (except for the mapping in the init function, but you can mke this part optional as I mentioned, this is the only part which is french specific.

Without it you can still use the standard keys for weapons but only if you remap them manually in the game one by one -> boring and useless, it's better to use this mapping instead.
b) I cannot see from the diff what I have to change
To sum up : the array of the keys has 512 indexes instead of 256 to be able to adress every key directly by its symcode, instead of running a stupid loop to find the corresponding index for each key typed.
Then the handling function maintains a corresp array to have directly for each key typed the old index required to be recognized by the old engine of the game.

Nothing complicated, but it was a little long to write in the end.
I seperated the function in 2, because I feared to be obliged to call it all the time for each key down, but it's not the case finally, so I could have kept only 1 function. Not a big deal, it might be a little clearer this way.
I think you should stop changing with the D2X-XL source code w/o consulting me about it, and stop messing with things you haven't studied thoroughly enough to understand them.
This is your opinion.
As a matter of fact, don't forget that I am doing this first on a selfish motivation!
Just because I find the game more enjoyable with this.
So this patch is first for myself, so I probably won't stop patching just for you. But if you want you can just refuse the patch, I proposed it because I thought it could be usefull. If you disagree, well it's not a big deal for me, I'll just keep it for me ! :)
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

You put the double quote in the wrong place. ;)

You have some special French key assignments hard coded in your changed keyboard handling. This is in no way a general method to achieve multi-language keyboard support. And the more I look at your diff (hotmail reports a virus in your archive, which I believe is a problem of their virus scanner, but I cannot download the stuff, so cannot look at the complete source file), the more I believe your changes to the keyboard handling could be severely flawed at least as far as the Mac part is concerned.

I have nothing against your patches, but I want an organized way to get them into the 'official' D2X-XL.

Though I do appreciate your contributions, your approach makes this rather hard.

Let's put it this way: You talk about your changes with me first, we find a way to put it into 'official' D2X-XL together instead of stomping over my code no matter what and regardless of what I am doing with it, and you will not have to patch your version every time I change something (and I sometimes create pretty substantial changes to the game ;)).
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

A note to everybody who followed this thread:

zelurker sent me an e-mail making clear that he is not willing to contribute to D2X-XL in a way that will make sure the program stays fully compatible and that is easily enough accessible for me to add his changes to the software.

I will not say too much about the contents and tone of his e-mail, only so much that I think there is no way to find a compromise satisfying both sides.
Locked