2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Review changes cf. Adam: change name of local vars to not start

with 'f' prefix (used for fields in objects).
Also removed trailing space from lines that irritate Git difference listings.
This commit is contained in:
rarified
2021-09-10 15:32:37 -06:00
parent 224ad908cc
commit b9f8e3d1bd

View File

@ -125,7 +125,7 @@ class pfEsHTMLChunk
hsScalar fCurrOpacity; // For SFX images hsScalar fCurrOpacity; // For SFX images
hsScalar fSFXTime; // For SFX images hsScalar fSFXTime; // For SFX images
hsScalar fMinOpacity, fMaxOpacity; hsScalar fMinOpacity, fMaxOpacity;
hsColorRGBA fCurrColor; hsColorRGBA fCurrColor;
hsColorRGBA fOffColor, fOnColor; hsColorRGBA fOffColor, fOnColor;
@ -156,7 +156,7 @@ class pfEsHTMLChunk
kCanLink = 0x00000008, kCanLink = 0x00000008,
kFloating = 0x00000010, kFloating = 0x00000010,
kGlowing = 0x00000020, kGlowing = 0x00000020,
kActAsCB = 0x00000040, // Cause the image to act in a checkbox-like fashion. kActAsCB = 0x00000040, // Cause the image to act in a checkbox-like fashion.
// Min opacity turns into "off opacity" and max opacity // Min opacity turns into "off opacity" and max opacity
// is "on opacity" // is "on opacity"
kChecked = 0x00000080, // Only for kActAsCB, set if it's currently "checked" kChecked = 0x00000080, // Only for kActAsCB, set if it's currently "checked"
@ -469,7 +469,7 @@ pfBookData::pfBookData(const char *guiName /* = nil */)
fTurnFrontEditCtrl = fTurnBackEditCtrl = nil; fTurnFrontEditCtrl = fTurnBackEditCtrl = nil;
fEditable = false; fEditable = false;
fAdjustCursorTo = -1; fAdjustCursorTo = -1;
if (guiName) if (guiName)
fGUIName = guiName; fGUIName = guiName;
else else
@ -542,7 +542,7 @@ hsBool pfBookData::MsgReceive(plMessage *pMsg)
else if( fCurrentlyTurning ) else if( fCurrentlyTurning )
{ {
if( callback->fUser & 0x04 ) if( callback->fUser & 0x04 )
IFillUncoveringPage( (hsBool)( callback->fUser & 0x01 ) ? true : false ); IFillUncoveringPage( (hsBool)( callback->fUser & 0x01 ) ? true : false );
else if( callback->fUser & 0x02 ) else if( callback->fUser & 0x02 )
StartTriggeredFlip( (hsBool)( callback->fUser & 0x01 ) ? true : false ); StartTriggeredFlip( (hsBool)( callback->fUser & 0x01 ) ? true : false );
else else
@ -564,7 +564,7 @@ hsBool pfBookData::MsgReceive(plMessage *pMsg)
if( time != nil && fCurrSFXPages != kNoSides && !fCurrentlyTurning && fCurrentlyOpen ) if( time != nil && fCurrSFXPages != kNoSides && !fCurrentlyTurning && fCurrentlyOpen )
{ {
IHandleSFX( (hsScalar)time->DSeconds() ); IHandleSFX( (hsScalar)time->DSeconds() );
return true; return true;
} }
plTimerCallbackMsg* timerMsg = plTimerCallbackMsg::ConvertNoRef(pMsg); plTimerCallbackMsg* timerMsg = plTimerCallbackMsg::ConvertNoRef(pMsg);
@ -590,13 +590,13 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg)
hsAssert(templateDlg != nil, "Nil template in pfBookData::IInitTemplate()!"); hsAssert(templateDlg != nil, "Nil template in pfBookData::IInitTemplate()!");
// Init and ref our fDialog pointer // Init and ref our fDialog pointer
hsgResMgr::ResMgr()->SendRef(templateDlg->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDialog), plRefFlags::kPassiveRef); hsgResMgr::ResMgr()->SendRef(templateDlg->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDialog), plRefFlags::kPassiveRef);
// Hijack the dialog proc with our own // Hijack the dialog proc with our own
templateDlg->SetHandlerForAll(TRACKED_NEW pfJournalDlgProc(this)); templateDlg->SetHandlerForAll(TRACKED_NEW pfJournalDlgProc(this));
// Find our animation keys // Find our animation keys
// And other interesting pointers // And other interesting pointers
fCoverButton = pfGUICheckBoxCtrl::ConvertNoRef(templateDlg->GetControlFromTag(pfJournalDlgProc::kTagBookCover)); fCoverButton = pfGUICheckBoxCtrl::ConvertNoRef(templateDlg->GetControlFromTag(pfJournalDlgProc::kTagBookCover));
fTurnPageButton = pfGUICheckBoxCtrl::ConvertNoRef(templateDlg->GetControlFromTag(pfJournalDlgProc::kTagTurnPageCtrl)); fTurnPageButton = pfGUICheckBoxCtrl::ConvertNoRef(templateDlg->GetControlFromTag(pfJournalDlgProc::kTagTurnPageCtrl));
@ -621,7 +621,7 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg)
// Grab and ref the default cover mipmap // Grab and ref the default cover mipmap
plLayer *lay = plLayer::ConvertNoRef(fCoverLayer); plLayer *lay = plLayer::ConvertNoRef(fCoverLayer);
if((lay != nil)&&(lay->GetTexture() != nil)) if((lay != nil)&&(lay->GetTexture() != nil))
hsgResMgr::ResMgr()->AddViaNotify(lay->GetTexture()->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDefaultCover), plRefFlags::kPassiveRef); hsgResMgr::ResMgr()->AddViaNotify(lay->GetTexture()->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, -1, kRefDefaultCover), plRefFlags::kPassiveRef);
fLeftPageMap->SetFlag(pfGUIClickMapCtrl::kReportHovering); fLeftPageMap->SetFlag(pfGUIClickMapCtrl::kReportHovering);
fRightPageMap->SetFlag(pfGUIClickMapCtrl::kReportHovering); fRightPageMap->SetFlag(pfGUIClickMapCtrl::kReportHovering);
@ -663,7 +663,7 @@ void pfBookData::IInitTemplate(pfGUIDialogMod *templateDlg)
} }
//// IGetDTMap /////////////////////////////////////////////////////////////// //// IGetDTMap ///////////////////////////////////////////////////////////////
// Just a quick helper // Just a quick helper
plDynamicTextMap *pfBookData::GetDTMap(UInt32 which) plDynamicTextMap *pfBookData::GetDTMap(UInt32 which)
{ {
@ -691,7 +691,7 @@ pfGUIMultiLineEditCtrl *pfBookData::GetEditCtrl(UInt32 which)
} }
//// IRegisterForSFX ///////////////////////////////////////////////////////// //// IRegisterForSFX /////////////////////////////////////////////////////////
// Registers (or unregisters) for time messages so we can process special FX // Registers (or unregisters) for time messages so we can process special FX
// if we need to // if we need to
void pfBookData::RegisterForSFX(WhichSide whichPages) void pfBookData::RegisterForSFX(WhichSide whichPages)
@ -705,7 +705,7 @@ void pfBookData::RegisterForSFX(WhichSide whichPages)
} }
else else
plgDispatch::Dispatch()->UnRegisterForExactType(plTimeMsg::Index(), GetKey()); plgDispatch::Dispatch()->UnRegisterForExactType(plTimeMsg::Index(), GetKey());
fCurrSFXPages = whichPages; fCurrSFXPages = whichPages;
} }
@ -747,7 +747,7 @@ void pfBookData::IHandleSFX(hsScalar currTime, WhichSide whichSide /*= kNoSides*
for(idx = fCurrBook->fPageStarts[fCurrBook->fCurrentPage + inc]; idx < fCurrBook->fPageStarts[fCurrBook->fCurrentPage + inc + 1]; idx++) for(idx = fCurrBook->fPageStarts[fCurrBook->fCurrentPage + inc]; idx < fCurrBook->fPageStarts[fCurrBook->fCurrentPage + inc + 1]; idx++)
{ {
pfEsHTMLChunk *chunk = fCurrBook->fHTMLSource[idx]; pfEsHTMLChunk *chunk = fCurrBook->fHTMLSource[idx];
if(chunk->fFlags & pfEsHTMLChunk::kGlowing) if(chunk->fFlags & pfEsHTMLChunk::kGlowing)
{ {
// Glow SFX: animate opacity based on time offset // Glow SFX: animate opacity based on time offset
@ -843,7 +843,7 @@ void pfBookData::IFillUncoveringPage(hsBool rightSide)
// The right edit ctrl doesn't update until the page flip animation is done // The right edit ctrl doesn't update until the page flip animation is done
id = 98; id = 98;
} }
// create a timer so we can hide the old left or right turn page right before the animation finishes to prevent flicker // create a timer so we can hide the old left or right turn page right before the animation finishes to prevent flicker
plTimerCallbackMsg* pTimerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(),id); plTimerCallbackMsg* pTimerMsg = TRACKED_NEW plTimerCallbackMsg(GetKey(),id);
plgTimerCallbackMgr::NewTimer( .5, pTimerMsg ); // .5 found by trial and error plgTimerCallbackMgr::NewTimer( .5, pTimerMsg ); // .5 found by trial and error
@ -882,7 +882,7 @@ void pfBookData::ITriggerPageFlip(hsBool flipBackwards, hsBool immediate)
} }
msg->SetAnimName(flipBackwards ? "backward" : "forward"); msg->SetAnimName(flipBackwards ? "backward" : "forward");
msg->AddReceivers(keys); msg->AddReceivers(keys);
// Here's the whole reason why we're not just checking the checkbox: so we can attach a callback // Here's the whole reason why we're not just checking the checkbox: so we can attach a callback
// so we know when the animation completes. Pretty sad, huh? Poor checkbox. // so we know when the animation completes. Pretty sad, huh? Poor checkbox.
plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg;
@ -920,7 +920,7 @@ void pfBookData::ITriggerPageFlip(hsBool flipBackwards, hsBool immediate)
} }
//// StartTriggeredFlip ///////////////////////////////////////////////////// //// StartTriggeredFlip /////////////////////////////////////////////////////
// Finishes the start of the triggered page flip (once we're sure the // Finishes the start of the triggered page flip (once we're sure the
// animation is at the new frame) // animation is at the new frame)
void pfBookData::StartTriggeredFlip(hsBool flipBackwards) void pfBookData::StartTriggeredFlip(hsBool flipBackwards)
@ -1206,7 +1206,7 @@ void pfJournalBook::UnloadAllGUIs()
// the name of the mipmap to use as the cover of the book. The callback // the name of the mipmap to use as the cover of the book. The callback
// key is the keyed object to send event messages to (see <img> tag). // key is the keyed object to send event messages to (see <img> tag).
pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/, pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/,
const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const char *guiName /* = nil */ ) const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const char *guiName /* = nil */ )
{ {
if (guiName && (strcmp(guiName,"") != 0)) if (guiName && (strcmp(guiName,"") != 0))
@ -1219,7 +1219,7 @@ pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plK
hsgResMgr::ResMgr()->NewKey(fCurBookGUI.c_str(),fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(fCurBookGUI.c_str(),fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation());
fBookGUIs[fCurBookGUI]->LoadGUI(); fBookGUIs[fCurBookGUI]->LoadGUI();
} }
fCurrentPage = 0; fCurrentPage = 0;
fLastPage = -1; fLastPage = -1;
fCoverMipKey = coverImageKey; fCoverMipKey = coverImageKey;
@ -1242,7 +1242,7 @@ pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plK
delete [] wESHTMLSource; delete [] wESHTMLSource;
} }
pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/, pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/,
const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const char *guiName /* = nil */ ) const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const char *guiName /* = nil */ )
{ {
if (guiName && (strcmp(guiName,"") != 0)) if (guiName && (strcmp(guiName,"") != 0))
@ -1255,7 +1255,7 @@ pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey,
hsgResMgr::ResMgr()->NewKey(fCurBookGUI.c_str(),fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(fCurBookGUI.c_str(),fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation());
fBookGUIs[fCurBookGUI]->LoadGUI(); fBookGUIs[fCurBookGUI]->LoadGUI();
} }
fCurrentPage = 0; fCurrentPage = 0;
fLastPage = -1; fLastPage = -1;
fCoverMipKey = coverImageKey; fCoverMipKey = coverImageKey;
@ -1498,7 +1498,7 @@ void pfJournalBook::ITriggerCloseWithNotify( hsBool closeNotOpen, hsBool immedia
} }
msg->SetAnimName( animName ); msg->SetAnimName( animName );
msg->AddReceivers( keys ); msg->AddReceivers( keys );
plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg; plEventCallbackMsg *eventMsg = TRACKED_NEW plEventCallbackMsg;
eventMsg->AddReceiver( fBookGUIs[fCurBookGUI]->GetKey() ); eventMsg->AddReceiver( fBookGUIs[fCurBookGUI]->GetKey() );
eventMsg->fRepeats = 0; eventMsg->fRepeats = 0;
@ -1548,7 +1548,7 @@ void pfJournalBook::NextPage( void )
fVisibleLinks.Reset(); fVisibleLinks.Reset();
// Swap the right DT map into the turn page front DTMap, then render // Swap the right DT map into the turn page front DTMap, then render
// the new current page into turn page back and currPage+1 into // the new current page into turn page back and currPage+1 into
// the right DTMap // the right DTMap
plDynamicTextMap *turnFront = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagTurnFrontDTMap ); plDynamicTextMap *turnFront = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagTurnFrontDTMap );
plDynamicTextMap *right = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagRightDTMap ); plDynamicTextMap *right = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagRightDTMap );
@ -1588,7 +1588,7 @@ void pfJournalBook::PreviousPage( void )
{ {
if (fCurrentPage >= 2) // this variable can get out of whack if we open the book to a page in the middle if (fCurrentPage >= 2) // this variable can get out of whack if we open the book to a page in the middle
fCurrentPage -= 2; // just making sure that this doesn't go below zero (and therefore wrap around) fCurrentPage -= 2; // just making sure that this doesn't go below zero (and therefore wrap around)
pfGUIMultiLineEditCtrl *right = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagRightEditCtrl); pfGUIMultiLineEditCtrl *right = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagRightEditCtrl);
pfGUIMultiLineEditCtrl *left = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagLeftEditCtrl); pfGUIMultiLineEditCtrl *left = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagLeftEditCtrl);
pfGUIMultiLineEditCtrl *turnFront = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagTurnFrontEditCtrl); pfGUIMultiLineEditCtrl *turnFront = fBookGUIs[fCurBookGUI]->GetEditCtrl(pfJournalDlgProc::kTagTurnFrontEditCtrl);
@ -1602,7 +1602,7 @@ void pfJournalBook::PreviousPage( void )
// At this point, only the left and right pages are visible, we don't want to actually update anything until the animation // At this point, only the left and right pages are visible, we don't want to actually update anything until the animation
// starts so that nothing flashes or overdraws. // starts so that nothing flashes or overdraws.
fBookGUIs[fCurBookGUI]->StartTriggeredFlip( true ); fBookGUIs[fCurBookGUI]->StartTriggeredFlip( true );
fBookGUIs[fCurBookGUI]->TurnPageButton()->PlaySound( pfGUICheckBoxCtrl::kMouseUp ); fBookGUIs[fCurBookGUI]->TurnPageButton()->PlaySound( pfGUICheckBoxCtrl::kMouseUp );
ISendNotify(kNotifyPreviousPage); ISendNotify(kNotifyPreviousPage);
@ -1618,7 +1618,7 @@ void pfJournalBook::PreviousPage( void )
fVisibleLinks.Reset(); fVisibleLinks.Reset();
// Swap the left DT map into the turn page back DTMap, then render // Swap the left DT map into the turn page back DTMap, then render
// the new current page into the left and currPage+1 into // the new current page into the left and currPage+1 into
// the turn page front DTMap // the turn page front DTMap
plDynamicTextMap *turnBack = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagTurnBackDTMap ); plDynamicTextMap *turnBack = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagTurnBackDTMap );
plDynamicTextMap *left = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagLeftDTMap ); plDynamicTextMap *left = fBookGUIs[fCurBookGUI]->GetDTMap( pfJournalDlgProc::kTagLeftDTMap );
@ -1844,7 +1844,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
UInt8 type = IGetTagType( c ); UInt8 type = IGetTagType( c );
if( type != pfEsHTMLChunk::kEmpty ) if( type != pfEsHTMLChunk::kEmpty )
{ {
// First, end the current paragraph chunk, which is a special case 'cause its // First, end the current paragraph chunk, which is a special case 'cause its
// text is defined outside the tag // text is defined outside the tag
if( start == c ) if( start == c )
{ {
@ -1855,7 +1855,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
else if( lastParChunk != nil ) else if( lastParChunk != nil )
{ {
UInt32 count = ((UInt32)c - (UInt32)start)/2; // wchar_t is 2 bytes UInt32 count = ((UInt32)c - (UInt32)start)/2; // wchar_t is 2 bytes
wchar_t *temp = TRACKED_NEW wchar_t[ count + 1 ]; wchar_t *temp = TRACKED_NEW wchar_t[ count + 1 ];
wcsncpy( temp, start, count ); wcsncpy( temp, start, count );
temp[count] = L'\0'; temp[count] = L'\0';
@ -2010,7 +2010,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
break; break;
case pfEsHTMLChunk::kCover: case pfEsHTMLChunk::kCover:
// Don't create an actual chunk for this one, just use the "src" and // Don't create an actual chunk for this one, just use the "src" and
// grab the mipmap key for our cover // grab the mipmap key for our cover
c += 6; c += 6;
while( IGetNextOption( c, name, option ) ) while( IGetNextOption( c, name, option ) )
@ -2181,7 +2181,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
} }
fHeightScale = 1.f - bookHeight; fHeightScale = 1.f - bookHeight;
fWidthScale = 1.f - bookWidth; fWidthScale = 1.f - bookWidth;
// Still gotta create a new par chunk // Still gotta create a new par chunk
lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil );
lastParChunk->fFlags = IFindLastAlignment(); lastParChunk->fFlags = IFindLastAlignment();
@ -2316,7 +2316,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil ); lastParChunk = TRACKED_NEW pfEsHTMLChunk( nil );
lastParChunk->fFlags = IFindLastAlignment(); lastParChunk->fFlags = IFindLastAlignment();
break; break;
case pfEsHTMLChunk::kEditable: case pfEsHTMLChunk::kEditable:
c += 9; c += 9;
SetEditable(true); SetEditable(true);
@ -2350,12 +2350,12 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
else if( lastParChunk != nil ) else if( lastParChunk != nil )
{ {
UInt32 count = (UInt32)c - (UInt32)start; UInt32 count = (UInt32)c - (UInt32)start;
wchar_t *temp = TRACKED_NEW wchar_t[ count + 1 ]; wchar_t *temp = TRACKED_NEW wchar_t[ count + 1 ];
wcsncpy( temp, start, count + 1 ); wcsncpy( temp, start, count + 1 );
lastParChunk->fText = temp; lastParChunk->fText = temp;
delete [] temp; delete [] temp;
// Special case to remove any last trailing carriage return // Special case to remove any last trailing carriage return
// if( count > 1 && lastParChunk->fText[ count - 1 ] == '\n' ) // if( count > 1 && lastParChunk->fText[ count - 1 ] == '\n' )
// lastParChunk->fText[ count - 1 ] = 0; // lastParChunk->fText[ count - 1 ] = 0;
@ -2370,7 +2370,7 @@ hsBool pfJournalBook::ICompileSource( const wchar_t *source, const plLocation &h
fLastPage = 0; fLastPage = 0;
else else
fLastPage = -1; fLastPage = -1;
return true; return true;
} }
@ -2394,7 +2394,7 @@ UInt8 pfJournalBook::IGetTagType( const wchar_t *string )
{ L"movie", pfEsHTMLChunk::kMovie }, { L"movie", pfEsHTMLChunk::kMovie },
{ L"editable", pfEsHTMLChunk::kEditable }, { L"editable", pfEsHTMLChunk::kEditable },
{ nil, pfEsHTMLChunk::kEmpty } }; { nil, pfEsHTMLChunk::kEmpty } };
UInt32 i; UInt32 i;
for( i = 0; tags[ i ].fTag != nil; i++ ) for( i = 0; tags[ i ].fTag != nil; i++ )
@ -2458,7 +2458,7 @@ hsBool pfJournalBook::IGetNextOption( const wchar_t *&string, wchar_t *name, wch
len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes
wcsncpy( option, c, len ); wcsncpy( option, c, len );
option[len] = L'\0'; option[len] = L'\0';
if( *string == L'\"' ) if( *string == L'\"' )
string++; string++;
@ -2473,14 +2473,14 @@ hsBool pfJournalBook::IGetNextOption( const wchar_t *&string, wchar_t *name, wch
len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes len = ((UInt32)string - (UInt32)c)/2; // divide length by 2 because each character is two bytes
wcsncpy( option, c, len ); wcsncpy( option, c, len );
option[len] = L'\0'; option[len] = L'\0';
return true; return true;
} }
void pfJournalBook::IFreeSource( void ) void pfJournalBook::IFreeSource( void )
{ {
UInt32 i; UInt32 i;
for( i = 0; i < fHTMLSource.GetCount(); i++ ) for( i = 0; i < fHTMLSource.GetCount(); i++ )
delete fHTMLSource[ i ]; delete fHTMLSource[ i ];
fHTMLSource.Reset(); fHTMLSource.Reset();
@ -2573,7 +2573,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
{ {
if (fAreEditing) if (fAreEditing)
return; // we don't render if we are editing the book return; // we don't render if we are editing the book
// Grab the DTMap via the GUI system // Grab the DTMap via the GUI system
plDynamicTextMap *dtMap = fBookGUIs[fCurBookGUI]->GetDTMap( whichDTMap ); plDynamicTextMap *dtMap = fBookGUIs[fCurBookGUI]->GetDTMap( whichDTMap );
hsAssert( dtMap != nil, "Invalid DT map in IRenderPage()" ); hsAssert( dtMap != nil, "Invalid DT map in IRenderPage()" );
@ -2619,12 +2619,12 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
#endif // USE_BINK_SDK #endif // USE_BINK_SDK
hsAssert(page < fPageStarts.GetCount() || page > fLastPage, "UnInitialized page start!"); hsAssert(page < fPageStarts.GetCount() || page > fLastPage, "UnInitialized page start!");
if( page <= fLastPage if( page <= fLastPage
&& page < fPageStarts.GetCount()) // Added this as a crash-prevention bandaid - MT && page < fPageStarts.GetCount()) // Added this as a crash-prevention bandaid - MT
{ {
UInt32 idx; UInt32 idx;
UInt16 width, height, y, x, ascent, lastX, lastY; UInt16 width, height, y, x, ascent, lastX, lastY;
UInt8 fontFlags, fontSize; UInt8 fontFlags, fontSize;
const wchar_t *fontFace; const wchar_t *fontFace;
hsColorRGBA fontColor; hsColorRGBA fontColor;
@ -2668,14 +2668,14 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
width = (UInt16)(512 - fPageLMargin - fPageRMargin); width = (UInt16)(512 - fPageLMargin - fPageRMargin);
height = (UInt16)(512 - fPageBMargin - y); height = (UInt16)(512 - fPageBMargin - y);
UInt32 lastChar; UInt32 lastChar;
const wchar_t *fTextStr; // initialize later to avoid compile errors inside case block const wchar_t *chunkTextStr; // initialize later to avoid compile errors inside case block
int fTextStrLen; int chunkTextStrLen;
fTextStr = chunk->fText.c_str(); chunkTextStr = chunk->fText.c_str();
fTextStrLen = chunk->fText.length(); chunkTextStrLen = chunk->fText.length();
dtMap->CalcWrappedStringSize( fTextStr, &width, &height, &lastChar, &ascent, &lastX, &lastY ); dtMap->CalcWrappedStringSize( chunkTextStr, &width, &height, &lastChar, &ascent, &lastX, &lastY );
width = (UInt16)(512 - fPageLMargin - fPageRMargin); width = (UInt16)(512 - fPageLMargin - fPageRMargin);
if( !suppressRendering ) if( !suppressRendering )
dtMap->DrawWrappedString( (UInt16)fPageLMargin, y, fTextStr, width, (UInt16)(512 - fPageBMargin - y), &lastX, &lastY ); dtMap->DrawWrappedString( (UInt16)fPageLMargin, y, chunkTextStr, width, (UInt16)(512 - fPageBMargin - y), &lastX, &lastY );
if( lastChar == 0 ) if( lastChar == 0 )
{ {
@ -2686,16 +2686,16 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
idx--; idx--;
break; break;
} }
if( fTextStr[ lastChar ] != L'\0' ) if( chunkTextStr[ lastChar ] != L'\0' )
{ {
// Didn't get to render the whole paragraph in this go, so we're going to cheat // Didn't get to render the whole paragraph in this go, so we're going to cheat
// and split the paragraph up into two so that we can handle it properly. Note: // and split the paragraph up into two so that we can handle it properly. Note:
// this changes the chunk array beyond this point, so we need to invalidate the // this changes the chunk array beyond this point, so we need to invalidate the
// cache, but that's ok 'cause if we're doing this, it's probably invalid (or empty) // cache, but that's ok 'cause if we're doing this, it's probably invalid (or empty)
// anyway // anyway
wchar_t *s = TRACKED_NEW wchar_t[fTextStrLen+1]; wchar_t *s = TRACKED_NEW wchar_t[chunkTextStrLen+1];
wcscpy(s,fTextStr); wcscpy(s,chunkTextStr);
s[fTextStrLen] = L'\0'; s[chunkTextStrLen] = L'\0';
// Note: Makes a copy of the string // Note: Makes a copy of the string
pfEsHTMLChunk *c2 = TRACKED_NEW pfEsHTMLChunk( &s[ lastChar ] ); pfEsHTMLChunk *c2 = TRACKED_NEW pfEsHTMLChunk( &s[ lastChar ] );
@ -2714,7 +2714,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
y += 512; y += 512;
break; break;
} }
x = lastX; x = lastX;
y = (UInt16)(lastY - dtMap->GetCurrFont()->GetAscent()); // Since our text is top-justified y = (UInt16)(lastY - dtMap->GetCurrFont()->GetAscent()); // Since our text is top-justified
@ -2753,13 +2753,13 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
{ {
// Mipmap overlaps the bottom of this page, so forcibly break so we'll // Mipmap overlaps the bottom of this page, so forcibly break so we'll
// end up marking the page break here (note that, unlike paragraphs, we // end up marking the page break here (note that, unlike paragraphs, we
// can't really break the mipmap into two...well, OK, we could, but it // can't really break the mipmap into two...well, OK, we could, but it
// wouldn't make much sense :) // wouldn't make much sense :)
y += (UInt16)(mip->GetHeight()); y += (UInt16)(mip->GetHeight());
// Wonderful, the break breaks us from the switch(), which means the for() // Wonderful, the break breaks us from the switch(), which means the for()
// loops runs once more and increments idx. So this is to counter that. // loops runs once more and increments idx. So this is to counter that.
// (We better check tho, just to make sure nobody feeds us an extra-large // (We better check tho, just to make sure nobody feeds us an extra-large
// image and sends us on an infinite loop) // image and sends us on an infinite loop)
if( idx > fPageStarts[ page ] ) if( idx > fPageStarts[ page ] )
idx--; idx--;
@ -2799,7 +2799,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
x = (UInt16)fPageLMargin; x = (UInt16)fPageLMargin;
break; break;
case pfEsHTMLChunk::kFontChange: case pfEsHTMLChunk::kFontChange:
IFindFontProps( idx, fontFace, fontSize, fontFlags, fontColor, fontSpacing ); IFindFontProps( idx, fontFace, fontSize, fontFlags, fontColor, fontSpacing );
dtMap->SetFont( fontFace, fontSize, fontFlags, false ); dtMap->SetFont( fontFace, fontSize, fontFlags, false );
dtMap->SetTextColor( fontColor, true ); dtMap->SetTextColor( fontColor, true );
@ -2827,7 +2827,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppress
// Wonderful, the break breaks us from the switch(), which means the for() // Wonderful, the break breaks us from the switch(), which means the for()
// loops runs once more and increments idx. So this is to counter that. // loops runs once more and increments idx. So this is to counter that.
// (We better check tho, just to make sure nobody feeds us an extra-large // (We better check tho, just to make sure nobody feeds us an extra-large
// image and sends us on an infinite loop) // image and sends us on an infinite loop)
if( idx > fPageStarts[ page ] ) if( idx > fPageStarts[ page ] )
idx--; idx--;
@ -2966,7 +2966,7 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, plMip
else else
x -= xShift; x -= xShift;
} }
copy->SetCurrLevel(0); // resize the image so it will look unchanged when rendered on the altered book copy->SetCurrLevel(0); // resize the image so it will look unchanged when rendered on the altered book
copy->ResizeNicely((UInt16)width,(UInt16)height,plMipmap::kDefaultFilter); copy->ResizeNicely((UInt16)width,(UInt16)height,plMipmap::kDefaultFilter);
} }
@ -2981,7 +2981,7 @@ void pfJournalBook::IDrawMipmap( pfEsHTMLChunk *chunk, UInt16 x, UInt16 y, plMip
opts.fBlueTint = chunk->fCurrColor.b; opts.fBlueTint = chunk->fCurrColor.b;
opts.fOpacity = (UInt8)(chunk->fCurrColor.a * 255.f); opts.fOpacity = (UInt8)(chunk->fCurrColor.a * 255.f);
} }
else else
{ {
if( chunk->fFlags & pfEsHTMLChunk::kGlowing ) if( chunk->fFlags & pfEsHTMLChunk::kGlowing )
opts.fFlags = ( chunk->fFlags & pfEsHTMLChunk::kBlendAlpha ) ? 0 : plMipmap::kMaskSrcAlpha; opts.fFlags = ( chunk->fFlags & pfEsHTMLChunk::kBlendAlpha ) ? 0 : plMipmap::kMaskSrcAlpha;
@ -3177,7 +3177,7 @@ plLayerBink *pfJournalBook::IMakeMovieLayer(pfEsHTMLChunk *chunk, UInt16 x, UInt
else else
flipMat = hsMatrix44::IdentityMatrix(); flipMat = hsMatrix44::IdentityMatrix();
} }
hsMatrix44 xfm; hsMatrix44 xfm;
xfm = translateMat * scaleMat * flipMat; xfm = translateMat * scaleMat * flipMat;
@ -3550,7 +3550,7 @@ void pfJournalBook::ILoadAllImages( hsBool unload )
fBookGUIs[fCurBookGUI]->GetKey()->Release( fHTMLSource[ i ]->fImageKey ); fBookGUIs[fCurBookGUI]->GetKey()->Release( fHTMLSource[ i ]->fImageKey );
else else
{ {
plGenRefMsg *ref = TRACKED_NEW plGenRefMsg( fBookGUIs[fCurBookGUI]->GetKey(), plRefMsg::kOnCreate, -1, kRefImage ); plGenRefMsg *ref = TRACKED_NEW plGenRefMsg( fBookGUIs[fCurBookGUI]->GetKey(), plRefMsg::kOnCreate, -1, kRefImage );
hsgResMgr::ResMgr()->AddViaNotify( fHTMLSource[ i ]->fImageKey, ref, plRefFlags::kActiveRef ); hsgResMgr::ResMgr()->AddViaNotify( fHTMLSource[ i ]->fImageKey, ref, plRefFlags::kActiveRef );
} }
} }