Character encoding fixups

This commit is contained in:
elasota
2020-10-14 18:18:57 -04:00
parent 7858aff6cd
commit b682004f29
5 changed files with 118 additions and 116 deletions

View File

@@ -144,9 +144,9 @@ void DrawHighScores (DrawSurface *surface)
PortabilityLayer::RenderedFont *appFont14 = GetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold, true);
PasStringCopy(PSTR("<EFBFBD> "), tempStr);
PasStringCopy(PSTR("\xa5 "), tempStr);
PasStringConcat(tempStr, thisHouseName);
PasStringConcat(tempStr, PSTR(" <EFBFBD>"));
PasStringConcat(tempStr, PSTR(" \xa5"));
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2) - 1, dropIt - 66);
surface->DrawString(scoreShadowPoint, tempStr, blackColor, appFont14);

View File

@@ -785,7 +785,7 @@ void ShiftWholeHouse (short howFar)
short i, h, numRooms;
char wasState;
OpenMessageWindow(PSTR("Shifting Whole House<EFBFBD>"));
OpenMessageWindow(PSTR("Shifting Whole House\xc9"));
SpinCursor(3);
CopyThisRoomToRoom();

View File

@@ -175,7 +175,7 @@ void RefreshRoomTitle (short mode)
break;
case kSavingTitleMode:
surface->DrawString(strShadowPoint, PSTR("Saving Game<EFBFBD>"), blackColor, appFont);
surface->DrawString(strShadowPoint, PSTR("Saving Game\xc9"), blackColor, appFont);
break;
default:
@@ -190,7 +190,7 @@ void RefreshRoomTitle (short mode)
break;
case kSavingTitleMode:
surface->DrawString(strPoint, PSTR("Saving Game<EFBFBD>"), whiteColor, appFont);
surface->DrawString(strPoint, PSTR("Saving Game\xc9"), whiteColor, appFont);
break;
default:

View File

