bzResourcesReadBytes(handle, &image, sizeof(image));
size_t compressedSize = chunk.chunkSize - sizeof(ASE_Chunk_Cel_CompressedImage) - sizeof(ASE_Chunk_Cel) - sizeof(ASE_Chunk);
- int8_t *compressedData = bzMemoryAlloc(arena, compressedSize); // If we do this on the stack (alloca) the Playdate will explode!
+ uint8_t *compressedData = bzMemoryAlloc(arena, compressedSize); // If we do this on the stack (alloca) the Playdate will explode!
bzResourcesReadBytes(handle, compressedData, compressedSize);
size_t imagePixelDataSize = image.pixelWidth * image.pixelHeight * pixelDataSize;
- int8_t *imagePixelData = bzMemoryAlloc(arena, imagePixelDataSize);
+ uint8_t *imagePixelData = bzMemoryAlloc(arena, imagePixelDataSize);
stbi_zlib_decode_buffer(imagePixelData, imagePixelDataSize, compressedData, compressedSize);
for (size_t y = 0; y < image.pixelHeight; ++y) {
uint32_t idx = bzRandomInteger(count);
return array + idx * arrayTypeSize;
}
+
+void bzRandomReseed(uint64_t seed) {
+ pcg32_srandom(seed, 1);
+}
extern void *bzRandomArrayValue(size_t count, size_t arrayTypeSize, void *array);
//extern void *bzRandomArrayValue(pcg32_random_t *rng, size_t count, size_t arrayTypeSize, void *array);
+extern void bzRandomReseed(uint64_t seed);
+
#define bzRandom(T, ...) (*((T *)bzRandomArrayValue(sizeof((T[]){__VA_ARGS__})/sizeof(T), sizeof(T), (T[]){__VA_ARGS__})))
#ifdef __cplusplus
}
}
+_FUNCTION_BINDING(srand, bzRandomReseed, _INT_PARAMETER(1))
+
_FUNCTION_BINDING_RTN(lerp, fixedLerp, _FUNCTION_PARAMETER(1, float), _FUNCTION_PARAMETER(2, float), _FUNCTION_PARAMETER(3, float))
static void native_dot(SVMModuleInstance *instance, int32_t parameterCount, SVMOperand stack[]) {
FUNCTION_BIND(ceil)
FUNCTION_BIND(adelta)
FUNCTION_BIND(rnd)
+ FUNCTION_BIND(srand)
FUNCTION_BIND(lerp)
FUNCTION_BIND(dot)
-Subproject commit a5b6b9ea53d78b2019201a9fb75b763b7d92873c
+Subproject commit b4bfa0d90e747a0f6f3080246823471423a30951