The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: Nicholai on May 26, 2006, 04:45:23 pm

Title: Some new source code questions...
Post by: Nicholai on May 26, 2006, 04:45:23 pm

Having devoted the last two days of my life to sitting and aimlessly moving stars around (which IS rather elating) I HAVE managed to learn some things about how the source code works.

But, if there's anyone here who might have answers to the following questions, I would appreciate any light you might be able to shed on them!  I feel like most of them are probably of the "wishful thinking" variety for someone such as myself who doesn't have a good deal of experience with this programming language.

(some of these questions might imply certain things about the game story, so there is a "spoiler alert" in effect here)

1. With some regularity, GOOD_GUY and BAD_GUY show up in the code.  They're used all the time, but I can't figure out exactly what they're responsible for.  This is more of a curiosity question than anything else.

2. ZOQFOT_DEATH_EVENT is, I'm sure, related to the Zoq Fot Pik being destroyed.  However, in the few places it is mentioned, I can't figure out what it is that actually causes the Zoq Fot Pik to go away.   There never seems to be anything in the code in conjunction with ZOQFOT_DEATH_EVENT that implies the game is removing the Zoq Fot Pik from their homeworld, or that Commander Hayes will say, "whoa, the Zoq Fot Pik are gone!"

Related to this, I'm wondering about how the game decides you're allowed to build a certain kind of ship, or why you're suddenly NOT able to if something happens.

3. What part of the black_urquan_genocide (void) function actually erases a race?  It's been so long since I've allowed the Kohr-Ah to start cleansing people that I forget whether or not you can still build a race's ship if that race has been cleansed (I suspect not though).    The Zoq Fot Pik are destroyed one way, and races which are cleansed are probably destroyed in a different way by the code.   Maybe not though.

4. Is there any way to place minerals ON a planet's surface manually, or dictate that a specific planet has a HUGE amount of resources?   (I'm sure there is, as anything is POSSIBLE, but what might be involved in this process?)

5. How much of an outrageous pain in the ass would it be to make a new module, or completely revamp what a module does?  Does weapon data for ships work the same way as it does for the flagship?  That is, could you make a weapon module that fires Kohr-Ah discs?   (or a module that generates a Yehat shield, etc.?)

6. Since there are the extra devices (the data plates) available, would it be possible to place them on a planet (say you changed the graphics to be a derelict Androsynth vessel or something) and have that ship added to your fleet if you found it?  What would be involved in this?

7. Lastly (and the one I'd most like to be able to make happen) what would it take to make the Syreen starbase function like the Sol starbase?  (only you'd talk to Talana instead of Commander Hayes) -- could you use the existing starbase.c and call the necessary functions and such when you visit the Syreen starbase?  Is this something I should even think about?  Heh.

My overall goal right now is making the game more challenging from the perspective of somebody who has played it daily since 1992, heh.  There are some things that I'll never duplicate (like not knowing exactly what I do with Mycon egg cases) -- but I can move the egg cases to God-knows where and make it so far away that you have to stop and refuel at the Syreen base to get to them because your fuel tanks only hold ten fuel each.  ;)

Title: Re: Some new source code questions...
Post by: meep-eep on May 26, 2006, 07:22:01 pm
1. GOOD_GUY refers to the bottom player in combat, and BAD_GUY to the top player. When not in combat races marked with GOOD_GUY are available for building.
2. It's not a matter of removing them, it's a matter of not activating them. At the ZOQFOT_DEATH_EVENT case, 'actual_strength' for the race is set to 0 and GOOD_GUY and BAD_GUY are removed. Then in planets/genzoq.c ActivateStarShip (ZOQFOTPIK_SHIP, SPHERE_TRACKING) will return false. The setting of the ZOQFOT_DISTRESS game state flag to 2 takes care of the commander's message.
3. see 2
4. Yes, you have to override the GENERATE_MINERAL case for the system, as in sc2code/planets/gen*
5. It's possible, and shouldn't be all that much work. It's not explainable in a few words though. Peruse sc2code/ships/sis_ship.c for this.
6. Again, too much to explain. Take a look at the code for the Spathi comm code, in src/sc2code/comm/spathi/spathic.c
7. That's probably very easy. Copy the relevant code from sc2code/planets/gensol.c to gensyr.c. And in DoStarBase() in sc2code/starbase.c you'll have to change the "InitCommunication (COMMANDER_CONVERSATION);" to something dependant on the captain's location.

Title: Re: Some new source code questions...
Post by: Nicholai on May 27, 2006, 05:16:59 pm

Thanks a lot!

I am still having a problem with the starbase -- perhaps you know what I'm doing wrong?  This is the code I've got right now, which seems oh-so-very correct to me (you know, the fellow with basically no programming experience):

      if (pMS->CurState == TALK_COMMANDER)
         FlushInput ();
         if ((GLOBAL_SIS (log_x) == 5728) && (GLOBAL_SIS (log_y) == 5416))
            InitCommunication (COMMANDER_CONVERSATION);
            InitCommunication (SYREEN_CONVERSATION);

(The coordinates for the starbase are correct for where I have SOL positioned)

I suspect that these aren't the correct variables for your location, because I suddenly encounter the Syreen right after I establish the name of the Alliance (when Hayes fades out at the beginning after the Ilwrath battle)

After I leave the conversation with the Syreen, I suddenly end up BACK in the conversation with the Syreen.  Forever.   :(

Either way, thanks for the help!

      ~ Nicholai

Title: Re: Some new source code questions...
Post by: meep-eep on May 28, 2006, 01:14:19 am
The game uses different coordinate systems. Use UNIVERSE_TO_LOGX and UNIVERSE_TO_LOGY to convert your universe coordinates to "logical" coordinates.

As for your second problem, what does your modified gensyr.c code look like?