The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => General UQM Discussion => Topic started by: kworces on July 17, 2005, 06:05:29 am



Title: Patch to find a star system quickly
Post by: kworces on July 17, 2005, 06:05:29 am
I have a patch for uqm that allows you to search for a star system in the starmap.  For example, you can hit '/' and then type "cent" and press enter to jump to Alpha Centauri.  You can also press the Tab key to cycle between stars in a star system.

This is a source patch in unified diff format.  If anyone is interested you can get it here:

http://www.misfitcode.com/urquanmisfits/


Title: Re: Patch to find a star system quickly
Post by: Torch on July 17, 2005, 03:26:09 pm
So, how do I apply that patch?


Title: Re: Patch to find a star system quickly
Post by: 0xDEC0DE on July 17, 2005, 05:12:44 pm
So, how do I apply that patch?

You can find more information and instructions here (http://www.justfuckinggoogleit.com/search.pl?query=apply+a+source+code+patch).


Title: Re: Patch to find a star system quickly
Post by: kworces on July 17, 2005, 05:45:54 pm
So, how do I apply that patch?

On a Unix-based system (Linux, FreeBSD, etc) you can use the patch command.  I've updated the page with those instructions.  I'm not sure what your best option is on Windows (even after googling it).


Title: Re: Patch to find a star system quickly
Post by: 0xDEC0DE on July 17, 2005, 06:03:42 pm
Huh.  Attempting to apply the patch against my sources yields this:
Code:
daedalus: patch -p0 < ~/Desktop/clustersearch.diff.txt
patching file content/starcon.key
patching file src/sc2code/controls.h
patching file src/sc2code/libs/input/sdl/input.c
patching file src/sc2code/planets/pstarmap.c
patch: **** malformed patch at line 81: @@ -609,12 +621,169 @@
                                                                               

Eyeballing the patch does little; it looks "normal" to me, and my local copy of pstarmap.c is the same as the repository version.  Did you do anything to the files after diff spit them out that might have caused such funny business? 


Title: Re: Patch to find a star system quickly
Post by: kworces on July 17, 2005, 06:28:27 pm
Huh.  Attempting to apply the patch against my sources yields this:

Bah.  I thought for sure I tried that on the website version before I uploaded it.  It's fixed now.


Title: Re: Patch to find a star system quickly
Post by: Megagun on July 17, 2005, 06:54:34 pm
Hey, this is nice!... :)
_O_


Title: Re: Patch to find a star system quickly
Post by: 0xDEC0DE on July 17, 2005, 07:01:45 pm
[keanu]  Whoa.  [/keanu]

Unless you have any overt objections, I'll be including this in my next build of the "unofficial version" (http://www.submedia.net/uqm/).  Very well done.

But of course, a few nitpicks:
  • SDL seems to map the backspace key on Macs to something weird, so that players need to hit Ctrl-H to correct typos.  This may be fixable by altering keys.cfg/starcon.key, or it may require code changes.  I'll post more info if/when I have it.
  • Players who use keys.cfg will not automagically get the key configs they need from starcon.key, which makes for some confusing times.  I'm not sure what the proper method would be for introducing new commands, perhaps a revision bump on starcon.key?
  • If you're looking for an additional challenge, it might be fun to have the star searcher draw "constellations" over the star groups that match; but this might be hard to get right algorithmically, i.e., the Lyncis constellation is supposed to look like "a snake that swallowed an elephant" (this is even a minor plot point) but the names of the stars would not leads one to draw it this way if playing connect-the-dots with the stars in order.  But it could still be fun, and I might take a crack at the task myself, time permitting.


Title: Re: Patch to find a star system quickly
Post by: kworces on July 17, 2005, 11:26:07 pm
Unless you have any overt objections, I'll be including this in my next build of the "unofficial version" (http://www.submedia.net/uqm/).  Very well done.

By all means, share and enjoy.

It also should probably have some sort of text cursor (since left/right will move the text insertion point, though this isn't obviously to the player).  But I'm not that ambitious.

The text entry code was stolen (and modified) from gameopt.c, so if you find a backspace fix for that you'll probably want to apply it there as well.

And yes, the new keys.cfg is an issue.  I specifically noted that on the website, but anyone who gets the patch through some other distribution means wouldn't have instructions for updating their key config.  Not sure what the proper method for updating it is.

Anyways, I actually implemented this back in the fall of 2002.  Then the input system was overhauled and broke my patch.  I just recently got around to redoing it.  After I got used to using this patch I now get too impatient trying to play the game without it.  :-)


