Technical support > Mac

Problem with build 23768 (03/29/09)

<< < (2/3) > >>

keybounce:
Now that I know what to look for, yes

62         assert(curTile->numtheads < LEVEL_MAX);
63         TR_BuildTracingNode_r(curTile->models.headnode, i);
64      }
65   }
66   
67   /**
(gdb) p i
$9 = 255
(gdb) p curTile->models
$10 = {
  mins = {0, 0, 0},
  maxs = {0, 0, 0},
  origin = {0, 0, 0},
  headnode = 1761607680,
  firstface = 0,
  numfaces = 134217728
}
(gdb) # There you go.
(gdb)

keybounce:
Still looking ...

--- Code: ---(gdb) break DoRouting
Breakpoint 4 at 0x1deb4: file src/tools/ufo2map/routing.c, line 155.
(gdb) c
Continuing.
     LEVEL: 0...1...2...3...4...5...6...7...8...9... (time:      0s, #: 258)

Breakpoint 4, DoRouting () at src/tools/ufo2map/routing.c:155
155 if (config.generateDebugTrace)
(gdb) p curTile->models[255]
$6 = {
  mins = {0, 0, 0},
  maxs = {0, 0, 0},
  origin = {0, 0, 0},
  headnode = 14,
  firstface = 0,
  numfaces = 14
}
(gdb)

--- End code ---
Not broken yet

Found it!
When the maps are written out, then it gets byteswapped.


--- Code: ---(gdb) n
219 data = curTile->routedata;
(gdb) n
220 for (i = 0; i < 3; i++)
(gdb) n
221 wpMins[i] = LittleLong(wpMins[i]);
(gdb) # Ohh ...
(gdb) list
216 }
217
218 /* store the data */
219 data = curTile->routedata;
220 for (i = 0; i < 3; i++)
221 wpMins[i] = LittleLong(wpMins[i]);
222 data = CompressRouting((byte*)wpMins, data, sizeof(wpMins));
223 for (i = 0; i < 3; i++)
224 wpMaxs[i] = LittleLong(wpMaxs[i]);
225 data = CompressRouting((byte*)wpMaxs, data, sizeof(wpMaxs));
(gdb)
226 data = CompressRouting((byte*)Nmap, data, sizeof(Nmap));
227
228 curTile->routedatasize = data - curTile->routedata;
229
230 /* Ensure that we did not exceed our allotment of memory for this data. */
231 assert(curTile->routedatasize <= MAX_MAP_ROUTING);
232
233 /* Remove the CLIPS fom the tracing structure by resetting it. */
234 PopInfo();
235 }
(gdb) break 232
Breakpoint 6 at 0x1e758: file src/tools/ufo2map/routing.c, line 232.
(gdb) c
Continuing.

Breakpoint 6, DoRouting () at src/tools/ufo2map/routing.c:234
234 PopInfo();
(gdb) p curTile->models[255]
$15 = {
  mins = {0, 0, 0},
  maxs = {0, 0, 0},
  origin = {0, 0, 0},
  headnode = 14,
  firstface = 0,
  numfaces = 14
}
(gdb) # Huh ...
(gdb) n
235 }
(gdb) n
ProcessWorldModel () at src/tools/ufo2map/bsp.c:50
50 }
(gdb) n
ProcessModels (filename=0xbffff6a8 "maps/africa/af_drop_herakles.bsp") at src/tools/ufo2map/bsp.c:116
116 if (!config.verboseentities)
(gdb) p curTile->models[255]
$16 = {
  mins = {0, 0, 0},
  maxs = {0, 0, 0},
  origin = {0, 0, 0},
  headnode = 14,
  firstface = 0,
  numfaces = 14
}
(gdb) n
117 config.verbose = qfalse; /* don't bother printing submodels */
(gdb) n
105 for (entity_num = 0; entity_num < num_entities; entity_num++) {
(gdb) p num_entities
$17 = 2
(gdb) p entity_num
$18 = 0
(gdb) n
106 if (!entities[entity_num].numbrushes)
(gdb) p entity_num
$19 = 1
(gdb) list
101 void ProcessModels (const char *filename)
102 {
103 BeginBSPFile();
104
105 for (entity_num = 0; entity_num < num_entities; entity_num++) {
106 if (!entities[entity_num].numbrushes)
107 continue;
108
109 Verb_Printf(VERB_EXTRA, "############### model %i ###############\n", curTile->nummodels);
110
(gdb) n
105 for (entity_num = 0; entity_num < num_entities; entity_num++) {
(gdb) n
120 EndBSPFile(filename);
(gdb) n
Writing maps/africa/af_drop_herakles.bsp
121 }
(gdb) p curTile->models[255]
$20 = {
  mins = {0, 0, 0},
  maxs = {0, 0, 0},
  origin = {0, 0, 0},
  headnode = 234881024,
  firstface = 0,
  numfaces = 234881024
}
(gdb) # Ahh
(gdb)

--- End code ---

keybounce:
Aha!


--- Code: ---295 /**
296 * @brief Swaps the bsp file in place, so it should not be referenced again
297 * @sa LoadBSPFile
298 */
299 long WriteBSPFile (const char *filename)
300 {

--- End code ---

This is the routine that does the byteswapping, and the data  is being referenced again afterwards.

Should a second swap be made after writing, so that the data is valid again?

A better question: What runs AFTER this that assumes that the data is swapped?

keybounce:
With a second byteswap, the code seems to compile maps.

I'm wondering if this will make the polygon faces look good.


--- Code: ---Kleiman-ibook:trunk michael$ svn diff
Index: src/tools/ufo2map/common/bspfile.c
===================================================================
--- src/tools/ufo2map/common/bspfile.c (revision 23734)
+++ src/tools/ufo2map/common/bspfile.c (working copy)
@@ -294,6 +294,7 @@
 
 /**
  * @brief Swaps the bsp file in place, so it should not be referenced again
+ * @brief Changed -- Now ubswaps afterwards.
  * @sa LoadBSPFile
  */
 long WriteBSPFile (const char *filename)
@@ -337,6 +338,9 @@
  fseek(bspfile.f, 0L, SEEK_SET);
  FS_Write(&outheader, sizeof(outheader), &bspfile);
  FS_CloseFile(&bspfile);
+
+ SwapBSPFile();
+
  return size;
 }
 


--- End code ---

Mattn:
readded the second byteswap to trunk (it was removed a few days ago with my first swap "fix") - thanks

please let us know whether it works. and please also have a look at the bug items you reported on the tracker. i've left some questions for you.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version