@@ -14,12 +14,12 @@
//============================================================== Functions
//-------------------------------------------------------------- PasStringCopy
// Given a source string and storage for a second, this function<EFBFBD>
// Given a source string and storage for a second, this function?
// copies from one to the other. It assumes Pascal style strings.
void PasStringCopy (StringPtr p1, StringPtr p2)
{
register short stringLength;
short stringLength;
stringLength = *p2++ = *p1++;
while (--stringLength >= 0)
@@ -28,9 +28,9 @@ void PasStringCopy (StringPtr p1, StringPtr p2)
//-------------------------------------------------------------- WhichStringFirst
// This is a sorting function that handles two Pascal strings. It<EFBFBD>
// will return a 1 to indicate the 1st string is "greater", a 1 to<EFBFBD>
// indicate the 2nd was greater and a 0 to indicate that the strings<EFBFBD>
// This is a sorting function that handles two Pascal strings. It?
// will return a 1 to indicate the 1st string is "greater", a 1 to?
// indicate the 2nd was greater and a 0 to indicate that the strings?
// are equal.
short WhichStringFirst (StringPtr p1, StringPtr p2)
@@ -85,7 +85,7 @@ short WhichStringFirst (StringPtr p1, StringPtr p2)
//-------------------------------------------------------------- PasStringCopyNum
// This function copies a specified number of characters from one<EFBFBD>
// This function copies a specified number of characters from one?
// Pascal string to another.
void PasStringCopyNum (StringPtr p1, StringPtr p2, short charsToCopy)
@@ -97,15 +97,15 @@ void PasStringCopyNum (StringPtr p1, StringPtr p2, short charsToCopy)
*p2 = static_cast<unsigned char>(charsToCopy);
*p2++;
*p1++;
p2++;
p1++;
for (i = 0; i < charsToCopy; i++)
*p2++ = *p1++;
}
//-------------------------------------------------------------- PasStringConcat
// This function concatenates the second Pascal string to the end of<EFBFBD>
// This function concatenates the second Pascal string to the end of?
// the first Pascal string.
void PasStringConcat (StringPtr p1, const PLPasStr &p2)
@@ -129,9 +129,9 @@ void PasStringConcat (StringPtr p1, const PLPasStr &p2)
//-------------------------------------------------------------- GetLineOfText
// This function walks through a source string and looks for an<EFBFBD>
// entire line of text. A "line" of text is assumed to be bounded<EFBFBD>
// by carriage returns. The index variable indicates which line<EFBFBD>
// This function walks through a source string and looks for an?
// entire line of text. A "line" of text is assumed to be bounded?
// by carriage returns. The index variable indicates which line?
// is sought.
void GetLineOfText (StringPtr srcStr, short index, StringPtr textLine)
@@ -206,8 +206,8 @@ void GetLineOfText (StringPtr srcStr, short index, StringPtr textLine)
//-------------------------------------------------------------- WrapText
// Given a string and the maximum number of characters to put on<EFBFBD>
// one line, this function goes through and inserts carriage returns<EFBFBD>
// Given a string and the maximum number of characters to put on?
// one line, this function goes through and inserts carriage returns?
// in order to ensure that no line of text exceeds maxChars.
void WrapText (StringPtr theText, short maxChars)
@@ -271,24 +271,24 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
//-------------------------------------------------------------- CollapseStringToWidth
// Given a string and a maximum width (in pixels), this function<EFBFBD>
// calculates how wide the text would be drawn with the current<EFBFBD>
// font. If the text would exceed our width limit, characters<EFBFBD>
// are dropped off the end of the string and "<EFBFBD>" appended.
// Given a string and a maximum width (in pixels), this function?
// calculates how wide the text would be drawn with the current?
// font. If the text would exceed our width limit, characters?
// are dropped off the end of the string and "?" appended.
void CollapseStringToWidth (PortabilityLayer::RenderedFont *font, StringPtr theStr, short wide)
{
short dotsWide;
Boolean tooWide;
dotsWide = font->MeasurePStr(PSTR("<EFBFBD>"));
dotsWide = font->MeasurePStr(PSTR("\xc9"));
tooWide = font->MeasurePStr(theStr) > wide;
while (tooWide && theStr[0] > 0)
{
theStr[0]--;
tooWide = ((font->MeasurePStr(theStr) + dotsWide) > wide);
if (!tooWide)
PasStringConcat(theStr, PSTR("<EFBFBD>"));
PasStringConcat(theStr, PSTR("\xc9"));
}
}

View File

