diff --git a/source/blood/CMakeLists.txt b/source/blood/CMakeLists.txt index c6db6f310..05cc62bdb 100644 --- a/source/blood/CMakeLists.txt +++ b/source/blood/CMakeLists.txt @@ -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 diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 2c2da35da..b53da7f80 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.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,202 +60,193 @@ 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) { - throw CExitEvent(0); + throw CExitEvent(0); } void EndLevel(void) { - gViewPos = VIEWPOS_0; - sndKillAllSounds(); - sfxKillAllSounds(); - ambKillAll(); - seqKillAll(); + gViewPos = VIEWPOS_0; + sndKillAllSounds(); + sfxKillAllSounds(); + ambKillAll(); + 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; + if (!level) return; STAT_Update(0); - EndLevel(); - gInput = {}; - gStartNewGame = nullptr; - currentLevel = level; + EndLevel(); + gInput = {}; + gStartNewGame = nullptr; + currentLevel = level; - if (gGameOptions.nGameType == 0) - { - /////// - gGameOptions.weaponsV10x = gWeaponsV10x; - /////// - } + if (gGameOptions.nGameType == 0) + { + /////// + gGameOptions.weaponsV10x = gWeaponsV10x; + /////// + } #if 0 - else if (gGameOptions.nGameType > 0 && !(gGameOptions.uGameFlags&1)) - { - // todo - gBlueFlagDropped = false; - gRedFlagDropped = false; - } + else if (gGameOptions.nGameType > 0 && !(gGameOptions.uGameFlags & 1)) + { + // todo + gBlueFlagDropped = false; + gRedFlagDropped = false; + } #endif - if (gGameOptions.uGameFlags&1) - { - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - { - 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)); - //drawLoadingScreen(); - if (dbLoadMap(currentLevel->fileName,(int*)&startpos.x,(int*)&startpos.y,(int*)&startpos.z,&startang,&startsectnum,nullptr)) - { - I_Error("Unable to load map"); - } - SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); + if (gGameOptions.uGameFlags & 1) + { + for (int i = connecthead; i >= 0; i = connectpoint2[i]) + { + 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)); + //drawLoadingScreen(); + if (dbLoadMap(currentLevel->fileName, (int*)&startpos.x, (int*)&startpos.y, (int*)&startpos.z, &startang, &startsectnum, nullptr)) + { + I_Error("%s: Unable to load map", level->DisplayName()); + } + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(currentLevel->fileName); - G_LoadMapHack(currentLevel->fileName); - wsrand(dbReadMapCRC(currentLevel->LabelName())); - gKillMgr.Clear(); - gSecretMgr.Clear(); - gLevelTime = 0; - automapping = 1; - - int modernTypesErased = 0; - for (int i = 0; i < kMaxSprites; i++) - { - spritetype *pSprite = &sprite[i]; - if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) { - - 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)) { - - DeleteSprite(i); - continue; - } + G_LoadMapHack(currentLevel->fileName); + wsrand(dbReadMapCRC(currentLevel->LabelName())); + gKillMgr.Clear(); + gSecretMgr.Clear(); + gLevelTime = 0; + automapping = 1; - - #ifdef NOONE_EXTENSIONS - if (!gModernMap && nnExtEraseModernStuff(pSprite, pXSprite)) - modernTypesErased++; - #endif - } - } - - #ifdef NOONE_EXTENSIONS - if (!gModernMap) - Printf(PRINT_NONOTIFY, "> Modern types erased: %d.\n", modernTypesErased); - #endif + int modernTypesErased = 0; + for (int i = 0; i < kMaxSprites; i++) + { + spritetype* pSprite = &sprite[i]; + if (pSprite->statnum < kMaxStatus && pSprite->extra > 0) { - 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; - gStartZone[i].z = startpos.z; - gStartZone[i].sectnum = startsectnum; - gStartZone[i].ang = startang; + 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)) { - #ifdef NOONE_EXTENSIONS - // Create spawn zones for players in teams mode. - if (gModernMap && i <= kMaxPlayers / 2) { - gStartZoneTeam1[i].x = startpos.x; - gStartZoneTeam1[i].y = startpos.y; - gStartZoneTeam1[i].z = startpos.z; - gStartZoneTeam1[i].sectnum = startsectnum; - gStartZoneTeam1[i].ang = startang; + DeleteSprite(i); + continue; + } - gStartZoneTeam2[i].x = startpos.x; - gStartZoneTeam2[i].y = startpos.y; - gStartZoneTeam2[i].z = startpos.z; - gStartZoneTeam2[i].sectnum = startsectnum; - gStartZoneTeam2[i].ang = startang; - } - #endif - } - InitSectorFX(); - warpInit(); - actInit(false); - evInit(); - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - { - if (!(gGameOptions.uGameFlags&1)) - { - if (numplayers == 1) - { - gProfile[i].skill = gSkill; - gProfile[i].nAutoAim = cl_autoaim; - gProfile[i].nWeaponSwitch = cl_weaponswitch; - } - playerInit(i,0); - } - playerStart(i, 1); - } - if (gGameOptions.uGameFlags&1) - { - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - { - PLAYER *pPlayer = &gPlayer[i]; - pPlayer->pXSprite->health &= 0xf000; - pPlayer->pXSprite->health |= gHealthTemp[i]; - pPlayer->weaponQav = gPlayerTemp[i].weaponQav; - pPlayer->curWeapon = gPlayerTemp[i].curWeapon; - pPlayer->weaponState = gPlayerTemp[i].weaponState; - pPlayer->weaponAmmo = gPlayerTemp[i].weaponAmmo; - pPlayer->qavCallback = gPlayerTemp[i].qavCallback; - pPlayer->qavLoop = gPlayerTemp[i].qavLoop; - pPlayer->weaponTimer = gPlayerTemp[i].weaponTimer; - pPlayer->nextWeapon = gPlayerTemp[i].nextWeapon; - } - } - gGameOptions.uGameFlags &= ~3; - PreloadCache(); - InitMirrors(); - trInit(); - if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect - sfxSetReverb(0); - ambInit(); - netReset(); - gFrameCount = 0; - gChokeCounter = 0; + +#ifdef NOONE_EXTENSIONS + if (!gModernMap && nnExtEraseModernStuff(pSprite, pXSprite)) + modernTypesErased++; +#endif + } + } + +#ifdef NOONE_EXTENSIONS + if (!gModernMap && modernTypesErased > 0) + Printf(PRINT_NONOTIFY, "> Modern types erased: %d.\n", modernTypesErased); +#endif + + 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; + gStartZone[i].z = startpos.z; + gStartZone[i].sectnum = startsectnum; + gStartZone[i].ang = startang; + +#ifdef NOONE_EXTENSIONS + // Create spawn zones for players in teams mode. + if (gModernMap && i <= kMaxPlayers / 2) { + gStartZoneTeam1[i].x = startpos.x; + gStartZoneTeam1[i].y = startpos.y; + gStartZoneTeam1[i].z = startpos.z; + gStartZoneTeam1[i].sectnum = startsectnum; + gStartZoneTeam1[i].ang = startang; + + gStartZoneTeam2[i].x = startpos.x; + gStartZoneTeam2[i].y = startpos.y; + gStartZoneTeam2[i].z = startpos.z; + gStartZoneTeam2[i].sectnum = startsectnum; + gStartZoneTeam2[i].ang = startang; + } +#endif + } + InitSectorFX(); + warpInit(); + actInit(false); + evInit(); + for (int i = connecthead; i >= 0; i = connectpoint2[i]) + { + if (!(gGameOptions.uGameFlags & 1)) + { + if (numplayers == 1) + { + gProfile[i].skill = gSkill; + } + playerInit(i, 0); + } + playerStart(i, 1); + } + if (gGameOptions.uGameFlags & 1) + { + for (int i = connecthead; i >= 0; i = connectpoint2[i]) + { + PLAYER* pPlayer = &gPlayer[i]; + pPlayer->pXSprite->health &= 0xf000; + pPlayer->pXSprite->health |= gHealthTemp[i]; + pPlayer->weaponQav = gPlayerTemp[i].weaponQav; + pPlayer->curWeapon = gPlayerTemp[i].curWeapon; + pPlayer->weaponState = gPlayerTemp[i].weaponState; + pPlayer->weaponAmmo = gPlayerTemp[i].weaponAmmo; + pPlayer->qavCallback = gPlayerTemp[i].qavCallback; + pPlayer->qavLoop = gPlayerTemp[i].qavLoop; + pPlayer->weaponTimer = gPlayerTemp[i].weaponTimer; + pPlayer->nextWeapon = gPlayerTemp[i].nextWeapon; + } + } + gGameOptions.uGameFlags &= ~3; + PreloadCache(); + InitMirrors(); + trInit(); + if (!bVanilla && !gMe->packSlots[1].isActive) // if diving suit is not active, turn off reverb sound effect + sfxSetReverb(0); + ambInit(); + Net_ClearFifo(); + gFrameCount = 0; + gChokeCounter = 0; M_ClearMenus(); - // viewSetMessage(""); - viewSetErrorMessage(""); - gameclock = 0; - lastTic = -1; - paused = 0; - levelTryPlayMusic(); + // viewSetMessage(""); + viewSetErrorMessage(""); + gameclock = 0; + paused = 0; + levelTryPlayMusic(); gFrameClock = 0; gChoke.reset(); } @@ -264,121 +254,181 @@ void StartLevel(MapRecord *level) bool gRestartGame = false; -void ProcessFrame(void) +static void commonTicker() { - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - { - auto& inp = gPlayer[i].input; - auto oldactions = inp.actions; + if (TestBitString(gotpic, 2342)) + { + FireProcess(); + ClearBitString(gotpic, 2342); + } + if (gStartNewGame) + { + auto sng = gStartNewGame; + gStartNewGame = nullptr; + gQuitGame = false; + auto completion = [=](bool = false) + { + StartLevel(sng); - inp = gFifoInput[gNetFifoTail & 255][i]; - inp.actions |= oldactions & ~(SB_BUTTON_MASK|SB_RUN|SB_WEAPONMASK_BITS); // should be everything non-button and non-weapon + gamestate = GS_LEVEL; + }; - int newweap = inp.getNewWeapon(); - if (newweap > 0 && newweap < WeaponSel_MaxBlood) gPlayer[i].newWeapon = newweap; - } - gNetFifoTail++; + 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; + } - // This is single player only. - if (gameRestart) - { - gameRestart = false; - levelRestart(); - return; - } - viewClearInterpolations(); - { - if (paused || (gGameOptions.nGameType == 0 && M_Active())) - return; - } + } + if (!startedCutscene) completion(false); + } + else if (gRestartGame) + { + Mus_Stop(); + soundEngine->StopAllChannels(); + gQuitGame = 0; + gQuitRequest = 0; + gRestartGame = 0; - thinktime.Reset(); - thinktime.Clock(); + // 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); + } + } +} - actortime.Reset(); - actortime.Clock(); - for (int i = connecthead; i >= 0; i = connectpoint2[i]) - { - viewBackupView(i); - playerProcess(&gPlayer[i]); - } - actortime.Unclock(); - trProcessBusy(); - evProcess(gFrameClock); - seqProcess(4); - DoSectorPanning(); - actProcessSprites(); - actPostProcess(); + +void GameInterface::Ticker() +{ + for (int i = connecthead; i >= 0; i = connectpoint2[i]) + { + auto& inp = gPlayer[i].input; + auto oldactions = inp.actions; + + 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; + } + + // This is single player only. + if (gameRestart) + { + gameRestart = false; + levelRestart(); + return; + } + viewClearInterpolations(); + { + if (paused || (gGameOptions.nGameType == 0 && M_Active())) + return; + } + + thinktime.Reset(); + thinktime.Clock(); + + actortime.Reset(); + actortime.Clock(); + for (int i = connecthead; i >= 0; i = connectpoint2[i]) + { + viewBackupView(i); + playerProcess(&gPlayer[i]); + } + actortime.Unclock(); + + trProcessBusy(); + evProcess(gFrameClock); + seqProcess(4); + DoSectorPanning(); + actProcessSprites(); + actPostProcess(); #ifdef POLYMER - G_RefreshLights(); + G_RefreshLights(); #endif - viewCorrectPrediction(); - ambProcess(); - viewUpdateDelirium(); - viewUpdateShake(); - gi->UpdateSounds(); - if (gMe->hand == 1) - { - const int CHOKERATE = 8; - const int COUNTRATE = 30; - gChokeCounter += CHOKERATE; - while (gChokeCounter >= COUNTRATE) - { - gChoke.at1c(gMe); - gChokeCounter -= COUNTRATE; - } - } + viewCorrectPrediction(); + ambProcess(); + viewUpdateDelirium(); + viewUpdateShake(); + gi->UpdateSounds(); + if (gMe->hand == 1) + { + const int CHOKERATE = 8; + const int COUNTRATE = 30; + gChokeCounter += CHOKERATE; + while (gChokeCounter >= COUNTRATE) + { + gChoke.at1c(gMe); + gChokeCounter -= COUNTRATE; + } + } - thinktime.Unclock(); + thinktime.Unclock(); - gLevelTime++; - gFrameCount++; - gFrameClock += 4; - - for(int i=0;i<8;i++) + gLevelTime++; + gFrameCount++; + gFrameClock += 4; + + 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) - { - seqKillAll(); - if (gGameOptions.uGameFlags&2) - { - STAT_Update(true); - if (gGameOptions.nGameType == 0) - { - auto completion = [] (bool) { + if ((gGameOptions.uGameFlags & 1) != 0 && !gStartNewGame) + { + seqKillAll(); + if (gGameOptions.uGameFlags & 2) + { + STAT_Update(true); + if (gGameOptions.nGameType == 0) + { + auto completion = [](bool) { gamestate = GS_MENUSCREEN; M_StartControlPanel(false); - M_SetMenu(NAME_Mainmenu); - M_SetMenu(NAME_CreditsMenu); + M_SetMenu(NAME_Mainmenu); + M_SetMenu(NAME_CreditsMenu); gGameOptions.uGameFlags &= ~3; gQuitGame = 1; - gRestartGame = true; - }; - - if (gGameOptions.uGameFlags&8) + gRestartGame = true; + }; + + if (gGameOptions.uGameFlags & 8) { - levelPlayEndScene(volfromlevelnum(currentLevel->levelNumber), completion); + levelPlayEndScene(volfromlevelnum(currentLevel->levelNumber), completion); } else completion(false); - } + } else { gGameOptions.uGameFlags &= ~3; gRestartGame = 1; gQuitGame = 1; } - } - else - { - ShowSummaryScreen(); - } - } + } + else + { + ShowSummaryScreen(); + } + } + commonTicker(); +} + +void GameInterface::DrawBackground() +{ + twod->ClearScreen(); + DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); + commonTicker(); } @@ -387,242 +437,162 @@ void ReadAllRFS(); void GameInterface::app_init() { - InitCheats(); - memcpy(&gGameOptions, &gSingleGameOptions, sizeof(GAMEOPTIONS)); - gGameOptions.nMonsterSettings = !userConfig.nomonsters; - ReadAllRFS(); + InitCheats(); + memcpy(&gGameOptions, &gSingleGameOptions, sizeof(GAMEOPTIONS)); + gGameOptions.nMonsterSettings = !userConfig.nomonsters; + ReadAllRFS(); - HookReplaceFunctions(); + HookReplaceFunctions(); - Printf(PRINT_NONOTIFY, "Initializing Build 3D engine\n"); - engineInit(); + Printf(PRINT_NONOTIFY, "Initializing Build 3D engine\n"); + engineInit(); - Printf(PRINT_NONOTIFY, "Loading tiles\n"); - if (!tileInit(0, NULL)) - I_FatalError("TILES###.ART files not found"); + Printf(PRINT_NONOTIFY, "Loading tiles\n"); + if (!tileInit(0, NULL)) + I_FatalError("TILES###.ART files not found"); - levelLoadDefaults(); + levelLoadDefaults(); - loaddefinitionsfile(BLOODWIDESCREENDEF); + loaddefinitionsfile(BLOODWIDESCREENDEF); - const char* defsfile = G_DefFile(); - uint32_t stime = I_msTime(); - if (!loaddefinitionsfile(defsfile)) - { - uint32_t etime = I_msTime(); - Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime); - } - powerupInit(); - Printf(PRINT_NONOTIFY, "Loading cosine table\n"); - trigInit(); - Printf(PRINT_NONOTIFY, "Initializing view subsystem\n"); - viewInit(); - Printf(PRINT_NONOTIFY, "Initializing dynamic fire\n"); - FireInit(); - Printf(PRINT_NONOTIFY, "Initializing weapon animations\n"); - WeaponInit(); - LoadSaveSetup(); + const char* defsfile = G_DefFile(); + uint32_t stime = I_msTime(); + if (!loaddefinitionsfile(defsfile)) + { + uint32_t etime = I_msTime(); + Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %d ms.\n", defsfile, etime - stime); + } + powerupInit(); + Printf(PRINT_NONOTIFY, "Loading cosine table\n"); + trigInit(); + Printf(PRINT_NONOTIFY, "Initializing view subsystem\n"); + viewInit(); + Printf(PRINT_NONOTIFY, "Initializing dynamic fire\n"); + FireInit(); + Printf(PRINT_NONOTIFY, "Initializing weapon animations\n"); + WeaponInit(); + LoadSaveSetup(); - Printf(PRINT_NONOTIFY, "Initializing network users\n"); - netInitialize(true); - Printf(PRINT_NONOTIFY, "Initializing sound system\n"); - sndInit(); - registerosdcommands(); + myconnectindex = connecthead = 0; + gNetPlayers = numplayers = 1; + connectpoint2[0] = -1; + gGameOptions.nGameType = 0; + UpdateNetworkMenus(); - gChoke.init(518, sub_84230); - UpdateDacs(0, true); + Printf(PRINT_NONOTIFY, "Initializing sound system\n"); + sndInit(); + registerosdcommands(); - enginecompatibility_mode = ENGINECOMPATIBILITY_19960925;//bVanilla; + gChoke.init(518, sub_84230); + UpdateDacs(0, true); + + enginecompatibility_mode = ENGINECOMPATIBILITY_19960925;//bVanilla; } static void gameInit() { -//RESTART: - netReset(); - gViewIndex = myconnectindex; - gMe = gView = &gPlayer[myconnectindex]; - netBroadcastPlayerInfo(myconnectindex); + //RESTART: + gViewIndex = myconnectindex; + gMe = gView = &gPlayer[myconnectindex]; + + PROFILE* pProfile = &gProfile[myconnectindex]; + strcpy(pProfile->name, playername); + pProfile->skill = gSkill; UpdateNetworkMenus(); - gQuitGame = 0; - gRestartGame = 0; - if (gGameOptions.nGameType > 0) - { - inputState.ClearAllInput(); - } + gQuitGame = 0; + gRestartGame = 0; + if (gGameOptions.nGameType > 0) + { + inputState.ClearAllInput(); + } } -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(); - } + gameInit(); + if (userConfig.CommandMap.IsNotEmpty()) + { + } + else + { + if (!userConfig.nologo && gGameOptions.nGameType == 0) playlogos(); + else + { + gamestate = GS_MENUSCREEN; + M_StartControlPanel(false); + M_SetMenu(NAME_Mainmenu); + } + } } -static void drawBackground() + +static void nonsharedkeys(void) { - twod->ClearScreen(); - DrawTexture(twod, tileGetTexture(2518, true), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); + 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; + } } -static void commonTicker() +void GameInterface::Render() { - 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()) - { - } - else - { - if (!userConfig.nologo && gGameOptions.nGameType == 0) playlogos(); - else - { - gamestate = GS_MENUSCREEN; - M_StartControlPanel(false); - 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; - } + nonsharedkeys(); + drawtime.Reset(); + drawtime.Clock(); + viewDrawScreen(); + drawtime.Unclock(); } void sndPlaySpecialMusicOrNothing(int nMusic) { - if (!Mus_Play(nullptr, quoteMgr.GetQuote(nMusic), true)) - { - Mus_Stop(); - } + if (!Mus_Play(nullptr, quoteMgr.GetQuote(nMusic), true)) + { + Mus_Stop(); + } } extern IniFile* BloodINI; void GameInterface::FreeGameData() { - if (BloodINI) delete BloodINI; + if (BloodINI) delete BloodINI; } ReservedSpace GameInterface::GetReservedScreenSpace(int viewsize) { - int top = 0; - if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3) - { - top = (tilesiz[2229].y * ((gNetPlayers + 3) / 4)); - } - return { top, 25 }; + int top = 0; + if (gGameOptions.nGameType > 0 && gGameOptions.nGameType <= 3) + { + top = (tilesiz[2229].y * ((gNetPlayers + 3) / 4)); + } + return { top, 25 }; } ::GameInterface* CreateInterface() diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 581063585..2e08291a5 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -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; }; diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index e93f78982..fe37b1837 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -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" diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 8f4c3d27e..9a1d8a2ac 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -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 diff --git a/source/blood/src/controls.h b/source/blood/src/controls.h index 934e383c6..6849e7ebc 100644 --- a/source/blood/src/controls.h +++ b/source/blood/src/controls.h @@ -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; diff --git a/source/blood/src/endgame.cpp b/source/blood/src/endgame.cpp index d8f25ca59..f89e24b1c 100644 --- a/source/blood/src/endgame.cpp +++ b/source/blood/src/endgame.cpp @@ -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" diff --git a/source/blood/src/levels.cpp b/source/blood/src/levels.cpp index ee3897d0d..bce54c4d2 100644 --- a/source/blood/src/levels.cpp +++ b/source/blood/src/levels.cpp @@ -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" diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 8ef0e122a..41940dd4d 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -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,8 +531,10 @@ bool GameInterface::LoadGame(FSaveGameNode* node) Mus_ResumeSaved(); - netBroadcastPlayerInfo(myconnectindex); - return true; + PROFILE* pProfile = &gProfile[myconnectindex]; + strcpy(pProfile->name, playername); + pProfile->skill = gSkill; + return true; } bool GameInterface::SaveGame(FSaveGameNode* node) diff --git a/source/blood/src/map2d.cpp b/source/blood/src/map2d.cpp index 300dac4b6..c9d6c7adb 100644 --- a/source/blood/src/map2d.cpp +++ b/source/blood/src/map2d.cpp @@ -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); } diff --git a/source/blood/src/messages.cpp b/source/blood/src/messages.cpp index 9127a7774..fb4ee0ead 100644 --- a/source/blood/src/messages.cpp +++ b/source/blood/src/messages.cpp @@ -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" diff --git a/source/blood/src/network.cpp b/source/blood/src/network.cpp deleted file mode 100644 index e6c1f03cd..000000000 --- a/source/blood/src/network.cpp +++ /dev/null @@ -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 diff --git a/source/blood/src/network.h b/source/blood/src/network.h deleted file mode 100644 index ea36f67ce..000000000 --- a/source/blood/src/network.h +++ /dev/null @@ -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 diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index 49aa8109b..ecd3a1dc2 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -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" diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 55b9ecfb7..0dfbd6967 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -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" diff --git a/source/blood/src/player.h b/source/blood/src/player.h index abb69cb7b..fe06055dd 100644 --- a/source/blood/src/player.h +++ b/source/blood/src/player.h @@ -190,8 +190,6 @@ struct PLAYER struct PROFILE { - int nAutoAim; - int nWeaponSwitch; int skill; char name[MAXPLAYERNAME]; }; diff --git a/source/blood/src/prediction.cpp b/source/blood/src/prediction.cpp index 3c5e8238d..4c4a3655b 100644 --- a/source/blood/src/prediction.cpp +++ b/source/blood/src/prediction.cpp @@ -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 diff --git a/source/blood/src/sfx.cpp b/source/blood/src/sfx.cpp index 75a206069..4f80b700e 100644 --- a/source/blood/src/sfx.cpp +++ b/source/blood/src/sfx.cpp @@ -125,15 +125,23 @@ void GameInterface::UpdateSounds() { SoundListener listener; - listener.angle = -(float)gMe->pSprite->ang * pi::pi() / 1024; // Build uses a period of 2048. - listener.velocity.Zero(); - listener.position = GetSoundPos(&gMe->pSprite->pos); + 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); diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 5966ce435..0725c5bec 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -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; } diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 92df3d908..802d723dc 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -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(); diff --git a/source/sw/src/2d.cpp b/source/sw/src/2d.cpp index 0c61f2855..7352a43a2 100644 --- a/source/sw/src/2d.cpp +++ b/source/sw/src/2d.cpp @@ -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" diff --git a/source/sw/src/d_menu.cpp b/source/sw/src/d_menu.cpp index b00b5aca0..4c01b0fe5 100644 --- a/source/sw/src/d_menu.cpp +++ b/source/sw/src/d_menu.cpp @@ -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"