- ported the menu changes of the last commit.

This commit is contained in:
Christoph Oelckers 2020-02-27 19:26:30 +01:00
parent 95cc4a8aab
commit dbf446ee6c
6 changed files with 124 additions and 61 deletions

View file

@ -436,6 +436,8 @@ bool M_SetMenu(FName menu, int param, FName caller)
switch (caller) switch (caller)
{ {
case NAME_EpisodeMenu: case NAME_EpisodeMenu:
case NAME_HuntMenu:
case NAME_TargetMenu:
// sent from the episode menu // sent from the episode menu
GameStartupInfo.Episode = param; GameStartupInfo.Episode = param;
GameStartupInfo.Level = 0; GameStartupInfo.Level = 0;
@ -443,6 +445,10 @@ bool M_SetMenu(FName menu, int param, FName caller)
GameStartupInfo.Skill = gDefaultSkill; GameStartupInfo.Skill = gDefaultSkill;
break; break;
case NAME_WeaponMenu:
GameStartupInfo.Skill = param;
break;
case NAME_CustomGameMenu: case NAME_CustomGameMenu:
GameStartupInfo.CustomLevel1 = param; GameStartupInfo.CustomLevel1 = param;
GameStartupInfo.CustomLevel2 = -1; GameStartupInfo.CustomLevel2 = -1;

View file

@ -65,6 +65,9 @@ xx(LoadGameMenu)
xx(SoundMenu) xx(SoundMenu)
xx(ConfirmPlayerReset) xx(ConfirmPlayerReset)
xx(EpisodeMenu) xx(EpisodeMenu)
xx(HuntMenu)
xx(WeaponMenu)
xx(TargetMenu)
xx(SkillMenu) xx(SkillMenu)
xx(CustomGameMenu) xx(CustomGameMenu)
xx(CustomSubMenu1) xx(CustomSubMenu1)

View file

@ -68,13 +68,13 @@ const char *GetVersionString();
#define MINSAVEVER_DN3D 4 #define MINSAVEVER_DN3D 4
#define MINSAVEVER_BLD 4 #define MINSAVEVER_BLD 4
#define MINSAVEVER_RR 4 #define MINSAVEVER_RR 5
#define MINSAVEVER_SW 3 #define MINSAVEVER_SW 3
#define MINSAVEVER_PS 3 #define MINSAVEVER_PS 3
#define SAVEVER_DN3D 4 #define SAVEVER_DN3D 4
#define SAVEVER_BLD 4 #define SAVEVER_BLD 4
#define SAVEVER_RR 4 #define SAVEVER_RR 5
#define SAVEVER_SW 3 #define SAVEVER_SW 3
#define SAVEVER_PS 3 #define SAVEVER_PS 3

View file

@ -508,6 +508,31 @@ class RedneckWeaponMenu : public RedneckListMenu
} }
}; };
class RedneckTrophiesMenu : public RedneckListMenu
{
void PreDraw() override
{
RedneckListMenu::PreDraw();
vec2_t forigin = { int(origin.X * 65536), int(origin.Y * 65536) };
if (g_player[myconnectindex].ps->gm & MODE_GAME)
{
if (ud.level_number < 4)
{
rotatesprite_fs(forigin.x + (160 << 16), forigin.y + (100 << 16), 65536, 0, 1730, 0, 0, 10);
sub_5469C(forigin, 0);
}
else
sub_5469C(forigin, 2);
}
else
{
rotatesprite_fs(forigin.x + (160 << 16), forigin.y + (100 << 16), 65536, 0, 1730, 0, 0, 10);
sub_5469C(forigin, 1);
}
}
};
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// //
// Menu related game interface functions // Menu related game interface functions
@ -642,6 +667,10 @@ void GameInterface::StartGame(FGameStartup& gs)
int32_t skillsound = PISTOL_BODYHIT; int32_t skillsound = PISTOL_BODYHIT;
soundEngine->StopAllChannels(); soundEngine->StopAllChannels();
if (!DEER)
{
switch (gs.Skill) switch (gs.Skill)
{ {
case 0: case 0:
@ -660,7 +689,6 @@ void GameInterface::StartGame(FGameStartup& gs)
skillsound = RR ? 197 : JIBBED_ACTOR5; // Does not exist in DN3D. skillsound = RR ? 197 : JIBBED_ACTOR5; // Does not exist in DN3D.
break; break;
} }
ud.m_player_skill = gs.Skill + 1; ud.m_player_skill = gs.Skill + 1;
if (menu_sounds && skillsound >= 0 && SoundEnabled()) if (menu_sounds && skillsound >= 0 && SoundEnabled())
{ {
@ -673,12 +701,22 @@ void GameInterface::StartGame(FGameStartup& gs)
} }
} }
ud.m_respawn_monsters = (gs.Skill == 3); ud.m_respawn_monsters = (gs.Skill == 3);
ud.m_volume_number = gs.Episode;
m_level_number = gs.Level;
}
else
{
ud.m_player_skill = 1;
ud.m_respawn_monsters = 0;
ud.m_volume_number = 0;
m_level_number = gs.Episode;
g_player[myconnectindex].ps->dhat61f = gs.Skill;
}
ud.m_monsters_off = ud.monsters_off = 0; ud.m_monsters_off = ud.monsters_off = 0;
ud.m_respawn_items = 0; ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0; ud.m_respawn_inventory = 0;
ud.multimode = 1; ud.multimode = 1;
ud.m_volume_number = gs.Episode;
m_level_number = gs.Level;
G_NewGame_EnterLevel(); G_NewGame_EnterLevel();
} }
@ -742,6 +780,7 @@ static TMenuClassDescriptor<Redneck::RedneckListMenu> _lm("Redneck.ListMenu");
static TMenuClassDescriptor<Redneck::RedneckHuntMenu> _dhm("Redneck.HuntMenu"); static TMenuClassDescriptor<Redneck::RedneckHuntMenu> _dhm("Redneck.HuntMenu");
static TMenuClassDescriptor<Redneck::RedneckTargetMenu> _dtm("Redneck.TargetMenu"); static TMenuClassDescriptor<Redneck::RedneckTargetMenu> _dtm("Redneck.TargetMenu");
static TMenuClassDescriptor<Redneck::RedneckWeaponMenu> _dwm("Redneck.WeaponMenu"); static TMenuClassDescriptor<Redneck::RedneckWeaponMenu> _dwm("Redneck.WeaponMenu");
static TMenuClassDescriptor<Redneck::RedneckTrophiesMenu> _dttm("Redneck.TrophiesMenu");
static TMenuClassDescriptor<DImageScrollerMenu> _ism("Redneck.ImageScrollerMenu"); // does not implement a new class, we only need the descriptor. static TMenuClassDescriptor<DImageScrollerMenu> _ism("Redneck.ImageScrollerMenu"); // does not implement a new class, we only need the descriptor.
void RegisterRedneckMenus() void RegisterRedneckMenus()
@ -752,4 +791,5 @@ void RegisterRedneckMenus()
menuClasses.Push(&_dhm); menuClasses.Push(&_dhm);
menuClasses.Push(&_dtm); menuClasses.Push(&_dtm);
menuClasses.Push(&_dwm); menuClasses.Push(&_dwm);
menuClasses.Push(&_dttm);
} }

