Make entities/fog/sky/clouds/borders/sides render when map failed to loaded, fix this to also work in multiplayer

This commit is contained in:
UnknownShadow200 2020-03-31 18:43:38 +11:00
parent f7dae6bc72
commit 48d394f8d0
4 changed files with 15 additions and 12 deletions

View File

@ -819,7 +819,7 @@ static void LocalPlayer_Tick(struct Entity* e, double delta) {
cc_bool wasOnGround; cc_bool wasOnGround;
Vec3 headingVelocity; Vec3 headingVelocity;
if (!World.Blocks) return; if (!World.Loaded) return;
e->StepSize = hacks->FullBlockStep && hacks->Enabled && hacks->CanSpeed ? 1.0f : 0.5f; e->StepSize = hacks->FullBlockStep && hacks->Enabled && hacks->CanSpeed ? 1.0f : 0.5f;
p->OldVelocity = e->Velocity; p->OldVelocity = e->Velocity;
wasOnGround = e->OnGround; wasOnGround = e->OnGround;
@ -938,7 +938,7 @@ static void LocalPlayer_DoRespawn(void) {
float height, spawnY; float height, spawnY;
int y; int y;
if (!World.Blocks) return; if (!World.Loaded) return;
IVec3_Floor(&pos, &spawn); IVec3_Floor(&pos, &spawn);
/* Spawn player at highest solid position to match vanilla Minecraft classic */ /* Spawn player at highest solid position to match vanilla Minecraft classic */

View File

@ -112,7 +112,7 @@ static void UpdateFogNormal(float fogDensity, PackedCol fogCol) {
void EnvRenderer_UpdateFog(void) { void EnvRenderer_UpdateFog(void) {
float fogDensity; float fogDensity;
PackedCol fogCol; PackedCol fogCol;
if (!World.Blocks) return; if (!World.Loaded) return;
CalcFog(&fogDensity, &fogCol); CalcFog(&fogDensity, &fogCol);
Gfx_ClearCol(fogCol); Gfx_ClearCol(fogCol);
@ -186,7 +186,7 @@ static void UpdateClouds(void) {
int x1, z1, x2, z2; int x1, z1, x2, z2;
Gfx_DeleteVb(&clouds_vb); Gfx_DeleteVb(&clouds_vb);
if (!World.Blocks || Gfx.LostContext) return; if (!World.Loaded || Gfx.LostContext) return;
if (EnvRenderer_Minimal) return; if (EnvRenderer_Minimal) return;
extent = Utils_AdjViewDist(Game_ViewDistance); extent = Utils_AdjViewDist(Game_ViewDistance);
@ -257,7 +257,7 @@ static void UpdateSky(void) {
int x1, z1, x2, z2; int x1, z1, x2, z2;
Gfx_DeleteVb(&sky_vb); Gfx_DeleteVb(&sky_vb);
if (!World.Blocks || Gfx.LostContext) return; if (!World.Loaded || Gfx.LostContext) return;
if (EnvRenderer_Minimal) return; if (EnvRenderer_Minimal) return;
extent = Utils_AdjViewDist(Game_ViewDistance); extent = Utils_AdjViewDist(Game_ViewDistance);
@ -672,7 +672,7 @@ static void UpdateMapSides(void) {
VertexP3fT2fC4b* data; VertexP3fT2fC4b* data;
Gfx_DeleteVb(&sides_vb); Gfx_DeleteVb(&sides_vb);
if (!World.Blocks || Gfx.LostContext) return; if (!World.Loaded || Gfx.LostContext) return;
block = Env.SidesBlock; block = Env.SidesBlock;
if (Blocks.Draw[block] == DRAW_GAS) return; if (Blocks.Draw[block] == DRAW_GAS) return;
@ -722,7 +722,7 @@ static void UpdateMapEdges(void) {
VertexP3fT2fC4b* data; VertexP3fT2fC4b* data;
Gfx_DeleteVb(&edges_vb); Gfx_DeleteVb(&edges_vb);
if (!World.Blocks || Gfx.LostContext) return; if (!World.Loaded || Gfx.LostContext) return;
block = Env.EdgeBlock; block = Env.EdgeBlock;
if (Blocks.Draw[block] == DRAW_GAS) return; if (Blocks.Draw[block] == DRAW_GAS) return;

View File

@ -107,8 +107,8 @@ static int Program_Run(int argc, char** argv) {
int argsCount = Platform_GetCommandLineArgs(argc, argv, args); int argsCount = Platform_GetCommandLineArgs(argc, argv, args);
#ifdef _MSC_VER #ifdef _MSC_VER
/* NOTE: Make sure to comment this out before pushing a commit */ /* NOTE: Make sure to comment this out before pushing a commit */
//String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565"); String rawArgs = String_FromConst("UnknownShadow200 fffff 127.0.0.1 25565");
String rawArgs = String_FromConst("UnknownShadow200"); //String rawArgs = String_FromConst("UnknownShadow200");
argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4); argsCount = String_UNSAFE_Split(&rawArgs, ' ', args, 4);
#endif #endif

View File

@ -515,7 +515,6 @@ static void Classic_LevelFinalise(cc_uint8* data) {
map_begunLoading = false; map_begunLoading = false;
WoM_CheckSendWomID(); WoM_CheckSendWomID();
if (map.allocFailed) return;
#ifdef EXTENDED_BLOCKS #ifdef EXTENDED_BLOCKS
if (map2.allocFailed) { FreeMapStates(); return; } if (map2.allocFailed) { FreeMapStates(); return; }
#endif #endif
@ -528,7 +527,11 @@ static void Classic_LevelFinalise(cc_uint8* data) {
Chat_AddRaw("&cFailed to load map, try joining a different map"); Chat_AddRaw("&cFailed to load map, try joining a different map");
Chat_AddRaw(" &cBlocks array size does not match volume of map"); Chat_AddRaw(" &cBlocks array size does not match volume of map");
FreeMapStates(); FreeMapStates();
return; }
/* TODO: TEMP HACK */
if (!map.blocks) {
width = 0; height = 0; length = 0;
} }
World_SetNewMap(map.blocks, width, height, length); World_SetNewMap(map.blocks, width, height, length);
@ -1434,7 +1437,7 @@ static void CPE_Tick(void) {
*------------------------------------------------------Custom blocks------------------------------------------------------* *------------------------------------------------------Custom blocks------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static void BlockDefs_OnBlockUpdated(BlockID block, cc_bool didBlockLight) { static void BlockDefs_OnBlockUpdated(BlockID block, cc_bool didBlockLight) {
if (!World.Blocks) return; if (!World.Loaded) return;
/* Need to refresh lighting when a block's light blocking state changes */ /* Need to refresh lighting when a block's light blocking state changes */
if (Blocks.BlocksLight[block] != didBlockLight) Lighting_Refresh(); if (Blocks.BlocksLight[block] != didBlockLight) Lighting_Refresh();
} }