Fix respawn point not being set (oops)

This commit is contained in:
UnknownShadow200 2024-04-26 20:07:11 +10:00
parent d927560acc
commit 047c390e70
3 changed files with 18 additions and 10 deletions

View File

@ -961,6 +961,10 @@ void LocalPlayers_MoveToSpawn(struct LocationUpdate* update) {
{
p = &LocalPlayer_Instances[i];
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... */

View File

@ -41,21 +41,25 @@ static int CalcNumVertices(int axis1Len, int axis2Len) {
/*########################################################################################################################*
*------------------------------------------------------------Fog----------------------------------------------------------*
*#########################################################################################################################*/
static void CalcFog(float* density, PackedCol* color) {
static cc_bool CameraInsideBlock(BlockID block, IVec3* coords) {
struct AABB blockBB;
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;
BlockID block;
struct AABB blockBB;
float blend;
IVec3_Floor(&coords, &Camera.CurrentPos); /* coords = floor(camera_pos); */
IVec3_ToVec3(&pos, &coords); /* pos = coords; */
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];
*color = Blocks.FogCol[block];
} else {

View File

@ -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. */
/* 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.y = RayTracer_Div((float)t->step.y, dir->y);
t->tDelta.z = RayTracer_Div((float)t->step.z, dir->z);
t->tDelta.x = (float)t->step.x * t->invDir.x;
t->tDelta.y = (float)t->step.y * t->invDir.y;
t->tDelta.z = (float)t->step.z * t->invDir.z;
}
void RayTracer_Step(struct RayTracer* t) {