- adjustments to make it compile with the new menu code.

This commit is contained in:
Christoph Oelckers 2019-12-13 21:01:14 +01:00
parent 052ed5fff7
commit cbfb79977a
9 changed files with 32 additions and 62 deletions

View file

@ -229,7 +229,7 @@ struct GameInterface
virtual void DrawMenuCaption(const DVector2& origin, const char* text) {} virtual void DrawMenuCaption(const DVector2& origin, const char* text) {}
virtual bool SaveGame(FSaveGameNode*) { return false; } virtual bool SaveGame(FSaveGameNode*) { return false; }
virtual bool LoadGame(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, ...) void PrintMessage(int prio, const char*fmt, ...)
{ {
va_list ap; va_list ap;

View file

@ -3043,7 +3043,7 @@ void InitSpiritHead()
lNextStateChange = (int)totalclock; lNextStateChange = (int)totalclock;
lHeadStartClock = (int)totalclock; lHeadStartClock = (int)totalclock;
auto headfd = kopenFileReader(filename, 512); // 512?? auto headfd = fileSystem.OpenFileReader(filename, 512); // 512??
if (!headfd.isOpen()) if (!headfd.isOpen())
{ {
memset(cPupData, 0, sizeof(cPupData)); memset(cPupData, 0, sizeof(cPupData));

View file

@ -84,7 +84,7 @@ int LoadPaletteLookups()
for (int i = 0; i < kMaxGrads; i++) for (int i = 0; i < kMaxGrads; i++)
{ {
auto hFile = kopenFileReader(GradList[i], 1); auto hFile = fileSystem.OpenFileReader(GradList[i], 1);
if (!hFile.isOpen()) if (!hFile.isOpen())
{ {
initprintf("Error reading palette lookup '%s'\n", GradList[i]); initprintf("Error reading palette lookup '%s'\n", GradList[i]);

View file

@ -751,6 +751,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
moveTimer = (int)totalclock; moveTimer = (int)totalclock;
} }
#if 0
if (curYPos == destYPos) if (curYPos == destYPos)
{ {
if (I_MenuUp()) if (I_MenuUp())
@ -832,6 +833,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
nIdleSeconds = 0; nIdleSeconds = 0;
} }
#endif
} }
MySetView(nViewLeft, nViewTop, nViewRight, nViewBottom); MySetView(nViewLeft, nViewTop, nViewRight, nViewBottom);
@ -886,6 +888,7 @@ void menu_AdjustVolume()
return; return;
} }
#if 0
if (I_MenuUp()) if (I_MenuUp())
{ {
I_MenuUpClear(); I_MenuUpClear();
@ -921,6 +924,7 @@ void menu_AdjustVolume()
{ {
I_MenuRightClear(); I_MenuRightClear();
} }
#endif
if (GetLocalSound() != 23) { if (GetLocalSound() != 23) {
continue; continue;
@ -933,6 +937,7 @@ void menu_AdjustVolume()
int menu_NewGameMenu() int menu_NewGameMenu()
{ {
#if 0
const char endMark = 0xF; const char endMark = 0xF;
char nameList[5][25]; char nameList[5][25];
int nNameLen = sizeof(nameList); int nNameLen = sizeof(nameList);
@ -1218,10 +1223,13 @@ check_keys:
y += 22; y += 22;
} }
} }
#endif
return 0;
} }
int menu_LoadGameMenu() int menu_LoadGameMenu()
{ {
#if 0
char nameList[5][25]; char nameList[5][25];
int nSlot = 0; int nSlot = 0;
@ -1312,6 +1320,8 @@ int menu_LoadGameMenu()
PlayLocalSound(4, 0); PlayLocalSound(4, 0);
} }
#endif
return 0;
} }
void menu_ResetKeyTimer() void menu_ResetKeyTimer()
@ -1437,6 +1447,7 @@ void menu_ResetZoom()
int menu_Menu(int nVal) int menu_Menu(int nVal)
{ {
#if 0
GrabPalette(); GrabPalette();
int var_1C = 0; int var_1C = 0;
@ -1714,7 +1725,7 @@ LABEL_21:
} }
*/ */
} }
#endif
return 0;// todo return 0;// todo
} }
@ -1756,7 +1767,7 @@ int LoadCinemaPalette(int nPal)
// original code strcpy'd into a buffer first... // original code strcpy'd into a buffer first...
auto hFile = kopenFileReader(cinpalfname[nPal], 1); auto hFile = fileSystem.OpenFileReader(cinpalfname[nPal], 0);
if (!hFile.isOpen()) { if (!hFile.isOpen()) {
return -2; return -2;
} }

