Add text anti-aliasing, disable arcade mode

This commit is contained in:
elasota
2020-01-18 18:20:16 -05:00
parent d8331eaeb7
commit c79ddd0d35
40 changed files with 615 additions and 159 deletions

View File

@@ -122,7 +122,7 @@ void DrawBannerMessage (Point topLeft)
do
{
GetLineOfText(bannerStr, count, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, true);
count++;
}
while (subStr[0] > 0);
@@ -144,10 +144,10 @@ void DrawBannerMessage (Point topLeft)
PasStringConcat(bannerStr, subStr);
workSrcMap->SetForeColor(StdColors::Red());
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, true);
GetLocalizedString(5, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, true);
}
workSrcMap->SetForeColor(StdColors::Black());

View File

@@ -25,7 +25,7 @@ void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
surface->SetForeColor(rgbaColor);
surface->DrawString(point, theStr);
surface->DrawString(point, theStr, true);
surface->SetForeColor(wasColor);
}

View File

@@ -86,7 +86,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(5, 12), tempStr);
surface->DrawString(Point::Create(5, 12), tempStr, true);
PasStringCopy(PSTR("v: "), tempStr);
if (coordV != -1)
@@ -97,7 +97,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(4, 22), tempStr);
surface->DrawString(Point::Create(4, 22), tempStr, true);
surface->SetForeColor(StdColors::Blue());
PasStringCopy(PSTR("d: "), tempStr);
@@ -109,7 +109,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(5, 32), tempStr);
surface->DrawString(Point::Create(5, 32), tempStr, true);
surface->SetForeColor(StdColors::Black());
#endif
}

View File

@@ -640,7 +640,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
const int32_t ascender = surface->MeasureFontAscender();
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
surface->DrawString(centeredDrawPoint, stringCopy);
surface->DrawString(centeredDrawPoint, stringCopy, true);
if (invert)
{
@@ -670,7 +670,7 @@ void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
surface->SetForeColor(StdColors::Black());
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy);
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, true);
}
//-------------------------------------------------------------- LoadDialogPICT

View File

@@ -110,11 +110,11 @@ void SetUpFinalScreen (void)
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
surface->DrawString(textShadowPos, subStr);
surface->DrawString(textShadowPos, subStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
const Point textPos = Point::Create(offset, textDown + 32 + (count * 20));
surface->DrawString(textPos, subStr);
surface->DrawString(textPos, subStr, true);
count++;
}
while (subStr[0] > 0);

View File

@@ -13,7 +13,7 @@
//#define CAREFULDEBUG
#define COMPILENOCP
#define COMPILEQT
#define BUILD_ARCADE_VERSION 1
#define BUILD_ARCADE_VERSION 0
#define kYellowUnaccounted 1
#define kYellowFailedResOpen 2

View File

@@ -143,11 +143,11 @@ void DrawHighScores (DrawSurface *surface)
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2) - 1, dropIt - 66);
surface->SetForeColor(blackColor);
surface->DrawString(scoreShadowPoint, tempStr);
surface->DrawString(scoreShadowPoint, tempStr, true);
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2), dropIt - 65);
surface->SetForeColor(cyanColor);
surface->DrawString(scoreTextPoint, tempStr);
surface->DrawString(scoreTextPoint, tempStr, true);
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
@@ -157,11 +157,11 @@ void DrawHighScores (DrawSurface *surface)
bannerWidth = surface->MeasureString(tempStr);
surface->SetForeColor(blackColor);
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
surface->DrawString(topScoreShadowPoint, tempStr);
surface->DrawString(topScoreShadowPoint, tempStr, true);
surface->SetForeColor(yellowColor);
const Point topScoreTextPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
surface->DrawString(topScoreTextPoint, tempStr);
surface->DrawString(topScoreTextPoint, tempStr, true);
QSetRect(&tempRect, 0, 0, bannerWidth + 8, kScoreSpacing);
QOffsetRect(&tempRect, scoreLeft - 3 + (kScoreWide - bannerWidth) / 2,
@@ -186,7 +186,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 1, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
@@ -195,7 +195,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
// draw high score name
PasStringCopy(thisHousePtr->highScores.names[i], tempStr);
surface->SetForeColor(blackColor);
@@ -203,7 +203,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 31, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
@@ -212,7 +212,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
// draw level number
NumToString(thisHousePtr->highScores.levels[i], tempStr);
surface->SetForeColor(blackColor);
@@ -220,7 +220,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 161, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
@@ -229,7 +229,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
// draw word "rooms"
if (thisHousePtr->highScores.levels[i] == 1)
GetLocalizedString(6, tempStr);
@@ -240,13 +240,13 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 193, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
surface->SetForeColor(cyanColor);
if (i == 0)
strPos = Point::Create(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
// draw high score points
NumToString(thisHousePtr->highScores.scores[i], tempStr);
surface->SetForeColor(blackColor);
@@ -254,7 +254,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 291, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
if (i == lastHighScore)
surface->SetForeColor(whiteColor);
else
@@ -263,7 +263,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr);
surface->DrawString(strPos, tempStr, true);
}
}
@@ -273,7 +273,7 @@ void DrawHighScores (DrawSurface *surface)
const Point textPos = Point::Create(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
GetLocalizedString(8, tempStr);
surface->DrawString(textPos, tempStr);
surface->DrawString(textPos, tempStr, true);
surface->SetForeColor(blackColor);
}