Title: Re: Patch to find a star system quickly
Post by: Death 999 on July 18, 2005, 06:01:57 pm
The text entry code was stolen (and modified) from gameopt.c, so if you find a backspace fix for that you'll probably want to apply it there as well.

Hey, that would be nice -- being able to correct melee team names...


Title: Re: Patch to find a star system quickly
Post by: 0xDEC0DE on July 18, 2005, 06:13:08 pm
Hey, that would be nice -- being able to correct melee team names...

On my iBook, Ctrl+H and Fn+Delete do the job.  On a full keyboard, I think the "normal" Delete key does nothing, but the "other" delete key works.

And all this time I thought it was just me.  ;)


Title: Re: Patch to find a star system quickly
Post by: meep-eep on July 18, 2005, 06:54:20 pm
When I saw this patch I immediately thought back to a patch someone made in the beginning of the project. We didn't use bugzilla yet and so I haven't been able to find it again. It looks like that was probably your patch too.

It's actually a patch that has a good chance to make it into the official version in some form (with your permission). Even though it wasn't in the original, the consensus is that it still fits in our straight port doctrine as it compensates for the lack of a paper map, and does not change the gameplay.

Also, could someone who has problems with the backspace (and knows how to build the sources) try adding "case SDLK_BACKSPACE: return '\b';" to KBDtoUNICODE in src/sc2code/libs/input/sdl/input.c and tell me if that has any effect.



Title: Re: Patch to find a star system quickly
Post by: Torch on July 18, 2005, 07:01:46 pm
So, could someone post the patched files?


Title: Re: Patch to find a star system quickly
Post by: Megagun on July 18, 2005, 10:13:52 pm
I could provide you with a W32 compiled exe, if kworces doesn't mind...


Title: Re: Patch to find a star system quickly
Post by: Torch on July 19, 2005, 12:59:14 am
Ok, coupld you please send it on email which is specified in my forum prfile?


Title: Re: Patch to find a star system quickly
Post by: kworces on July 19, 2005, 07:20:45 am
When I saw this patch I immediately thought back to a patch someone made in the beginning of the project. We didn't use bugzilla yet and so I haven't been able to find it again. It looks like that was probably your patch too.

It's actually a patch that has a good chance to make it into the official version in some form (with your permission).

Yeah, I mentioned it way back then in the IRC channel, if memory serves.  Then I stopped following the project for a long while.  So it's probably the same patch you remember.  Anyways, if you want to make it (or a variation on it) part of the official version that's cool with me.

And in the meantime anyone else who wants to redistribute it in source or binary form is welcome to do so.  I just don't want to maintain binaries myself (particularly if it means rebooting to Windows).  ;-)


