Introducing wcdx - Kilrathi Saga for modern Windows

wcnut

Rear Admiral
I was joking since Spirit dies in the middle of WC2 out of nowhere as part of the game. Sorry to have confused you guys.
 

delMar

Rear Admiral
Hey @Stinger,

It would be absolutely the most awesomest if you could patch in some functionality that allows for creating special mod .exe files.
So, if we were to build some SM1.5 (thanks to the great work of @UnnamedCharacter), it would be cool to be able to just name the files CAMP.003, etc. instead of having to replace the .002 file with the modded one.
We would have 997 slots available for mods...

In the original SM2.exe, the byte sequence to look for is this:
b8 02 00 50 9a 48
The 02 has to be replaced with the according number.
Unfortunately, setting this to 03 does not work. It just crashes the game.

Thanks
 

Stinger

Vice Admiral
That would be awesome, but one thing at a time. Now I think I need both a bug tracker and a feature request tracker...
 

cff

Kilk'dymga'qith laq Ik'vikvi
I take it you haven't played wc2 then? Or I'm just too subtle...
I've probably played it a couple dozen time more often then you (only the DOS version tho if that matters), but I still don't know what you are talking about. WC2 DOES have its bugs, but I am not aware of any related to the transfer function.
 

Wirsing

Spaceman
I'm intentionally not supporting that mode. The game was very much intended to be played at 4:3, since that's the aspect ratio that all monitors had when the game was released.
Well, I started out playing the DOS-version of WC on a CRT-monitor that gave me more control over the picture than my TFT today. And I would fiddle with the width/height-controls until the result made some sense, e.g. the background planets looked more like globes rather than eggs, so that's probably why I'm so used to viewing the graphic at something else than perfect 4:3 ratio :)

The game has non-square pixels, as did all games running at 320x200 back then. (Denis can certainly confirm that, if you ask.) We've gotten used to seeing screenshots using square pixels, which effectively distort the image from how it was actually intended to be viewed by stretching it horizontally. I find that ugly, and it's a pet peeve of mine. (I also get annoyed when I see 4:3 content stretched to 16:9 on modern televisions.)
The problem is that the image-rotation routine in WC assumes square pixels for its calculations, though. If a spacecraft or other rotatable object in view at a fixed distance is rotated from a horizontal towards a vertical orientation, it gets noticably longer and thinner with non-square pixels, pretty much the same distortion effect that you get with 4:3 material stretched to 16:9 (what I also dislike, btw., for that very reason), just rotated by 90 degrees.

But I will ask Denis as you suggested and take his oppinion as the final word on this. I wanted to ask him something about the Scimitar's cockpit anyway. :)
 

wcnut

Rear Admiral
I've probably played it a couple dozen time more often then you (only the DOS version tho if that matters), but I still don't know what you are talking about. WC2 DOES have its bugs, but I am not aware of any related to the transfer function.
I was joking since Spirit dies in the middle of WC2 out of nowhere as part of the game. Sorry to have confused you guys.
Again sorry for the confusion.
 

Stinger

Vice Admiral
The problem is that the image-rotation routine in WC assumes square pixels for its calculations, though. If a spacecraft or other rotatable object in view at a fixed distance is rotated from a horizontal towards a vertical orientation, it gets noticably longer and thinner with non-square pixels, pretty much the same distortion effect that you get with 4:3 material stretched to 16:9 (what I also dislike, btw., for that very reason), just rotated by 90 degrees.
I'll have to verify that at some point, but you may be correct about how rotation was done. (Sigh... yet another thing for me to look at.) I did some investigating with the raw image resources. In some places, it's very clear that stretching to 4:3 is the right thing to do.

Here's the planet from the victory sequence:
3_0.png


Here it is again, stretched appropriately for 8:5 -> 4:3 conversion (pixels 6/5 higher than wide):
3_0_corrected.png


Just in case it's not very obvious which one is more circular, I've drawn circles around them using Paint.NET's ellipse tool (holding shift to force a perfect circle):
3_0_highlighted.png
3_0_corrected_highlighted.png


Clearly, the stretched version is better.

Here's another example, this one from PLANETS.VGA:
6_0.png
6_0_corrected.png

...and with the same circular highlights:
6_0_highlighted.png
6_0_corrected_highlighted.png


Problem solved, debate over!

...Right?

...Except for these, also from PLANETS.VGA (uploading only the highlighted versions because of image limits in posts):
9_0_highlighted.png
9_0_corrected_highlighted.png

10_0_highlighted.png
10_0_incorrected_highlighted.png


