Technical support > Mac

Log of an attempt to compile a universal binary for 10.5.6 for 2.3-dev (trunk)

<< < (5/5)

keybounce:
I'd like help understanding "numTiles" in the file src/common/cmodel.c

As far as I can tell, this is a global that counts the current tile being loaded into the map.

It is initialized to zero in CM_LoadMap.
It gets incremented in CM_AddMapTile
It is increased just before calling CMod_LoadRouting
It is down in CMod_LoadRouting that I'm crashing.

Is this a trivial "Oppsie", or am I looking at the wrong thing?

keybounce:
Ok, I really think this is a bug.


As mentioned, AddMapTile increments numTiles and then makes these calls:

Stack trace:

--- Code: ---#8  0x0011f8b0 in CM_AddMapTile (name=0xbfffbde0 "wilderness", day=qtrue, sX=0, sY=0, sZ=0 '\0') at src/common/cmodel.c:1107
1107 CMod_LoadRouting(name, &header.lumps[LUMP_ROUTING], sX, sY, sZ);
(gdb) down
#7  0x0011ecd8 in CMod_LoadRouting (name=0xbfffbde0 "wilderness", l=0xbfffbce8, sX=0, sY=0, sZ=0) at src/common/cmodel.c:915
915 RT_GetMapSize(map_min, map_max);
(gdb) down
#6  0x0014b578 in RT_GetMapSize (map_min=0x4432014, map_max=0x4432008) at src/common/routing.c:177
177 trace = RT_COMPLETEBOXTRACE(origin, origin, mins, maxs, 0x1FF, MASK_ALL, 0);
(gdb) down
#5  0x0011d7a4 in CM_EntCompleteBoxTrace (start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, levelmask=511, brushmask=-1, brushreject=0) at src/common/cmodel.c:741
741 trace = TR_CompleteBoxTrace(start, end, mins, maxs, levelmask, brushmask, brushreject);
(gdb) down
#4  0x0014a70c in TR_CompleteBoxTrace (start=0xbfffba10, end=0xbfffba10, mins=0xbfffb9f8, maxs=0xbfffba04, levelmask=511, brushmask=-1, brushreject=0) at src/common/tracing.c:1319
1319 newtr = TR_TileBoxTrace(myTile, start, end, mins, maxs, levelmask, brushmask, brushreject, tr.fraction);
--- End code ---

At this point, we have this code:


--- Code: ---1281 trace_t TR_CompleteBoxTrace (const vec3_t start, const vec3_t end, const vec3_t mins,
     const vec3_t maxs, const int levelmask, const int brushmask, const int brushreject)
