Commit 1f819f5a authored by Gerhard Stein's avatar Gerhard Stein

Special sprite fixes

parent c10fd11b
Subproject commit 0ef9fc5fde676b9e20f7dbb81e3017afca7c41ec
Subproject commit 8ba531009b9ae084df943b8e4bfa9651099c5886
......@@ -117,18 +117,26 @@ void CPlatformHorizontal::draw()
int showX = scrx+Sprite.getXOffset();
int showY = scry+Sprite.getYOffset();
GsSprite &fireSprite = gGraphics.getSprite(mSprVar,m_FireSprite);
// Only in Episode 4
if(drawFire)
{
GsSprite &fireSprite = gGraphics.getSprite(mSprVar,m_FireSprite);
const int w = fireSprite.getWidth();
const int h = fireSprite.getHeight();
const int w = fireSprite.getWidth();
const int h = fireSprite.getHeight();
if(drawFire && xDirection == RIGHT)
fireSprite.drawSprite(showX-2, showY+8, w, h);
if(xDirection == RIGHT)
{
fireSprite.drawSprite(showX-2, showY+8, w, h);
}
Sprite.drawSprite( showX, showY, sprW, sprH, (255-transluceny) );
Sprite.drawSprite( showX, showY, sprW, sprH, (255-transluceny) );
if(drawFire && xDirection == LEFT)
fireSprite.drawSprite(showX+Sprite.getWidth()-6, showY+8, w, h);
if(xDirection == LEFT)
{
fireSprite.drawSprite(showX+Sprite.getWidth()-6, showY+8, w, h);
}
}
for( auto &player : mCarriedPlayerVec)
......
......@@ -28,7 +28,7 @@ public:
private:
bool drawFire;
bool drawFire = false;
int m_FireSprite;
int m_fireTimer;
......
......@@ -112,7 +112,7 @@ GalaxyMenu(GsRect<float>(0.15f, 0.20f, 0.65f, 0.55f) )
mpMenuDialog->addControl( mpRenderScaleQualitySel );
mpVPadSwitch = new Switch( "VirtPad" );
//mpVPadSwitch = new Switch( "VirtPad" );
//mpMenuDialog->addControl( mpVPadSwitch );
mpBorderColorSwitch = new Switch( "Border Color" );
......@@ -141,7 +141,7 @@ void CVideoSettings::refresh()
//mpShowCursorSwitch->enable( mUserVidConf.mShowCursor );
mpVPadSwitch->enable( mUserVidConf.mVPad );
//mpVPadSwitch->enable( mUserVidConf.mVPad );
#if defined(USE_OPENGL)
mpRenderScaleQualitySel->setSelection(mUserVidConf.mRenderScQuality);
......@@ -211,7 +211,7 @@ void CVideoSettings::release()
mUserVidConf.mRenderScQuality = mpRenderScaleQualitySel->getSelection();
#endif
mUserVidConf.mVPad = mpVPadSwitch->isEnabled();
//mUserVidConf.mVPad = mpVPadSwitch->isEnabled();
#if !defined(EMBEDDED)
mUserVidConf.mVSync = mpVSyncSwitch->isEnabled();
......
......@@ -45,7 +45,7 @@ private:
Switch *mpShowCursorSwitch = nullptr;
Switch *mpVPadSwitch;
//Switch *mpVPadSwitch;
ComboSelection *mpRenderScaleQualitySel;
......
......@@ -730,8 +730,7 @@ bool CEGAGraphicsGalaxy::begin()
// Make a clean memory pattern
ChunkStruct ChunkTemplate;
ChunkTemplate.len=0;
m_egagraph.assign(m_egahead.size(), ChunkTemplate);
m_egagraph.assign(m_egahead.size()+1, ChunkTemplate);
unsigned long inlen = 0, outlen = 0;
......@@ -1545,7 +1544,11 @@ bool CEGAGraphicsGalaxy::readTexts()
if(thisChunk.data.at(0))
{
const auto *txtData = (char*)( thisChunk.data.data() );
std::vector<char> chunkData(thisChunk.data.size()+1, 0);
memcpy(chunkData.data(), thisChunk.data.data(), thisChunk.data.size());
const auto *txtData = (char*)( chunkData.data() );
std::string text(txtData);
gGameText.addLine(text);
......@@ -1589,8 +1592,10 @@ bool CEGAGraphicsGalaxy::readMiscStuff()
// Memcpy is here required for correct alignment on devices with different architectures
// and compiles which do not like pointer from 8-bit to 16-bit
Uint16 *dataEndPtr = nullptr;
memcpy( &dataEndPtr, &(dataChunk.data) + dataSize, sizeof(Uint16 *) );
//Uint16 *dataEndPtr = nullptr;
// This might copy beyond the boundaries. We need to fix that.
//memcpy( &dataEndPtr, &(dataChunk.data) + dataSize, sizeof(Uint16 *) );
Uint16 *dataPtr = nullptr;
......@@ -1671,13 +1676,14 @@ bool CEGAGraphicsGalaxy::readMiscStuff()
bool bad = false;
while(pixelNum < expectedNumPixels)
{
/*
if(rlepointer == dataEndPtr)
{
gLogging.ftextOut("bad misc rle data size=%u for pixelNum=%d width=%d height=%d index=%d misc=%d",
dataSize, pixelNum, width, height, index, misc);
bad = true;
break;
}
}*/
Uint16 pixelCount = *rlepointer;
if(pixelCount != 0xFFFF)
......
......@@ -34,9 +34,7 @@ struct EpisodeInfoStruct
struct ChunkStruct
{
ChunkStruct() : len(0) {}
unsigned long len;
unsigned long len = 0;
std::vector<unsigned char> data;
};
......
......@@ -93,7 +93,7 @@ VorticonMenu(GsRect<float>(0.15f, 0.24f, 0.65f, 0.55f) )
mpMenuDialog->addControl( mpFullScreenSwitch );
#endif
mpVPadSwitch = new Switch( "VirtPad" );
//mpVPadSwitch = new Switch( "VirtPad" );
#if defined(USE_OPENGL)
mpOpenGLSwitch = new Switch( "OpenGL" );
......@@ -132,7 +132,7 @@ void CVideoSettings::refresh()
//mpShowCursorSwitch->enable( mUserVidConf.mShowCursor );
mpVPadSwitch->enable(mpVPadSwitch->isEnabled());
//mpVPadSwitch->enable(mpVPadSwitch->isEnabled());
mpRenderScaleQualitySel->setSelection(mUserVidConf.mRenderScQuality);
......@@ -198,7 +198,7 @@ void CVideoSettings::release()
#endif
mUserVidConf.mVPad = mpVPadSwitch->isEnabled();
//mUserVidConf.mVPad = mpVPadSwitch->isEnabled();
mUserVidConf.mRenderScQuality = mpRenderScaleQualitySel->getSelection();
......@@ -217,7 +217,7 @@ void CVideoSettings::release()
#if !defined(EMBEDDED)
mUserVidConf.mVPad = mpVPadSwitch->isEnabled();
//mUserVidConf.mVPad = mpVPadSwitch->isEnabled();
// Disable OpenGL when using Virtual GL
if(mUserVidConf.mVPad)
......
......@@ -45,7 +45,7 @@ private:
Switch *mpShowCursorSwitch = nullptr;
Switch *mpVPadSwitch = nullptr;
//Switch *mpVPadSwitch = nullptr;
ComboSelection *mpRenderScaleQualitySel = nullptr;
......
......@@ -103,7 +103,12 @@ void CSoundSlot::setupWaveForm( Uint8 *buf, Uint32 len )
mSounddata.resize(m_soundlength);
memcpy(mSounddata.data(), buf, m_soundlength);
if(!(mpWaveChunk=Mix_QuickLoad_RAW(mSounddata.data(), mSounddata.size())))
if(mpWaveChunk)
{
Mix_FreeChunk(mpWaveChunk);
}
if(!(mpWaveChunk = Mix_QuickLoad_RAW(mSounddata.data(), mSounddata.size())))
{
gLogging.ftextOut("Mix_QuickLoad_WAV: %s\n", Mix_GetError());
// handle error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment