[TUT] Writting a halo app Part 1!

Mods for Mac should be placed here. All posts must have pictures and a mod to download. Use PPF always, unless the map is rebuilt.
Locked
cloud4058





Posts: 51
Joined: Sat Mar 12, 2005 8:32 am
Contact:

[TUT] Writting a halo app Part 1!

Post by cloud4058 »

First off were going to be using realbasic.
Ok lets start!!!!!

First open up RealBasic then your going to go to window1 which will automaticly be there inside that window your going to want to put 2 things.
1. A pushbutton
2. A Statictext
Ok After those are laid out your going to start coding yay the fun part!!!
Double click on the button and a code window will pop up make sure in the box to the side that you have action highlighted basicly action means when you click the button it will do all the code you have in action.

Ok were going to some code now.

dim f as folderitem = getopenfolderitem("")

In simple words this is saying is that your going to open the dialog box and when you makes a selection it returns a folderitem.

Next.

dim br as binarystream

all this is saying is that br now represents binarystream.

Next.

br = f.openasbinaryfile(true)
What this says is the binarystream reads the folder item you selected.the true part makes it where you can read and write.

Next.

Now were going to actualy read the map header. and index header

dim Headstring as string

dim Gametype as int32

dim decompressedmapsize as int32

dim indexoffset as int32

dim metastart as int32

dim mapname as string

dim mapbuilddate as string

dim maptype as int32 // 0 = sp 1 = mp 2 = ui

dim xorchecksum as int32

dim footstring as string

dim primaryMagic as int32

dim tempint as int32

//Index Header

dim indexMagic as int32

dim verticecount as int32

dim modelrawoffset as int32

dim indiciecount as int32

dim modelindiceoffsets as int32

dim modelrawsize as int32

dim tagsoffset as int32

dim tagstring as string

Basicly all of this is for sotring information from the map header and no we havent read anything yet.



Now were going to read the info
br.littleEndian = true



br.position = 0

Headstring = br.read(4)


br.position = 4

Gametype = br.readint32


br.position = 8

decompressedmapsize = br.readint32


br.position = 16

indexoffset = br.readint32


br.position = 20

metastart = br.readint32


br.position = 32

dim i as integer = 0
while i < 32

dim inputint as int8
inputint = br.readint8

if (not(inputint = 0))then

br.position = br.position - 1
mapname = mapname + br.read(1)

end

i = i + 1

wend
map_name_disp.caption = mapname

br.position = 64

//Mapbuilddate = br.read(32)
Mapbuilddate = br.read(13)


br.position = 96

maptype = br.readint32


br.position = 100

xorchecksum = br.readint32


br.position = 2044

Footstring = br.read(4)



br.position = indexoffset

indexmagic = br.readint32


br.position = indexoffset + 12

metacount = br.readint32


br.position = indexoffset + 16

verticecount = br.readint32


br.position = indexoffset + 20

modelrawoffset = br.readint32


br.position = indexoffset + 24

indiciecount = br.readint32


br.position = indexoffset + 28

modelindiceoffsets = br.readint32


br.position = indexoffset + 32

modelrawsize = br.readint32


br.position = indexoffset + 36

tagstring = br.read(4)


tagsoffset = indexOffset + 36

tempint = indexOffset + 36

primaryMagic = indexMagic - tempint


br.position = indexoffset + 36

tagstring = br.read(4)

This reads all the information pretty much and stores it.

Now we get to use the static text in a simple way.

statictext1.caption = mapname
All this is saying is that the static text will now say the info stored in mapname. Good luck


Cloud4058
User avatar
WarHampster





Posts: 206
Joined: Thu Aug 03, 2006 5:22 am
Location: In a place.
Contact:

Post by WarHampster »

Shweet. I'm trying that the second I'm down downloading the demo of real basic
JOIN THE WARHAMPSTER MAC MOD TEAM: http://warhampster.editboard.com/ We have 81 users and counting!!!
Macsforever wrote:WHMT (Great site, keep it up Sam!)
User avatar
shadowkhas




Snitch! Socialist

Posts: 5423
Joined: Wed Jun 23, 2004 8:00 am
Location: Salt Lake City, Utah

Post by shadowkhas »

I think you should know where to post tutorials...at HaloDev. Locked.
(7:15:27 PM) Xenon7: I BRUK THE FIRST PAGE OMGOMGOMG RONALD REGAN
Locked