Skip to content

Commit f3aadfa

Browse files
committed
- Added camera move speed setting
- Tweak to EMP effect for high fps - Debug flag changes
1 parent d032257 commit f3aadfa

6 files changed

Lines changed: 549 additions & 531 deletions

File tree

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,59 @@
1-
#pragma once
2-
3-
class GenOnlineSettings
4-
{
5-
public:
6-
GenOnlineSettings();
7-
8-
float Camera_GetMinHeight() const { return m_Camera_MinHeight; }
9-
float Camera_GetMaxHeight_WhenLobbyHost() const { return m_Camera_MaxHeight_LobbyHost; }
10-
11-
float DetermineCameraMaxHeight();
12-
13-
bool Input_LockCursorToGameWindow() const { return m_Input_LockCursorToGameWindow; }
14-
15-
void Save_Camera_MaxHeight_WhenLobbyHost(float maxHeight)
16-
{
17-
if (maxHeight >= GENERALS_ONLINE_MIN_LOBBY_CAMERA_ZOOM || maxHeight <= GENERALS_ONLINE_MAX_LOBBY_CAMERA_ZOOM)
18-
{
19-
m_Camera_MaxHeight_LobbyHost = maxHeight;
20-
Save();
21-
}
22-
}
23-
24-
bool Graphics_DrawStatsOverlay() const { return m_Render_DrawStatsOverlay; }
25-
bool Graphics_LimitFramerate() const { return m_Render_LimitFramerate; }
26-
int Graphics_GetFPSLimit() const { return std::max<int>(m_Render_FramerateLimit_FPSVal, 60); }
27-
28-
int GetChatLifeSeconds() const { return std::max<int>(m_Chat_LifeSeconds, 10); }
29-
30-
void Initialize()
31-
{
32-
m_bInitialized = true;
33-
Load();
34-
}
35-
36-
private:
37-
void Load(void);
38-
void Save();
39-
40-
private:
41-
// NOTE: This also works as the default creation (since we just call Save)
42-
const float m_Camera_MinHeight_default = 100.f;
43-
float m_Camera_MinHeight = m_Camera_MinHeight_default;
44-
45-
float m_Camera_MaxHeight_LobbyHost = GENERALS_ONLINE_DEFAULT_LOBBY_CAMERA_ZOOM;
46-
47-
bool m_Input_LockCursorToGameWindow = true;
48-
49-
bool m_bInitialized = false;
50-
51-
bool m_Render_DrawStatsOverlay = true;
52-
bool m_Render_LimitFramerate = true;
53-
int m_Render_FramerateLimit_FPSVal = 60;
54-
int m_Chat_LifeSeconds = 30;
1+
#pragma once
2+
3+
class GenOnlineSettings
4+
{
5+
public:
6+
GenOnlineSettings();
7+
8+
float Camera_MoveSpeedRatio() const { return m_Camera_MoveSpeedRatio; }
9+
float Camera_GetMinHeight() const { return m_Camera_MinHeight; }
10+
float Camera_GetMaxHeight_WhenLobbyHost() const { return m_Camera_MaxHeight_LobbyHost; }
11+
12+
float DetermineCameraMaxHeight();
13+
14+
bool Input_LockCursorToGameWindow() const { return m_Input_LockCursorToGameWindow; }
15+
16+
void Save_Camera_MaxHeight_WhenLobbyHost(float maxHeight)
17+
{
18+
if (maxHeight >= GENERALS_ONLINE_MIN_LOBBY_CAMERA_ZOOM || maxHeight <= GENERALS_ONLINE_MAX_LOBBY_CAMERA_ZOOM)
19+
{
20+
m_Camera_MaxHeight_LobbyHost = maxHeight;
21+
Save();
22+
}
23+
}
24+
25+
bool Graphics_DrawStatsOverlay() const { return m_Render_DrawStatsOverlay; }
26+
bool Graphics_LimitFramerate() const { return m_Render_LimitFramerate; }
27+
int Graphics_GetFPSLimit() const { return std::max<int>(m_Render_FramerateLimit_FPSVal, 60); }
28+
29+
int GetChatLifeSeconds() const { return std::max<int>(m_Chat_LifeSeconds, 10); }
30+
31+
void Initialize()
32+
{
33+
m_bInitialized = true;
34+
Load();
35+
}
36+
37+
private:
38+
void Load(void);
39+
void Save();
40+
41+
private:
42+
// NOTE: This also works as the default creation (since we just call Save)
43+
const float m_Camera_MinHeight_default = 100.f;
44+
float m_Camera_MinHeight = m_Camera_MinHeight_default;
45+
46+
const float m_Camera_MoveSpeedRatio_default = 1.f;
47+
float m_Camera_MoveSpeedRatio = m_Camera_MoveSpeedRatio_default;
48+
49+
float m_Camera_MaxHeight_LobbyHost = GENERALS_ONLINE_DEFAULT_LOBBY_CAMERA_ZOOM;
50+
51+
bool m_Input_LockCursorToGameWindow = true;
52+
53+
bool m_bInitialized = false;
54+
55+
bool m_Render_DrawStatsOverlay = true;
56+
bool m_Render_LimitFramerate = true;
57+
int m_Render_FramerateLimit_FPSVal = 60;
58+
int m_Chat_LifeSeconds = 30;
5559
};

GeneralsMD/Code/GameEngine/Include/GameNetwork/GeneralsOnline/NextGenMP_defines.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@
5353
// useful for testing release builds with multiple logins
5454
//#define GENERALS_ONLINE_DONT_SAVE_CREDENTIALS 1
5555

56+
#define GENERALS_ONLINE_USE_LARGER_DMAPOOL 1
5657

5758
#if defined(_DEBUG)
5859
#define GENERALS_ONLINE_INSTABUILD 1
5960
#define GENERALS_ONLINE_FREEBUILD 1
6061
#define GENERALS_ONLINE_BUILD_ANY 1
61-
#define GENERALS_ONLINE_ALL_SCIENCES 1
62-
#define GENERALS_ONLINE_MAX_SCIENCES_POINTS 1
62+
//#define GENERALS_ONLINE_ALL_SCIENCES 1
63+
//#define GENERALS_ONLINE_MAX_SCIENCES_POINTS 1
6364
#endif
6465

6566
#if !_DEBUG

GeneralsMD/Code/GameEngine/Include/GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ class NGMP_OnlineServices_LobbyInterface
192192
{
193193
// cheats
194194
#if defined(GENERALS_ONLINE_ALL_SCIENCES)
195-
static bool GrantAllSciences = false;
195+
static bool GrantAllSciences = true;
196196
if (GrantAllSciences)
197197
{
198-
GrantAllSciences = false;
198+
//GrantAllSciences = false;
199199
Player* player = ThePlayerList->getLocalPlayer();
200200
if (player)
201201
{
@@ -207,10 +207,11 @@ class NGMP_OnlineServices_LobbyInterface
207207
if (st != SCIENCE_INVALID && TheScienceStore->isScienceGrantable(st))
208208
{
209209
player->grantScience(st);
210+
TheInGameUI->message(UnicodeString(L"Granting all sciences!"));
210211
}
211212
}
212213
}
213-
TheInGameUI->message(UnicodeString(L"Granting all sciences!"));
214+
214215
}
215216
#endif
216217

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,13 @@ void EMPUpdate::doDisableAttack( void )
337337

338338
sys->attachToObject(curVictim);
339339
sys->setPosition( &offs );
340+
#if defined(GENERALS_ONLINE) && defined(GENERALS_ONLINE_HIGH_FPS_SERVER)
341+
sys->setSystemLifetime(MAX(0, (data->m_disabledDuration/ GENERALS_ONLINE_HIGH_FPS_FRAME_MULTIPLIER) - 240));
342+
sys->setInitialDelay(GameLogicRandomValue(1, 100) / GENERALS_ONLINE_HIGH_FPS_FRAME_MULTIPLIER);
343+
#else
340344
sys->setSystemLifetime(MAX(0, data->m_disabledDuration - 30));
341-
sys->setInitialDelay(GameLogicRandomValue(1,100));
345+
sys->setInitialDelay(GameLogicRandomValue(1, 100));
346+
#endif
342347
}
343348
}
344349
}

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/GeneralsOnline_Settings.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#define SETTINGS_KEY_CAMERA "camera"
77
#define SETTINGS_KEY_CAMERA_MIN_HEIGHT "min_height"
8+
#define SETTINGS_KEY_CAMERA_MOVE_SPEED_RATIO "move_speed_ratio"
89
#define SETTINGS_KEY_CAMERA_MAX_HEIGHT_WHEN_LOBBY_HOST "max_height_when_lobby_host"
910

