Merge devel into master (#78)

* * Turn survival back on for now.

* * Add TP command.

* * Fix fall damage reset.

* * Mob hitting works.

I've disabled entity shading though. Will get back to it at some point, promise!

* * Knockback

* * Mobs now rotate when they die.

* * Fire fix
This commit is contained in:
iProgramInCpp
2023-09-17 12:47:09 +03:00
committed by GitHub
parent e9b00e6ba1
commit 350100ac48
15 changed files with 225 additions and 8 deletions

View File

@@ -60,11 +60,13 @@ void Cube::addBox(float x, float y, float z, int d, int e, int f, float g)
m_faces[4] = PolygonQuad(&m_verts[1], &m_verts[0], &m_verts[3], &m_verts[2], m + f, n + f, m + f + d, n + f + e); // z1 face
m_faces[5] = PolygonQuad(&m_verts[4], &m_verts[5], &m_verts[6], &m_verts[7], m + f + d + f, n + f, m + f + d + f + d, n + f + e); // z2 face
#ifdef ENH_ENTITY_SHADING
m_faces[0].setColor(0.6f, 0.6f, 0.6f);
m_faces[1].setColor(0.6f, 0.6f, 0.6f);
m_faces[4].setColor(0.8f, 0.8f, 0.8f);
m_faces[5].setColor(0.8f, 0.8f, 0.8f);
m_faces[3].setColor(0.5f, 0.5f, 0.5f);
#endif
if (field_18)
{
@@ -92,7 +94,11 @@ void Cube::compile(float scale)
void Cube::draw()
{
#ifdef ENH_ENTITY_SHADING
drawArrayVTC(m_buffer, 36, sizeof(Tesselator::Vertex));
#else
drawArrayVT(m_buffer, 36, sizeof(Tesselator::Vertex));
#endif
}
void Cube::drawSlow(float scale)
@@ -172,12 +178,14 @@ void Cube::setBrightness(float b)
m_brightness = b;
#ifdef ENH_ENTITY_SHADING
m_faces[0].setColor(0.6f * b, 0.6f * b, 0.6f * b);
m_faces[1].setColor(0.6f * b, 0.6f * b, 0.6f * b);
m_faces[2].setColor(1.0f * b, 1.0f * b, 1.0f * b);
m_faces[3].setColor(0.5f * b, 0.5f * b, 0.5f * b);
m_faces[4].setColor(0.8f * b, 0.8f * b, 0.8f * b);
m_faces[5].setColor(0.8f * b, 0.8f * b, 0.8f * b);
#endif
}
void Cube::setPos(float x, float y, float z)

View File

@@ -647,6 +647,7 @@ void GameRenderer::render(float f)
sprintf(posStr, "%.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
debugText << "\npos: " << posStr;
debugText << "\nentities: " << m_pMinecraft->m_pLevel->m_entities.size();
debugText << "\n" << m_pMinecraft->m_pLevelRenderer->gatherStats1();
}

View File

@@ -64,6 +64,16 @@ void MobRenderer::setupPosition(Entity* entity, float x, float y, float z)
void MobRenderer::setupRotations(Entity* entity, float x, float y, float z)
{
glRotatef(180.0f - y, 0.0f, 1.0f, 0.0f);
Mob* mob = (Mob*)entity;
if (mob->field_110 > 0)
{
float t = Mth::sqrt((float(mob->field_110) + z - 1.0f) / 20.0f * 1.6f);
if (t > 1.0f)
t = 1.0f;
glRotatef(getFlipDegrees(mob) * t, 0.0f, 0.0f, 1.0f);
}
}
void MobRenderer::render(Entity* entity, float x, float y, float z, float unused, float f)
@@ -116,7 +126,7 @@ void MobRenderer::render(Entity* entity, float x, float y, float z, float unused
if (pMob->field_104 > 0 || pMob->field_110 > 0)
{
glColor4f(fBright, 0.0f, 0.0f, 0.4f);
m_pModel->render(x2, x1, fBob, aYaw - fSmth, aPitch, 0.0625f);
m_pModel->render(x2, x1, fBob, aYaw - fSmth, aPitch, 0.059375f); // was 0.0625f. Why?
}
if (GET_ALPHA(iOverlayColor))
{
@@ -126,7 +136,7 @@ void MobRenderer::render(Entity* entity, float x, float y, float z, float unused
float(GET_BLUE(iOverlayColor)) / 255.0f,
float(GET_ALPHA(iOverlayColor)) / 255.0f);
m_pModel->render(x2, x1, fBob, aYaw - fSmth, aPitch, 0.0625f);
m_pModel->render(x2, x1, fBob, aYaw - fSmth, aPitch, 0.059375f); // same here
}
glDepthFunc(GL_LEQUAL);