From 577727d9a5b72fc118eade0174714b9e8a72b7fd Mon Sep 17 00:00:00 2001 From: tankefugl Date: Mon, 4 Jul 2005 21:22:39 +0000 Subject: [PATCH] Mantis 994: o Fixed bug where the voice comm icon would not be displayed while using a mic The new MemoryInputStream class either contains a bug or doesn't match what the vgui::BitmapTGA class expects. I've inserted the old code to get this working till Karl can take a look at it, as it's a bit painstaking to sort it out when I don't even know what method(s) it fails in. I also fixed a bug in the constructor for the new MemoryInputStream where the length parameter would not be applied to the length member. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@232 67975925-1194-0748-b3d5-c16f83f1a3a1 --- main/source/game_shared/vgui_loadtga.cpp | 70 +++++++++++++++++++++++- main/source/ui/MemoryInputStream.cpp | 2 +- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/main/source/game_shared/vgui_loadtga.cpp b/main/source/game_shared/vgui_loadtga.cpp index d9d2406..cea0050 100644 --- a/main/source/game_shared/vgui_loadtga.cpp +++ b/main/source/game_shared/vgui_loadtga.cpp @@ -12,13 +12,79 @@ #include "vgui_inputstream.h" -#include "ui/MemoryInputStream.h" +//#include "ui/MemoryInputStream.h" + +// tankefugl: HACK +// Implemented old MemoryInputStream to work around bugs(?) in the other implementation or in +// the vgui's handling of the other one +class MemoryInputStream2 : public vgui::InputStream +{ +public: + MemoryInputStream2() + { + m_pData = NULL; + m_DataLen = m_ReadPos = 0; + } + + virtual void seekStart(bool& success) {m_ReadPos=0; success=true;} + virtual void seekRelative(int count,bool& success) {m_ReadPos+=count; success=true;} + virtual void seekEnd(bool& success) {m_ReadPos=m_DataLen; success=true;} + virtual int getAvailable(bool& success) {success=false; return 0;} // This is what vgui does for files... + + virtual uchar readUChar(bool& success) + { + if(m_ReadPos>=0 && m_ReadPos MemoryInputStream::MemoryInputStream(void) : m_pData(NULL), m_DataLen(0), m_ReadPos(0) {} -MemoryInputStream::MemoryInputStream(uchar* pData, int nLength) : m_pData(pData), m_DataLen(0), m_ReadPos(0) {} +MemoryInputStream::MemoryInputStream(uchar* pData, int nLength) : m_pData(pData), m_DataLen(nLength), m_ReadPos(0) {} MemoryInputStream::~MemoryInputStream(void) {}