1 | /* |
1 | /* |
2 | * static char *rcsid_object_c = |
2 | * static char *rcsid_object_c = |
3 | * "$Id: object.C,v 1.11 2006/09/03 00:18:40 root Exp $"; |
3 | * "$Id: object.C,v 1.12 2006/09/03 14:33:47 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
1158 | /* we set up values so that it could be inserted into |
1158 | /* we set up values so that it could be inserted into |
1159 | * the map, but we don't actually do that - it is up |
1159 | * the map, but we don't actually do that - it is up |
1160 | * to the caller to decide what we want to do. |
1160 | * to the caller to decide what we want to do. |
1161 | */ |
1161 | */ |
1162 | op->x=op->env->x,op->y=op->env->y; |
1162 | op->x=op->env->x,op->y=op->env->y; |
1163 | op->ox=op->x,op->oy=op->y; |
|
|
1164 | op->map=op->env->map; |
1163 | op->map=op->env->map; |
1165 | op->above=NULL,op->below=NULL; |
1164 | op->above=NULL,op->below=NULL; |
1166 | op->env=NULL; |
1165 | op->env=NULL; |
1167 | return; |
1166 | return; |
1168 | } |
1167 | } |
… | |
… | |
1379 | * we set the map, that doesn't work if the location is within |
1378 | * we set the map, that doesn't work if the location is within |
1380 | * a map and this is straddling an edge. So only if coordinate |
1379 | * a map and this is straddling an edge. So only if coordinate |
1381 | * is clear wrong do we normalize it. |
1380 | * is clear wrong do we normalize it. |
1382 | */ |
1381 | */ |
1383 | if (OUT_OF_REAL_MAP(more->map, more->x, more->y)) { |
1382 | if (OUT_OF_REAL_MAP(more->map, more->x, more->y)) { |
1384 | /* Debugging information so you can see the last coordinates this object had */ |
|
|
1385 | more->ox = more->x; |
|
|
1386 | more->oy = more->y; |
|
|
1387 | more->map = get_map_from_coord(m, &more->x, &more->y); |
1383 | more->map = get_map_from_coord(m, &more->x, &more->y); |
1388 | } else if (!more->map) { |
1384 | } else if (!more->map) { |
1389 | /* For backwards compatibility - when not dealing with tiled maps, |
1385 | /* For backwards compatibility - when not dealing with tiled maps, |
1390 | * more->map should always point to the parent. |
1386 | * more->map should always point to the parent. |
1391 | */ |
1387 | */ |
… | |
… | |
1397 | LOG (llevError, "BUG: insert_ob_in_map(): inserting op->more killed op\n"); |
1393 | LOG (llevError, "BUG: insert_ob_in_map(): inserting op->more killed op\n"); |
1398 | return NULL; |
1394 | return NULL; |
1399 | } |
1395 | } |
1400 | } |
1396 | } |
1401 | CLEAR_FLAG(op,FLAG_REMOVED); |
1397 | CLEAR_FLAG(op,FLAG_REMOVED); |
1402 | |
|
|
1403 | /* Debugging information so you can see the last coordinates this object had */ |
|
|
1404 | op->ox=op->x; |
|
|
1405 | op->oy=op->y; |
|
|
1406 | |
1398 | |
1407 | /* Ideally, the caller figures this out. However, it complicates a lot |
1399 | /* Ideally, the caller figures this out. However, it complicates a lot |
1408 | * of areas of callers (eg, anything that uses find_free_spot would now |
1400 | * of areas of callers (eg, anything that uses find_free_spot would now |
1409 | * need extra work |
1401 | * need extra work |
1410 | */ |
1402 | */ |
… | |
… | |
1812 | op->map=NULL; |
1804 | op->map=NULL; |
1813 | op->env=where; |
1805 | op->env=where; |
1814 | op->above=NULL; |
1806 | op->above=NULL; |
1815 | op->below=NULL; |
1807 | op->below=NULL; |
1816 | op->x=0,op->y=0; |
1808 | op->x=0,op->y=0; |
1817 | op->ox=0,op->oy=0; |
|
|
1818 | |
1809 | |
1819 | /* reset the light list and los of the players on the map */ |
1810 | /* reset the light list and los of the players on the map */ |
1820 | if((op->glow_radius!=0)&&where->map) |
1811 | if((op->glow_radius!=0)&&where->map) |
1821 | { |
1812 | { |
1822 | #ifdef DEBUG_LIGHTS |
1813 | #ifdef DEBUG_LIGHTS |