1011
#define SETTINGS_KEY_INPUT "input"
@@ -114,6 +115,11 @@ void GenOnlineSettings::Load(void)
114115
m_Camera_MinHeight = std::max<float>(static_cast<float>(cameraSettings[SETTINGS_KEY_CAMERA_MIN_HEIGHT]), m_Camera_MinHeight_default);
115116
}
116117

118+
if (cameraSettings.contains(SETTINGS_KEY_CAMERA_MOVE_SPEED_RATIO))
119+
{
120+
m_Camera_MoveSpeedRatio = std::clamp<float>(0.05f, static_cast<float>(cameraSettings[SETTINGS_KEY_CAMERA_MOVE_SPEED_RATIO]), 25.f);
121+
}
122+
117123
if (cameraSettings.contains(SETTINGS_KEY_CAMERA_MAX_HEIGHT_WHEN_LOBBY_HOST))
118124
{
119125
m_Camera_MaxHeight_LobbyHost = std::clamp<float>(static_cast<float>(cameraSettings[SETTINGS_KEY_CAMERA_MAX_HEIGHT_WHEN_LOBBY_HOST]), GENERALS_ONLINE_MIN_LOBBY_CAMERA_ZOOM, GENERALS_ONLINE_MAX_LOBBY_CAMERA_ZOOM);
@@ -194,7 +200,8 @@ void GenOnlineSettings::Save()
194200
SETTINGS_KEY_CAMERA,
195201
{
196202
{SETTINGS_KEY_CAMERA_MIN_HEIGHT, m_Camera_MinHeight},
197-
{SETTINGS_KEY_CAMERA_MAX_HEIGHT_WHEN_LOBBY_HOST, m_Camera_MaxHeight_LobbyHost}
203+
{SETTINGS_KEY_CAMERA_MAX_HEIGHT_WHEN_LOBBY_HOST, m_Camera_MaxHeight_LobbyHost},
204+
{ SETTINGS_KEY_CAMERA_MOVE_SPEED_RATIO, m_Camera_MoveSpeedRatio },
198205
}
199206
},
200207

0 commit comments

Comments
 (0)