View file

@ -28,9 +28,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "baselayer.h" #include "baselayer.h"
#include "duke3d.h" #include "duke3d.h"
#include "i_time.h" #include "i_time.h"
#include "files.h"
#include "i_specialpaths.h"
BEGIN_RR_NS BEGIN_RR_NS
inline bool KB_KeyPressed(int code)
{
return inputState.GetKeyStatus(code);
}
inline void KB_ClearKeyDown(int key)
{
inputState.ClearKeyStatus(key);
}
int rrdh_randseed = 1; int rrdh_randseed = 1;
int rrdh_random(void) int rrdh_random(void)
@ -298,15 +310,16 @@ char dword_AA390[43] = " ";
void ghtrophy_savebestscores(void) void ghtrophy_savebestscores(void)
{ {
FILE *handle; FileWriter *handle;
handle = Bfopen("scores", "rb"); FString filename = M_GetDocumentsPath() + "scores";
handle = FileWriter::Open(filename);
if (!handle) if (!handle)
{ {
initprintf("ghtrophy_savebestscores cant open scores\n"); Printf("ghtrophy_savebestscores: cannot open scores\n"); // this is not an error!
return; return;
} }
Bfseek(handle, 0, SEEK_SET);
if (dword_AA36C > bestscore.f_0) if (dword_AA36C > bestscore.f_0)
bestscore.f_0 = dword_AA36C; bestscore.f_0 = dword_AA36C;
if (dword_AA370 > bestscore.f_4) if (dword_AA370 > bestscore.f_4)
@ -316,35 +329,30 @@ void ghtrophy_savebestscores(void)
if (dword_AA378 > bestscore.f_c) if (dword_AA378 > bestscore.f_c)
bestscore.f_c = dword_AA378; bestscore.f_c = dword_AA378;
Bfseek(handle, 0, SEEK_SET); if (handle->Write(&bestscore, sizeof(bestscore)) != sizeof(bestscore))
if (Bfwrite(&bestscore, sizeof(bestscore), 1, handle) != 1)
{ {
initprintf("ghtrophy_savebestscores err write scores\n"); initprintf("ghtrophy_savebestscores: error writing scores\n");
Bfclose(handle); delete handle;
return; return;
} }
Bfclose(handle); delete handle;
dword_AA380 = 0; dword_AA380 = 0;
} }
void ghtrophy_loadbestscores(void) void ghtrophy_loadbestscores(void)
{ {
FILE *handle; FileReader handle;
handle = fopen("scores", "wb"); FString filename = M_GetDocumentsPath() + "scores";
if (!handle) if (!handle.OpenFile(filename))
{ {
initprintf("ghtrophy_loadbestscores cant open scores\n"); // This is not an error.
return; return;
} }
Bfseek(handle, 0, SEEK_SET); if (handle.Read(&bestscore, sizeof(bestscore)) != sizeof(bestscore))
if (Bfread(&bestscore, sizeof(bestscore), 1, handle) != 1)
{ {
initprintf("ghtrophy_loadbestscores err read scores\n"); initprintf("ghtrophy_loadbestscores err read scores\n");
Bfclose(handle); memset(&bestscore, 0, sizeof(bestscore));
return;
} }
Bfclose(handle);
} }
int ghtrophy_isakill(short a1) int ghtrophy_isakill(short a1)
@ -818,6 +826,7 @@ void sub_54A2C(void)
char sub_54B80(void) char sub_54B80(void)
{ {
#if 0
switch (KB_GetLastScanCode()) switch (KB_GetLastScanCode())
{ {
case sc_A: case sc_A:
@ -902,6 +911,7 @@ char sub_54B80(void)
KB_SetLastScanCode(sc_None); KB_SetLastScanCode(sc_None);
return ' '; return ' ';
} }
#endif
return 0; return 0;
} }

