mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-12 08:04:09 +02:00
convert tabs to spaces
This commit is contained in:
@@ -39,7 +39,9 @@ struct Controller {
|
|||||||
void update() {
|
void update() {
|
||||||
float rot = 0.0f;
|
float rot = 0.0f;
|
||||||
|
|
||||||
enum { LEFT = 1, RIGHT = 2, FORTH = 4, BACK = 8, JUMP = 16, WALK = 32, ACTION = 64, WEAPON = 128, ROLL = 256, GROUND = 512, WATER = 1024, DEATH = 2048,
|
enum { LEFT = 1, RIGHT = 2, FORTH = 4, BACK = 8,
|
||||||
|
JUMP = 16, WALK = 32, ACTION = 64, WEAPON = 128, ROLL = 256,
|
||||||
|
GROUND = 512, WATER = 1024, DEATH = 2048,
|
||||||
PULL = 4096, PICKUP = 8192, SWITCH_ON = 16 * 1024, SWITCH_OFF = 32 * 1024, KEY = 64 * 1024, PUZZLE = 128 * 1024, HANG = 256 * 1024, FALL = 512 * 1024, COMPRESS = 1024 * 1024};
|
PULL = 4096, PICKUP = 8192, SWITCH_ON = 16 * 1024, SWITCH_OFF = 32 * 1024, KEY = 64 * 1024, PUZZLE = 128 * 1024, HANG = 256 * 1024, FALL = 512 * 1024, COMPRESS = 1024 * 1024};
|
||||||
int mask = 0;
|
int mask = 0;
|
||||||
|
|
||||||
@@ -56,12 +58,10 @@ struct Controller {
|
|||||||
if (velocity.y > 2048) mask |= FALL;
|
if (velocity.y > 2048) mask |= FALL;
|
||||||
if (anim->state == TR::STATE_COMPRESS) mask |= COMPRESS;
|
if (anim->state == TR::STATE_COMPRESS) mask |= COMPRESS;
|
||||||
|
|
||||||
|
|
||||||
int origMask = mask;
|
int origMask = mask;
|
||||||
if (origMask & (FORTH | BACK))
|
if (origMask & (FORTH | BACK))
|
||||||
mask &= ~(LEFT | RIGHT);
|
mask &= ~(LEFT | RIGHT);
|
||||||
|
|
||||||
|
|
||||||
int stateMask[TR::STATE_MAX];
|
int stateMask[TR::STATE_MAX];
|
||||||
for (int i = 0; i < TR::STATE_MAX; i++)
|
for (int i = 0; i < TR::STATE_MAX; i++)
|
||||||
stateMask[i] = -1;
|
stateMask[i] = -1;
|
||||||
@@ -273,7 +273,6 @@ struct Controller {
|
|||||||
fCount = anim->frameEnd - anim->frameStart + 1;
|
fCount = anim->frameEnd - anim->frameStart + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
move(velocity * dt);
|
move(velocity * dt);
|
||||||
collide();
|
collide();
|
||||||
|
|
||||||
|
59
src/level.h
59
src/level.h
@@ -899,64 +899,6 @@ struct Level {
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void debugEntity() {
|
|
||||||
Core::setCulling(cfNone);
|
|
||||||
Core::active.shader = NULL;
|
|
||||||
glUseProgram(0);
|
|
||||||
|
|
||||||
mat4 mProj;
|
|
||||||
glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat*)&mProj);
|
|
||||||
|
|
||||||
glPushMatrix();
|
|
||||||
glScalef(-SCALE, -SCALE, SCALE);
|
|
||||||
|
|
||||||
for (int i = 0; i < entities.count; i++) {
|
|
||||||
tr_entity *entity = &entities[i];
|
|
||||||
|
|
||||||
glPushMatrix();
|
|
||||||
glTranslatef(entity->x, entity->y, entity->z);
|
|
||||||
|
|
||||||
for (int i = 0; i < models.count; i++)
|
|
||||||
if (entity->id == models[i].id) {
|
|
||||||
glRotatef((entity->rotation >> 14) * 90.0f, 0, 1, 0);
|
|
||||||
tr_anim_frame *frame = (tr_anim_frame*)&frames[models[i].frame >> 1];
|
|
||||||
glTranslatef(frame->x, frame->y, frame->z);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mat4 mView, mViewProj;
|
|
||||||
glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat*)&mView);
|
|
||||||
mViewProj = mProj * mView;
|
|
||||||
vec4 p = mViewProj * vec4(0, 0, 0, 1);
|
|
||||||
if (p.w > 0) {
|
|
||||||
p.xyz /= p.w;
|
|
||||||
p.y = -p.y;
|
|
||||||
|
|
||||||
p.xy = (p.xy * 0.5f + 0.5f) * vec2(Core::width, Core::height);
|
|
||||||
char buf[16];
|
|
||||||
sprintf(buf, "%d", entity->id);
|
|
||||||
|
|
||||||
UI::begin();
|
|
||||||
font->print(p.xy, vec4(1, 0, 0, 1), buf);
|
|
||||||
UI::end();
|
|
||||||
}
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
Core::setCulling(cfFront);
|
|
||||||
Core::active.shader = NULL;
|
|
||||||
glUseProgram(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isInsideRoom(const vec3 pos, tr_room *room) {
|
|
||||||
vec3 min = vec3(room->info.x, room->info.yTop, room->info.z);
|
|
||||||
Box box(min, min + vec3(room->xSectors * 1024, room->info.yBottom - room->info.yTop, room->zSectors * 1024));
|
|
||||||
return box.intersect(vec3(-pos.x, -pos.y, pos.z) / SCALE);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
float tickTextureAnimation = 0.0f;
|
float tickTextureAnimation = 0.0f;
|
||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
@@ -1017,7 +959,6 @@ struct Level {
|
|||||||
debugRooms();
|
debugRooms();
|
||||||
// debugLights();
|
// debugLights();
|
||||||
debugPortals();
|
debugPortals();
|
||||||
// debugEntity();
|
|
||||||
Debug::Draw::end();
|
Debug::Draw::end();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
26
src/utils.h
26
src/utils.h
@@ -131,23 +131,23 @@ struct quat {
|
|||||||
w = cosf(angle);
|
w = cosf(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::operator - () const {
|
quat operator - () const {
|
||||||
return quat(-x, -y, -z, -w);
|
return quat(-x, -y, -z, -w);
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::operator + (const quat &q) const {
|
quat operator + (const quat &q) const {
|
||||||
return quat(x + q.x, y + q.y, z + q.z, w + q.w);
|
return quat(x + q.x, y + q.y, z + q.z, w + q.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::operator - (const quat &q) const {
|
quat operator - (const quat &q) const {
|
||||||
return quat(x - q.x, y - q.y, z - q.z, w - q.w);
|
return quat(x - q.x, y - q.y, z - q.z, w - q.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::operator * (const float s) const {
|
quat operator * (const float s) const {
|
||||||
return quat(x * s, y * s, z * s, w * s);
|
return quat(x * s, y * s, z * s, w * s);
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::operator * (const quat &q) const {
|
quat operator * (const quat &q) const {
|
||||||
return quat(w * q.x + x * q.w + y * q.z - z * q.y,
|
return quat(w * q.x + x * q.w + y * q.z - z * q.y,
|
||||||
w * q.y + y * q.w + z * q.x - x * q.z,
|
w * q.y + y * q.w + z * q.x - x * q.z,
|
||||||
w * q.z + z * q.w + x * q.y - y * q.x,
|
w * q.z + z * q.w + x * q.y - y * q.x,
|
||||||
@@ -166,19 +166,19 @@ struct quat {
|
|||||||
return sqrtf(length2());
|
return sqrtf(length2());
|
||||||
}
|
}
|
||||||
|
|
||||||
void quat::normalize() {
|
void normalize() {
|
||||||
*this = normal();
|
*this = normal();
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::normal() const {
|
quat normal() const {
|
||||||
return *this * (1.0f / length());
|
return *this * (1.0f / length());
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::conjugate() const {
|
quat conjugate() const {
|
||||||
return quat(-x, -y, -z, w);
|
return quat(-x, -y, -z, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
quat quat::inverse() const {
|
quat inverse() const {
|
||||||
return conjugate() * (1.0f / length2());
|
return conjugate() * (1.0f / length2());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +382,7 @@ struct mat4 {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
quat mat4::getRot() const {
|
quat getRot() const {
|
||||||
float t, s;
|
float t, s;
|
||||||
t = 1.0f + e00 + e11 + e22;
|
t = 1.0f + e00 + e11 + e22;
|
||||||
if (t > EPS) {
|
if (t > EPS) {
|
||||||
@@ -402,7 +402,7 @@ struct mat4 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mat4::setRot(const quat &rot) {
|
void setRot(const quat &rot) {
|
||||||
float sx = rot.x * rot.x,
|
float sx = rot.x * rot.x,
|
||||||
sy = rot.y * rot.y,
|
sy = rot.y * rot.y,
|
||||||
sz = rot.z * rot.z,
|
sz = rot.z * rot.z,
|
||||||
@@ -430,11 +430,11 @@ struct mat4 {
|
|||||||
e12 = (t1 - t2) * inv;
|
e12 = (t1 - t2) * inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 mat4::getPos() const {
|
vec3 getPos() const {
|
||||||
return offset.xyz;
|
return offset.xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mat4::setPos(const vec3 &pos) {
|
void setPos(const vec3 &pos) {
|
||||||
offset.xyz = pos;
|
offset.xyz = pos;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user