removed speaker.png, the game now uses the built-in voiceSpeaking and voiceNotSpeaking images
This commit is contained in:
1 parent
9073983db5
commit
b60c156add
8 files changed
+95
-21
No files matched your search
@@ -2,4 +2,6 @@ splashes.txt
|
||||
HTMLColours.col
|
||||
Graphics\SaveChest.png
|
||||
Graphics\MinecraftIcon.png
|
||||
Graphics\TexturePackIcon.png
|
||||
Graphics\TexturePackIcon.png
|
||||
Graphics\InGameInfo\voiceSpeaking.png
|
||||
Graphics\InGameInfo\voiceNotSpeaking.png
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 334 B |
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c357a4e7ca1ae6e96805b2e1ce3dd46499f3f6ee92db5ab349c543728623e523
|
||||
size 334
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "LocalPlayer.h"
|
||||
#include "MultiPlayerLocalPlayer.h"
|
||||
#include "entityRenderDispatcher.h"
|
||||
#include "BufferedImage.h"
|
||||
#include "..\Minecraft.World\File.h"
|
||||
#include "..\Minecraft.World\InputOutputStream.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.item.h"
|
||||
@@ -54,6 +57,74 @@ static unsigned int nametagColorForIndex(int index)
|
||||
return 0xFF000000; //Fallback if exceeds 256 somehow
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
static const float VOICE_ICON_HALF_HEIGHT = 8.0f;
|
||||
static const float VOICE_ICON_HALF_WIDTH = VOICE_ICON_HALF_HEIGHT * (60.0f / 40.0f);
|
||||
|
||||
BufferedImage *LoadVoiceIndicatorImage(bool speaking)
|
||||
{
|
||||
const wchar_t *filePath = speaking
|
||||
? L"Common\\Media\\Graphics\\InGameInfo\\voiceSpeaking.png"
|
||||
: L"Common\\Media\\Graphics\\InGameInfo\\voiceNotSpeaking.png";
|
||||
File file(filePath);
|
||||
if (file.exists())
|
||||
{
|
||||
byteArray imageBytes(static_cast<unsigned int>(file.length()));
|
||||
FileInputStream stream(file);
|
||||
const int bytesRead = stream.read(imageBytes);
|
||||
stream.close();
|
||||
if (bytesRead > 0)
|
||||
{
|
||||
imageBytes.length = static_cast<unsigned int>(bytesRead);
|
||||
BufferedImage *image = new BufferedImage(imageBytes.data, imageBytes.length);
|
||||
delete[] imageBytes.data;
|
||||
return image;
|
||||
}
|
||||
delete[] imageBytes.data;
|
||||
}
|
||||
|
||||
const wchar_t *archivePath = speaking
|
||||
? L"Graphics\\InGameInfo\\voiceSpeaking.png"
|
||||
: L"Graphics\\InGameInfo\\voiceNotSpeaking.png";
|
||||
if (!app.hasArchiveFile(archivePath))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
byteArray imageBytes = app.getArchiveFile(archivePath);
|
||||
if (imageBytes.data == nullptr || imageBytes.length == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BufferedImage *image = new BufferedImage(imageBytes.data, imageBytes.length);
|
||||
delete[] imageBytes.data;
|
||||
return image;
|
||||
}
|
||||
|
||||
int GetVoiceIndicatorTextureId(Textures *textures, bool speaking)
|
||||
{
|
||||
static int s_voiceSpeakingTextureId = -1;
|
||||
static int s_voiceNotSpeakingTextureId = -1;
|
||||
|
||||
int &textureId = speaking ? s_voiceSpeakingTextureId : s_voiceNotSpeakingTextureId;
|
||||
if (textureId >= 0)
|
||||
{
|
||||
return textureId;
|
||||
}
|
||||
|
||||
BufferedImage *image = LoadVoiceIndicatorImage(speaking);
|
||||
if (image == nullptr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
textureId = textures->getTexture(image, C4JRender::TEXTURE_FORMAT_RxGyBzAw, false);
|
||||
return textureId;
|
||||
}
|
||||
}
|
||||
|
||||
ResourceLocation PlayerRenderer::DEFAULT_LOCATION = ResourceLocation(TN_MOB_CHAR);
|
||||
|
||||
PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0.5f )
|
||||
@@ -473,9 +544,10 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
|
||||
|
||||
void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, const wstring &msg, float scale, double dist)
|
||||
{
|
||||
// Voice chat speaking indicator
|
||||
if (player != nullptr && VoiceChatManager::getInstance().isEntitySpeaking(player->entityId))
|
||||
// Voice chat indicator
|
||||
if (player != nullptr)
|
||||
{
|
||||
const bool isSpeaking = VoiceChatManager::getInstance().isEntitySpeaking(player->entityId);
|
||||
glPushMatrix();
|
||||
// Position above the head (slightly higher than the name tag)
|
||||
glTranslatef(static_cast<float>(x), static_cast<float>(y) + player->bbHeight + 0.75f, static_cast<float>(z));
|
||||
@@ -493,16 +565,22 @@ void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, d
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
ResourceLocation speakerLoc(TN_GUI_SPEAKER);
|
||||
bindTexture(&speakerLoc);
|
||||
const int voiceIndicatorTextureId = GetVoiceIndicatorTextureId(entityRenderDispatcher->textures, isSpeaking);
|
||||
if (voiceIndicatorTextureId < 0)
|
||||
{
|
||||
glPopMatrix();
|
||||
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist);
|
||||
return;
|
||||
}
|
||||
|
||||
entityRenderDispatcher->textures->bind(voiceIndicatorTextureId);
|
||||
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
t->begin();
|
||||
// 16x16 icon coordinates
|
||||
t->vertexUV(-8, -8, 0, 0, 0);
|
||||
t->vertexUV(-8, 8, 0, 0, 1);
|
||||
t->vertexUV( 8, 8, 0, 1, 1);
|
||||
t->vertexUV( 8, -8, 0, 1, 0);
|
||||
t->vertexUV(-VOICE_ICON_HALF_WIDTH, -VOICE_ICON_HALF_HEIGHT, 0, 0, 0);
|
||||
t->vertexUV(-VOICE_ICON_HALF_WIDTH, VOICE_ICON_HALF_HEIGHT, 0, 0, 1);
|
||||
t->vertexUV( VOICE_ICON_HALF_WIDTH, VOICE_ICON_HALF_HEIGHT, 0, 1, 1);
|
||||
t->vertexUV( VOICE_ICON_HALF_WIDTH, -VOICE_ICON_HALF_HEIGHT, 0, 1, 0);
|
||||
t->end();
|
||||
|
||||
glPopMatrix();
|
||||
@@ -617,4 +695,4 @@ ResourceLocation *PlayerRenderer::getTextureLocation(shared_ptr<Entity> entity)
|
||||
{
|
||||
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
|
||||
return new ResourceLocation(static_cast<_TEXTURE_NAME>(player->getTexture()));
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ private:
|
||||
public:
|
||||
ResourceLocation()
|
||||
{
|
||||
m_texture = textureNameArray();
|
||||
m_preloaded = false;
|
||||
m_path = L"";
|
||||
}
|
||||
@@ -25,6 +26,7 @@ public:
|
||||
|
||||
ResourceLocation(wstring path)
|
||||
{
|
||||
m_texture = textureNameArray();
|
||||
m_path = path;
|
||||
m_preloaded = false;
|
||||
}
|
||||
@@ -41,7 +43,7 @@ public:
|
||||
|
||||
~ResourceLocation()
|
||||
{
|
||||
delete m_texture.data;
|
||||
delete[] m_texture.data;
|
||||
}
|
||||
|
||||
_TEXTURE_NAME getTexture()
|
||||
@@ -68,4 +70,4 @@ public:
|
||||
{
|
||||
return m_preloaded;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -246,7 +246,6 @@ const wchar_t *Textures::preLoaded[TN_COUNT] =
|
||||
L"/AH_0008",
|
||||
L"/AH_0009",*/
|
||||
|
||||
L"gui/speaker",
|
||||
L"gui/items",
|
||||
L"terrain",
|
||||
};
|
||||
|
||||
@@ -228,7 +228,6 @@ typedef enum _TEXTURE_NAME
|
||||
TN_AH_0008,
|
||||
TN_AH_0009,*/
|
||||
|
||||
TN_GUI_SPEAKER,
|
||||
TN_GUI_ITEMS,
|
||||
TN_TERRAIN,
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c357a4e7ca1ae6e96805b2e1ce3dd46499f3f6ee92db5ab349c543728623e523
|
||||
size 334
|
||||
Reference in new issue
Block a user