1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-14 17:14:29 +02:00

minor fixes

This commit is contained in:
XProger
2017-11-25 05:40:53 +03:00
parent 5a40006671
commit aaabdde6e9
6 changed files with 9 additions and 8 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);