Jump to content


Source Code?

  • Please log in to reply
4 replies to this topic

#1 Chaman



  • Forum Members
  • PipPip
  • 2 posts

Posted 04 March 2007 - 12:43 PM

Do you have the source code for 2.5 available (and the exe editor would be nice)? Is it masquerading under the "version 2.4 source" link?
I was looking at some of the code (the 2.4), and you can shorten quite a few of the functions:

In PubStuff:
Public Function GetBaseMult(BaseNum As Double) As Long
	GetBaseMult = (BaseNum-1)*292
End Function
Public Function GetHex(ToGet As String) As Integer
	GetHex = Asc(ToGet)
End Function
Public Function CheckMonth(MonthNum As String) As String
'Select Case blocks are prefered for descisions like this, in VB they 
'can use strings as well as numbers, and can be set to cover a range 
'([1 to 6] or [a to d]) and can take multiple arguments ([a to d, A to D])
'and can use comparisons as well ([>5], [<f])
'I cast MonthNum to a numeric value to ensure matching wouldn't get 
'"wierd" though it shouldn't matter

Select Case Val(MonthNum)
	Case 0
		CheckMonth = "Jan"
	Case 1
		CheckMonth = "Feb"
	Case 2
		CheckMonth = "Mar"
	Case 3
		CheckMonth = "Apr"
	'Continue cases as above
	Case 11
		CheckMonth = "Dec"
End Select
End Function
Public Function LoadUFOP()
'not sure about this one, but it should work since  
'the caption is a string, if it was a value you could 
'cast it to a string as you concatenated

'Note that the final Else that throws is not capturing 
'the error it says it is. The entire If-Then-Else set is 
'only testing the value stored in the lblLoad.Caption
'which is set by the Options at the top of the form 
'and by nothing else, the values that can be set are
'know and will the final else will never throw.

	 mHandle5 = FreeFile
	 Open MyPath & "\game_" & frmBaseEditor.lblLoad.Caption & "\up.dat" For Binary As #mHandle5
'Rest of code that follows the End If is unchanged
End Function
If I'm going to play with the code, I'd rather play with the most recent.
Thnx, Robert

BTW, in case you had't seen, check this out: http://www.ufo-extraterrestrials.com/; also, the UFO series by Altair are good (Aftershock, Aftermath, and Afterlight), You should also check out the X-com WIKI, lots of DATs decrypted: http://en.wikipedia.org/wiki/X-COM

Edited by Chaman, 06 March 2007 - 10:40 PM.

#2 Chaman



  • Forum Members
  • PipPip
  • 2 posts

Posted 06 March 2007 - 10:20 PM

Here's another one from PubStuff that can be shortened:

'This function adds commas to the money
Public Function AddCommas(Comma As String) As String
	AddCommas=str(format(val(Comma), "###,###,###,##0"))
End Function

Note: though VB will cast types safely most of the time, it is often safer to
explicitly cast, and I use the Explicit option to make sure I do.

BTW I checked the "About" message box & found that this is from the 2.45 version

Edited by Chaman, 06 March 2007 - 10:48 PM.

#3 hatfarm


    Sound Department

  • Xenocide Sound Department
  • 133 posts

Posted 11 May 2007 - 08:59 PM

Yeah, I didn't have much formal VB training. I just finished my first college level VB class (I thought I was a musician for several years). I just looked at the code and I'm kinda finding it funny how much didn't need to be that long. But, these two projects really helped me to get a good understanding of things.

Anyway, yeah, I do have the code available. If you do any modifying let me know, I was hoping someone would want to help. I believe the code for 2.5 is available if you just change the name from 2.4 to 2.5 in the download link. Lemme check though...

Here is the link:


#4 hatfarm


    Sound Department

  • Xenocide Sound Department
  • 133 posts

Posted 11 May 2007 - 09:06 PM

Also, how is UFO:ET? I was really let down by the one from 2k3 or so... I can't think of the name off the top of my head.

#5 Gurluas2000



  • Forum Members
  • PipPipPipPip
  • 151 posts

Posted 31 October 2007 - 12:34 PM

Hatfarm, would it be possible if you added the alien armors before abandoning the project?
(armor 4-11 goes: sectoid, etc. same for tftd, it just goes: aquatoid etc.)