mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Fix respawn point not being set (oops)
This commit is contained in:
parent
d927560acc
commit
047c390e70
@ -961,6 +961,10 @@ void LocalPlayers_MoveToSpawn(struct LocationUpdate* update) {
|
|||||||
{
|
{
|
||||||
p = &LocalPlayer_Instances[i];
|
p = &LocalPlayer_Instances[i];
|
||||||
p->Base.VTABLE->SetLocation(&p->Base, update);
|
p->Base.VTABLE->SetLocation(&p->Base, update);
|
||||||
|
|
||||||
|
if (update->flags & LU_HAS_POS) p->Spawn = update->pos;
|
||||||
|
if (update->flags & LU_HAS_YAW) p->SpawnYaw = update->yaw;
|
||||||
|
if (update->flags & LU_HAS_PITCH) p->SpawnPitch = update->pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: This needs to be before new map... */
|
/* TODO: This needs to be before new map... */
|
||||||
|
@ -41,21 +41,25 @@ static int CalcNumVertices(int axis1Len, int axis2Len) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*------------------------------------------------------------Fog----------------------------------------------------------*
|
*------------------------------------------------------------Fog----------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static void CalcFog(float* density, PackedCol* color) {
|
static cc_bool CameraInsideBlock(BlockID block, IVec3* coords) {
|
||||||
|
struct AABB blockBB;
|
||||||
Vec3 pos;
|
Vec3 pos;
|
||||||
|
IVec3_ToVec3(&pos, coords); /* pos = coords; */
|
||||||
|
|
||||||
|
Vec3_Add(&blockBB.Min, &pos, &Blocks.MinBB[block]);
|
||||||
|
Vec3_Add(&blockBB.Max, &pos, &Blocks.MaxBB[block]);
|
||||||
|
return AABB_ContainsPoint(&blockBB, &Camera.CurrentPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CalcFog(float* density, PackedCol* color) {
|
||||||
IVec3 coords;
|
IVec3 coords;
|
||||||
BlockID block;
|
BlockID block;
|
||||||
struct AABB blockBB;
|
|
||||||
float blend;
|
float blend;
|
||||||
|
|
||||||
IVec3_Floor(&coords, &Camera.CurrentPos); /* coords = floor(camera_pos); */
|
IVec3_Floor(&coords, &Camera.CurrentPos); /* coords = floor(camera_pos); */
|
||||||
IVec3_ToVec3(&pos, &coords); /* pos = coords; */
|
|
||||||
|
|
||||||
block = World_SafeGetBlock(coords.x, coords.y, coords.z);
|
block = World_SafeGetBlock(coords.x, coords.y, coords.z);
|
||||||
Vec3_Add(&blockBB.Min, &pos, &Blocks.MinBB[block]);
|
|
||||||
Vec3_Add(&blockBB.Max, &pos, &Blocks.MaxBB[block]);
|
|
||||||
|
|
||||||
if (AABB_ContainsPoint(&blockBB, &Camera.CurrentPos) && Blocks.FogDensity[block]) {
|
if (Blocks.FogDensity[block] && CameraInsideBlock(block, &coords)) {
|
||||||
*density = Blocks.FogDensity[block];
|
*density = Blocks.FogDensity[block];
|
||||||
*color = Blocks.FogCol[block];
|
*color = Blocks.FogCol[block];
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,9 +83,9 @@ void RayTracer_Init(struct RayTracer* t, const Vec3* origin, const Vec3* dir) {
|
|||||||
t->tMax.z = RayTracer_Div(cellBoundary.z - origin->z, dir->z); /* Boundary is a plane on the XY axis. */
|
t->tMax.z = RayTracer_Div(cellBoundary.z - origin->z, dir->z); /* Boundary is a plane on the XY axis. */
|
||||||
|
|
||||||
/* Determine how far we must travel along the ray before we have crossed a gridcell. */
|
/* Determine how far we must travel along the ray before we have crossed a gridcell. */
|
||||||
t->tDelta.x = RayTracer_Div((float)t->step.x, dir->x);
|
t->tDelta.x = (float)t->step.x * t->invDir.x;
|
||||||
t->tDelta.y = RayTracer_Div((float)t->step.y, dir->y);
|
t->tDelta.y = (float)t->step.y * t->invDir.y;
|
||||||
t->tDelta.z = RayTracer_Div((float)t->step.z, dir->z);
|
t->tDelta.z = (float)t->step.z * t->invDir.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RayTracer_Step(struct RayTracer* t) {
|
void RayTracer_Step(struct RayTracer* t) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user