mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-17 01:31:25 +00:00
-scriptified the ReadThis screen.
This commit is contained in:
parent
e46571c192
commit
2440951811
10 changed files with 136 additions and 151 deletions
|
@ -851,7 +851,6 @@ set( FASTMATH_PCH_SOURCES
|
||||||
menu/messagebox.cpp
|
menu/messagebox.cpp
|
||||||
menu/optionmenu.cpp
|
menu/optionmenu.cpp
|
||||||
menu/playermenu.cpp
|
menu/playermenu.cpp
|
||||||
menu/readthis.cpp
|
|
||||||
menu/videomenu.cpp
|
menu/videomenu.cpp
|
||||||
oplsynth/fmopl.cpp
|
oplsynth/fmopl.cpp
|
||||||
oplsynth/mlopl.cpp
|
oplsynth/mlopl.cpp
|
||||||
|
|
|
@ -1461,6 +1461,7 @@ void G_InitLevelLocals ()
|
||||||
level.LevelName = level.info->LookupLevelName();
|
level.LevelName = level.info->LookupLevelName();
|
||||||
level.NextMap = info->NextMap;
|
level.NextMap = info->NextMap;
|
||||||
level.NextSecretMap = info->NextSecretMap;
|
level.NextSecretMap = info->NextSecretMap;
|
||||||
|
level.F1Pic = info->F1Pic;
|
||||||
|
|
||||||
compatflags.Callback();
|
compatflags.Callback();
|
||||||
compatflags2.Callback();
|
compatflags2.Callback();
|
||||||
|
@ -1909,6 +1910,7 @@ DEFINE_FIELD(FLevelLocals, LevelName)
|
||||||
DEFINE_FIELD(FLevelLocals, MapName)
|
DEFINE_FIELD(FLevelLocals, MapName)
|
||||||
DEFINE_FIELD(FLevelLocals, NextMap)
|
DEFINE_FIELD(FLevelLocals, NextMap)
|
||||||
DEFINE_FIELD(FLevelLocals, NextSecretMap)
|
DEFINE_FIELD(FLevelLocals, NextSecretMap)
|
||||||
|
DEFINE_FIELD(FLevelLocals, F1Pic)
|
||||||
DEFINE_FIELD(FLevelLocals, maptype)
|
DEFINE_FIELD(FLevelLocals, maptype)
|
||||||
DEFINE_FIELD(FLevelLocals, Music)
|
DEFINE_FIELD(FLevelLocals, Music)
|
||||||
DEFINE_FIELD(FLevelLocals, musicorder)
|
DEFINE_FIELD(FLevelLocals, musicorder)
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct FLevelLocals
|
||||||
FString MapName; // the lump name (E1M1, MAP01, etc)
|
FString MapName; // the lump name (E1M1, MAP01, etc)
|
||||||
FString NextMap; // go here when using the regular exit
|
FString NextMap; // go here when using the regular exit
|
||||||
FString NextSecretMap; // map to go to when used secret exit
|
FString NextSecretMap; // map to go to when used secret exit
|
||||||
|
FString F1Pic;
|
||||||
EMapType maptype;
|
EMapType maptype;
|
||||||
|
|
||||||
TStaticArray<vertex_t> vertexes;
|
TStaticArray<vertex_t> vertexes;
|
||||||
|
|
|
@ -1970,6 +1970,7 @@ static void ClearMapinfo()
|
||||||
DefaultSkill = -1;
|
DefaultSkill = -1;
|
||||||
DeinitIntermissions();
|
DeinitIntermissions();
|
||||||
level.info = NULL;
|
level.info = NULL;
|
||||||
|
level.F1Pic = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -51,6 +51,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon1)
|
||||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon2)
|
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon2)
|
||||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gametype)
|
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gametype)
|
||||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, norandomplayerclass)
|
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, norandomplayerclass)
|
||||||
|
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, infoPages)
|
||||||
|
|
||||||
|
|
||||||
const char *GameNames[17] =
|
const char *GameNames[17] =
|
||||||
|
|
|
@ -1,149 +0,0 @@
|
||||||
/*
|
|
||||||
** readthis.cpp
|
|
||||||
** Help screens
|
|
||||||
**
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
** Copyright 2001-2010 Randy Heit
|
|
||||||
** Copyright 2010 Christoph Oelckers
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions
|
|
||||||
** are met:
|
|
||||||
**
|
|
||||||
** 1. Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in the
|
|
||||||
** documentation and/or other materials provided with the distribution.
|
|
||||||
** 3. The name of the author may not be used to endorse or promote products
|
|
||||||
** derived from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
**---------------------------------------------------------------------------
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "menu/menu.h"
|
|
||||||
#include "v_video.h"
|
|
||||||
#include "g_level.h"
|
|
||||||
#include "gi.h"
|
|
||||||
#include "g_levellocals.h"
|
|
||||||
#include "textures/textures.h"
|
|
||||||
|
|
||||||
class DReadThisMenu : public DMenu
|
|
||||||
{
|
|
||||||
DECLARE_CLASS(DReadThisMenu, DMenu)
|
|
||||||
int mScreen;
|
|
||||||
int mInfoTic;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DReadThisMenu(DMenu *parent = NULL);
|
|
||||||
void Drawer();
|
|
||||||
bool MenuEvent(int mkey, bool fromcontroller);
|
|
||||||
bool DimAllowed () { return false; }
|
|
||||||
bool MouseEvent(int type, int x, int y);
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DReadThisMenu, false, false)
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// Read This Menus
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
DReadThisMenu::DReadThisMenu(DMenu *parent)
|
|
||||||
: DMenu(parent)
|
|
||||||
{
|
|
||||||
mScreen = 1;
|
|
||||||
mInfoTic = gametic;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
void DReadThisMenu::Drawer()
|
|
||||||
{
|
|
||||||
FTexture *tex = NULL, *prevpic = NULL;
|
|
||||||
double alpha;
|
|
||||||
|
|
||||||
// Did the mapper choose a custom help page via MAPINFO?
|
|
||||||
if ((level.info != NULL) && level.info->F1Pic.Len() != 0)
|
|
||||||
{
|
|
||||||
tex = TexMan.FindTexture(level.info->F1Pic);
|
|
||||||
mScreen = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tex == NULL)
|
|
||||||
{
|
|
||||||
tex = TexMan[gameinfo.infoPages[mScreen-1].GetChars()];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mScreen > 1)
|
|
||||||
{
|
|
||||||
prevpic = TexMan[gameinfo.infoPages[mScreen-2].GetChars()];
|
|
||||||
}
|
|
||||||
|
|
||||||
screen->Dim(0, 1.0, 0,0, SCREENWIDTH, SCREENHEIGHT);
|
|
||||||
alpha = MIN((gametic - mInfoTic) * (3. / TICRATE), 1.);
|
|
||||||
if (alpha < 1. && prevpic != NULL)
|
|
||||||
{
|
|
||||||
screen->DrawTexture (prevpic, 0, 0, DTA_Fullscreen, true, TAG_DONE);
|
|
||||||
}
|
|
||||||
screen->DrawTexture (tex, 0, 0, DTA_Fullscreen, true, DTA_Alpha, alpha, TAG_DONE);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
bool DReadThisMenu::MenuEvent(int mkey, bool fromcontroller)
|
|
||||||
{
|
|
||||||
if (mkey == MKEY_Enter)
|
|
||||||
{
|
|
||||||
S_Sound (CHAN_VOICE | CHAN_UI, "menu/choose", snd_menuvolume, ATTN_NONE);
|
|
||||||
mScreen++;
|
|
||||||
mInfoTic = gametic;
|
|
||||||
if ((level.info != NULL && level.info->F1Pic.Len() != 0) || mScreen > int(gameinfo.infoPages.Size()))
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else return Super::MenuEvent(mkey, fromcontroller);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
bool DReadThisMenu::MouseEvent(int type, int x, int y)
|
|
||||||
{
|
|
||||||
if (type == MOUSE_Click)
|
|
||||||
{
|
|
||||||
return MenuEvent(MKEY_Enter, true);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -906,6 +906,9 @@ void InitThingdef()
|
||||||
fieldptr = new PField("OptionMenuSettings", NewStruct("FOptionMenuSettings", nullptr), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&OptionSettings);
|
fieldptr = new PField("OptionMenuSettings", NewStruct("FOptionMenuSettings", nullptr), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&OptionSettings);
|
||||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||||
|
|
||||||
|
fieldptr = new PField("gametic", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&gametic);
|
||||||
|
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||||
|
|
||||||
|
|
||||||
// Argh. It sucks when bad hacks need to be supported. WP_NOCHANGE is just a bogus pointer but it used everywhere as a special flag.
|
// Argh. It sucks when bad hacks need to be supported. WP_NOCHANGE is just a bogus pointer but it used everywhere as a special flag.
|
||||||
// It cannot be defined as constant because constants can either be numbers or strings but nothing else, so the only 'solution'
|
// It cannot be defined as constant because constants can either be numbers or strings but nothing else, so the only 'solution'
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "zscript/menu/playercontrols.txt"
|
#include "zscript/menu/playercontrols.txt"
|
||||||
#include "zscript/menu/textentermenu.txt"
|
#include "zscript/menu/textentermenu.txt"
|
||||||
#include "zscript/menu/videomenu.txt"
|
#include "zscript/menu/videomenu.txt"
|
||||||
|
#include "zscript/menu/readthis.txt"
|
||||||
|
|
||||||
#include "zscript/inventory/inventory.txt"
|
#include "zscript/inventory/inventory.txt"
|
||||||
#include "zscript/inventory/inv_misc.txt"
|
#include "zscript/inventory/inv_misc.txt"
|
||||||
|
|
|
@ -299,6 +299,7 @@ struct GameInfoStruct native
|
||||||
native String ArmorIcon2;
|
native String ArmorIcon2;
|
||||||
native int gametype;
|
native int gametype;
|
||||||
native bool norandomplayerclass;
|
native bool norandomplayerclass;
|
||||||
|
native Array<Name> infoPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Object native
|
class Object native
|
||||||
|
@ -436,6 +437,7 @@ struct LevelLocals native
|
||||||
native readonly String MapName;
|
native readonly String MapName;
|
||||||
native String NextMap;
|
native String NextMap;
|
||||||
native String NextSecretMap;
|
native String NextSecretMap;
|
||||||
|
native String F1Pic;
|
||||||
native readonly int maptype;
|
native readonly int maptype;
|
||||||
native readonly String Music;
|
native readonly String Music;
|
||||||
native readonly int musicorder;
|
native readonly int musicorder;
|
||||||
|
|
124
wadsrc/static/zscript/menu/readthis.txt
Normal file
124
wadsrc/static/zscript/menu/readthis.txt
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
** readthis.cpp
|
||||||
|
** Help screens
|
||||||
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2001-2010 Randy Heit
|
||||||
|
** Copyright 2010 Christoph Oelckers
|
||||||
|
** All rights reserved.
|
||||||
|
**
|
||||||
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions
|
||||||
|
** are met:
|
||||||
|
**
|
||||||
|
** 1. Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in the
|
||||||
|
** documentation and/or other materials provided with the distribution.
|
||||||
|
** 3. The name of the author may not be used to endorse or promote products
|
||||||
|
** derived from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ReadThisMenu : Menu
|
||||||
|
{
|
||||||
|
int mScreen;
|
||||||
|
int mInfoTic;
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
override void Drawer()
|
||||||
|
{
|
||||||
|
double alpha;
|
||||||
|
TextureID tex, prevpic;
|
||||||
|
|
||||||
|
if (mScreen == 0)
|
||||||
|
{
|
||||||
|
mScreen = 1;
|
||||||
|
mInfoTic = gametic;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Did the mapper choose a custom help page via MAPINFO?
|
||||||
|
if (level.F1Pic.Length() != 0)
|
||||||
|
{
|
||||||
|
tex = TexMan.CheckForTexture(level.F1Pic, TexMan.Type_MiscPatch);
|
||||||
|
mScreen = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tex.IsValid())
|
||||||
|
{
|
||||||
|
tex = TexMan.CheckForTexture(gameinfo.infoPages[mScreen-1], TexMan.Type_MiscPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mScreen > 1)
|
||||||
|
{
|
||||||
|
prevpic = TexMan.CheckForTexture(gameinfo.infoPages[mScreen-2], TexMan.Type_MiscPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.Dim(0, 1.0, 0,0, screen.GetWidth(), screen.GetHeight());
|
||||||
|
alpha = MIN((gametic - mInfoTic) * (3. / Thinker.TICRATE), 1.);
|
||||||
|
if (alpha < 1. && prevpic.IsValid())
|
||||||
|
{
|
||||||
|
screen.DrawTexture (prevpic, false, 0, 0, DTA_Fullscreen, true);
|
||||||
|
}
|
||||||
|
else alpha = 1;
|
||||||
|
screen.DrawTexture (tex, false, 0, 0, DTA_Fullscreen, true, DTA_Alpha, alpha);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
override bool MenuEvent(int mkey, bool fromcontroller)
|
||||||
|
{
|
||||||
|
if (mkey == MKEY_Enter)
|
||||||
|
{
|
||||||
|
MenuSound("menu/choose");
|
||||||
|
mScreen++;
|
||||||
|
mInfoTic = gametic;
|
||||||
|
if (level.F1Pic.Length() != 0 || mScreen > gameinfo.infoPages.Size())
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return Super.MenuEvent(mkey, fromcontroller);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
override bool MouseEvent(int type, int x, int y)
|
||||||
|
{
|
||||||
|
if (type == MOUSE_Click)
|
||||||
|
{
|
||||||
|
return MenuEvent(MKEY_Enter, true);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue