Suspiciously everything worked when changing to floats
This commit is contained in:
@@ -1,5 +1,2 @@
|
||||
def floatToFixed248(value):
|
||||
# Converts a float to the fixed248_t used internally.
|
||||
high24 = int(value) & 0xFFFFFF
|
||||
low8 = int((value * 256.0 - high24) * 256.0) & 0xFF
|
||||
return f'((fixed248_t){(high24 << 8) | low8})'
|
||||
return value;
|
@@ -128,8 +128,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 ((fixed248_t){floatToFixed248(mapData['playerSpawnX'])})\n")
|
||||
f.write(f"#define WORLD_PLAYER_SPAWN_Y ((fixed248_t){floatToFixed248(mapData['playerSpawnY'])})\n")
|
||||
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("\n")
|
||||
|
||||
|
Reference in New Issue
Block a user