Skip to content

Commit

Permalink
Fix crash Serious Editor 64-bit
Browse files Browse the repository at this point in the history
Fixed level editor crash when calling the function to show all entities <N>.
Now the 64-bit editor has full functionality, just like its 32-bit version.
The cause of the crash was the conversion of pointers to 32 bits.
  • Loading branch information
tx00100xt committed Oct 12, 2023
1 parent dd9fd76 commit 912964e
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion SamTFE/Sources/WorldEditor/ColoredButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ INT_PTR CColoredButton::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const
rectToolTip.top = 50;
rectToolTip.bottom = 60;
pTI->hwnd = GetParent()->m_hWnd;
pTI->uId = (UINT) m_hWnd;
pTI->uId = (DWORD_PTR) m_hWnd;
pTI->rect = rectToolTip;
pTI->uFlags = TTF_IDISHWND;
return 1;
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/WorldEditor/CtrlEditFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ INT_PTR CCtrlEditFlags::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const
rectToolTip.top = 50;
rectToolTip.bottom = 60;
pTI->hwnd = GetParent()->m_hWnd;
pTI->uId = (UINT) m_hWnd;
pTI->uId = (DWORD_PTR) m_hWnd;
pTI->rect = rectToolTip;
pTI->uFlags = TTF_IDISHWND;
return 1;
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/WorldEditor/DlgBrowseByClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void CDlgBrowseByClass::AddEntity( CEntity *pen)
itItem.iSubItem = COLUMN_CLASS;
itItem.pszText = achrTemp;
itItem.iItem = m_listEntities.InsertItem( &itItem);
m_listEntities.SetItemData( itItem.iItem, (DWORD) pen);
m_listEntities.SetItemData( itItem.iItem, (DWORD_PTR) pen);