Title: Re: Patch to find a star system quickly
Post by: Novus on July 19, 2005, 11:20:12 am
I like this patch. I would like it even more if I could enter the full name of a star in a cluster (e.g. "Alpha Centauri") and select only that star. Right now, searching for "Centauri" works, but searching for "Alpha Centauri" fails silently (the selection isn't changed at all).

I'd also change the default key mapping to a key that actually exists on my keyboard; many European keyboards don't have a "/" key!


Title: Re: Patch to find a star system quickly
Post by: Megagun on July 19, 2005, 01:14:05 pm
UQM 0.4.0 - Find Star mod W32 binary: http://home.deds.nl/~megagun/sc2/UQM-fsmod.rar

There you go. Also includes the original description text from http://www.misfitcode.com/urquanmisfits/


Title: Re: Patch to find a star system quickly
Post by: Torch on July 19, 2005, 02:26:55 pm
UQM-fsmod.rar is broken ('Unexpected end of archive'). Please make new archive.


Title: Re: Patch to find a star system quickly
Post by: Novus on July 19, 2005, 02:52:43 pm
Try this (http://koti.mbnet.fi/lonnberg/uqm.zip) instead. I've applied the starmap search and ship spin video patches.

The usual disclaimer, of course, applies. If you break something, you get to keep the pieces.


Title: Re: Patch to find a star system quickly
Post by: Megagun on July 19, 2005, 04:24:58 pm
Rargh. Blame my internet for failing when I reuploaded it (forgot to mention the name of the creator of it).. Reuploading....


Title: Re: Patch to find a star system quickly
Post by: Kohr-Ah Death on July 19, 2005, 04:51:20 pm
Quote
The usual disclaimer, of course, applies. If you break something, you get to keep the pieces.

LOL i like that...

time to give the star search thingy a go


Title: Re: Patch to find a star system quickly
Post by: kworces on July 19, 2005, 05:38:49 pm
I like this patch. I would like it even more if I could enter the full name of a star in a cluster (e.g. "Alpha Centauri") and select only that star.

Yeah, that would be better.  Try v2 and see if that works.  The star name is optional so the original behavior still works.  But if you provide the star it should work.  Searching for "lam drac", "illum", and even something like erroneous "zeta procyon" should give expected results now.

http://www.misfitcode.com/urquanmisfits/


Title: Re: Patch to find a star system quickly
Post by: Novus on July 19, 2005, 06:26:46 pm
Just updated to v2 of your patch. Using MinGW under XP I get some really nasty graphics corruption after a while. Star names being printed over the map, the entire starmap turning blue, menus and stuff disappearing and so on. Also, the search feature sometimes seems to fail to find stars.

Seems like you have a synchronisation problem somewhere in there; probably lack of locking in the graphics code.


Title: Re: Patch to find a star system quickly
Post by: kworces on July 19, 2005, 09:42:05 pm
Just updated to v2 of your patch. Using MinGW under XP I get some really nasty graphics corruption after a while.

The only drawing code is DrawSISMessage.  That logic didn't change between v1 and v2, so I'm not sure why you would be getting this behavior now and not before (unless the new version didn't apply cleanly for some reason); but I'll take a closer look at it when I have some time.


Title: Re: Patch to find a star system quickly
Post by: Novus on July 19, 2005, 10:03:57 pm
The only drawing code is DrawSISMessage. That logic didn't change between v1 and v2, so I'm not sure why you would be getting this behavior now and not before (unless the new version didn't apply cleanly for some reason); but I'll take a closer look at it when I have some time.
I only get these problems sporadically, and I didn't test v1 quite as thoroughly as v2. I reversed the v1 patch before applying v2, and the end result seems to be correct. Besides, it works most of the time, which I'd hardly expect from a badly applied patch.


Title: Re: Patch to find a star system quickly
Post by: kworces on July 20, 2005, 03:49:14 am
I only get these problems sporadically, and I didn't test v1 quite as thoroughly as v2. I reversed the v1 patch before applying v2, and the end result seems to be correct. Besides, it works most of the time, which I'd hardly expect from a badly applied patch.

Yeah, looks like DrawSISMessage needs to be proteced by GraphicsLock, which it was not where I was calling it.  So I added the lock for those calls (v3, now available).

As for the search failing...  I've searched for a few dozen star systems, multiple stars within those systems, stars that don't have peer stars (procyon, organon) with and without using prefixes.  The search has always worked for me.  To track down any search failures I'll need a repeatable example.

I'm fully willing to admit my code is not be bug-free, but I need to know more specifically what is wrong before I can fix it.


Title: Re: Patch to find a star system quickly
Post by: Novus on July 20, 2005, 09:35:02 am
To track down any search failures I'll need a repeatable example.
I know. The problem is that I couldn't find any sort of pattern to the failures. At one point, nothing worked. Then I restarted the game and the search worked perfectly. Next time around, searching for a system was apparently ignored, but then worked when I tried again. This could be related to the graphics problems (redrawing of the map going missing, which looks quite like the search failing). I'll check out v3.


Title: Re: Patch to find a star system quickly
Post by: Novus on July 20, 2005, 03:24:53 pm
Version 3 of the patch is looking good. No bugs detected so far. I'll try it on a few different operating systems just to make sure.


Title: Re: Patch to find a star system quickly
Post by: fossil on January 18, 2006, 02:58:08 am
A mostly modified version of this patch in now in CVS. It works somewhat differently and is folded into the new DoTextEntry().
The major difference is that you do not hit Enter before you start Tabbing through the matches and the text edit box is more in line with the rest of the GUI. Also the Menu-Tab key is called Menu-Next.

Enjoy, and thanks to kworces for the original!