Magic...
-
- Posts: 185
- Joined: Mon Dec 05, 2005 9:08 pm
Magic...
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?
- WaywornMmmmm
- Posts: 1341
- Joined: Sat Nov 05, 2005 5:17 am
- Location: U.S.A
![]() |
- Iron_Forge
- Posts: 532
- Joined: Sat Sep 20, 2003 9:21 pm
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
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...
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...
-
- Posts: 115
- Joined: Thu Apr 06, 2006 12:32 pm
- Location: Canadia.
-
- Posts: 185
- Joined: Mon Dec 05, 2005 9:08 pm
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.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...