View file

@ -197,42 +197,14 @@ void ServeSample(const char** ptr, uint32_t* length)
void PlayMovie(const char* fileName) void PlayMovie(const char* fileName)
{ {
char buffer[256];
int bDoFade = kTrue; int bDoFade = kTrue;
int hFx = -1; int hFx = -1;
#if 0 auto fp = fileSystem.OpenFileReader(fileName, 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));
if (!fp.isOpen()) if (!fp.isOpen())
{ {
Printf("Unable to open %s\n", fileName); Printf("Unable to open %s\n", fileName);
return; return;
} }
#endif
tileLoad(kMovieTile); tileLoad(kMovieTile);
CurFrame = TileFiles.tileMakeWritable(kMovieTile); CurFrame = TileFiles.tileMakeWritable(kMovieTile);
@ -261,7 +233,7 @@ void PlayMovie(const char* fileName)
if (ReadFrame(fp)) if (ReadFrame(fp))
{ {
// start audio playback // 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()) while (!inputState.keyBufferWaiting())
{ {

View file

@ -71,6 +71,7 @@ fix16_t nPlayerDAng = 0;
short obobangle = 0, bobangle = 0; short obobangle = 0, bobangle = 0;
short bPlayerPan = 0; short bPlayerPan = 0;
short bLockPan = 0; short bLockPan = 0;
bool g_MyAimMode;
static actionSeq ActionSeq[] = { static actionSeq ActionSeq[] = {
{18, 0}, {0, 0}, {9, 0}, {27, 0}, {63, 0}, {18, 0}, {0, 0}, {9, 0}, {27, 0}, {63, 0},
@ -165,27 +166,6 @@ void PlayerInterruptKeys()
CONTROL_GetInput(&info); CONTROL_GetInput(&info);
D_ProcessEvents(); 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) if (PlayerList[nLocalPlayer].nHealth == 0)
{ {
lPlayerYVel = 0; lPlayerYVel = 0;
@ -195,7 +175,7 @@ void PlayerInterruptKeys()
} }
// JBF: Run key behaviour is selectable // 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 turnAmount = playerRunning ? 12 : 8;
int const keyMove = playerRunning ? 12 : 6; int const keyMove = playerRunning ? 12 : 6;
constexpr int const analogTurnAmount = 12; constexpr int const analogTurnAmount = 12;
@ -218,6 +198,8 @@ void PlayerInterruptKeys()
q16avel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1); q16avel += fix16_from_int(info.dyaw) / analogExtent * (analogTurnAmount << 1);
} }
g_MyAimMode = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
if (g_MyAimMode) if (g_MyAimMode)
q16horz = fix16_div(fix16_from_int(info.mousey), F16(64)); q16horz = fix16_div(fix16_from_int(info.mousey), F16(64));
else else
@ -346,13 +328,17 @@ void PlayerInterruptKeys()
info.mousey = 6400; 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 else
{ {
buttonMap.ClearButton(gamefunc_Mouseview); buttonMap.ClearButton(gamefunc_Mouseview);
aimmode = !aimmode; aimmode = !aimmode;
} }*/
// loc_18EE4 // loc_18EE4
if (aimmode) if (aimmode)

View file

@ -166,7 +166,7 @@ int seq_ReadSequence(const char *seqName)
strcat(buffer, seqName); strcat(buffer, seqName);
strcat(buffer, ".seq"); strcat(buffer, ".seq");
auto hFile = kopenFileReader(buffer, 1); auto hFile = fileSystem.OpenFileReader(buffer, 1);
if (!hFile.isOpen()) if (!hFile.isOpen())
{ {
initprintf("Unable to open '%s'!\n", buffer); initprintf("Unable to open '%s'!\n", buffer);

View file

@ -444,7 +444,7 @@ int LoadSound(const char *sound)
strcat(buffer, ".voc"); strcat(buffer, ".voc");
auto hVoc = kopenFileReader(buffer, 0); auto hVoc = fileSystem.OpenFileReader(buffer, 0);
if (hVoc.isOpen()) if (hVoc.isOpen())
{ {

View file

@ -3712,6 +3712,7 @@ void getinput(SW_PACKET *loc)
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite];
short const which_weapon = u->WeaponNum + 1; short const which_weapon = u->WeaponNum + 1;
SET(loc->bits, which_weapon); SET(loc->bits, which_weapon);
}
inv_hotkey = 0; inv_hotkey = 0;