2019-12-02 23:01:04 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2016 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Christoph Oelckers
|
|
|
|
|
|
|
|
This 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"
|
2020-08-16 07:46:37 +00:00
|
|
|
#include "g_input.h"
|
2019-12-02 23:01:04 +00:00
|
|
|
|
|
|
|
#include "names2.h"
|
|
|
|
#include "panel.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "tags.h"
|
|
|
|
#include "sector.h"
|
|
|
|
#include "sprite.h"
|
|
|
|
#include "weapon.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "jsector.h"
|
|
|
|
#include "menus.h"
|
|
|
|
#include "pal.h"
|
|
|
|
#include "keydef.h"
|
2020-09-02 08:00:07 +00:00
|
|
|
#include "d_net.h"
|
2019-12-02 23:01:04 +00:00
|
|
|
|
|
|
|
#include "gamecontrol.h"
|
2020-08-05 22:18:45 +00:00
|
|
|
#include "misc.h"
|
2019-12-02 23:01:04 +00:00
|
|
|
#include "version.h"
|
|
|
|
#include "network.h"
|
|
|
|
|
2020-08-05 15:07:19 +00:00
|
|
|
#include "misc.h"
|
2020-10-04 16:31:48 +00:00
|
|
|
#include "razemenu.h"
|
2020-04-12 06:09:38 +00:00
|
|
|
#include "raze_sound.h"
|
2019-12-18 18:17:37 +00:00
|
|
|
#include "sounds.h"
|
2020-08-16 18:10:26 +00:00
|
|
|
#include "gamestate.h"
|
2020-08-18 18:26:16 +00:00
|
|
|
#include "raze_music.h"
|
2020-10-04 16:31:48 +00:00
|
|
|
#include "v_draw.h"
|
2020-10-07 21:22:29 +00:00
|
|
|
#include "vm.h"
|
2019-12-02 23:01:04 +00:00
|
|
|
|
|
|
|
#include "../../glbackend/glbackend.h"
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_SW_NS
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Implements the native looking menu used for the main menu
|
|
|
|
// and the episode/skill selection screens, i.e. the parts
|
|
|
|
// that need to look authentic
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static bool DidOrderSound;
|
|
|
|
static int zero = 0;
|
|
|
|
|
2020-10-07 21:22:29 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(_SWMenuDelegate, PlayOrderSound)
|
2019-12-02 23:01:04 +00:00
|
|
|
{
|
2020-10-07 21:22:29 +00:00
|
|
|
if (SW_SHAREWARE && !DidOrderSound)
|
2019-12-02 23:01:04 +00:00
|
|
|
{
|
2020-10-07 21:22:29 +00:00
|
|
|
DidOrderSound = true;
|
|
|
|
int choose_snd = STD_RANDOM_RANGE(1000);
|
|
|
|
if (choose_snd > 500)
|
|
|
|
PlaySound(DIGI_WANGORDER1, v3df_dontpan, CHAN_BODY, CHANF_UI);
|
|
|
|
else
|
|
|
|
PlaySound(DIGI_WANGORDER2, v3df_dontpan, CHAN_BODY, CHANF_UI);
|
2019-12-02 23:01:04 +00:00
|
|
|
}
|
2020-10-07 21:22:29 +00:00
|
|
|
return 0;
|
2019-12-02 23:01:04 +00:00
|
|
|
}
|
|
|
|
|
2020-08-17 18:38:46 +00:00
|
|
|
void GameInterface::QuitToTitle()
|
|
|
|
{
|
2020-08-18 18:15:06 +00:00
|
|
|
Mus_Stop();
|
2020-09-05 13:43:34 +00:00
|
|
|
gameaction = ga_mainmenu;
|
2020-08-17 18:38:46 +00:00
|
|
|
}
|
|
|
|
|
2019-12-02 23:01:04 +00:00
|
|
|
|
|
|
|
void GameInterface::MenuSound(EMenuSounds snd)
|
|
|
|
{
|
|
|
|
switch (snd)
|
|
|
|
{
|
|
|
|
case CursorSound:
|
2020-02-16 19:08:04 +00:00
|
|
|
PlaySound(DIGI_STAR, v3df_dontpan, CHAN_BODY, CHANF_UI);
|
2019-12-02 23:01:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AdvanceSound:
|
2020-08-21 19:04:16 +00:00
|
|
|
case ChooseSound:
|
2020-02-16 19:08:04 +00:00
|
|
|
PlaySound(DIGI_SWORDSWOOSH, v3df_dontpan, CHAN_BODY, CHANF_UI);
|
2019-12-02 23:01:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CloseSound:
|
2020-08-21 19:04:16 +00:00
|
|
|
case BackSound:
|
2020-02-16 19:08:04 +00:00
|
|
|
PlaySound(DIGI_STARCLINK, v3df_dontpan, CHAN_BODY, CHANF_UI);
|
2019-12-02 23:01:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GameInterface::CanSave()
|
|
|
|
{
|
2020-08-16 18:10:26 +00:00
|
|
|
return (gamestate == GS_LEVEL && !CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !TEST(Player[myconnectindex].Flags, PF_DEAD));
|
2019-12-02 23:01:04 +00:00
|
|
|
}
|
|
|
|
|
2020-09-25 17:36:50 +00:00
|
|
|
bool GameInterface::StartGame(FNewGameStartup& gs)
|
2019-12-02 23:01:04 +00:00
|
|
|
{
|
|
|
|
PLAYERp pp = Player + screenpeek;
|
|
|
|
int handle = 0;
|
|
|
|
int zero = 0;
|
2020-09-04 19:15:15 +00:00
|
|
|
|
2020-09-03 21:10:28 +00:00
|
|
|
MapRecord* map;
|
2020-09-25 17:36:50 +00:00
|
|
|
if (gs.Episode >= 1)
|
|
|
|
{
|
|
|
|
if (g_gameType & GAMEFLAG_SHAREWARE)
|
|
|
|
{
|
2020-10-04 16:31:48 +00:00
|
|
|
M_StartMessage(GStrings("BUYSW"), 1, NAME_None);
|
2020-09-25 17:36:50 +00:00
|
|
|
return false;
|
|
|
|
}
|
2020-09-03 21:10:28 +00:00
|
|
|
map = FindMapByLevelNum(5);
|
2020-09-25 17:36:50 +00:00
|
|
|
}
|
2019-12-02 23:01:04 +00:00
|
|
|
else
|
2020-09-03 21:10:28 +00:00
|
|
|
map = FindMapByLevelNum(1);
|
2019-12-02 23:01:04 +00:00
|
|
|
|
2020-09-25 17:36:50 +00:00
|
|
|
if (!map) return false;
|
2020-09-09 17:52:52 +00:00
|
|
|
CameraTestMode = false;
|
2020-02-17 18:43:58 +00:00
|
|
|
StopFX();
|
2019-12-02 23:01:04 +00:00
|
|
|
|
|
|
|
//InitNewGame();
|
|
|
|
|
2020-09-02 08:00:07 +00:00
|
|
|
if (!netgame)
|
2019-12-18 21:24:50 +00:00
|
|
|
{
|
2020-10-09 22:09:18 +00:00
|
|
|
if (gs.Skill == 0)
|
2020-09-02 08:00:07 +00:00
|
|
|
PlaySound(DIGI_TAUNTAI3, v3df_none, CHAN_VOICE, CHANF_UI);
|
2020-10-09 22:09:18 +00:00
|
|
|
else if (gs.Skill == 1)
|
2020-09-02 08:00:07 +00:00
|
|
|
PlaySound(DIGI_NOFEAR, v3df_none, CHAN_VOICE, CHANF_UI);
|
2020-10-09 22:09:18 +00:00
|
|
|
else if (gs.Skill == 2)
|
2020-09-02 08:00:07 +00:00
|
|
|
PlaySound(DIGI_WHOWANTSWANG, v3df_none, CHAN_VOICE, CHANF_UI);
|
2020-10-09 22:09:18 +00:00
|
|
|
else if (gs.Skill == 3)
|
2020-09-02 08:00:07 +00:00
|
|
|
PlaySound(DIGI_NOPAIN, v3df_none, CHAN_VOICE, CHANF_UI);
|
|
|
|
|
|
|
|
while (soundEngine->IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_VOICE))
|
|
|
|
{
|
|
|
|
gi->UpdateSounds();
|
|
|
|
soundEngine->UpdateSounds(I_GetTime());
|
|
|
|
I_GetEvent();
|
|
|
|
}
|
|
|
|
Net_ClearFifo();
|
2019-12-18 21:24:50 +00:00
|
|
|
}
|
2020-09-03 21:10:28 +00:00
|
|
|
DeferedStartGame(map, gs.Skill);
|
2020-09-25 17:36:50 +00:00
|
|
|
return true;
|
2019-12-02 23:01:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FSavegameInfo GameInterface::GetSaveSig()
|
|
|
|
{
|
|
|
|
return { SAVESIG_SW, MINSAVEVER_SW, SAVEVER_SW };
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
END_SW_NS
|