equal
deleted
inserted
replaced
314 * Gets the index of the given coordinate direction |
314 * Gets the index of the given coordinate direction |
315 * referring to the DIRECTIONS table in Physics.hh |
315 * referring to the DIRECTIONS table in Physics.hh |
316 */ |
316 */ |
317 static int getDirectionIndex (Vector direction) { |
317 static int getDirectionIndex (Vector direction) { |
318 Vector dir = direction.roundToInt(); |
318 Vector dir = direction.roundToInt(); |
319 if(dir.x == 0 && dir.y == -1) { |
319 |
|
320 if (dir.x == 0 && dir.y == -1) { |
320 return 0; |
321 return 0; |
321 } else if (dir.x == 1 && dir.y == -1) { |
322 } else if (dir.x == 1 && dir.y == -1) { |
322 return 1; |
323 return 1; |
323 } else if (dir.x == 1 && dir.y == 0) { |
324 } else if (dir.x == 1 && dir.y == 0) { |
324 return 2; |
325 return 2; |
370 if (getType(point) == TERRAIN_EMPTY || getType(prevPoint) != TERRAIN_EMPTY) { |
371 if (getType(point) == TERRAIN_EMPTY || getType(prevPoint) != TERRAIN_EMPTY) { |
371 Engine::log(DEBUG, "Physics.getNormal ") << "logic ground error"; |
372 Engine::log(DEBUG, "Physics.getNormal ") << "logic ground error"; |
372 } |
373 } |
373 |
374 |
374 return normal; |
375 return normal; |
375 } |
|
376 |
|
377 // XXX: weird vectors |
|
378 Vector direction (const Vector &v) { |
|
379 Vector tmp(v); |
|
380 |
|
381 if (tmp.length() > 0) |
|
382 tmp /= tmp.length(); |
|
383 |
|
384 tmp.x = (uint16_t)(tmp.x); |
|
385 tmp.y = (uint16_t)(tmp.y); |
|
386 |
|
387 return tmp; |
|
388 } |
376 } |
389 |
377 |
390 // TODO: This could better :) |
378 // TODO: This could better :) |
391 // TODO: And this need some cleaning :) |
379 // TODO: And this need some cleaning :) |
392 void Terrain::generateTerrain (int seed) { |
380 void Terrain::generateTerrain (int seed) { |