View File

@@ -220,7 +220,7 @@ void DoHeliumEngaged (gliderPtr thisGlider)
#else
if (theKeys->IsSet(kCommandKeyMap))
if (theKeys->IsSet(PL_KEY_EITHER_SPECIAL(kControl)))
DoCommandKey();
#endif

View File

@@ -74,7 +74,7 @@ void DrawOnSplash(DrawSurface *surface)
if (thisMac.isDepth == 4)
{
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, houseLoadedStr);
surface->DrawString(textPoint, houseLoadedStr, true);
}
else
{

View File

@@ -29,6 +29,8 @@ PLError_t DumpMusicSounds (void);
PLError_t OpenMusicChannel (void);
PLError_t CloseMusicChannel (void);
THandle<void> ParseAndConvertSound(const THandle<void> &handle);
PortabilityLayer::AudioChannel *musicChannel;
Ptr theMusicData[kMaxMusic];
@@ -210,17 +212,17 @@ PLError_t LoadMusicSounds (void)
for (i = 0; i < kMaxMusic; i++)
{
theSound = GetResource('snd ', i + kBaseBufferMusicID);
theSound = ParseAndConvertSound(GetResource('snd ', i + kBaseBufferMusicID));
if (theSound == nil)
return PLErrors::kOutOfMemory;
soundDataSize = GetHandleSize(theSound) - 20L;
soundDataSize = GetHandleSize(theSound);
theMusicData[i] = PortabilityLayer::MemoryManager::GetInstance()->Alloc(soundDataSize);
if (theMusicData[i] == nil)
return PLErrors::kOutOfMemory;
BlockMove((Ptr)(static_cast<Byte*>(*theSound) + 20L), theMusicData[i], soundDataSize);
BlockMove(static_cast<Byte*>(*theSound), theMusicData[i], soundDataSize);
theSound.Dispose();
}
return (theErr);

View File

@@ -250,9 +250,9 @@ void ReadyBackground (short theID, short *theTiles)
const Point textPoint = Point::Create(10, 20);
if (houseUnlocked)
workSrcMap->DrawString(textPoint, PSTR("No rooms"));
workSrcMap->DrawString(textPoint, PSTR("No rooms"), true);
else
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"));
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), true);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
(BitMap *)*GetGWorldPixMap(backSrcMap),

View File

@@ -167,15 +167,15 @@ void RefreshRoomTitle (short mode)
switch (mode)
{
case kEscapedTitleMode:
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"));
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), true);
break;
case kSavingTitleMode:
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"));
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), true);
break;
default:
surface->DrawString(strShadowPoint, thisRoom->name);
surface->DrawString(strShadowPoint, thisRoom->name, true);
break;
}
@@ -184,15 +184,15 @@ void RefreshRoomTitle (short mode)
switch (mode)
{
case kEscapedTitleMode:
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"));
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), true);
break;
case kSavingTitleMode:
surface->DrawString(strPoint, PSTR("Saving Game<6D>"));
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), true);
break;
default:
surface->DrawString(strPoint, thisRoom->name);
surface->DrawString(strPoint, thisRoom->name, true);
break;
}
@@ -225,10 +225,10 @@ void RefreshNumGliders (void)
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, nGlidersStr);
surface->DrawString(shadowPoint, nGlidersStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, nGlidersStr);
surface->DrawString(textPoint, nGlidersStr, true);
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
(BitMap *)*GetGWorldPixMap(boardSrcMap),
@@ -254,10 +254,10 @@ void RefreshPoints (void)
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, scoreStr);
surface->DrawString(shadowPoint, scoreStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, scoreStr);
surface->DrawString(textPoint, scoreStr, true);
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
(BitMap *)*GetGWorldPixMap(boardSrcMap),
@@ -285,10 +285,10 @@ void QuickGlidersRefresh (void)
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, nGlidersStr);
surface->DrawString(shadowPoint, nGlidersStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, nGlidersStr);
surface->DrawString(textPoint, nGlidersStr, true);
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
@@ -315,10 +315,10 @@ void QuickScoreRefresh (void)
const Point textPoint = Point::Create(0, 9);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
surface->DrawString(shadowPoint, scoreStr);
surface->DrawString(shadowPoint, scoreStr, true);
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
surface->DrawString(textPoint, scoreStr);
surface->DrawString(textPoint, scoreStr, true);
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),