for( INDEX iColumn=COLUMN_CLASS; iColumn<COLUMN_PROPERTY_START+_ctProperties; iColumn++)
{
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/WorldEditor/DlgPgShadow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void CDlgPgShadow::OnContextMenu(CWnd* pWnd, CPoint point)
BOOL CDlgPgShadow::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
DWORD_PTR nID =pNMHDR->idFrom;
if (pTTT->uFlags & TTF_IDISHWND)
{
// idFrom is actually the HWND of the tool
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/WorldEditor/SkyFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BOOL FloatFromString(HWND hWnd, float &fNumber, BOOL &bValid)

bValid = TRUE;
float fTmpNumber = fNumber;
int iNumLen, iRetLen;
size_t iNumLen, iRetLen;
iNumLen = strlen( CStringA(szWindowText));
iRetLen = sscanf( CStringA(szWindowText), "%f", &fTmpNumber);
if( (iRetLen == 1) || ((iNumLen == 1) && (szWindowText[0] == '-') || (iNumLen == 0)) )
Expand Down
4 changes: 2 additions & 2 deletions SamTFE/Sources/WorldEditor/WorldEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ static CTString GetNextParam(void)
// if the first char is not quote
} else {
// find first next space
INDEX iSpace;
INDEX ctChars = strlen(_strCmd);
size_t iSpace;
size_t ctChars = strlen(_strCmd);
for(iSpace=0; iSpace<ctChars; iSpace++) {
if (isspace(_strCmd[iSpace])) {
break;
Expand Down
22 changes: 11 additions & 11 deletions SamTFE/Sources/WorldEditor/WorldEditorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8066,7 +8066,7 @@ void CWorldEditorView::GetToolTipText( char *pToolTipText)
// get description line for all properties with name
pdecDLLClass = penEntity->GetClass()->ec_pdecDLLClass;
pchrCursor += sprintf(pchrCursor, "Class: %-24.24s\n", pdecDLLClass->dec_strName);
INDEX ctLetters = strlen("Class: ")+strlen(pdecDLLClass->dec_strName);
size_t ctLetters = strlen("Class: ")+strlen(pdecDLLClass->dec_strName);
memset(pchrCursor, '�', ctLetters);
pchrCursor+=ctLetters;
*pchrCursor = '\n';
Expand Down Expand Up @@ -8217,11 +8217,11 @@ else {\
"Blend: \""+pDoc->m_woWorld.wo_atbTextureBlendings[mp.s.bpt_ubBlend].tb_strName+"\"");}

CBrushPolygon &bpo = *crRayHit.cr_pbpoBrushPolygon;
SET_MAPPING_INFO( bpo.bpo_abptTextures[0], "Texture 1");
SET_MAPPING_INFO( bpo.bpo_abptTextures[1], "Texture 2");
SET_MAPPING_INFO( bpo.bpo_abptTextures[2], "Texture 3");
pchrCursor += sprintf(pchrCursor, "Polygon under mouse has %d edges\n", bpo.bpo_abpePolygonEdges.Count());
pchrCursor += sprintf(pchrCursor, "Shadow on polygon under mouse occupies %g kb\n", bpo.bpo_smShadowMap.GetShadowSize()/1024.0f);
SET_MAPPING_INFO(bpo.bpo_abptTextures[0], (const char*)"Texture 1");
SET_MAPPING_INFO( bpo.bpo_abptTextures[1], (const char*)"Texture 2");
SET_MAPPING_INFO( bpo.bpo_abptTextures[2], (const char*)"Texture 3");
pchrCursor += sprintf(pchrCursor, (const char*)"Polygon under mouse has %d edges\n", bpo.bpo_abpePolygonEdges.Count());
pchrCursor += sprintf(pchrCursor, (const char*)"Shadow on polygon under mouse occupies %g kb\n", bpo.bpo_smShadowMap.GetShadowSize()/1024.0f);
}
}

Expand All @@ -8238,11 +8238,11 @@ else {\
ctPlanes += itbsc->bsc_abplPlanes.Count();
}
pchrCursor += sprintf(pchrCursor, "%-24s %d\n%-24s %d\n%-24s %d\n%-24s %d\n%-24s %d\n%",
"No of sectors:", ctSectors,
"No of polygons:", ctPolygons,
"No of edges:", ctEdges,
"No of vertices:", ctVertices,
"No of planes:", ctPlanes);
(const char*)"No of sectors:", ctSectors,
(const char*)"No of polygons:", ctPolygons,
(const char*)"No of edges:", ctEdges,
(const char*)"No of vertices:", ctVertices,
(const char*)"No of planes:", ctPlanes);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/WorldEditor/ColoredButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ INT_PTR CColoredButton::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const
rectToolTip.top = 50;
rectToolTip.bottom = 60;
pTI->hwnd = GetParent()->m_hWnd;
pTI->uId = (UINT) m_hWnd;
pTI->uId = (DWORD_PTR) m_hWnd;
pTI->rect = rectToolTip;
pTI->uFlags = TTF_IDISHWND;
return 1;
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/WorldEditor/CtrlEditFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ INT_PTR CCtrlEditFlags::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const
rectToolTip.top = 50;
rectToolTip.bottom = 60;
pTI->hwnd = GetParent()->m_hWnd;
pTI->uId = (UINT) m_hWnd;
pTI->uId = (DWORD_PTR) m_hWnd;
pTI->rect = rectToolTip;
pTI->uFlags = TTF_IDISHWND;
return 1;
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/WorldEditor/DlgBrowseByClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void CDlgBrowseByClass::AddEntity( CEntity *pen)
itItem.iSubItem = COLUMN_CLASS;
itItem.pszText = achrTemp;
itItem.iItem = m_listEntities.InsertItem( &itItem);
m_listEntities.SetItemData( itItem.iItem, (DWORD) pen);
m_listEntities.SetItemData( itItem.iItem, (DWORD_PTR) pen);