1282 {
1283     trace_t newtr, tr;
1284     int tile, i;
1285     vec3_t smin, smax, emin, emax, wpmins, wpmaxs;
1286     const vec3_t offset = {UNIT_SIZE / 2, UNIT_SIZE / 2, UNIT_HEIGHT / 2};
1287
1288     memset(&tr, 0, sizeof(tr));
1289     tr.fraction = 2.0f;
1290
1291     /* Prep the mins and maxs */
1292     for (i = 0; i < 3; i++) {
1293         smin[i] = start[i] + min(mins[i], maxs[i]);
1294         smax[i] = start[i] + max(mins[i], maxs[i]);
1295         emin[i] = end[i] + min(mins[i], maxs[i]);
1296         emax[i] = end[i] + max(mins[i], maxs[i]);
1297     }
1298
1299     /* trace against all loaded map tiles */
1300     for (tile = 0; tile < numTiles; tile++) {
--- End code ---

And we're looking one tile past anything that has been loaded.

Testing ...

keybounce:
It got a lot farther.


--- Code: ---====== UFO Initialized ======

Switch grab input off
developer 1
ExecuteString: '+leftmouse 200 81775'
ExecuteString: 'mn_push options'
ExecuteString: ''
ExecuteString: 'mn_init_keylist'
ExecuteString: 'mn_textupdated keylist'
Unknown command "mn_textupdated" - wasn't sent to server
ExecuteString: 'optionkey_count 0'
ExecuteString: ''
ExecuteString: '-leftmouse 200 81951'
ExecuteString: '-select 200 81951'
ExecuteString: '+leftmouse 200 86667'
ExecuteString: 'copy mn_vidmode vid_mode'
ExecuteString: ''
ExecuteString: '-leftmouse 200 86820'
ExecuteString: '-select 200 86820'
ExecuteString: '+leftmouse 200 90735'
ExecuteString: '-leftmouse 200 90905'
ExecuteString: '-select 200 90905'
ExecuteString: '+leftmouse 200 98807'
ExecuteString: 'mn_pop'
ExecuteString: ''
ExecuteString: '-leftmouse 200 98958'
ExecuteString: '-select 200 98958'
ExecuteString: 'toggleconsole'
ExecuteString: '-turnup 114 258507'
ExecuteString: '-hudradar 104 259605'
ExecuteString: '-turnup 114 261267'
ExecuteString: '-turnup 114 261457'
ExecuteString: '-turnup 114 261760'
r_checkerror 1
ExecuteString: 'r_checkerror 1'
ExecuteString: '-turnup 114 269564'
ExecuteString: '-turnup 114 275134'
ExecuteString: '-turnup 114 276309'
ExecuteString: '-shiftleft 97 276428'
ExecuteString: '-shiftdown 115 276754'
r_programs
ExecuteString: 'r_programs '
"r_programs" is "0"
ExecuteString: '-turnup 114 286054'
ExecuteString: '-turnup 114 286872'
ExecuteString: '-turnup 114 287434'
ExecuteString: '-shiftleft 97 287570'
ExecuteString: '-shiftdown 115 287931'
r_programs 1
ExecuteString: 'r_programs 1'
R_LoadProgram: 'default' loaded.
R_LoadProgram: 'warp' loaded.
ExecuteString: '-turnup 114 308121'
ExecuteString: '-turnup 114 309742'
ExecuteString: '-turnup 114 310329'
ExecuteString: '-shiftleft 97 310569'
ExecuteString: '-shiftdown 115 311208'
r_programs 0
ExecuteString: 'r_programs 0'
ExecuteString: '+leftmouse 200 326474'
ExecuteString: 'mn_push singleplayer'
ExecuteString: ''
ExecuteString: '-leftmouse 200 326620'
ExecuteString: '-select 200 326620'
ExecuteString: '+leftmouse 200 327685'
ExecuteString: 'mn_push skirmish'
ExecuteString: ''
ExecuteString: 'game_setmode'
Change gametype to 'Skirmish mode'
ExecuteString: 'set ai_numaliens 8'
ExecuteString: 'set difficulty 0'
ExecuteString: ''
ExecuteString: 'set mn_serverday 1'
ExecuteString: 'mn_getmaps'
ExecuteString: ''
ExecuteString: '-leftmouse 200 328351'
ExecuteString: '-select 200 328351'
ExecuteString: '+leftmouse 200 331987'
ExecuteString: 'mn_prevmap'
ExecuteString: ''
ExecuteString: '-leftmouse 200 332114'
ExecuteString: '-select 200 332114'
ExecuteString: '+leftmouse 200 334809'
ExecuteString: 'sk_start'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
No valid name definitions for gender 0 in category 'phalanx'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
Could not find rank 'rifleman'
ExecuteString: ''
ExecuteString: 'map day wilderness '
Set server state to 0
------- Loading game.dylib -------
LoadLibrary (./base/game.dylib)
==== InitGame ====
SpawnServer: wilderness
Set server state to 0
CM_LoadMap: token: wilderness
CM_AddMapTile: wilderness at 0,0,0
...surfaces: 1767
...leafs: 6946
...leafbrushes: 2598
...planes: 9290
...brushes: 732
...brushsides: 8155
...submodels: 258
...nodes: 6939
Map:wilderness  Offset:(0, 0, 0)
wpMins:(128, 118, 0) wpMaxs:(193, 197, 7)
Shifted wpMins:(128, 118, 0) wpMaxs:(193, 197, 7)
Tile bounds: (128, 118, 0) to (193, 197, 7)
Source bounds: (128, 118, 0) to (193, 197, 7)
Done copying data.
Loaded routing for tile wilderness in   0.0s
checksum for the map 'wilderness': 261412033
ufo script checksum 849594367
Set server state to 1
Entity:0 class:(null) key:classname
entity: model () num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 0 0 0
Entity:1 class:noclass key:angle
Entity:1 class:noclass key:origin
Entity:1 class:noclass key:classname
entity: model () num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 176 912 292
Entity:2 class:noclass key:model
Entity:2 class:noclass key:spawnflags
Entity:2 class:noclass key:origin
Entity:2 class:noclass key:classname
entity: model (models/aircraft/drop_firebird/firebird_top.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 448 2080 292
Entity:2 class:noclass key:model
Entity:2 class:noclass key:origin
Entity:2 class:noclass key:spawnflags
Entity:2 class:noclass key:classname
entity: model (models/aircraft/drop_firebird/firebird_glass.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 448 2080 292
Entity:2 class:noclass key:spawnflags
Entity:2 class:noclass key:model
Entity:2 class:noclass key:origin
Entity:2 class:noclass key:classname
entity: model (models/aircraft/drop_firebird/firebird.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 448 2080 292
Entity:2 class:noclass key:origin
Entity:2 class:noclass key:classname
entity: model () num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 304 1904 284
Entity:3 class:noclass key:team

... snip ...

Entity:19 class:noclass key:classname
entity: model () num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 2064 1520 92
Entity:20 class:noclass key:angles
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:model
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/tropic/tropic01.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1862 1926 170
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/plants/plant_a.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 516 474 116
Entity:20 class:noclass key:modelscale_vec
ED_ParseField: modelscale_vec is not a valid field
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/plant/plant2.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 689 1232 222
Entity:20 class:noclass key:modelscale_vec
ED_ParseField: modelscale_vec is not a valid field
Entity:20 class:noclass key:skin
ED_ParseField: skin is not a valid field
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/fir/fir.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1904 1072 90
Entity:20 class:noclass key:modelscale_vec
ED_ParseField: modelscale_vec is not a valid field
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/tree02/tree2_a.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1744 944 88
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin

... massive snip ...

Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/tree02/tree2_a.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 400 1232 216
Entity:20 class:noclass key:angles
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:model
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/tropic/tropic04.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 276 1218 236
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:team
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model () num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1904 272 76
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:team
Entity:20 class:noclass key:origin
Eter
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
Created AI player (team 7)
0 groups with 0 entities
Set server state to 2
-------------------------------------
CL_SetClientState: Set new state to 3 (old was: 1)
s key:classname
entity: model (models/objects/vegi/water_lily/lily_leaf.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1712 512 32
No civilian spawn points in this map or civilians deactivated
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
CHRSH_CharGetBody: use 'aliens/ortnok/body01' as body model path for character
CHRSH_CharGetBody: use 'aliens/ortnok/head02' as head model path for character
INVSH_EquipActor: no weapon picked in equipment 'multiplayer_alien', defaulting to the most expensive secondary weapon without reload.
No valid name definitions for gender 1 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
CHRSH_CharGetBody: use 'aliens/ortnok/body01' as body model path for character
CHRSH_CharGetBody: use 'aliens/ortnok/head01' as head model path for character
INVSH_EquipActor: no weapon picked in equipment 'multiplayer_alien', defaulting to the most expensive secondary weapon without reload.

... snip ...

CHRSH_CharGetBody: use 'aliens/ortnok/body01' as body model path for character
CHRSH_CharGetBody: use 'aliens/ortnok/head01' as head model path for character
No valid name definitions for gender 2 in category 'ortnok'
CHRSH_CharGetBody: use 'aliens/ortnok/body01' as body model path for character
CHRSH_CharGetBody: use 'aliens/ortnok/head01' as head model path for charac2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1712 480 32
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/water_lily/lily_stem.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1712 480 32
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/water_lily/lily_stem.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1744 496 32
Entity:20 class:noclass key:modelscale_vec
ED_ParseField: modelscale_vec is not a valid field
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/water_lily/lily_leaf.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1744 496 32
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/water_lily/lily_stem.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1712 512 32
Entity:20 class:noclass key:modelscale_vec
ED_ParseField: modelscale_vec is not a valid field
Entity:20 class:noclass key:angle
Entity:20 class:noclass key:spawnflags
Entity:20 class:noclass key:model
Entity:20 class:noclass key:origin
Entity:20 class:noclass key:classname
entity: model (models/objects/vegi/water_lily/lily_leaf.md2) num: 0 solid:0 mins: 0 0 0 maxs: 0 0 0 absmins: 0 0 0 absmaxs: 0 0 0 origin: 1712 512 32
No civilian spawn points in this map or civilians deactivated
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 2 in category 'ortnok'
No valid name definitions for gender 1 in category 'ortnok'
CHRSH_CharGetBody: use 'aliens/ortnok/body01' as body model path for character
CHRSH_CharGetBody: use 'aliens/ortnok/head02' as head model path for character
INVSH_EquipActor: no weapon picked in equipment 'multiplayer_alien', defaulting to the most expensive secondary weapon without reload.
... snip ...

CHRSH_CharGetBody: use 'aliens/ortnok/body01' as body model path for character
CHRSH_CharGetBody: use 'aliens/ortnok/head01' as head model path for character
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '12' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
new event '22' for mask 0
Created AI player (team 7)
0 groups with 0 entities
Set server state to 2
-------------------------------------
CL_SetClientState: Set new state to 3 (old was: 1)
Connecting to localhost...
New stream at index: 0
New stream at index: 1
Packet : connect
SVC_DirectConnect()
Set state for client 'michael' to 1
server OOB:
CL_SetClientState: Set new state to 4 (old was: 3)
0   ufo                                 0x0019c790 Sys_Mkdir + 180
1   ufo                                 0x0019c808 Sys_Mkdir + 300
2   libSystem.B.dylib                   0x92f3399c _sigtramp + 68
Wrote keys.cfg

^CReceived signal 2, quitting..
recursive shutdown
Kleiman-ibook:trunk michael$

--- End code ---

Yep, it really takes that long and does that much on entity 20.

Now, sometimes I can get it to display a black map (cannot even see my team), and sometimes it crashes like this.
However, it does get that little bit farther -- the map does load now.

Investigation continues ...

keybounce:
I think I see the problem.

There are some places where "numTiles" is used as "past the upper limit of valid tiles" -- things like for(i=0; i<numTiles; i++), where if "numTiles == 0", for the start of the level load, will be skipped completely; and other places where "numTiles" is used as a valid current index into an array.

I don't pretend to know all of it, but it seems that numTiles is being used inconsistently, like its meaning has changed over the course of the code development.

Mattn:
as a reference, please also see: https://sourceforge.net/tracker2/?func=detail&aid=2695771&group_id=157793&atid=805244

Navigation

[0] Message Index

[*] Previous page

Go to full version