From cbfb79977a9125c94947306acc76bb6d3a176dd6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 13 Dec 2019 21:01:14 +0100 Subject: [PATCH] - adjustments to make it compile with the new menu code. --- source/build/include/baselayer.h | 2 +- source/exhumed/src/exhumed.cpp | 2 +- source/exhumed/src/light.cpp | 2 +- source/exhumed/src/menu.cpp | 15 +++++++++++-- source/exhumed/src/movie.cpp | 32 ++-------------------------- source/exhumed/src/player.cpp | 36 ++++++++++---------------------- source/exhumed/src/sequence.cpp | 2 +- source/exhumed/src/sound.cpp | 2 +- source/sw/src/game.cpp | 1 + 9 files changed, 32 insertions(+), 62 deletions(-) diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 979f2e95f..f8bf9d644 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -229,7 +229,7 @@ struct GameInterface virtual void DrawMenuCaption(const DVector2& origin, const char* text) {} virtual bool SaveGame(FSaveGameNode*) { return false; } virtual bool LoadGame(FSaveGameNode*) { return false; } - virtual void DoPrintMessage(int prio, const char*) = 0; + virtual void DoPrintMessage(int prio, const char*) {} void PrintMessage(int prio, const char*fmt, ...) { va_list ap; diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 18efc0e31..61267f078 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -3043,7 +3043,7 @@ void InitSpiritHead() lNextStateChange = (int)totalclock; lHeadStartClock = (int)totalclock; - auto headfd = kopenFileReader(filename, 512); // 512?? + auto headfd = fileSystem.OpenFileReader(filename, 512); // 512?? if (!headfd.isOpen()) { memset(cPupData, 0, sizeof(cPupData)); diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index 599281715..37b1d3a9f 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -84,7 +84,7 @@ int LoadPaletteLookups() for (int i = 0; i < kMaxGrads; i++) { - auto hFile = kopenFileReader(GradList[i], 1); + auto hFile = fileSystem.OpenFileReader(GradList[i], 1); if (!hFile.isOpen()) { initprintf("Error reading palette lookup '%s'\n", GradList[i]); diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index 2c8529a4a..8b1010acd 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -751,6 +751,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) moveTimer = (int)totalclock; } +#if 0 if (curYPos == destYPos) { if (I_MenuUp()) @@ -832,6 +833,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest) nIdleSeconds = 0; } +#endif } MySetView(nViewLeft, nViewTop, nViewRight, nViewBottom); @@ -886,6 +888,7 @@ void menu_AdjustVolume() return; } +#if 0 if (I_MenuUp()) { I_MenuUpClear(); @@ -921,6 +924,7 @@ void menu_AdjustVolume() { I_MenuRightClear(); } +#endif if (GetLocalSound() != 23) { continue; @@ -933,6 +937,7 @@ void menu_AdjustVolume() int menu_NewGameMenu() { +#if 0 const char endMark = 0xF; char nameList[5][25]; int nNameLen = sizeof(nameList); @@ -1218,10 +1223,13 @@ check_keys: y += 22; } } +#endif + return 0; } int menu_LoadGameMenu() { +#if 0 char nameList[5][25]; int nSlot = 0; @@ -1312,6 +1320,8 @@ int menu_LoadGameMenu() PlayLocalSound(4, 0); } +#endif + return 0; } void menu_ResetKeyTimer() @@ -1437,6 +1447,7 @@ void menu_ResetZoom() int menu_Menu(int nVal) { +#if 0 GrabPalette(); int var_1C = 0; @@ -1714,7 +1725,7 @@ LABEL_21: } */ } - +#endif return 0;// todo } @@ -1756,7 +1767,7 @@ int LoadCinemaPalette(int nPal) // original code strcpy'd into a buffer first... - auto hFile = kopenFileReader(cinpalfname[nPal], 1); + auto hFile = fileSystem.OpenFileReader(cinpalfname[nPal], 0); if (!hFile.isOpen()) { return -2; } diff --git a/source/exhumed/src/movie.cpp b/source/exhumed/src/movie.cpp index dec10a166..05bb6a5f7 100644 --- a/source/exhumed/src/movie.cpp +++ b/source/exhumed/src/movie.cpp @@ -197,42 +197,14 @@ void ServeSample(const char** ptr, uint32_t* length) void PlayMovie(const char* fileName) { - char buffer[256]; int bDoFade = kTrue; int hFx = -1; -#if 0 - if (bNoCDCheck) - { - sprintf(buffer, "C:\\PS\\%s", fileName); - } - else - { - char driveLetter = GetCDDriveLetter(); - if (!driveLetter) { - driveLetter = 'C'; - } - sprintf(buffer, "%c:%s", driveLetter, fileName); - } - - FILE* fp = fopen(buffer, "rb"); - if (fp == NULL) - { - Printf("Can't open movie file '%s' on CD-ROM\n", buffer); - fp = fopen(fileName, "rb"); - if (fp == NULL) - { - Printf("Can't open movie file on hard drive\n"); - return; - } - } -#else - auto fp = fileSystem.OpenFileReader(fileSystem.FindFile(fileName)); + auto fp = fileSystem.OpenFileReader(fileName, 0); if (!fp.isOpen()) { Printf("Unable to open %s\n", fileName); return; } -#endif tileLoad(kMovieTile); CurFrame = TileFiles.tileMakeWritable(kMovieTile); @@ -261,7 +233,7 @@ void PlayMovie(const char* fileName) if (ReadFrame(fp)) { // start audio playback - hFx = FX_StartDemandFeedPlayback(ServeSample, kSampleRate, 0, mus_volume, mus_volume, mus_volume, FX_MUSIC_PRIORITY, fix16_one, -1); + hFx = FX_StartDemandFeedPlayback(ServeSample, kSampleRate, 0, snd_fxvolume, snd_fxvolume, snd_fxvolume, FX_MUSIC_PRIORITY, fix16_one, -1); while (!inputState.keyBufferWaiting()) { diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index 3ad85ce6e..4bba6d59c 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -71,6 +71,7 @@ fix16_t nPlayerDAng = 0; short obobangle = 0, bobangle = 0; short bPlayerPan = 0; short bLockPan = 0; +bool g_MyAimMode; static actionSeq ActionSeq[] = { {18, 0}, {0, 0}, {9, 0}, {27, 0}, {63, 0}, @@ -165,27 +166,6 @@ void PlayerInterruptKeys() CONTROL_GetInput(&info); D_ProcessEvents(); - if (in_mousedeadzone) - { - if (info.mousey > 0) - info.mousey = max(info.mousey - in_mousedeadzone, 0); - else if (info.mousey < 0) - info.mousey = min(info.mousey + in_mousedeadzone, 0); - - if (info.mousex > 0) - info.mousex = max(info.mousex - in_mousedeadzone, 0); - else if (info.mousex < 0) - info.mousex = min(info.mousex + in_mousedeadzone, 0); - } - - if (in_mousebias) - { - if (klabs(info.mousex) > klabs(info.mousey)) - info.mousey = tabledivide32_noinline(info.mousey, in_mousebias); - else - info.mousex = tabledivide32_noinline(info.mousex, in_mousebias); - } - if (PlayerList[nLocalPlayer].nHealth == 0) { lPlayerYVel = 0; @@ -195,7 +175,7 @@ void PlayerInterruptKeys() } // JBF: Run key behaviour is selectable - int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run)); + int const playerRunning = false;// G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run)); int const turnAmount = playerRunning ? 12 : 8; int const keyMove = playerRunning ? 12 : 6; constexpr int const analogTurnAmount = 12; @@ -218,6 +198,8 @@ void PlayerInterruptKeys() q16avel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1); } + g_MyAimMode = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming); + if (g_MyAimMode) q16horz = fix16_div(fix16_from_int(info.mousey), F16(64)); else @@ -346,13 +328,17 @@ void PlayerInterruptKeys() info.mousey = 6400; } - if (mouseaiming) - aimmode = buttonMap.ButtonDown(gamefunc_Mouseview); + + int aimmode = true; + // This needs serious fixing + //if (mouseaiming) + //aimmode = buttonMap.ButtonDown(gamefunc_Mouseview); + /* else { buttonMap.ClearButton(gamefunc_Mouseview); aimmode = !aimmode; - } + }*/ // loc_18EE4 if (aimmode) diff --git a/source/exhumed/src/sequence.cpp b/source/exhumed/src/sequence.cpp index f0f697d16..845ca87b8 100644 --- a/source/exhumed/src/sequence.cpp +++ b/source/exhumed/src/sequence.cpp @@ -166,7 +166,7 @@ int seq_ReadSequence(const char *seqName) strcat(buffer, seqName); strcat(buffer, ".seq"); - auto hFile = kopenFileReader(buffer, 1); + auto hFile = fileSystem.OpenFileReader(buffer, 1); if (!hFile.isOpen()) { initprintf("Unable to open '%s'!\n", buffer); diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index e3bff7884..a344454c1 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -444,7 +444,7 @@ int LoadSound(const char *sound) strcat(buffer, ".voc"); - auto hVoc = kopenFileReader(buffer, 0); + auto hVoc = fileSystem.OpenFileReader(buffer, 0); if (hVoc.isOpen()) { diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index d2434935b..3ba3a4ecc 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -3712,6 +3712,7 @@ void getinput(SW_PACKET *loc) USERp u = User[pp->PlayerSprite]; short const which_weapon = u->WeaponNum + 1; SET(loc->bits, which_weapon); + } inv_hotkey = 0;