Page 1 of 2
Programming: Loading Halo2 Maps In VB
Posted: Wed Jun 22, 2005 12:32 pm
by Jefff
Ok, you can choose any method you want to get the filename of the map, and you can use the map however you want. This tutorial will just load the map and save the map.
First, lets assume your loading
Posted: Wed Jun 22, 2005 1:31 pm
by TfAv1228
YAY thanks jefff
Posted: Wed Jun 22, 2005 1:40 pm
by [users]glitchyguardian
YA now every one gets to write programs
Posted: Wed Jun 22, 2005 1:44 pm
by [users]glitchyguardian
here ya go a shorter sub for hextodec
Code: Select all
Private Function HexToDec(ByVal HexStr As String) As Double
HexToDec = val("&H" & HexStr)
End Function
Posted: Wed Jun 22, 2005 1:45 pm
by Jefff
glitchyguardian wrote:here ya go a shorter sub for hextodec
Code: Select all
Private Function HexToDec(ByVal HexStr As String) As Double
HexToDec = val("&H" & HexStr)
End Function
Meh, mine looks 13373|2
Posted: Wed Jun 22, 2005 1:46 pm
by [users]glitchyguardian
But yours takes up so much space
ROFL
but ya got to admit it does do a nice job at taking up
space and looking good
Posted: Wed Jun 22, 2005 1:50 pm
by [users]glitchyguardian
also sometimes if to do the HEX() command you will get an overflow command so here is a funtion i use to solve that
Code: Select all
Public Function BigDecToHex(ByVal DecNum) As String
' This function is 100% accurate untill
' 15,000,000,000,000,000 (1.5E+16)
Dim NextHexDigit As Double
Dim HexNum As String
HexNum = ""
While DecNum <> 0
NextHexDigit = DecNum - (Int(DecNum / 16) * 16)
If NextHexDigit < 10 Then
HexNum = Chr(Asc(NextHexDigit)) & HexNum
Else
HexNum = Chr(Asc("A") + NextHexDigit - 10) & HexNum
End If
DecNum = Int(DecNum / 16)
Wend
If HexNum = "" Then HexNum = "0"
BigDecToHex = HexNum
End Function
Posted: Wed Jun 22, 2005 5:14 pm
by TfAv1228
There's the TagTag (for lack of a better name )
\
TagClass is what they are
Posted: Thu Jun 23, 2005 12:47 pm
by TfAv1228
Code: Select all
ByteArray(offset) = number between 0 and 255
is there any way to change a double or a long with this
Posted: Thu Jun 23, 2005 1:04 pm
by [users]glitchyguardian
do something like
Put4Hex "0000FFFF",25443
Code: Select all
Public Function Put4Hex(HexString As String, tLoc)
HexString = right("00000000" & HexString,8)
ByteArray(tLoc + 0) = HexToDec(Right(Left(HexString, 2), 2))
ByteArray(tLoc + 1) = HexToDec(Right(Left(HexString, 4), 2))
ByteArray(tLoc + 2) = HexToDec(Right(Left(HexString, 6), 2))
ByteArray(tLoc + 3) = HexToDec(Right(Left(HexString, 8), 2))
End Function
Posted: Thu Jun 23, 2005 1:29 pm
by Excal
Wow... nice to know you were generous to let the comunity know.
Posted: Thu Jun 23, 2005 1:44 pm
by kornman00
Code: Select all
Private Function Load4String(ByRef Offset As Double, r As Boolean) As String
I'm not too savy with VB6's value types, but all the languages I've used, treat a "Double" as a real number that takes up 8 bytes (on 32bit platforms).
When dealing with offsets you would only want to use a integer. IE, short or a long
Posted: Thu Jun 23, 2005 2:15 pm
by [users]zulux
Long int for offsets...
Posted: Thu Jun 23, 2005 2:33 pm
by TfAv1228
Glitchy i cant figure out htat code i know its a function but i cant figure out how ot use it
Posted: Fri Jun 24, 2005 3:17 pm
by TfAv1228
i got it workin but Jefff could u explain how to use the tag stuff u have in the tutorial
Posted: Mon Jun 27, 2005 8:48 pm
by mrhyperpenguin
i want to show tags from specific tagclasses (say coll) in treeview1
i can access the index offset but how would i populate the treeview1 with the tags?
Posted: Fri Aug 12, 2005 6:47 pm
by smellylobster
Jefff wrote:glitchyguardian wrote:here ya go a shorter sub for hextodec
Code: Select all
Private Function HexToDec(ByVal HexStr As String) As Double
HexToDec = val("&H" & HexStr)
End Function
Meh, mine looks 13373|2
haha, I was just about to say that. But your long code is still useful for learning purposes.
But thanks a lot for this tutorial. I've always wanted to learn how to read bytes from a file, not just an open process.
After I'm done reading, I'll let you know if there are any problems with it.
ok not to sound like a noob
Posted: Thu Nov 03, 2005 4:23 pm
by n3xg3n
ok i was making a program to edit bipd and wut not. i cant come close to figure out what to do with this code i can tell which code to put in the module and the form plus some you dont go into enough explaination of the code and usage. for instance
Code: Select all
IndexHeader = Load4Hex(16, True)
IndexMagic = Load4Hex(IndexHeader, True) - (Load4Hex(16, True) + 32)
MapMagic = Load4Hex((Load4Hex(IndexHeader + 8, True) - IndexMagic) + 8, True) - (IndexHeader + Load4Hex(20, True))
what do i do with that? or
Code: Select all
Dim TagID() As Double
Dim TagOffset() As Double
Dim TagMetaSize() As Double
Dim TagTag() As String
TagCount = Load4Hex(IndexHeader + 4, True)
RealTagOff = IndexHeader + 32 + TagCount * 12
RealTagCount = Load4Hex(indexheader + 24, True)
EndTagOff = RealTagOff + RealTagCount * 16
ReDim TagTag(0 To rtagcount + 1)
ReDim TagID(0 To rtagcount + 1)
ReDim TagOffset(0 To rtagcount + 1)
ReDim TagMetaSize(0 To rtagcount + 1)
j = 0
For i = RealTagOff To EndTagOff Step 16
j = j + 1
TagTag(j) = Load4String(i + 0, True)
TagID(j) = Load4Hex(i + 4, True)
TagOffset(j) = Load4Hex(i + 8, True) - MapMagic
TagMetaSize(j) = Load4Hex(i + 12, True)
Next i
Thanks, N3XG3N
Posted: Thu Nov 03, 2005 4:35 pm
by JK-47
WOAH!! THANKS!
Posted: Fri Nov 18, 2005 7:27 am
by superaison
um, is this vb6 or vb 2005? if its vb6 then i need help