mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- do not call handleEvents outside the main loop.
In other places I_GetEvent should be used to call the system's message pump and keep the app responsive, but all game side processing should be skipped.
This commit is contained in:
parent
fbdc6c7a6c
commit
7bb6b6a1ee
9 changed files with 26 additions and 40 deletions
|
@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "baselayer.h"
|
#include "baselayer.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "common_game.h"
|
#include "common_game.h"
|
||||||
|
#include "g_input.h"
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "blood.h"
|
#include "blood.h"
|
||||||
|
@ -315,7 +316,7 @@ void PreloadTiles(void)
|
||||||
fxPrecache();
|
fxPrecache();
|
||||||
gibPrecache();
|
gibPrecache();
|
||||||
|
|
||||||
gameHandleEvents();
|
I_GetEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreloadCache(void)
|
void PreloadCache(void)
|
||||||
|
@ -325,21 +326,20 @@ void PreloadCache(void)
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int percentDisplayed = -1;
|
int percentDisplayed = -1;
|
||||||
|
|
||||||
for (int i=0; i<kMaxTiles && !inputState.GetKeyStatus(sc_Space); i++)
|
for (int i = 0; i < kMaxTiles && !inputState.GetKeyStatus(sc_Space); i++)
|
||||||
{
|
{
|
||||||
if (TestBitString(gotpic, i))
|
if (TestBitString(gotpic, i))
|
||||||
{
|
{
|
||||||
// For the hardware renderer precaching the raw pixel data is pointless.
|
// For the hardware renderer precaching the raw pixel data is pointless.
|
||||||
if (videoGetRenderMode() < REND_POLYMOST)
|
if (videoGetRenderMode() < REND_POLYMOST)
|
||||||
tileLoad(i);
|
tileLoad(i);
|
||||||
|
|
||||||
if (r_precache) PrecacheHardwareTextures(i);
|
if (r_precache) PrecacheHardwareTextures(i);
|
||||||
|
|
||||||
if ((++cnt & 7) == 0)
|
if ((++cnt & 7) == 0)
|
||||||
gameHandleEvents();
|
I_GetEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
memset(gotpic,0,sizeof(gotpic));
|
memset(gotpic,0,sizeof(gotpic));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,13 +621,13 @@ void ProcessFrame(void)
|
||||||
sfxUpdate3DSounds();
|
sfxUpdate3DSounds();
|
||||||
if (gMe->hand == 1)
|
if (gMe->hand == 1)
|
||||||
{
|
{
|
||||||
#define CHOKERATE 8
|
const int CHOKERATE = 8;
|
||||||
#define TICRATE 30
|
const int COUNTRATE = 30;
|
||||||
gChokeCounter += CHOKERATE;
|
gChokeCounter += CHOKERATE;
|
||||||
while (gChokeCounter >= TICRATE)
|
while (gChokeCounter >= COUNTRATE)
|
||||||
{
|
{
|
||||||
gChoke.at1c(gMe);
|
gChoke.at1c(gMe);
|
||||||
gChokeCounter -= TICRATE;
|
gChokeCounter -= COUNTRATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gLevelTime++;
|
gLevelTime++;
|
||||||
|
@ -636,14 +636,17 @@ void ProcessFrame(void)
|
||||||
if ((gGameOptions.uGameFlags&1) != 0 && !gStartNewGame)
|
if ((gGameOptions.uGameFlags&1) != 0 && !gStartNewGame)
|
||||||
{
|
{
|
||||||
ready2send = 0;
|
ready2send = 0;
|
||||||
|
#if 0
|
||||||
if (gNetPlayers > 1 && gNetMode == NETWORK_SERVER && gPacketMode == PACKETMODE_1 && myconnectindex == connecthead)
|
if (gNetPlayers > 1 && gNetMode == NETWORK_SERVER && gPacketMode == PACKETMODE_1 && myconnectindex == connecthead)
|
||||||
{
|
{
|
||||||
while (gNetFifoMasterTail < gNetFifoTail)
|
while (gNetFifoMasterTail < gNetFifoTail)
|
||||||
{
|
{
|
||||||
gameHandleEvents();
|
netGetPackets();
|
||||||
|
h andleevents();
|
||||||
netMasterUpdate();
|
netMasterUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
seqKillAll();
|
seqKillAll();
|
||||||
if (gGameOptions.uGameFlags&2)
|
if (gGameOptions.uGameFlags&2)
|
||||||
{
|
{
|
||||||
|
@ -932,7 +935,8 @@ int GameInterface::app_main()
|
||||||
if (gamestate == GS_STARTUP) gameInit();
|
if (gamestate == GS_STARTUP) gameInit();
|
||||||
|
|
||||||
commonTicker(playvideo);
|
commonTicker(playvideo);
|
||||||
gameHandleEvents();
|
netGetPackets();
|
||||||
|
handleevents();
|
||||||
updatePauseStatus();
|
updatePauseStatus();
|
||||||
D_ProcessEvents();
|
D_ProcessEvents();
|
||||||
ctrlGetInput();
|
ctrlGetInput();
|
||||||
|
|
|
@ -485,12 +485,6 @@ extern void G_ExtInit(void);
|
||||||
extern void G_SetupGlobalPsky(void);
|
extern void G_SetupGlobalPsky(void);
|
||||||
|
|
||||||
|
|
||||||
static inline int gameHandleEvents(void)
|
|
||||||
{
|
|
||||||
netGetPackets();
|
|
||||||
return handleevents();
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -6,4 +6,4 @@ void I_PutInClipboard (const char *str);
|
||||||
FString I_GetFromClipboard (bool use_primary_selection);
|
FString I_GetFromClipboard (bool use_primary_selection);
|
||||||
void I_SetMouseCapture();
|
void I_SetMouseCapture();
|
||||||
void I_ReleaseMouseCapture();
|
void I_ReleaseMouseCapture();
|
||||||
|
void I_GetEvent();
|
|
@ -526,7 +526,6 @@ public:
|
||||||
if (completion) completion(false);
|
if (completion) completion(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
handleevents();
|
|
||||||
if (actionState == State_Clear)
|
if (actionState == State_Clear)
|
||||||
{
|
{
|
||||||
actionState = State_Run;
|
actionState = State_Run;
|
||||||
|
|
|
@ -28,6 +28,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
||||||
|
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
|
#include "g_input.h"
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
|
|
||||||
#include "superfasthash.h"
|
#include "superfasthash.h"
|
||||||
|
@ -292,7 +293,7 @@ void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
while (S_CheckSoundPlaying(skillsound))
|
while (S_CheckSoundPlaying(skillsound))
|
||||||
{
|
{
|
||||||
S_Update();
|
S_Update();
|
||||||
handleevents();
|
I_GetEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ud.m_respawn_monsters = (gs.Skill == 3);
|
ud.m_respawn_monsters = (gs.Skill == 3);
|
||||||
|
|
|
@ -841,7 +841,6 @@ void donewgame(MapRecord* map, int sk)
|
||||||
template<class func>
|
template<class func>
|
||||||
void newgame(MapRecord* map, int sk, func completion)
|
void newgame(MapRecord* map, int sk, func completion)
|
||||||
{
|
{
|
||||||
handleevents();
|
|
||||||
ready2send = 0;
|
ready2send = 0;
|
||||||
|
|
||||||
auto completion1 = [=](bool res)
|
auto completion1 = [=](bool res)
|
||||||
|
|
|
@ -36,6 +36,7 @@ source as it is released.
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
#include "g_input.h"
|
||||||
|
|
||||||
#include "duke3d.h"
|
#include "duke3d.h"
|
||||||
#include "raze_music.h"
|
#include "raze_music.h"
|
||||||
|
@ -103,7 +104,7 @@ void S_CacheAllSounds(void)
|
||||||
{
|
{
|
||||||
soundEngine->CacheSound(&snd);
|
soundEngine->CacheSound(&snd);
|
||||||
if (((++i)&31) == 0)
|
if (((++i)&31) == 0)
|
||||||
handleevents();
|
I_GetEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#include "ns.h" // Must come before everything else!
|
#include "ns.h" // Must come before everything else!
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
#include "g_input.h"
|
||||||
|
|
||||||
#include "names2.h"
|
#include "names2.h"
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
|
@ -221,7 +222,7 @@ void GameInterface::StartGame(FNewGameStartup& gs)
|
||||||
while (soundEngine->IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_VOICE))
|
while (soundEngine->IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_VOICE))
|
||||||
{
|
{
|
||||||
DoUpdateSounds();
|
DoUpdateSounds();
|
||||||
handleevents();
|
I_GetEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,21 +412,8 @@ bool InitGame()
|
||||||
InitPalette();
|
InitPalette();
|
||||||
// sets numplayers, connecthead, connectpoint2, myconnectindex
|
// sets numplayers, connecthead, connectpoint2, myconnectindex
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!firstnet)
|
|
||||||
initmultiplayers(0, NULL, 0, 0, 0);
|
|
||||||
else if (initmultiplayersparms(argc - firstnet, &argv[firstnet]))
|
|
||||||
{
|
|
||||||
Printf("Waiting for players...\n");
|
|
||||||
while (initmultiplayerscycle())
|
|
||||||
{
|
|
||||||
handleevents();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
numplayers = 1; myconnectindex = 0;
|
numplayers = 1; myconnectindex = 0;
|
||||||
connecthead = 0; connectpoint2[0] = -1;
|
connecthead = 0; connectpoint2[0] = -1;
|
||||||
#endif
|
|
||||||
initsynccrc();
|
initsynccrc();
|
||||||
|
|
||||||
// code to duplicate packets
|
// code to duplicate packets
|
||||||
|
|
Loading…
Reference in a new issue