for( INDEX iColumn=COLUMN_CLASS; iColumn<COLUMN_PROPERTY_START+_ctProperties; iColumn++)
{
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/WorldEditor/DlgPgShadow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void CDlgPgShadow::OnContextMenu(CWnd* pWnd, CPoint point)
BOOL CDlgPgShadow::OnToolTipNotify( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
DWORD_PTR nID =pNMHDR->idFrom;
if (pTTT->uFlags & TTF_IDISHWND)
{
// idFrom is actually the HWND of the tool
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/WorldEditor/SkyFloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BOOL FloatFromString(HWND hWnd, float &fNumber, BOOL &bValid)

bValid = TRUE;
float fTmpNumber = fNumber;
int iNumLen, iRetLen;
size_t iNumLen, iRetLen;
iNumLen = strlen( CStringA(szWindowText));
iRetLen = sscanf( CStringA(szWindowText), "%f", &fTmpNumber);
if( (iRetLen == 1) || ((iNumLen == 1) && (szWindowText[0] == '-') || (iNumLen == 0)) )
Expand Down
4 changes: 2 additions & 2 deletions SamTSE/Sources/WorldEditor/WorldEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ static CTString GetNextParam(void)
// if the first char is not quote
} else {
// find first next space
INDEX iSpace;
INDEX ctChars = strlen(_strCmd);
size_t iSpace;
size_t ctChars = strlen(_strCmd);
for(iSpace=0; iSpace<ctChars; iSpace++) {
if (isspace(_strCmd[iSpace])) {
break;
Expand Down
22 changes: 11 additions & 11 deletions SamTSE/Sources/WorldEditor/WorldEditorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8066,7 +8066,7 @@ void CWorldEditorView::GetToolTipText( char *pToolTipText)
// get description line for all properties with name
pdecDLLClass = penEntity->GetClass()->ec_pdecDLLClass;
pchrCursor += sprintf(pchrCursor, "Class: %-24.24s\n", pdecDLLClass->dec_strName);
INDEX ctLetters = strlen("Class: ")+strlen(pdecDLLClass->dec_strName);
size_t ctLetters = strlen("Class: ")+strlen(pdecDLLClass->dec_strName);
memset(pchrCursor, '�', ctLetters);
pchrCursor+=ctLetters;
*pchrCursor = '\n';
Expand Down Expand Up @@ -8217,11 +8217,11 @@ else {\
"Blend: \""+pDoc->m_woWorld.wo_atbTextureBlendings[mp.s.bpt_ubBlend].tb_strName+"\"");}

CBrushPolygon &bpo = *crRayHit.cr_pbpoBrushPolygon;
SET_MAPPING_INFO( bpo.bpo_abptTextures[0], "Texture 1");
SET_MAPPING_INFO( bpo.bpo_abptTextures[1], "Texture 2");
SET_MAPPING_INFO( bpo.bpo_abptTextures[2], "Texture 3");
pchrCursor += sprintf(pchrCursor, "Polygon under mouse has %d edges\n", bpo.bpo_abpePolygonEdges.Count());
pchrCursor += sprintf(pchrCursor, "Shadow on polygon under mouse occupies %g kb\n", bpo.bpo_smShadowMap.GetShadowSize()/1024.0f);
SET_MAPPING_INFO(bpo.bpo_abptTextures[0], (const char*)"Texture 1");
SET_MAPPING_INFO( bpo.bpo_abptTextures[1], (const char*)"Texture 2");
SET_MAPPING_INFO( bpo.bpo_abptTextures[2], (const char*)"Texture 3");
pchrCursor += sprintf(pchrCursor, (const char*)"Polygon under mouse has %d edges\n", bpo.bpo_abpePolygonEdges.Count());
pchrCursor += sprintf(pchrCursor, (const char*)"Shadow on polygon under mouse occupies %g kb\n", bpo.bpo_smShadowMap.GetShadowSize()/1024.0f);
}
}

Expand All @@ -8238,11 +8238,11 @@ else {\
ctPlanes += itbsc->bsc_abplPlanes.Count();
}
pchrCursor += sprintf(pchrCursor, "%-24s %d\n%-24s %d\n%-24s %d\n%-24s %d\n%-24s %d\n%",
"No of sectors:", ctSectors,
"No of polygons:", ctPolygons,
"No of edges:", ctEdges,
"No of vertices:", ctVertices,
"No of planes:", ctPlanes);
(const char*)"No of sectors:", ctSectors,
(const char*)"No of polygons:", ctPolygons,
(const char*)"No of edges:", ctEdges,
(const char*)"No of vertices:", ctVertices,
(const char*)"No of planes:", ctPlanes);
}
else
{
Expand Down

0 comments on commit 912964e

Please sign in to comment.