View File

@@ -12,6 +12,7 @@
#include "MemoryManager.h"
#include "SoundSync.h"
#include "VirtualDirectory.h"
#include "WaveFormat.h"
#define kBaseBufferSoundID 1000
@@ -25,7 +26,7 @@ PLError_t LoadBufferSounds (void);
void DumpBufferSounds (void);
PLError_t OpenSoundChannels (void);
void CloseSoundChannels (void);
THandle<void> ParseAndConvertSound(const THandle<void> &handle);
PortabilityLayer::AudioChannel *channel0, *channel1, *channel2;
Ptr theSoundData[kMaxSounds];
@@ -167,6 +168,9 @@ void PlayExclusiveSoundChannel(short channelIndex, short soundID, short oldPrior
}
}
//-------------------------------------------------------------- ParseAndConvertSound
//-------------------------------------------------------------- LoadTriggerSound
PLError_t LoadTriggerSound (short soundID)
@@ -183,14 +187,14 @@ PLError_t LoadTriggerSound (short soundID)
theErr = PLErrors::kNone;
theSound = GetResource('snd ', soundID);
theSound = ParseAndConvertSound(GetResource('snd ', soundID));
if (theSound == nil)
{
theErr = PLErrors::kFileNotFound;
}
else
{
soundDataSize = GetHandleSize(theSound) - 20L;
soundDataSize = GetHandleSize(theSound);
theSoundData[kMaxSounds - 1] = PortabilityLayer::MemoryManager::GetInstance()->Alloc(soundDataSize);
if (theSoundData[kMaxSounds - 1] == nil)
{
@@ -199,7 +203,7 @@ PLError_t LoadTriggerSound (short soundID)
}
else
{
BlockMove((Ptr)((Byte*)(*theSound) + 20L), theSoundData[kMaxSounds - 1], soundDataSize);
BlockMove((Byte*)(*theSound), theSoundData[kMaxSounds - 1], soundDataSize);
theSound.Dispose();
}
}
@@ -230,17 +234,17 @@ PLError_t LoadBufferSounds (void)
for (i = 0; i < kMaxSounds - 1; i++)
{
theSound = GetResource('snd ', i + kBaseBufferSoundID);
theSound = ParseAndConvertSound(GetResource('snd ', i + kBaseBufferSoundID));
if (theSound == nil)
return (PLErrors::kOutOfMemory);
soundDataSize = GetHandleSize(theSound) - 20L;
soundDataSize = GetHandleSize(theSound);
theSoundData[i] = PortabilityLayer::MemoryManager::GetInstance()->Alloc(soundDataSize);
if (theSoundData[i] == nil)
return (PLErrors::kOutOfMemory);
BlockMove((Ptr)((Byte*)(*theSound) + 20L), theSoundData[i], soundDataSize);
BlockMove(*theSound, theSoundData[i], soundDataSize);
theSound.Dispose();
}
@@ -408,3 +412,143 @@ void BitchAboutSM3 (void)
hitWhat = Alert(kNoSoundManager3Alert, nil);
}
//-------------------------------------------------------------- ParseAndConvertSound
THandle<void> ParseAndConvertSoundChecked(const THandle<void> &handle)
{
const uint8_t *dataStart = static_cast<const uint8_t*>(*handle);
const size_t size = handle.MMBlock()->m_size;
if (size < sizeof(PortabilityLayer::RIFFTag))
return THandle<void>();
PortabilityLayer::RIFFTag mainRiffTag;
memcpy(&mainRiffTag, dataStart, sizeof(PortabilityLayer::RIFFTag));
if (mainRiffTag.m_tag != PortabilityLayer::WaveConstants::kRiffChunkID)
return THandle<void>();
const uint32_t riffSize = mainRiffTag.m_chunkSize;
if (riffSize < 4 || riffSize - 4 > size - sizeof(PortabilityLayer::RIFFTag))
return THandle<void>();
const uint8_t *riffStart = dataStart + sizeof(PortabilityLayer::RIFFTag);
const uint8_t *riffEnd = riffStart + riffSize;
const uint8_t *formatTagLoc = nullptr;
const uint8_t *dataTagLoc = nullptr;
LEUInt32_t waveMarker;
memcpy(&waveMarker, riffStart, 4);
if (waveMarker != PortabilityLayer::WaveConstants::kWaveChunkID)
return THandle<void>();
const uint8_t *tagSearchLoc = riffStart + 4;
// Find tags
while (tagSearchLoc != riffEnd)
{
if (riffEnd - tagSearchLoc < sizeof(PortabilityLayer::RIFFTag))
return THandle<void>();
PortabilityLayer::RIFFTag riffTag;
memcpy(&riffTag, tagSearchLoc, sizeof(PortabilityLayer::RIFFTag));
if (riffTag.m_tag == PortabilityLayer::WaveConstants::kFormatChunkID)
formatTagLoc = tagSearchLoc;
else if (riffTag.m_tag == PortabilityLayer::WaveConstants::kDataChunkID)
dataTagLoc = tagSearchLoc;
const uint32_t riffTagSizeUnpadded = riffTag.m_chunkSize;
if (riffTagSizeUnpadded == 0xffffffffU)
return THandle<void>();
const uint32_t riffTagSizePadded = riffTagSizeUnpadded + (riffTagSizeUnpadded & 1);
tagSearchLoc += sizeof(PortabilityLayer::RIFFTag);
if (riffEnd - tagSearchLoc < riffTagSizePadded)
return THandle<void>();
tagSearchLoc += riffTagSizePadded;
}
if (formatTagLoc == nullptr || dataTagLoc == nullptr)
return THandle<void>();
PortabilityLayer::RIFFTag fmtTag;
memcpy(&fmtTag, formatTagLoc, sizeof(PortabilityLayer::RIFFTag));
const uint8_t *formatContents = formatTagLoc + sizeof(PortabilityLayer::RIFFTag);
PortabilityLayer::RIFFTag dataTag;
memcpy(&dataTag, dataTagLoc, sizeof(PortabilityLayer::RIFFTag));
const uint8_t *dataContents = dataTagLoc + sizeof(PortabilityLayer::RIFFTag);
PortabilityLayer::WaveFormatChunkV3 formatChunkV3;
memset(&formatChunkV3, 0, sizeof(formatChunkV3));
int formatChunkVersion = 0;
size_t copyableSize = 0;
if (fmtTag.m_chunkSize >= sizeof(PortabilityLayer::WaveFormatChunkV3))
{
formatChunkVersion = 3;
copyableSize = sizeof(PortabilityLayer::WaveFormatChunkV3);
}
else if (fmtTag.m_chunkSize >= sizeof(PortabilityLayer::WaveFormatChunkV2))
{
formatChunkVersion = 2;
copyableSize = sizeof(PortabilityLayer::WaveFormatChunkV2);
}
else if (fmtTag.m_chunkSize >= sizeof(PortabilityLayer::WaveFormatChunkV1))
{
formatChunkVersion = 1;
copyableSize = sizeof(PortabilityLayer::WaveFormatChunkV1);
}
else
return THandle<void>();
memcpy(&formatChunkV3, formatContents, copyableSize);
const PortabilityLayer::WaveFormatChunkV2 formatChunkV2 = formatChunkV3.m_v2;
const PortabilityLayer::WaveFormatChunkV1 formatChunkV1 = formatChunkV2.m_v1;
if (formatChunkV1.m_bitsPerSample != 8)
return THandle<void>();
if (formatChunkV1.m_formatCode != PortabilityLayer::WaveConstants::kFormatPCM ||
formatChunkV1.m_numChannels != 1 ||
formatChunkV1.m_blockAlignmentBytes != 1 ||
formatChunkV1.m_bitsPerSample != 8)
return THandle<void>();
THandle<void> convertedHandle = THandle<void>(PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(4 + dataTag.m_chunkSize));
if (!convertedHandle)
return THandle<void>();
uint8_t *handleData = static_cast<uint8_t*>(*convertedHandle);
uint32_t dataSize = dataTag.m_chunkSize;
memcpy(handleData, &dataSize, 4);
memcpy(handleData + 4, dataContents, dataSize);
return convertedHandle;
}
THandle<void> ParseAndConvertSound(const THandle<void> &handle)
{
if (!handle)
return THandle<void>();
THandle<void> converted = ParseAndConvertSoundChecked(handle);
handle.Dispose();
return converted;
}

View File

@@ -145,7 +145,7 @@ void SetMessageWindowMessage (StringPtr message)
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
surface->SetForeColor(StdColors::Black());
surface->DrawString(textPoint, message);
surface->DrawString(textPoint, message, true);
}
}