@@ -34,7 +34,7 @@ extern Boolean switchedOut;
//-------------------------------------------------------------- ToolBoxInit
// The standard ToolBox intialization that must happen when any Mac<61>
// The standard ToolBox intialization that must happen when any Mac<61>
// program first launches.
void ToolBoxInit (void)
@@ -48,7 +48,7 @@ void ToolBoxInit (void)
short RandomInt (short range)
{
register long rawResult;
long rawResult;
rawResult = Random();
if (rawResult < 0L)
@@ -64,8 +64,8 @@ short RandomInt (short range)
long RandomLong (long range)
{
register long highWord, lowWord;
register long rawResultHi, rawResultLo;
long highWord, lowWord;
long rawResultHi, rawResultLo;
highWord = (range & 0xFFFF0000) >> 16;
lowWord = range & 0x0000FFFF;
@@ -87,7 +87,7 @@ long RandomLong (long range)
//-------------------------------------------------------------- RedAlert
// Called when we must quit app. Brings up a dialog informing user<65>
// Called when we must quit app. Brings up a dialog informing user<65>
// of the problem and the exits to shell.
void RedAlert (short errorNumber)
@@ -210,7 +210,7 @@ void CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen)
}
*/
//-------------------------------------------------------------------- CreateOffScreenGWorld
// Creates an offscreen GWorld<6C>using the depth passed in.
// Creates an offscreen GWorld<6C>using the depth passed in.
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds)
{
@@ -257,8 +257,8 @@ void KillOffScreenBitMap (GrafPtr offScreen)
}
*/
//-------------------------------------------------------------- LoadGraphic
// Function loads the specified 'PICT' from disk and draws it to<74>
// the current port (no scaling, clipping, etc, are done). Always<79>
// Function loads the specified 'PICT' from disk and draws it to<74>
// the current port (no scaling, clipping, etc, are done). Always<79>
// draws in the upper left corner of current port.
void LoadGraphic (DrawSurface *surface, short resID)
@@ -296,8 +296,8 @@ void LoadGraphicCustom(DrawSurface *surface, short resID)
}
//-------------------------------------------------------------- LoadScaledGraphic
// Loads the specified 'PICT' and draws it mapped to the rectangle<6C>
// specified. If this rect isn't the same size of the 'PICT', scaling<6E>
// Loads the specified 'PICT' and draws it mapped to the rectangle<6C>
// specified. If this rect isn't the same size of the 'PICT', scaling<6E>
// will occur.
void LoadScaledGraphic (DrawSurface *surface, short resID, Rect *theRect)
@@ -312,8 +312,8 @@ void LoadScaledGraphic (DrawSurface *surface, short resID, Rect *theRect)
}
//-------------------------------------------------------------- LoadScaledGraphic
// Loads the specified 'PICT' and draws it mapped to the rectangle<6C>
// specified. If this rect isn't the same size of the 'PICT', scaling<6E>
// Loads the specified 'PICT' and draws it mapped to the rectangle<6C>
// specified. If this rect isn't the same size of the 'PICT', scaling<6E>
// will occur.
void LoadScaledGraphicCustom(DrawSurface *surface, short resID, Rect *theRect)
@@ -393,8 +393,8 @@ void DrawCIcon (DrawSurface *surface, short theID, short h, short v)
//-------------------------------------------------------------- LongSquareRoot
// This is a quick and dirty square root function that returns pretty<74>
// accurate long integer results. It uses no transcendental functions or<6F>
// This is a quick and dirty square root function that returns pretty<74>
// accurate long integer results. It uses no transcendental functions or<6F>
// floating point.
long LongSquareRoot (long theNumber)
@@ -496,7 +496,7 @@ char KeyMapOffsetFromRawKey (char rawKeyCode)
}
//-------------------------------------------------------------- GetKeyName
// Given a keyDown event (it's message field), this function returns<6E>
// Given a keyDown event (it's message field), this function returns<6E>
// a string with that key's name (so we get "Shift" and "Esc", etc.).
static const char *gs_specialKeyNames[GpKeySpecials::kCount] =
@@ -591,6 +591,8 @@ void GetKeyName (intptr_t message, StringPtr theName)
// This should never happen
assert(false);
break;
default:
break;
}
const size_t name1Length = (name1 == nullptr) ? 0 : strlen(name1);
@@ -631,7 +633,7 @@ long ExtractCTSeed (CGrafPtr porter)
}
*/
//-------------------------------------------------------------- ForceCTSeed
// Forces the "color table seed" from a specified graf port to a<>
// Forces the "color table seed" from a specified graf port to a<>
// specified value.
/*
void ForceCTSeed (CGrafPtr porter, long newSeed)
@@ -640,7 +642,7 @@ void ForceCTSeed (CGrafPtr porter, long newSeed)
}
*/
//-------------------------------------------------------------- DelayTicks
// Lil' function that just sits and waits a specified number of<6F>
// Lil' function that just sits and waits a specified number of<6F>
// Ticks (1/60 of a second).
void DelayTicks (long howLong)
@@ -651,7 +653,7 @@ void DelayTicks (long howLong)
}
//-------------------------------------------------------------- UnivGetSoundVolume
// Returns the speaker volume (as set by the user) in the range of<6F>
// Returns the speaker volume (as set by the user) in the range of<6F>
// zero to seven (handles Sound Manager 3 case as well).
void UnivGetSoundVolume (short *volume, Boolean hasSM3)
@@ -674,7 +676,7 @@ void UnivGetSoundVolume (short *volume, Boolean hasSM3)
}
//-------------------------------------------------------------- UnivSetSoundVolume
// Sets the speaker volume to a specified value (in the range of<6F>
// Sets the speaker volume to a specified value (in the range of<6F>
// zero to seven (handles Sound Manager 3 case as well).
void UnivSetSoundVolume (short volume, Boolean hasSM3)