mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 20:40:47 +00:00
- transitioned Blood to the new main loop.
Mostly working but interpolation is not correct yet and for some strange reason the numbers on the HUD are gone.
This commit is contained in:
parent
35b14753e7
commit
8d63e735d0
22 changed files with 477 additions and 662 deletions
|
@ -49,7 +49,6 @@ set( PCH_SOURCES
|
|||
src/messages.cpp
|
||||
src/mirrors.cpp
|
||||
src/misc.cpp
|
||||
src/network.cpp
|
||||
src/nnexts.cpp
|
||||
src/osdcmd.cpp
|
||||
src/player.cpp
|
||||
|
|
|
@ -42,7 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "globals.h"
|
||||
#include "levels.h"
|
||||
#include "loadsave.h"
|
||||
#include "network.h"
|
||||
#include "sectorfx.h"
|
||||
#include "seq.h"
|
||||
#include "sound.h"
|
||||
|
@ -61,26 +60,27 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "screenjob.h"
|
||||
#include "mapinfo.h"
|
||||
#include "choke.h"
|
||||
#include "d_net.h"
|
||||
#include "v_video.h"
|
||||
#include "map2d.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
void InitCheats();
|
||||
|
||||
bool bNoDemo = false;
|
||||
|
||||
char gUserMapFilename[BMAX_PATH];
|
||||
|
||||
short BloodVersion = 0x115;
|
||||
|
||||
bool gameRestart;
|
||||
int gNetPlayers;
|
||||
int gQuitRequest;
|
||||
|
||||
int gChokeCounter = 0;
|
||||
|
||||
bool gQuitGame;
|
||||
|
||||
int blood_globalflags;
|
||||
PLAYER gPlayerTemp[kMaxPlayers];
|
||||
int gHealthTemp[kMaxPlayers];
|
||||
vec3_t startpos;
|
||||
int16_t startang, startsectnum;
|
||||
MapRecord* gStartNewGame = nullptr;
|
||||
|
||||
|
||||
void QuitGame(void)
|
||||
{
|
||||
|
@ -97,14 +97,7 @@ void EndLevel(void)
|
|||
seqKillAll();
|
||||
}
|
||||
|
||||
|
||||
PLAYER gPlayerTemp[kMaxPlayers];
|
||||
int gHealthTemp[kMaxPlayers];
|
||||
|
||||
vec3_t startpos;
|
||||
int16_t startang, startsectnum;
|
||||
|
||||
void StartLevel(MapRecord *level)
|
||||
void StartLevel(MapRecord* level)
|
||||
{
|
||||
if (!level) return;
|
||||
STAT_Update(0);
|
||||
|
@ -120,28 +113,28 @@ void StartLevel(MapRecord *level)
|
|||
///////
|
||||
}
|
||||
#if 0
|
||||
else if (gGameOptions.nGameType > 0 && !(gGameOptions.uGameFlags&1))
|
||||
else if (gGameOptions.nGameType > 0 && !(gGameOptions.uGameFlags & 1))
|
||||
{
|
||||
// todo
|
||||
gBlueFlagDropped = false;
|
||||
gRedFlagDropped = false;
|
||||
}
|
||||
#endif
|
||||
if (gGameOptions.uGameFlags&1)
|
||||
if (gGameOptions.uGameFlags & 1)
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
memcpy(&gPlayerTemp[i],&gPlayer[i],sizeof(PLAYER));
|
||||
memcpy(&gPlayerTemp[i], &gPlayer[i], sizeof(PLAYER));
|
||||
gHealthTemp[i] = xsprite[gPlayer[i].pSprite->extra].health;
|
||||
}
|
||||
}
|
||||
bVanilla = false;
|
||||
memset(xsprite,0,sizeof(xsprite));
|
||||
memset(sprite,0,kMaxSprites*sizeof(spritetype));
|
||||
memset(xsprite, 0, sizeof(xsprite));
|
||||
memset(sprite, 0, kMaxSprites * sizeof(spritetype));
|
||||
//drawLoadingScreen();
|
||||
if (dbLoadMap(currentLevel->fileName,(int*)&startpos.x,(int*)&startpos.y,(int*)&startpos.z,&startang,&startsectnum,nullptr))
|
||||
if (dbLoadMap(currentLevel->fileName, (int*)&startpos.x, (int*)&startpos.y, (int*)&startpos.z, &startang, &startsectnum, nullptr))
|
||||
{
|
||||
I_Error("Unable to load map");
|
||||
I_Error("%s: Unable to load map", level->DisplayName());
|
||||
}
|
||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||
STAT_NewLevel(currentLevel->fileName);
|
||||
|
@ -155,10 +148,10 @@ void StartLevel(MapRecord *level)
|
|||
int modernTypesErased = 0;
|
||||
for (int i = 0; i < kMaxSprites; i++)
|
||||
{
|
||||
spritetype *pSprite = &sprite[i];
|
||||
spritetype* pSprite = &sprite[i];
|
||||
if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) {
|
||||
|
||||
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
||||
XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
||||
if ((pXSprite->lSkill & (1 << gGameOptions.nDifficulty)) || (pXSprite->lS && gGameOptions.nGameType == 0)
|
||||
|| (pXSprite->lB && gGameOptions.nGameType == 2) || (pXSprite->lT && gGameOptions.nGameType == 3)
|
||||
|| (pXSprite->lC && gGameOptions.nGameType == 1)) {
|
||||
|
@ -168,19 +161,19 @@ void StartLevel(MapRecord *level)
|
|||
}
|
||||
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (!gModernMap && nnExtEraseModernStuff(pSprite, pXSprite))
|
||||
modernTypesErased++;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (!gModernMap)
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (!gModernMap && modernTypesErased > 0)
|
||||
Printf(PRINT_NONOTIFY, "> Modern types erased: %d.\n", modernTypesErased);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
startpos.z = getflorzofslope(startsectnum,startpos.x,startpos.y);
|
||||
startpos.z = getflorzofslope(startsectnum, startpos.x, startpos.y);
|
||||
for (int i = 0; i < kMaxPlayers; i++) {
|
||||
gStartZone[i].x = startpos.x;
|
||||
gStartZone[i].y = startpos.y;
|
||||
|
@ -188,7 +181,7 @@ void StartLevel(MapRecord *level)
|
|||
gStartZone[i].sectnum = startsectnum;
|
||||
gStartZone[i].ang = startang;
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
// Create spawn zones for players in teams mode.
|
||||
if (gModernMap && i <= kMaxPlayers / 2) {
|
||||
gStartZoneTeam1[i].x = startpos.x;
|
||||
|
@ -203,7 +196,7 @@ void StartLevel(MapRecord *level)
|
|||
gStartZoneTeam2[i].sectnum = startsectnum;
|
||||
gStartZoneTeam2[i].ang = startang;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
InitSectorFX();
|
||||
warpInit();
|
||||
|
@ -211,23 +204,21 @@ void StartLevel(MapRecord *level)
|
|||
evInit();
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
if (!(gGameOptions.uGameFlags&1))
|
||||
if (!(gGameOptions.uGameFlags & 1))
|
||||
{
|
||||
if (numplayers == 1)
|
||||
{
|
||||
gProfile[i].skill = gSkill;
|
||||
gProfile[i].nAutoAim = cl_autoaim;
|
||||
gProfile[i].nWeaponSwitch = cl_weaponswitch;
|
||||
}
|
||||
playerInit(i,0);
|
||||
playerInit(i, 0);
|
||||
}
|
||||
playerStart(i, 1);
|
||||
}
|
||||
if (gGameOptions.uGameFlags&1)
|
||||
if (gGameOptions.uGameFlags & 1)
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
PLAYER *pPlayer = &gPlayer[i];
|
||||
PLAYER* pPlayer = &gPlayer[i];
|
||||
pPlayer->pXSprite->health &= 0xf000;
|
||||
pPlayer->pXSprite->health |= gHealthTemp[i];
|
||||
pPlayer->weaponQav = gPlayerTemp[i].weaponQav;
|
||||
|
@ -247,14 +238,13 @@ void StartLevel(MapRecord *level)
|
|||
if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect
|
||||
sfxSetReverb(0);
|
||||
ambInit();
|
||||
netReset();
|
||||
Net_ClearFifo();
|
||||
gFrameCount = 0;
|
||||
gChokeCounter = 0;
|
||||
M_ClearMenus();
|
||||
// viewSetMessage("");
|
||||
viewSetErrorMessage("");
|
||||
gameclock = 0;
|
||||
lastTic = -1;
|
||||
paused = 0;
|
||||
levelTryPlayMusic();
|
||||
gFrameClock = 0;
|
||||
|
@ -264,20 +254,72 @@ void StartLevel(MapRecord *level)
|
|||
|
||||
bool gRestartGame = false;
|
||||
|
||||
void ProcessFrame(void)
|
||||
static void commonTicker()
|
||||
{
|
||||
if (TestBitString(gotpic, 2342))
|
||||
{
|
||||
FireProcess();
|
||||
ClearBitString(gotpic, 2342);
|
||||
}
|
||||
if (gStartNewGame)
|
||||
{
|
||||
auto sng = gStartNewGame;
|
||||
gStartNewGame = nullptr;
|
||||
gQuitGame = false;
|
||||
auto completion = [=](bool = false)
|
||||
{
|
||||
StartLevel(sng);
|
||||
|
||||
gamestate = GS_LEVEL;
|
||||
};
|
||||
|
||||
bool startedCutscene = false;
|
||||
if (!(sng->flags & MI_USERMAP))
|
||||
{
|
||||
int episode = volfromlevelnum(sng->levelNumber);
|
||||
int level = mapfromlevelnum(sng->levelNumber);
|
||||
if (gEpisodeInfo[episode].cutALevel == level && gEpisodeInfo[episode].cutsceneAName[0])
|
||||
{
|
||||
levelPlayIntroScene(episode, completion);
|
||||
startedCutscene = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (!startedCutscene) completion(false);
|
||||
}
|
||||
else if (gRestartGame)
|
||||
{
|
||||
Mus_Stop();
|
||||
soundEngine->StopAllChannels();
|
||||
gQuitGame = 0;
|
||||
gQuitRequest = 0;
|
||||
gRestartGame = 0;
|
||||
|
||||
// Don't switch to startup if we're already outside the game.
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
gamestate = GS_MENUSCREEN;
|
||||
M_StartControlPanel(false);
|
||||
M_SetMenu(NAME_Mainmenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GameInterface::Ticker()
|
||||
{
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
auto& inp = gPlayer[i].input;
|
||||
auto oldactions = inp.actions;
|
||||
|
||||
inp = gFifoInput[gNetFifoTail & 255][i];
|
||||
inp.actions |= oldactions & ~(SB_BUTTON_MASK|SB_RUN|SB_WEAPONMASK_BITS); // should be everything non-button and non-weapon
|
||||
inp = playercmds[i].ucmd;
|
||||
inp.actions |= oldactions & ~(SB_BUTTON_MASK | SB_RUN | SB_WEAPONMASK_BITS); // should be everything non-button and non-weapon
|
||||
|
||||
int newweap = inp.getNewWeapon();
|
||||
if (newweap > 0 && newweap < WeaponSel_MaxBlood) gPlayer[i].newWeapon = newweap;
|
||||
}
|
||||
gNetFifoTail++;
|
||||
|
||||
// This is single player only.
|
||||
if (gameRestart)
|
||||
|
@ -336,22 +378,22 @@ void ProcessFrame(void)
|
|||
gFrameCount++;
|
||||
gFrameClock += 4;
|
||||
|
||||
for(int i=0;i<8;i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
dword_21EFD0[i] = dword_21EFD0[i] -= 4;
|
||||
if (dword_21EFD0[i] < 0)
|
||||
dword_21EFD0[i] = 0;
|
||||
}
|
||||
|
||||
if ((gGameOptions.uGameFlags&1) != 0 && !gStartNewGame)
|
||||
if ((gGameOptions.uGameFlags & 1) != 0 && !gStartNewGame)
|
||||
{
|
||||
seqKillAll();
|
||||
if (gGameOptions.uGameFlags&2)
|
||||
if (gGameOptions.uGameFlags & 2)
|
||||
{
|
||||
STAT_Update(true);
|
||||
if (gGameOptions.nGameType == 0)
|
||||
{
|
||||
auto completion = [] (bool) {
|
||||
auto completion = [](bool) {
|
||||
gamestate = GS_MENUSCREEN;
|
||||
M_StartControlPanel(false);
|
||||
M_SetMenu(NAME_Mainmenu);
|
||||
|
@ -361,7 +403,7 @@ void ProcessFrame(void)
|
|||
gRestartGame = true;
|
||||
};
|
||||
|
||||
if (gGameOptions.uGameFlags&8)
|
||||
if (gGameOptions.uGameFlags & 8)
|
||||
{
|
||||
levelPlayEndScene(volfromlevelnum(currentLevel->levelNumber), completion);
|
||||
}
|
||||
|
@ -379,6 +421,14 @@ void ProcessFrame(void)
|
|||
ShowSummaryScreen();
|
||||
}
|
||||
}
|
||||
commonTicker();
|
||||
}
|
||||
|
||||
void GameInterface::DrawBackground()
|
||||
{
|
||||
twod->ClearScreen();
|
||||
DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
|
||||
commonTicker();
|
||||
}
|
||||
|
||||
|
||||
|
@ -423,8 +473,12 @@ void GameInterface::app_init()
|
|||
WeaponInit();
|
||||
LoadSaveSetup();
|
||||
|
||||
Printf(PRINT_NONOTIFY, "Initializing network users\n");
|
||||
netInitialize(true);
|
||||
myconnectindex = connecthead = 0;
|
||||
gNetPlayers = numplayers = 1;
|
||||
connectpoint2[0] = -1;
|
||||
gGameOptions.nGameType = 0;
|
||||
UpdateNetworkMenus();
|
||||
|
||||
Printf(PRINT_NONOTIFY, "Initializing sound system\n");
|
||||
sndInit();
|
||||
registerosdcommands();
|
||||
|
@ -437,11 +491,13 @@ void GameInterface::app_init()
|
|||
|
||||
static void gameInit()
|
||||
{
|
||||
//RESTART:
|
||||
netReset();
|
||||
//RESTART:
|
||||
gViewIndex = myconnectindex;
|
||||
gMe = gView = &gPlayer[myconnectindex];
|
||||
netBroadcastPlayerInfo(myconnectindex);
|
||||
|
||||
PROFILE* pProfile = &gProfile[myconnectindex];
|
||||
strcpy(pProfile->name, playername);
|
||||
pProfile->skill = gSkill;
|
||||
|
||||
UpdateNetworkMenus();
|
||||
gQuitGame = 0;
|
||||
|
@ -453,121 +509,9 @@ static void gameInit()
|
|||
|
||||
}
|
||||
|
||||
static void gameTicker()
|
||||
|
||||
void GameInterface::Startup()
|
||||
{
|
||||
bool gameUpdate = false;
|
||||
double const gameUpdateStartTime = I_msTimeF();
|
||||
while (gPredictTail < gNetFifoHead[myconnectindex] && !paused)
|
||||
{
|
||||
viewUpdatePrediction(&gFifoInput[gPredictTail & 255][myconnectindex]);
|
||||
}
|
||||
|
||||
int gBufferJitter = 0;
|
||||
|
||||
int const currentTic = I_GetTime();
|
||||
gameclock = I_GetBuildTime();
|
||||
|
||||
gameupdatetime.Reset();
|
||||
gameupdatetime.Clock();
|
||||
|
||||
while (currentTic - lastTic >= 1)
|
||||
{
|
||||
gNetInput = gInput;
|
||||
gInput = {};
|
||||
netGetInput();
|
||||
lastTic = currentTic;
|
||||
while (gNetFifoHead[myconnectindex] - gNetFifoTail > gBufferJitter && !gStartNewGame && !gQuitGame)
|
||||
{
|
||||
int i;
|
||||
for (i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
if (gNetFifoHead[i] == gNetFifoTail)
|
||||
break;
|
||||
if (i >= 0)
|
||||
break;
|
||||
ProcessFrame();
|
||||
gameUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
gameupdatetime.Unclock();
|
||||
|
||||
if (gQuitRequest && gQuitGame)
|
||||
videoClearScreen(0);
|
||||
else
|
||||
{
|
||||
drawtime.Reset();
|
||||
drawtime.Clock();
|
||||
viewDrawScreen();
|
||||
drawtime.Unclock();
|
||||
}
|
||||
}
|
||||
|
||||
static void drawBackground()
|
||||
{
|
||||
twod->ClearScreen();
|
||||
DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
|
||||
}
|
||||
|
||||
static void commonTicker()
|
||||
{
|
||||
if (TestBitString(gotpic, 2342))
|
||||
{
|
||||
FireProcess();
|
||||
ClearBitString(gotpic, 2342);
|
||||
}
|
||||
if (gStartNewGame)
|
||||
{
|
||||
auto sng = gStartNewGame;
|
||||
gStartNewGame = nullptr;
|
||||
gQuitGame = false;
|
||||
auto completion = [=](bool = false)
|
||||
{
|
||||
StartLevel(sng);
|
||||
|
||||
gamestate = GS_LEVEL;
|
||||
};
|
||||
|
||||
bool startedCutscene = false;
|
||||
if (!(sng->flags & MI_USERMAP))
|
||||
{
|
||||
int episode = volfromlevelnum(sng->levelNumber);
|
||||
int level = mapfromlevelnum(sng->levelNumber);
|
||||
if (gEpisodeInfo[episode].cutALevel == level && gEpisodeInfo[episode].cutsceneAName[0])
|
||||
{
|
||||
levelPlayIntroScene(episode, completion);
|
||||
startedCutscene = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (!startedCutscene) completion(false);
|
||||
}
|
||||
else if (gRestartGame)
|
||||
{
|
||||
Mus_Stop();
|
||||
soundEngine->StopAllChannels();
|
||||
gQuitGame = 0;
|
||||
gQuitRequest = 0;
|
||||
gRestartGame = 0;
|
||||
|
||||
// Don't switch to startup if we're already outside the game.
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
gamestate = GS_MENUSCREEN;
|
||||
M_StartControlPanel(false);
|
||||
M_SetMenu(NAME_Mainmenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameInterface::RunGameFrame()
|
||||
{
|
||||
commonTicker();
|
||||
ctrlGetInput();
|
||||
|
||||
switch (gamestate)
|
||||
{
|
||||
default:
|
||||
case GS_STARTUP:
|
||||
gameInit();
|
||||
if (userConfig.CommandMap.IsNotEmpty())
|
||||
{
|
||||
|
@ -582,22 +526,48 @@ void GameInterface::RunGameFrame()
|
|||
M_SetMenu(NAME_Mainmenu);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case GS_MENUSCREEN:
|
||||
case GS_FULLCONSOLE:
|
||||
drawBackground();
|
||||
break;
|
||||
|
||||
case GS_INTRO:
|
||||
case GS_INTERMISSION:
|
||||
RunScreenJobFrame(); // This handles continuation through its completion callback.
|
||||
break;
|
||||
|
||||
case GS_LEVEL:
|
||||
gameTicker();
|
||||
break;
|
||||
static void nonsharedkeys(void)
|
||||
{
|
||||
static int nonsharedtimer;
|
||||
int ms = screen->FrameTime;
|
||||
int interval;
|
||||
if (nonsharedtimer > 0 || ms < nonsharedtimer)
|
||||
{
|
||||
interval = ms - nonsharedtimer;
|
||||
}
|
||||
else
|
||||
{
|
||||
interval = 0;
|
||||
}
|
||||
nonsharedtimer = screen->FrameTime;
|
||||
|
||||
if (System_WantGuiCapture())
|
||||
return;
|
||||
|
||||
if (automapMode != am_off)
|
||||
{
|
||||
double j = interval * (120. / 1000);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
gZoom += (int)fmulscale6(j, max(gZoom, 256));
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
gZoom -= (int)fmulscale6(j, max(gZoom, 256));
|
||||
|
||||
gZoom = clamp(gZoom, 48, 2048);
|
||||
gViewMap.nZoom = gZoom;
|
||||
}
|
||||
}
|
||||
|
||||
void GameInterface::Render()
|
||||
{
|
||||
nonsharedkeys();
|
||||
drawtime.Reset();
|
||||
drawtime.Clock();
|
||||
viewDrawScreen();
|
||||
drawtime.Unclock();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "db.h"
|
||||
#include "mapinfo.h"
|
||||
#include "gamestruct.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -45,8 +46,8 @@ struct INICHAIN {
|
|||
|
||||
extern INICHAIN *pINIChain;
|
||||
|
||||
extern MapRecord* gStartNewGame;
|
||||
|
||||
extern short BloodVersion;
|
||||
extern int gNetPlayers;
|
||||
extern bool gRestartGame;
|
||||
extern int blood_globalflags;
|
||||
|
@ -77,7 +78,6 @@ struct GameInterface : ::GameInterface
|
|||
{
|
||||
const char* Name() override { return "Blood"; }
|
||||
void app_init() override;
|
||||
void RunGameFrame() override;
|
||||
bool GenerateSavePic() override;
|
||||
void FreeGameData() override;
|
||||
FSavegameInfo GetSaveSig() override;
|
||||
|
@ -94,6 +94,11 @@ struct GameInterface : ::GameInterface
|
|||
FString GetCoordString() override;
|
||||
ReservedSpace GetReservedScreenSpace(int viewsize) override;
|
||||
void UpdateSounds() override;
|
||||
void GetInput(InputPacket* gInput) override;
|
||||
void Ticker() override;
|
||||
void DrawBackground() override;
|
||||
void Startup() override;
|
||||
void Render() override;
|
||||
|
||||
GameStats getStats() override;
|
||||
};
|
||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "common.h"
|
||||
#include "pragmas.h"
|
||||
#include "misc.h"
|
||||
#include "network.h"
|
||||
#include "printf.h"
|
||||
#include "v_text.h"
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
InputPacket gInput, gNetInput;
|
||||
InputPacket gInput;
|
||||
bool bSilentAim = false;
|
||||
|
||||
int iTurnCount = 0;
|
||||
|
@ -51,7 +51,7 @@ float gViewAngleAdjust;
|
|||
float gViewLookAdjust;
|
||||
int gViewLookRecenter;
|
||||
|
||||
void ctrlGetInput(void)
|
||||
void GetInputInternal(InputPacket &inputParm)
|
||||
{
|
||||
int prevPauseState = paused;
|
||||
ControlInfo info;
|
||||
|
@ -64,60 +64,26 @@ void ctrlGetInput(void)
|
|||
|
||||
auto scaleAdjustmentToInterval = [=](double x) { return x * kTicsPerSec / (1000.0 / elapsedInputTicks); };
|
||||
|
||||
if (gamestate != GS_LEVEL || System_WantGuiCapture())
|
||||
{
|
||||
gInput = {};
|
||||
CONTROL_GetInput(&info);
|
||||
return;
|
||||
}
|
||||
|
||||
if (paused)
|
||||
return;
|
||||
|
||||
InputPacket input = {};
|
||||
|
||||
if (numplayers == 1)
|
||||
{
|
||||
gProfile[myconnectindex].nAutoAim = cl_autoaim;
|
||||
gProfile[myconnectindex].nWeaponSwitch = cl_weaponswitch;
|
||||
}
|
||||
|
||||
CONTROL_GetInput(&info);
|
||||
|
||||
ApplyGlobalInput(gInput, &info);
|
||||
ApplyGlobalInput(inputParm, &info);
|
||||
|
||||
bool mouseaim = !(gInput.actions & SB_AIMMODE);
|
||||
if (!mouseaim) gInput.actions |= SB_CENTERVIEW;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
{
|
||||
if (automapMode != am_off)
|
||||
{
|
||||
gZoom = ClipLow(gZoom - (gZoom >> 4), 64);
|
||||
gViewMap.nZoom = gZoom;
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
if (automapMode != am_off)
|
||||
{
|
||||
gZoom = ClipHigh(gZoom + (gZoom >> 4), 4096);
|
||||
gViewMap.nZoom = gZoom;
|
||||
}
|
||||
}
|
||||
bool mouseaim = !(inputParm.actions & SB_AIMMODE);
|
||||
if (!mouseaim) inputParm.actions |= SB_CENTERVIEW;
|
||||
|
||||
if (gPlayer[myconnectindex].nextWeapon == 0)
|
||||
{
|
||||
}
|
||||
|
||||
if (gInput.actions & (SB_LOOK_UP|SB_LOOK_DOWN))
|
||||
gInput.actions |= SB_CENTERVIEW;
|
||||
if (inputParm.actions & (SB_LOOK_UP|SB_LOOK_DOWN))
|
||||
inputParm.actions |= SB_CENTERVIEW;
|
||||
|
||||
int const run = !!(gInput.actions & SB_RUN);
|
||||
int const run = !!(inputParm.actions & SB_RUN);
|
||||
int const keyMove = (1 + run) << 10;
|
||||
|
||||
if (gInput.fvel < keyMove && gInput.fvel > -keyMove)
|
||||
if (inputParm.fvel < keyMove && inputParm.fvel > -keyMove)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||
input.fvel += keyMove;
|
||||
|
@ -126,7 +92,7 @@ void ctrlGetInput(void)
|
|||
input.fvel -= keyMove;
|
||||
}
|
||||
|
||||
if (gInput.svel < keyMove && gInput.svel > -keyMove)
|
||||
if (inputParm.svel < keyMove && inputParm.svel > -keyMove)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
|
||||
input.svel += keyMove;
|
||||
|
@ -139,7 +105,7 @@ void ctrlGetInput(void)
|
|||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
if (gInput.svel < keyMove && gInput.svel > -keyMove)
|
||||
if (inputParm.svel < keyMove && inputParm.svel > -keyMove)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
input.svel += keyMove;
|
||||
|
@ -210,11 +176,11 @@ void ctrlGetInput(void)
|
|||
input.fvel = 0;
|
||||
input.svel = 0;
|
||||
}
|
||||
gInput.fvel = clamp(gInput.fvel + input.fvel, -2048, 2048);
|
||||
gInput.svel = clamp(gInput.svel + input.svel, -2048, 2048);
|
||||
gInput.q16avel += input.q16avel;
|
||||
gInput.q16horz = clamp(gInput.q16horz + input.q16horz, IntToFixed(-127)>>2, IntToFixed(127)>>2);
|
||||
if (gMe && gMe->pXSprite->health != 0 && !paused)
|
||||
inputParm.fvel = clamp(inputParm.fvel + input.fvel, -2048, 2048);
|
||||
inputParm.svel = clamp(inputParm.svel + input.svel, -2048, 2048);
|
||||
inputParm.q16avel += input.q16avel;
|
||||
inputParm.q16horz = clamp(inputParm.q16horz + input.q16horz, IntToFixed(-127)>>2, IntToFixed(127)>>2);
|
||||
if (gMe && gMe->pXSprite && gMe->pXSprite->health != 0 && !paused)
|
||||
{
|
||||
int upAngle = 289;
|
||||
int downAngle = -347;
|
||||
|
@ -236,4 +202,14 @@ void ctrlGetInput(void)
|
|||
}
|
||||
}
|
||||
|
||||
void GameInterface::GetInput(InputPacket* packet)
|
||||
{
|
||||
GetInputInternal(gInput);
|
||||
if (packet)
|
||||
{
|
||||
*packet = gInput;
|
||||
gInput = {};
|
||||
}
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
extern InputPacket gInput, gNetInput;
|
||||
extern InputPacket gInput;
|
||||
extern bool bSilentAim;
|
||||
|
||||
extern fixed_t gViewLook, gViewAngle;
|
||||
|
|
|
@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "globals.h"
|
||||
#include "levels.h"
|
||||
#include "loadsave.h"
|
||||
#include "network.h"
|
||||
#include "player.h"
|
||||
#include "sound.h"
|
||||
#include "view.h"
|
||||
|
|
|
@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "levels.h"
|
||||
#include "loadsave.h"
|
||||
#include "messages.h"
|
||||
#include "network.h"
|
||||
#include "seq.h"
|
||||
#include "sound.h"
|
||||
#include "view.h"
|
||||
|
|
|
@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "globals.h"
|
||||
#include "db.h"
|
||||
#include "messages.h"
|
||||
#include "network.h"
|
||||
#include "loadsave.h"
|
||||
#include "sectorfx.h"
|
||||
#include "seq.h"
|
||||
|
@ -44,6 +43,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "raze_music.h"
|
||||
#include "mapinfo.h"
|
||||
#include "gamestate.h"
|
||||
#include "d_net.h"
|
||||
|
||||
#include "aistate.h"
|
||||
#include "aiunicult.h"
|
||||
|
@ -501,15 +501,11 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
|
|||
if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect
|
||||
sfxSetReverb(0);
|
||||
ambInit();
|
||||
gNetFifoTail = 0;
|
||||
memset(gNetFifoHead, 0, sizeof(gNetFifoHead));
|
||||
gPredictTail = 0;
|
||||
memset(gFifoInput, 0, sizeof(gFifoInput));
|
||||
for (int i = 0; i < gNetPlayers; i++)
|
||||
playerSetRace(&gPlayer[i], gPlayer[i].lifeMode);
|
||||
viewSetErrorMessage("");
|
||||
gFrameCount = 0;
|
||||
lastTic = -1;
|
||||
Net_ClearFifo();
|
||||
paused = 0;
|
||||
gamestate = GS_LEVEL;
|
||||
bVanilla = false;
|
||||
|
@ -535,7 +531,9 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
|
|||
|
||||
Mus_ResumeSaved();
|
||||
|
||||
netBroadcastPlayerInfo(myconnectindex);
|
||||
PROFILE* pProfile = &gProfile[myconnectindex];
|
||||
strcpy(pProfile->name, playername);
|
||||
pProfile->skill = gSkill;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,8 +189,8 @@ void CViewMap::sub_25C74(void)
|
|||
}
|
||||
// only clear the actual window.
|
||||
twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000);
|
||||
renderDrawMapView(x,y,nZoom>>2,angle);
|
||||
sub_2541C(x,y,nZoom>>2,angle);
|
||||
renderDrawMapView(x,y,nZoom>>1,angle);
|
||||
sub_2541C(x,y,nZoom>>1,angle);
|
||||
if (tm)
|
||||
setViewport(hud_size);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "levels.h"
|
||||
#include "loadsave.h"
|
||||
#include "messages.h"
|
||||
#include "network.h"
|
||||
#include "player.h"
|
||||
#include "view.h"
|
||||
#include "gstrings.h"
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
||||
Copyright (C) 2019 Nuke.YKT
|
||||
|
||||
This file is part of NBlood.
|
||||
|
||||
NBlood is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#include "ns.h" // Must come before everything else!
|
||||
|
||||
#include "build.h"
|
||||
#include "mmulti.h"
|
||||
#include "pragmas.h"
|
||||
#include "compat.h"
|
||||
#include "controls.h"
|
||||
#include "globals.h"
|
||||
#include "network.h"
|
||||
#include "player.h"
|
||||
#include "seq.h"
|
||||
#include "sound.h"
|
||||
#include "view.h"
|
||||
#include "menu.h"
|
||||
#include "gamestate.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
MapRecord *gStartNewGame = 0;
|
||||
int gNetFifoTail = 0;
|
||||
int gNetFifoHead[8];
|
||||
int gPredictTail = 0;
|
||||
InputPacket gFifoInput[256][8];
|
||||
|
||||
void netResetToSinglePlayer(void)
|
||||
{
|
||||
myconnectindex = connecthead = 0;
|
||||
gNetPlayers = numplayers = 1;
|
||||
connectpoint2[0] = -1;
|
||||
gGameOptions.nGameType = 0;
|
||||
UpdateNetworkMenus();
|
||||
}
|
||||
|
||||
void netReset(void)
|
||||
{
|
||||
lastTic = -1;
|
||||
gPredictTail = 0;
|
||||
gNetFifoTail = 0;
|
||||
memset(gNetFifoHead, 0, sizeof(gNetFifoHead));
|
||||
}
|
||||
|
||||
void netBroadcastPlayerInfo(int nPlayer)
|
||||
{
|
||||
PROFILE *pProfile = &gProfile[nPlayer];
|
||||
strcpy(pProfile->name, playername);
|
||||
pProfile->skill = gSkill;
|
||||
pProfile->nAutoAim = cl_autoaim;
|
||||
pProfile->nWeaponSwitch = cl_weaponswitch;
|
||||
}
|
||||
|
||||
void netGetInput(void)
|
||||
{
|
||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
if (gNetFifoHead[myconnectindex]-200 > gNetFifoHead[p])
|
||||
return;
|
||||
InputPacket &input = gFifoInput[gNetFifoHead[myconnectindex]&255][myconnectindex];
|
||||
input = gNetInput;
|
||||
gNetFifoHead[myconnectindex]++;
|
||||
}
|
||||
|
||||
void netInitialize(bool bConsole)
|
||||
{
|
||||
netReset();
|
||||
netResetToSinglePlayer();
|
||||
}
|
||||
|
||||
|
||||
END_BLD_NS
|
|
@ -1,43 +0,0 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
||||
Copyright (C) 2019 Nuke.YKT
|
||||
|
||||
This file is part of NBlood.
|
||||
|
||||
NBlood is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "controls.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
extern MapRecord *gStartNewGame;
|
||||
extern int gNetFifoTail;
|
||||
extern int gNetFifoHead[8];
|
||||
extern int gPredictTail;
|
||||
extern InputPacket gFifoInput[256][8];
|
||||
|
||||
void netReset(void);
|
||||
void netResetToSinglePlayer(void);
|
||||
void netInitialize(bool bConsole);
|
||||
void netBroadcastPlayerInfo(int nPlayer);
|
||||
void netGetInput(void);
|
||||
|
||||
END_BLD_NS
|
|
@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "globals.h"
|
||||
#include "levels.h"
|
||||
#include "messages.h"
|
||||
#include "network.h"
|
||||
#include "sound.h"
|
||||
#include "view.h"
|
||||
#include "mapinfo.h"
|
||||
|
|
|
@ -38,7 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "levels.h"
|
||||
#include "loadsave.h"
|
||||
#include "map2d.h"
|
||||
#include "network.h"
|
||||
#include "player.h"
|
||||
#include "seq.h"
|
||||
#include "sound.h"
|
||||
|
|
|
@ -190,8 +190,6 @@ struct PLAYER
|
|||
|
||||
struct PROFILE
|
||||
{
|
||||
int nAutoAim;
|
||||
int nWeaponSwitch;
|
||||
int skill;
|
||||
char name[MAXPLAYERNAME];
|
||||
};
|
||||
|
|
|
@ -109,8 +109,8 @@ void viewUpdatePrediction(InputPacket *pInput)
|
|||
fakePlayerProcess(gMe, pInput);
|
||||
fakeActProcessSprites();
|
||||
gMe->pSprite->cstat = bakCstat;
|
||||
predictFifo[gPredictTail&255] = predict;
|
||||
gPredictTail++;
|
||||
//predictFifo[gPredictTail&255] = predict;
|
||||
//gPredictTail++;
|
||||
if (numplayers != 1)
|
||||
{
|
||||
gViewAngle = predict.at30;
|
||||
|
@ -706,6 +706,7 @@ void fakeActProcessSprites(void)
|
|||
|
||||
void viewCorrectPrediction(void)
|
||||
{
|
||||
#if 0
|
||||
if (numplayers == 1)
|
||||
{
|
||||
gViewLook = gMe->q16look;
|
||||
|
@ -724,6 +725,7 @@ void viewCorrectPrediction(void)
|
|||
viewUpdatePrediction(&gFifoInput[gPredictTail&255][myconnectindex]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -125,15 +125,23 @@ void GameInterface::UpdateSounds()
|
|||
{
|
||||
SoundListener listener;
|
||||
|
||||
if (gMe->pSprite)
|
||||
{
|
||||
listener.angle = -(float)gMe->pSprite->ang * pi::pi() / 1024; // Build uses a period of 2048.
|
||||
listener.velocity.Zero();
|
||||
listener.position = GetSoundPos(&gMe->pSprite->pos);
|
||||
listener.valid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
listener.position.Zero();
|
||||
listener.valid = false;
|
||||
}
|
||||
listener.underwater = false;
|
||||
// This should probably use a real environment instead of the pitch hacking in S_PlaySound3D.
|
||||
// listenactor->waterlevel == 3;
|
||||
//assert(primaryLevel->Zones.Size() > listenactor->Sector->ZoneNumber);
|
||||
listener.Environment = 0;// primaryLevel->Zones[listenactor->Sector->ZoneNumber].Environment;
|
||||
listener.valid = true;
|
||||
|
||||
listener.ListenerObject = gMe->pSprite;
|
||||
soundEngine->SetListener(listener);
|
||||
|
|
|
@ -321,7 +321,7 @@ void UpdateAimVector(PLAYER * pPlayer)
|
|||
WEAPONTRACK *pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon];
|
||||
int nTarget = -1;
|
||||
pPlayer->aimTargetsCount = 0;
|
||||
if (gProfile[pPlayer->nPlayer].nAutoAim == 1 || (gProfile[pPlayer->nPlayer].nAutoAim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
||||
if (cl_autoaim == 1 || (cl_autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
||||
{
|
||||
int nClosest = 0x7fffffff;
|
||||
for (nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
||||
|
@ -1679,7 +1679,7 @@ char gWeaponUpgrade[][13] = {
|
|||
char WeaponUpgrade(PLAYER *pPlayer, char newWeapon)
|
||||
{
|
||||
char weapon = pPlayer->curWeapon;
|
||||
if (!sub_4B1A4(pPlayer) && (gProfile[pPlayer->nPlayer].nWeaponSwitch&1) && (gWeaponUpgrade[pPlayer->curWeapon][newWeapon] || (gProfile[pPlayer->nPlayer].nWeaponSwitch&2)))
|
||||
if (!sub_4B1A4(pPlayer) && (cl_weaponswitch&1) && (gWeaponUpgrade[pPlayer->curWeapon][newWeapon] || (cl_weaponswitch&2)))
|
||||
weapon = newWeapon;
|
||||
return weapon;
|
||||
}
|
||||
|
|
|
@ -866,7 +866,7 @@ int RunGame()
|
|||
videoInit();
|
||||
|
||||
// Duke has transitioned to the new main loop, the other games haven't yet.
|
||||
if (g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_RRALL | GAMEFLAG_NAM | GAMEFLAG_NAPALM | GAMEFLAG_WW2GI))
|
||||
if (!(g_gameType & (GAMEFLAG_SW | GAMEFLAG_PSEXHUMED)))
|
||||
{
|
||||
D_CheckNetGame();
|
||||
MainLoop();
|
||||
|
|
|
@ -29,7 +29,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "game.h"
|
||||
#include "sounds.h"
|
||||
#include "v_draw.h"
|
||||
#include "network.h"
|
||||
#include "menus.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "mapinfo.h"
|
||||
|
|
|
@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "keydef.h"
|
||||
|
||||
#include "gamecontrol.h"
|
||||
#include "network.h"
|
||||
#include "misc.h"
|
||||
#include "version.h"
|
||||
#include "network.h"
|
||||
|
|
Loading…
Reference in a new issue