View file

@ -130,11 +130,11 @@ LISTMENU "IngameMenu"
position 160, 72, 108 position 160, 72, 108
centermenu centermenu
animatedtransition animatedtransition
NativeTextItem "Go Huntin'!", "g", "HuntMenu" NativeTextItem "Keep Huntin'!", "k", "HuntMenu"
NativeTextItem "Target Range", "r", "TargetMenu"
NativeTextItem "Trophies", "t", "TrophiesMenu" NativeTextItem "Trophies", "t", "TrophiesMenu"
NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu" NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu"
NativeTextItem "$MNU_HELP", "h", "HelpMenu" NativeTextItem "$MNU_HELP", "h", "HelpMenu"
NativeTextItem "Leave Area", "l", "EndgameMenu"
NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu"
} }
ifgame(Blood) ifgame(Blood)
@ -226,10 +226,10 @@ LISTMENU "HuntMenu"
position 160, 102, 78 position 160, 102, 78
centermenu centermenu
animatedtransition animatedtransition
NativeTextItem "LAKE SWAMPY", "q", "WeaponsMenu" NativeTextItem "LAKE SWAMPY", "q", "WeaponsMenu", 0
NativeTextItem "SAGEBRUSH FLATS", "q", "WeaponsMenu" NativeTextItem "SAGEBRUSH FLATS", "q", "WeaponsMenu", 1
NativeTextItem "OZARK FOREST", "q", "WeaponsMenu" NativeTextItem "OZARK FOREST", "q", "WeaponsMenu", 2
NativeTextItem "SNOWBUSH RIDGE", "q", "WeaponsMenu" NativeTextItem "SNOWBUSH RIDGE", "q", "WeaponsMenu", 3
} }
} }
@ -241,13 +241,17 @@ LISTMENU "TargetMenu"
position 160, 102, 78 position 160, 102, 78
centermenu centermenu
animatedtransition animatedtransition
NativeTextItem "NORTH RANGE", "q", "WeaponsMenu" NativeTextItem "NORTH RANGE", "q", "WeaponsMenu", 4
NativeTextItem "SOUTH RANGE", "q", "WeaponsMenu" NativeTextItem "SOUTH RANGE", "q", "WeaponsMenu", 5
} }
} }
LISTMENU "TrophiesMenu" LISTMENU "TrophiesMenu"
{ {
class "$.TrophiesMenu"
position 160, 102, 78
centermenu
animatedtransition
} }
LISTMENU "WeaponsMenu" LISTMENU "WeaponsMenu"
@ -258,11 +262,11 @@ LISTMENU "WeaponsMenu"
position 160, 102, 98 position 160, 102, 98
centermenu centermenu
animatedtransition animatedtransition
NativeTextItem "Pistol", "q", "QuitMenu" NativeTextItem "Pistol", "q", "StartGame", 0
NativeTextItem "Rifle", "q", "QuitMenu" NativeTextItem "Rifle", "q", "StartGame", 1
NativeTextItem "Rifle With Scope", "q", "QuitMenu" NativeTextItem "Rifle With Scope", "q", "StartGame", 2
NativeTextItem "Shotgun", "q", "QuitMenu" NativeTextItem "Shotgun", "q", "StartGame", 3
NativeTextItem "Crossbow", "q", "QuitMenu" NativeTextItem "Crossbow", "q", "StartGame", 4
} }
} }