Skip to content

Commit

Permalink
Fixed HUD, player FOV, weapon FOV for Serious Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Oct 13, 2023
1 parent 43b412b commit 71b030e
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,19 @@ All notable changes to this project will be documented in this file.
## 2023-06-07 - 2023-06-09
- Adding root CMakeLists.txt to build files for Serious Sam Classic The First Encounter and Serious Sam Classic The Second Encounter.
- Added debian directory for building deb package using regular tools(bzr debuild) under Debian/Ubuntu.

## 2023-06-15 - 2023-07-07
- Fixed OpenGL lens flares,fix platform definition and CMakeList.
- Fixed loading of some incorrect custom maps.

## 2023-10-03 - 2023-10-14
- Added support building only OpenGL version of game.
- Fixed Obelisk textures and Alley Of Sphinxes textures (TFE).
- Fixed incorrect variable type in Beast.es.
- Removed deprecated PlatformToolset from aml11lib (Win).
- Fixed Serious Editor 64-bit 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.
- SeriousModeler: Fixed conversion of pointers to 32 bits (Win).
- SeriousSkaStudio: Fixed conversion of pointers to 32 bits (Win).
- Fixed HUD, player FOV, weapon FOV for Serious Editor.
2 changes: 1 addition & 1 deletion SamTFE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local" OR CMAKE_INSTALL_PREFIX STREQUAL "
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/../") # set install path to project root directory since
endif() # since one wasn't set during config
set(LOCAL_INSTALL TRUE)
message(STATUS "Using LOCAL Imstall")
message(STATUS "Using LOCAL Install")
endif()
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr" ) # Only works for linux since I don't know what default is for windows/macos/freebsd.
set(LOCAL_INSTALL FALSE)
Expand Down
60 changes: 60 additions & 0 deletions SamTFE/Sources/WorldEditor/ChildFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ static char THIS_FILE[] = __FILE__;
extern INDEX wed_bSaveTestGameFirstTime = TRUE;
ENGINE_API extern INDEX snd_iFormat;

extern ENGINE_API FLOAT _fPlayerFOVAdjuster;
extern ENGINE_API FLOAT _fWeaponFOVAdjuster;
extern ENGINE_API FLOAT _fArmorHeightAdjuster;
extern ENGINE_API FLOAT _fFragScorerHeightAdjuster;

/////////////////////////////////////////////////////////////////////////////
// CChildFrame

Expand Down Expand Up @@ -401,6 +406,48 @@ CWorldEditorView *CChildFrame::GetPerspectiveView(void)

#define APPLICATION_NAME "TestGame FullScreen"

void CChildFrame::SetAdjusters(float ratio)
{
//if (pdp == NULL) return;
//float ratio = (float)pdp->GetWidth() / (float)pdp->GetHeight();
if (ratio >= 1.30f && ratio < 1.43f) //4:3
{
_fWeaponFOVAdjuster = 1.0f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.0f; //Field of View for player
_fArmorHeightAdjuster = 0.7f;
_fFragScorerHeightAdjuster = 0.75f;
}else if (ratio >= 1.2f && ratio < 1.30f) //5:4
{
_fWeaponFOVAdjuster = 1.0f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.0f; //Field of View for player
_fArmorHeightAdjuster = 0.7f;
_fFragScorerHeightAdjuster = 0.75f;
}else if (ratio >= 1.73f && ratio < 1.8f) //16:9
{
_fWeaponFOVAdjuster = 1.25f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.15f; //Field of View for player
_fArmorHeightAdjuster = 0.835f;
_fFragScorerHeightAdjuster = 1.5f;
}else if (ratio >= 1.43f && ratio < 1.73f) //16:10
{
_fWeaponFOVAdjuster = 1.15f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.10f; //Field of View for player
_fArmorHeightAdjuster = 0.78f;
_fFragScorerHeightAdjuster = 1.17f;
}else if (ratio >= 1.8f && ratio <= 4.2f) //21:9
{
_fWeaponFOVAdjuster = 1.55f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.35f; //Field of View for player
_fArmorHeightAdjuster = 1.0f;
_fFragScorerHeightAdjuster = 2.35f;
}
_pShell->SetFLOAT("_fWeaponFOVAdjuster", _fWeaponFOVAdjuster);
_pShell->SetFLOAT("_fPlayerFOVAdjuster", _fPlayerFOVAdjuster);
_pShell->SetFLOAT("_fArmorHeightAdjuster", _fArmorHeightAdjuster);
_pShell->SetFLOAT("_fFragScorerHeightAdjuster", _fFragScorerHeightAdjuster);
/* CPrintF("[WorlEditor] _fWeaponFOVAdjuster: %f _fPlayerFOVAdjuster: %f _fArmorHeightAdjuster: %f _fFragScorerHeightAdjuster: %f\n",
_fWeaponFOVAdjuster,_fPlayerFOVAdjuster, _fArmorHeightAdjuster,_fFragScorerHeightAdjuster ); */ // For Debug
}

void CChildFrame::TestGame( BOOL bFullScreen)
{
Expand Down Expand Up @@ -467,6 +514,19 @@ void CChildFrame::TestGame( BOOL bFullScreen)
HINSTANCE hInstanceFullScreen;
WNDCLASSEX wcFullScreen;
char achWindowTitle[256]; // current window title

// Set Adjusters for HUD and FOV
FLOAT ratio;
if (bFullScreen) {
ratio = (FLOAT)theApp.m_dmFullScreen.dm_pixSizeI / (FLOAT)theApp.m_dmFullScreen.dm_pixSizeJ;
} else {
ratio = (FLOAT)pdp->GetWidth() / (FLOAT)pdp->GetHeight();
}
/*
CPrintF("[WorlEditor] pdp->GetWidth: %d pdp->GetHeight: %d Ratio: %f\n",pdp->GetWidth(), pdp->GetHeight(), ratio);
*/ // For Debug
SetAdjusters(ratio);

if( bFullScreen)
{
// get full screen display mode info
Expand Down
1 change: 1 addition & 0 deletions SamTFE/Sources/WorldEditor/ChildFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CChildFrame : public CMDIChildWnd
inline INDEX CChildFrame::GetVSplitters(void) { return m_wndSplitter.GetRowCount();}
CWorldEditorView *GetPerspectiveView(void);
void TestGame( BOOL bFullScreen);
void SetAdjusters(float ratio);

// Overrides
// ClassWizard generated virtual function overrides
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local" OR CMAKE_INSTALL_PREFIX STREQUAL "
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/../") # set install path to project root directory since
endif() # since one wasn't set during config
set(LOCAL_INSTALL TRUE)
message(STATUS "Using LOCAL Imstall")
message(STATUS "Using LOCAL Install")
endif()
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr" ) # Only works for linux since I don't know what default is for windows/macos/freebsd.
set(LOCAL_INSTALL FALSE)
Expand Down
60 changes: 60 additions & 0 deletions SamTSE/Sources/WorldEditor/ChildFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ static char THIS_FILE[] = __FILE__;
extern INDEX wed_bSaveTestGameFirstTime = TRUE;
ENGINE_API extern INDEX snd_iFormat;

extern ENGINE_API FLOAT _fPlayerFOVAdjuster;
extern ENGINE_API FLOAT _fWeaponFOVAdjuster;
extern ENGINE_API FLOAT _fArmorHeightAdjuster;
extern ENGINE_API FLOAT _fFragScorerHeightAdjuster;

/////////////////////////////////////////////////////////////////////////////
// CChildFrame

Expand Down Expand Up @@ -401,6 +406,48 @@ CWorldEditorView *CChildFrame::GetPerspectiveView(void)

#define APPLICATION_NAME "TestGame FullScreen"

void CChildFrame::SetAdjusters(float ratio)
{
//if (pdp == NULL) return;
//float ratio = (float)pdp->GetWidth() / (float)pdp->GetHeight();
if (ratio >= 1.30f && ratio < 1.43f) //4:3
{
_fWeaponFOVAdjuster = 1.0f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.0f; //Field of View for player
_fArmorHeightAdjuster = 0.7f;
_fFragScorerHeightAdjuster = 0.75f;
}else if (ratio >= 1.2f && ratio < 1.30f) //5:4
{
_fWeaponFOVAdjuster = 1.0f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.0f; //Field of View for player
_fArmorHeightAdjuster = 0.7f;
_fFragScorerHeightAdjuster = 0.75f;
}else if (ratio >= 1.73f && ratio < 1.8f) //16:9
{
_fWeaponFOVAdjuster = 1.25f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.15f; //Field of View for player
_fArmorHeightAdjuster = 0.835f;
_fFragScorerHeightAdjuster = 1.5f;
}else if (ratio >= 1.43f && ratio < 1.73f) //16:10
{
_fWeaponFOVAdjuster = 1.15f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.10f; //Field of View for player
_fArmorHeightAdjuster = 0.78f;
_fFragScorerHeightAdjuster = 1.17f;
}else if (ratio >= 1.8f && ratio <= 4.2f) //21:9
{
_fWeaponFOVAdjuster = 1.55f; //Field of View for weapon
_fPlayerFOVAdjuster = 1.35f; //Field of View for player
_fArmorHeightAdjuster = 1.0f;
_fFragScorerHeightAdjuster = 2.35f;
}
_pShell->SetFLOAT("_fWeaponFOVAdjuster", _fWeaponFOVAdjuster);
_pShell->SetFLOAT("_fPlayerFOVAdjuster", _fPlayerFOVAdjuster);
_pShell->SetFLOAT("_fArmorHeightAdjuster", _fArmorHeightAdjuster);
_pShell->SetFLOAT("_fFragScorerHeightAdjuster", _fFragScorerHeightAdjuster);
/* CPrintF("[WorlEditor] _fWeaponFOVAdjuster: %f _fPlayerFOVAdjuster: %f _fArmorHeightAdjuster: %f _fFragScorerHeightAdjuster: %f\n",
_fWeaponFOVAdjuster,_fPlayerFOVAdjuster, _fArmorHeightAdjuster,_fFragScorerHeightAdjuster ); */ // For Debug
}

void CChildFrame::TestGame( BOOL bFullScreen)
{
Expand Down Expand Up @@ -467,6 +514,19 @@ void CChildFrame::TestGame( BOOL bFullScreen)
HINSTANCE hInstanceFullScreen;
WNDCLASSEX wcFullScreen;
char achWindowTitle[256]; // current window title

// Set Adjusters for HUD and FOV
FLOAT ratio;
if (bFullScreen) {
ratio = (FLOAT)theApp.m_dmFullScreen.dm_pixSizeI / (FLOAT)theApp.m_dmFullScreen.dm_pixSizeJ;
} else {
ratio = (FLOAT)pdp->GetWidth() / (FLOAT)pdp->GetHeight();
}
/*
CPrintF("[WorlEditor] pdp->GetWidth: %d pdp->GetHeight: %d Ratio: %f\n",pdp->GetWidth(), pdp->GetHeight(), ratio);
*/ // For Debug
SetAdjusters(ratio);

if( bFullScreen)
{
// get full screen display mode info
Expand Down
1 change: 1 addition & 0 deletions SamTSE/Sources/WorldEditor/ChildFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CChildFrame : public CMDIChildWnd
inline INDEX CChildFrame::GetVSplitters(void) { return m_wndSplitter.GetRowCount();}
CWorldEditorView *GetPerspectiveView(void);
void TestGame( BOOL bFullScreen);
void SetAdjusters(float ratio);

// Overrides
// ClassWizard generated virtual function overrides
Expand Down

0 comments on commit 71b030e

Please sign in to comment.