Magic...

Discuss Halo 2 modding, progress on figuring things out, mapfiles...you know the drill. Cheating discussion not allowed.
Post Reply
DeviousDave





Posts: 185
Joined: Mon Dec 05, 2005 9:08 pm

Magic...

Post by DeviousDave »

What exactaly are the primary and secondary magics of a map? Are they how big the file is and then how big the actual map is or what? I know what they are used for but all the tutorials just say "reverse edian and subtract the magic" or something... they're all superficial, I'm not. What the hell is the magic?
User avatar
WaywornMmmmm




Coroner

Posts: 1341
Joined: Sat Nov 05, 2005 5:17 am
Location: U.S.A

Post by WaywornMmmmm »

I know it has somthin to do with bsp.
User avatar
Iron_Forge




Illusionist Socialist Decryptor System Engineer
ONI Golden Age Magic Era Bloodhound
Coagulator Omega Mad Hatter Eureka
Critic Tsunami Firestorm Literarian 250

Posts: 532
Joined: Sat Sep 20, 2003 9:21 pm

Post by Iron_Forge »

Primary magic is calculated by taking the first value in the index header, subtracting the index offset, and then subtracting 32 (the size of the index header)...It's only used in a handfull of places, so you need not worry much about it...

Secondary magic is calculated by adding the BSP size to the value of primary magic...It's also commonly known map magic, since it's the magic thats used throughout the meta...

Both tend to be rather large numbers...Their purpose is to allow you to modify the map without having to rebuild it...

For example...

Lets say the index offset of a map is 500...And secondary magic is 1234...In the meta, there is a reflexive at 600, which points to 620...This reflexive will be stored with the value 1854 (620 + secondary magic)...Now, lets say we modified the map, changeing the index to a location of 400...Secondary magic would instantly become 1334, remember, it's calculated by value - index offset - 32, so shifting the index -100, makes secondary magic +100...Now see what this has done to the reflexive, it's still stored as 1854, but now 1854 - 1334 is 520, which is where the reflexive would point if the map was shifted -100 bytes...

Thats pretty much what magic is for...The BSP has it's own magic for the same basic purpose...
Image
...Thats right...I invented modding...So give me Wii Points...
SyrinEldarin





Posts: 115
Joined: Thu Apr 06, 2006 12:32 pm
Location: Canadia.

Post by SyrinEldarin »

I know that whenever you open up a map with H2X, it shows the primary and secondary magic of that map. Not sure how it finds it out, though.
DeviousDave





Posts: 185
Joined: Mon Dec 05, 2005 9:08 pm

Post by DeviousDave »

Iron_Forge wrote:Primary magic is calculated by taking the first value in the index header, subtracting the index offset, and then subtracting 32 (the size of the index header)...It's only used in a handfull of places, so you need not worry much about it...

Secondary magic is calculated by adding the BSP size to the value of primary magic...It's also commonly known map magic, since it's the magic thats used throughout the meta...

Both tend to be rather large numbers...Their purpose is to allow you to modify the map without having to rebuild it...

For example...

Lets say the index offset of a map is 500...And secondary magic is 1234...In the meta, there is a reflexive at 600, which points to 620...This reflexive will be stored with the value 1854 (620 + secondary magic)...Now, lets say we modified the map, changeing the index to a location of 400...Secondary magic would instantly become 1334, remember, it's calculated by value - index offset - 32, so shifting the index -100, makes secondary magic +100...Now see what this has done to the reflexive, it's still stored as 1854, but now 1854 - 1334 is 520, which is where the reflexive would point if the map was shifted -100 bytes...

Thats pretty much what magic is for...The BSP has it's own magic for the same basic purpose...
Thanks... you're very discriptive and complete unlike many other people. Most other people would just say something like "it's the bsp size + the primary magic... ... ..." Which doesn't really answer my question. You actually answered all the question I asked, gave enough info so I could understand it, and weren't a jerk about it. Thanks again.
Post Reply