diff --git a/CMakeLists.txt b/CMakeLists.txt index 63cfa60..c6711b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) if(NOT DEFINED DUSK_TARGET_SYSTEM) - set(DUSK_TARGET_SYSTEM "psp") - # set(DUSK_TARGET_SYSTEM "linux") + # set(DUSK_TARGET_SYSTEM "psp") + set(DUSK_TARGET_SYSTEM "linux") endif() # Prep cache diff --git a/src/dusk/entity/entity.c b/src/dusk/entity/entity.c index 736631d..5eebd37 100644 --- a/src/dusk/entity/entity.c +++ b/src/dusk/entity/entity.c @@ -40,8 +40,8 @@ void entityLoad(entity_t *entity, const entity_t *source) { memoryZero(entity, sizeof(entity_t)); entity->type = source->type; - entity->x = (uint32_t)roundf(source->x / (float_t)TILE_WIDTH_HEIGHT); - entity->y = (uint32_t)roundf(source->y / (float_t)TILE_WIDTH_HEIGHT); + entity->x = source->x; + entity->y = source->y; entity->dir = source->dir; entity->id = source->id; diff --git a/tools/mapcompile/constants.py b/tools/mapcompile/constants.py index 8bb3b44..824c01c 100644 --- a/tools/mapcompile/constants.py +++ b/tools/mapcompile/constants.py @@ -3,5 +3,4 @@ CHUNK_WIDTH = 8 CHUNK_HEIGHT = 8 CHUNK_TILE_COUNT = CHUNK_WIDTH * CHUNK_HEIGHT CHUNK_ENTITY_COUNT_MAX = 8 -TILE_WIDTH_HEIGHT = 16 TILE_WIDTH_HEIGHT = 16 \ No newline at end of file diff --git a/tools/mapcompile/helper.py b/tools/mapcompile/helper.py deleted file mode 100644 index fe932ed..0000000 --- a/tools/mapcompile/helper.py +++ /dev/null @@ -1,2 +0,0 @@ -def floatToFixed248(value): - return value; \ No newline at end of file diff --git a/tools/mapcompile/mapcompile.py b/tools/mapcompile/mapcompile.py index 802b75b..2c28807 100644 --- a/tools/mapcompile/mapcompile.py +++ b/tools/mapcompile/mapcompile.py @@ -2,11 +2,10 @@ import sys, os import argparse from datetime import datetime import math -from helper import floatToFixed248 from inputParser import parseInputFile from mapParser import parseMap from chunkParser import parseChunk -from constants import CHUNK_WIDTH, CHUNK_HEIGHT +from constants import CHUNK_WIDTH, CHUNK_HEIGHT, TILE_WIDTH_HEIGHT # Check if the script is run with the correct arguments parser = argparse.ArgumentParser(description="Generate chunk header files") @@ -83,8 +82,8 @@ for chunkY in range(mapData['mapHeightInRealChunks']): f.write(" {\n") f.write(f" .id = {entity['id']},\n") f.write(f" .type = {entity['type']},\n") - f.write(f" .x = {floatToFixed248(entity['x'])},\n") - f.write(f" .y = {floatToFixed248(entity['y'])},\n") + f.write(f" .x = {round(entity['x'] / TILE_WIDTH_HEIGHT)},\n") + f.write(f" .y = {round(entity['y'] / TILE_WIDTH_HEIGHT)},\n") if 'dir' in entity: f.write(f" .dir = {entity['dir']},\n") @@ -128,8 +127,8 @@ with open(headerPath, 'w') as f: f.write(f"#define WORLD_HEIGHT {worldHeight}\n") # Write out other global variables. - f.write(f"#define WORLD_PLAYER_SPAWN_X ((float_t){floatToFixed248(mapData['playerSpawnX'])})\n") - f.write(f"#define WORLD_PLAYER_SPAWN_Y ((float_t){floatToFixed248(mapData['playerSpawnY'])})\n") + f.write(f"#define WORLD_PLAYER_SPAWN_X ({round(mapData['playerSpawnX'] / TILE_WIDTH_HEIGHT)})\n") + f.write(f"#define WORLD_PLAYER_SPAWN_Y ({round(mapData['playerSpawnY'] / TILE_WIDTH_HEIGHT)})\n") f.write("\n")