Skip to content

Commit

Permalink
Fix main menu extra graphics/sounds (#632)
Browse files Browse the repository at this point in the history
* Merge remote-tracking branch 'upstream/master'

* Dirty fix

Removed the new menu graphics for now and blocked the sounds.

* Add option for main menu graphics/sounds

* Restore optional menu graphics

Fixed up Menu2.png, which was 772x600 iso 800x600

Co-authored-by: fejoa <[email protected]>
  • Loading branch information
red-kangaroo and ryfactor authored Dec 20, 2021
1 parent 4120086 commit bcc258d
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 16 deletions.
Binary file added .devsPrefs/red-kangaroo/TodoGraphics/Menu2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .devsPrefs/red-kangaroo/TodoGraphics/Menu3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .devsPrefs/red-kangaroo/TodoGraphics/Menu4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .devsPrefs/red-kangaroo/TodoGraphics/Menu5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion FeLib/Include/feio.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class iosystem
static int Menu(std::vector<bitmap*> vBackGround, v2, cfestring&,
cfestring&, col16,
cfestring& = CONST_S(""),
cfestring& = CONST_S(""));
cfestring& = CONST_S(""),
truth = false);
static void TextScreen(cfestring&, v2 Disp = ZERO_V2,
col16 = 0xFFFF, truth = true,
truth = true, bitmapeditor = 0);
Expand Down
23 changes: 14 additions & 9 deletions FeLib/Source/feio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int iSelectedPrevious=-1;
int iosystem::Menu(std::vector<bitmap*> vBackGround, v2 Pos,
cfestring& Topic, cfestring& sMS,
col16 Color, cfestring& SmallText1,
cfestring& SmallText2)
cfestring& SmallText2, truth ExtraMenuGraphics)
{
if(CountChars('\r', sMS) < 1)
return (-1);
Expand All @@ -180,7 +180,12 @@ int iosystem::Menu(std::vector<bitmap*> vBackGround, v2 Pos,

while(!bReady)
{
cbitmap* BackGround = vBackGround.size()>iSelected?vBackGround[iSelected]:NULL;
cbitmap* BackGround = NULL;
if(ExtraMenuGraphics)
BackGround = vBackGround.size()>iSelected?vBackGround[iSelected]:NULL;
else
BackGround = vBackGround[0];

if(BackGround){
if( (RES.X!=BackGround->GetSize().X) || (RES.Y!=BackGround->GetSize().Y) ){
blitdata B = DEFAULT_BLITDATA;
Expand All @@ -207,14 +212,14 @@ int iosystem::Menu(std::vector<bitmap*> vBackGround, v2 Pos,
}
}else
Buffer.ClearToColor(0);

#ifndef NOSOUND
if(iSelectedPrevious != iSelected){
if(ExtraMenuGraphics && iSelectedPrevious != iSelected){
soundeffects::playSound(festring()<<"Main Menu Entry "<<(iSelected+1));
iSelectedPrevious = iSelected;
}
#endif

clock_t StartTime = clock();
sCopyOfMS = Topic;
int i;
Expand Down Expand Up @@ -298,7 +303,7 @@ int iosystem::Menu(std::vector<bitmap*> vBackGround, v2 Pos,
}
else
{
//FONT->Printf(&Buffer, v2(100, 100), Color, "%s", "NUKES IS HERE!");
//FONT->Printf(&Buffer, v2(100, 100), Color, "%s", "NUKES IS HERE!");
Buffer.FastBlit(DOUBLE_BUFFER);
graphics::BlitDBToScreen();
k = GET_KEY(false);
Expand Down Expand Up @@ -921,7 +926,7 @@ struct sAlertConfirmMsg{
void iosystem::AlertConfirmMsgDraw(bitmap* Buffer)
{
if(!sAlertConfirmMsgInst.bShow)return;

//TODO calc all line withs to determine the full popup width to not look bad if overflow, see specialkeys help dialog creation
int iLineHeight=20;
v2 v2Border(700,100+(sAlertConfirmMsgInst.vfsCritMsgs.size()*iLineHeight));
Expand All @@ -944,7 +949,7 @@ void iosystem::AlertConfirmMsgDraw(bitmap* Buffer)
bool iosystem::AlertConfirmMsg(const char* cMsg,std::vector<festring> vfsCritMsgs,bool bConfirmMode)
{
static bool bDummyInit = [](){graphics::AddDrawAboveAll(&AlertConfirmMsgDraw,100100,"iosystem::AlertConfirmMsgDraw"); return true;}();

bInUse=true;

sAlertConfirmMsgInst.bShow=true;
Expand Down Expand Up @@ -1186,7 +1191,7 @@ festring iosystem::ContinueMenu(col16 TopicColor, col16 ListColor,
* Generating a new level is probably bad as it will ignore whatever happened in that level and may create
* duplicated items (uniques) and characters (uniques that died) when they should not exist,
* may be only for fully random (with non unique things on it) levels such workaround could be used...
*
*
* TODO for file extensions, find the type only at the end, use std::string if easier/clearer to implement
*/
}else
Expand Down
Binary file added Graphics/Menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Graphics/Menu2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion Main/Include/iconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ class ivanconfig
static int GetAltListItemPos() { return AltListItemPos.Value; }
static truth GetPlaySounds() { return PlaySounds.Value; }
static truth IsShowTurn() { return ShowTurn.Value; }
static truth IsAllowMouseOnFelist(){return AllowMouseOnFelist.Value;}
static truth IsAllowMouseOnFelist(){ return AllowMouseOnFelist.Value; }
static truth IsStartingOutlinedGfx() { return bStartingOutlinedGfx; }
static long GetVolume() { return Volume.Value; }
static long GetSfxVolume() { return SfxVolume.Value; }
static long GetMIDIOutputDevice() { return MIDIOutputDevice.Value; }
static truth GetExtraMenuGraphics(){ return UseExtraMenuGraphics.Value; }

#ifndef __DJGPP__
static int GetGraphicsScale() { return GraphicsScale.Value; }
Expand Down Expand Up @@ -149,6 +150,7 @@ class ivanconfig
static void SfxVolumeChanger(numberoption*, long);
static void AltSilhouetteDisplayer(const cycleoption* O, festring& Entry);
static void AllowMouseOnFelistChanger(truthoption*, truth);
static void UseExtraMenuGraphicsChanger(truthoption*, truth);

#ifndef __DJGPP__
static void GraphicsScaleDisplayer(const cycleoption*, festring&);
Expand Down Expand Up @@ -261,6 +263,7 @@ class ivanconfig
static truthoption ShowTurn;

static truthoption AllowMouseOnFelist;
static truthoption UseExtraMenuGraphics;
};

inline long ivanconfig::ApplyContrastTo(long L)
Expand Down
3 changes: 2 additions & 1 deletion Main/Source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4643,7 +4643,8 @@ int game::Menu(std::vector<bitmap*> vBackGround, v2 Pos, cfestring& Topic, cfest
col16 Color, cfestring& SmallText1, cfestring& SmallText2)
{
globalwindowhandler::DisableControlLoops();
int Return = iosystem::Menu(vBackGround, Pos, Topic, sMS, Color, SmallText1, SmallText2);
int Return = iosystem::Menu(vBackGround, Pos, Topic, sMS, Color, SmallText1, SmallText2,
ivanconfig::GetExtraMenuGraphics());
globalwindowhandler::EnableControlLoops();
return Return;
}
Expand Down
22 changes: 19 additions & 3 deletions Main/Source/iconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,13 @@ cycleoption ivanconfig::ScalingQuality( "ScalingQuality",
"",
0, 2,
&ScalingQualityDisplayer);
truthoption ivanconfig::UseExtraMenuGraphics("UseExtraMenuGraphics",
"Use extra main menu graphics",
"Add changing graphics and sounds to the main menu.",
false,
&configsystem::NormalTruthDisplayer,
&configsystem::NormalTruthChangeInterface,
&UseExtraMenuGraphicsChanger);
#endif
col24 ivanconfig::ContrastLuminance = NORMAL_LUMINANCE;
truthoption ivanconfig::PlaySounds( "PlaySounds",
Expand Down Expand Up @@ -1019,6 +1026,13 @@ void ivanconfig::AllowMouseOnFelistChanger(truthoption* O, truth What)
graphics::SetAllowMouseInFullScreen(What);
}

void ivanconfig::UseExtraMenuGraphicsChanger(truthoption* O, truth What)
{
if(O!=NULL)O->Value = What;
felist::SetAllowMouse(What);
graphics::SetAllowMouseInFullScreen(What);
}

void ivanconfig::FullScreenModeChanger(truthoption*, truth)
{
graphics::SwitchMode();
Expand Down Expand Up @@ -1065,9 +1079,9 @@ void ivanconfig::VolumeHandler(long Value)
void ivanconfig::SfxVolumeHandler(long Value)
{
SfxVolumeChanger(&SfxVolume, Value);

soundeffects::SetSfxVolume(SfxVolume.Value);

if(game::IsRunning())
{
game::GetCurrentArea()->SendNewDrawRequest();
Expand Down Expand Up @@ -1160,6 +1174,7 @@ void ivanconfig::Initialize()
configsystem::AddOption(fsCategory,&HitIndicator);
configsystem::AddOption(fsCategory,&ShowMap);
configsystem::AddOption(fsCategory,&TransparentMapLM);
configsystem::AddOption(fsCategory,&UseExtraMenuGraphics);

fsCategory="Sounds";
configsystem::AddOption(fsCategory,&PlaySounds);
Expand Down Expand Up @@ -1222,7 +1237,8 @@ void ivanconfig::Initialize()
SelectedBkgColorChanger(NULL, SelectedBkgColor.Value);
AutoPickUpMatchingChanger(NULL, AutoPickUpMatching.Value);
AllowMouseOnFelistChanger(NULL, AllowMouseOnFelist.Value);

UseExtraMenuGraphicsChanger(NULL, UseExtraMenuGraphics.Value);

#ifndef NOSOUND
soundeffects::SetEnableSfx(PlaySounds.Value);
soundeffects::SetSfxVolume(SfxVolume.Value);
Expand Down
3 changes: 2 additions & 1 deletion Main/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ int main(int argc, char** argv)
CONST_S("Released under the GNU\r"
"General Public License\r"
"More info: see COPYING\r"),
CONST_S("IVAN v" IVAN_VERSION "\r"));
CONST_S("IVAN v" IVAN_VERSION "\r"),
ivanconfig::GetExtraMenuGraphics());

switch(Select)
{
Expand Down

0 comments on commit bcc258d

Please sign in to comment.