diff --git a/src/debug.h b/src/debug.h index 997f156..aa3022b 100644 --- a/src/debug.h +++ b/src/debug.h @@ -577,7 +577,7 @@ namespace Debug { FILE *f = fopen(buf, "wb"); if (level->version == TR::VER_TR1_PSX) { - int dataSize = level->soundSize[index] / 16 * 28 * 2 * 4; + uint32 dataSize = level->soundSize[index] / 16 * 28 * 2 * 4; struct Header { uint32 RIFF; @@ -596,10 +596,10 @@ namespace Debug { uint32 data; uint32 dataSize; } header = { - FOURCC("RIFF"), (uint32) sizeof(Header) - 8 + dataSize, + FOURCC("RIFF"), sizeof(Header) - 8 + dataSize, FOURCC("WAVE"), FOURCC("fmt "), 16, { 1, 1, 44100, 44100 * 16 / 8, 0, 16 }, - FOURCC("data"), (uint32) dataSize + FOURCC("data"), dataSize }; fwrite(&header, sizeof(header), 1, f); @@ -686,7 +686,7 @@ namespace Debug { TR::Level::FloorInfo info; controller->getFloorInfo(controller->getRoomIndex(), controller->pos, info); - sprintf(buf, "floor = %d, roomBelow = %d, roomAbove = %d, height = %d", info.floorIndex, info.roomBelow, info.roomAbove, info.floor - info.ceiling); + sprintf(buf, "floor = %d, roomBelow = %d, roomAbove = %d, height = %d", info.floorIndex, info.roomBelow, info.roomAbove, int(info.floor - info.ceiling)); Debug::Draw::text(vec2(16, y += 16), vec4(1.0f), buf); y += 16; diff --git a/src/lara.h b/src/lara.h index 3ba2eb8..557e966 100644 --- a/src/lara.h +++ b/src/lara.h @@ -2124,7 +2124,7 @@ struct Lara : Character { float ceiling = c.info[Collision::FRONT].ceiling; float hands = bounds.min.y; - if (abs(floor - hands) < 64 && floor != ceiling) { + if (fabsf(floor - hands) < 64 && floor != ceiling) { alignToWall(-LARA_RADIUS); pos.y = float(floor + LARA_HANG_OFFSET); stand = STAND_HANG; @@ -2804,7 +2804,7 @@ struct Lara : Character { } else { // fast distance check for object if (e.type != TR::Entity::HAMMER_HANDLE && e.type != TR::Entity::HAMMER_BLOCK && e.type != TR::Entity::SCION_HOLDER) - if (abs(pos.x - controller->pos.x) > 1024 || abs(pos.z - controller->pos.z) > 1024 || abs(pos.y - controller->pos.y) > 2048) continue; + if (fabsf(pos.x - controller->pos.x) > 1024 || fabsf(pos.z - controller->pos.z) > 1024 || fabsf(pos.y - controller->pos.y) > 2048) continue; } vec3 dir = pos - vec3(0.0f, 128.0f, 0.0f) - controller->pos; diff --git a/src/platform/web/audio/dummy b/src/platform/web/audio/dummy deleted file mode 100644 index e69de29..0000000 diff --git a/src/platform/web/level/dummy b/src/platform/web/level/dummy deleted file mode 100644 index e69de29..0000000 diff --git a/src/trigger.h b/src/trigger.h index b04793b..96f9d32 100644 --- a/src/trigger.h +++ b/src/trigger.h @@ -621,7 +621,7 @@ struct TrapFloor : Controller { virtual bool activate() { if (state != STATE_STATIC) return false; vec3 &p = ((Controller*)level->laraController)->pos; - if (abs(p.y - (pos.y - 512.0f)) <= 8 && Controller::activate()) { + if (fabsf(p.y - (pos.y - 512.0f)) <= 8 && Controller::activate()) { animation.setState(STATE_SHAKE); return true; } diff --git a/src/utils.h b/src/utils.h index 66da320..6ed3b5a 100644 --- a/src/utils.h +++ b/src/utils.h @@ -53,7 +53,7 @@ typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; -#define FOURCC(str) (((uint8*)(str))[0] | (((uint8*)(str))[1] << 8) | (((uint8*)(str))[2] << 16) | (((uint8*)(str))[3] << 24) ) +#define FOURCC(str) uint32(((uint8*)(str))[0] | (((uint8*)(str))[1] << 8) | (((uint8*)(str))[2] << 16) | (((uint8*)(str))[3] << 24) ) #define COUNT(arr) (sizeof(arr) / sizeof(arr[0])) @@ -1031,6 +1031,7 @@ struct Stream { LOG("error loading file \"%s\"\n", name); if (callback) { callback(NULL, userData); + delete this; return; } else { ASSERT(false);