(The sun has a blue highlight because the red one was too difficult to see. At this size and against this background, the blue isn't much better. Sorry.)

So it looks like some of the resources were created with stretching in mind, and others weren't. That makes it a little more difficult to decide on a "correct" answer.

My conclusion:
There are inconsistencies in the in-flight artwork, but all of the surrounding stuff (the cockpits, the sequences between missions) all look much better (to me) at 4:3 than 8:5. Monitors of the time were all 4:3. Players at the time (almost always) played at 4:3. 4:3 is therefore still the best default ratio, although there is some inconsistency in spaceflight.

But I will ask Denis as you suggested and take his oppinion as the final word on this. I wanted to ask him something about the Scimitar's cockpit anyway. :)
I'm looking forward to his response!
 
Last edited:

Stinger

Vice Admiral
victory.png


It took a bit longer than I'd planned, but 1.2 beta2 is finally here! Here's my list of fixes:
  • Planets are now visible in the stellar background and in the Wing1 victory sequence.
  • SM1 and SM2 now correctly search the local path for streams before looking for a CD (Wing1 already did this).
  • Fixed window title.
  • Joystick menu navigation now works correctly, showing the correct cursor and help text.
My initial fix for planets made them visible, but locked their orientation to your display. After watching a few YouTube videos, I found that my memory had been faulty; the original planets in the DOS versions actually did keep their orientation relative to the universe. Further, since the planet in the Wing1 victory sequence is drawn using the same code, planets also are drawn scaled at all times (just usually with a scale very close to 1.0). My original fix prevented the planet in the victory sequence from growing larger as the Tiger's Claw approached. This has now been properly fixed.

The joystick cursor issue took a lot more work than I was expecting. The bug may actually have been a result of some of the changes I made; it's possible that this feature worked correctly in the originally released Kilrathi Saga. Originally, the joystick handling code for the gameflow sequences would reposition the mouse cursor by calling the Windows SetCursorPos API. I think the resulting mouse "movement" would then trigger the code that updated the cursor image. As part of my changes aimed at making the game play nice with Windows systems, I removed all calls to SetCursorPos, so the second part of that sequence couldn't happen. Instead, I've reworked the joystick code to explicitly tell the rest of the game that the cursor position has been updated, and the gameflow sequences respond by updating the cursor image in the appropriate fashion.

The new binaries are up on the first post. As always, give them a try and let me know how it goes!

Happy flying!
 
Last edited:

Stinger

Vice Admiral
[Stingers amazingly detailed response]

Many thanks for the explanation. Your knowledge of the inner working of the game is amazing! Are you using Ollydbg or something similar?
Again, what you have done here is fantastic.
I'm sorry; I somehow missed this one. To your question: I'm using IDA Pro. I've never yet tried Olly, mainly because IDA is so very good at what it does, and I'm used to all the keyboard shortcuts and commands. Olly at least won't cost you your firstborn child for a license...
 

wcnut

Rear Admiral
Runs Great! You've done such an amazing job.

I don't expect you to support it or anything, but I thought you would like to know it all runs well in Wine on my Mac as well thanks to the dx9 calls. Vanilla would crash otherwise. Only shame is the game doesn't detect the joystick through wine. Wine is very hit and miss with its joystick support. Some games like Prophecy/Secretops/Standoff that must address the joystick directly work just fine. Others that call upon direct input like Xwing 95 series doesn't find it at all....
 
Last edited:

wcnut

Rear Admiral
I just noticed, I was playing the dos version of SM2 and realized that the first mission had different planets then the KS version. In fact the planets in the first mission of KS's SM2 were the same as the first mission of the Vega Campaign. I noticed SM1 had the same issue too.
 

Stinger

Vice Admiral
Thanks, I'll take a look. It's probably just reading from camp.000 when it should be looking at camp.001 (SM1) or camp.002 (SM2).

Edit: Yup, that's definitely the problem. The game loads the planet info before it knows which campaign you're playing. Interestingly, it looks like this only affects new games, not loaded games. Should be an easy fix.
 
Last edited:

Stinger

Vice Admiral
More on the planets:

Locally, I've fixed the camp.00x loading issue, but SM2 has another problem. It never loads planets1.vga at all! It's currently crashing for me when attempting to load a planet image. (Not the beta, just a private version I'm working with.) This will take a little longer...

Edit: I've now fixed this locally. It'll be in the next update.
 
Last edited:

wcnut

Rear Admiral
Thank-you so much! You sent me down a rabit hole to discover just what the status of winmm in macwine was, only for me to discover that it didn't exist until a patch that was made yesterday! I'm compiling a new version of wine and crossing my fingers. :)

Also thanks for looking in to the planet issue!

[EDIT]
Dang not yet, it crashes when it detects the joystick. But it's a start :)
[EDIT]
He just fixed the error in his patch and it works now!
 
Last edited:
Top