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

View file

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

View file

@ -68,13 +68,13 @@ const char *GetVersionString();
#define MINSAVEVER_DN3D 4
#define MINSAVEVER_BLD 4
#define MINSAVEVER_RR 4
#define MINSAVEVER_RR 5
#define MINSAVEVER_SW 3
#define MINSAVEVER_PS 3
#define SAVEVER_DN3D 4
#define SAVEVER_BLD 4
#define SAVEVER_RR 4
#define SAVEVER_RR 5
#define SAVEVER_SW 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
@ -642,43 +667,56 @@ void GameInterface::StartGame(FGameStartup& gs)
int32_t skillsound = PISTOL_BODYHIT;
soundEngine->StopAllChannels();
switch (gs.Skill)
{
case 0:
skillsound = RR? 427 : JIBBED_ACTOR6;
break;
case 1:
skillsound = RR? 428 : BONUS_SPEECH1;
break;
case 2:
skillsound = RR? 196 : DUKE_GETWEAPON2;
break;
case 3:
skillsound = RR? 195 : JIBBED_ACTOR5;
break;
case 4:
skillsound = RR? 197 : JIBBED_ACTOR5; // Does not exist in DN3D.
break;
}
ud.m_player_skill = gs.Skill + 1;
if (menu_sounds && skillsound >= 0 && SoundEnabled())
if (!DEER)
{
S_PlaySound(skillsound, CHAN_AUTO, CHANF_UI);
while (S_CheckSoundPlaying(skillsound))
switch (gs.Skill)
{
S_Update();
G_HandleAsync();
case 0:
skillsound = RR ? 427 : JIBBED_ACTOR6;
break;
case 1:
skillsound = RR ? 428 : BONUS_SPEECH1;
break;
case 2:
skillsound = RR ? 196 : DUKE_GETWEAPON2;
break;
case 3:
skillsound = RR ? 195 : JIBBED_ACTOR5;
break;
case 4:
skillsound = RR ? 197 : JIBBED_ACTOR5; // Does not exist in DN3D.
break;
}
ud.m_player_skill = gs.Skill + 1;
if (menu_sounds && skillsound >= 0 && SoundEnabled())
{
S_PlaySound(skillsound, CHAN_AUTO, CHANF_UI);
while (S_CheckSoundPlaying(skillsound))
{
S_Update();
G_HandleAsync();
}
}
ud.m_respawn_monsters = (gs.Skill == 3);
ud.m_volume_number = gs.Episode;
m_level_number = gs.Level;
}
ud.m_respawn_monsters = (gs.Skill == 3);
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_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
ud.m_volume_number = gs.Episode;
m_level_number = gs.Level;
G_NewGame_EnterLevel();
}
@ -742,6 +780,7 @@ static TMenuClassDescriptor<Redneck::RedneckListMenu> _lm("Redneck.ListMenu");
static TMenuClassDescriptor<Redneck::RedneckHuntMenu> _dhm("Redneck.HuntMenu");
static TMenuClassDescriptor<Redneck::RedneckTargetMenu> _dtm("Redneck.TargetMenu");
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.
void RegisterRedneckMenus()
@ -752,4 +791,5 @@ void RegisterRedneckMenus()
menuClasses.Push(&_dhm);
menuClasses.Push(&_dtm);
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 "duke3d.h"
#include "i_time.h"
#include "files.h"
#include "i_specialpaths.h"
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_random(void)
@ -298,15 +310,16 @@ char dword_AA390[43] = " ";
void ghtrophy_savebestscores(void)
{
FILE *handle;
FileWriter *handle;
handle = Bfopen("scores", "rb");
FString filename = M_GetDocumentsPath() + "scores";
handle = FileWriter::Open(filename);
if (!handle)
{
initprintf("ghtrophy_savebestscores cant open scores\n");
Printf("ghtrophy_savebestscores: cannot open scores\n"); // this is not an error!
return;
}
Bfseek(handle, 0, SEEK_SET);
if (dword_AA36C > bestscore.f_0)
bestscore.f_0 = dword_AA36C;
if (dword_AA370 > bestscore.f_4)
@ -316,35 +329,30 @@ void ghtrophy_savebestscores(void)
if (dword_AA378 > bestscore.f_c)
bestscore.f_c = dword_AA378;
Bfseek(handle, 0, SEEK_SET);
if (Bfwrite(&bestscore, sizeof(bestscore), 1, handle) != 1)
if (handle->Write(&bestscore, sizeof(bestscore)) != sizeof(bestscore))
{
initprintf("ghtrophy_savebestscores err write scores\n");
Bfclose(handle);
initprintf("ghtrophy_savebestscores: error writing scores\n");
delete handle;
return;
}
Bfclose(handle);
delete handle;
dword_AA380 = 0;
}
void ghtrophy_loadbestscores(void)
{
FILE *handle;
handle = fopen("scores", "wb");
if (!handle)
FileReader handle;
FString filename = M_GetDocumentsPath() + "scores";
if (!handle.OpenFile(filename))
{
initprintf("ghtrophy_loadbestscores cant open scores\n");
// This is not an error.
return;
}
Bfseek(handle, 0, SEEK_SET);
if (Bfread(&bestscore, sizeof(bestscore), 1, handle) != 1)
if (handle.Read(&bestscore, sizeof(bestscore)) != sizeof(bestscore))
{
initprintf("ghtrophy_loadbestscores err read scores\n");
Bfclose(handle);
return;
memset(&bestscore, 0, sizeof(bestscore));
}
Bfclose(handle);
}
int ghtrophy_isakill(short a1)
@ -818,6 +826,7 @@ void sub_54A2C(void)
char sub_54B80(void)
{
#if 0
switch (KB_GetLastScanCode())
{
case sc_A:
@ -902,6 +911,7 @@ char sub_54B80(void)
KB_SetLastScanCode(sc_None);
return ' ';
}
#endif
return 0;
}

View file

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