Merge remote-tracking branch 'remotes/origin/master' into localization
# Conflicts: # src/v_font.cpp
This commit is contained in:
commit
d15e3391a0
11 changed files with 421 additions and 133 deletions
|
|
@ -544,6 +544,11 @@ static void ParseReplies (const char *name, int pos, FStrifeDialogueReply **repl
|
|||
|
||||
// The next node to use when this reply is chosen.
|
||||
reply->NextNode = rsp->Link;
|
||||
if (reply->NextNode < 0)
|
||||
{
|
||||
reply->NextNode *= -1;
|
||||
reply->CloseDialog = false;
|
||||
}
|
||||
|
||||
// The message to record in the log for this reply.
|
||||
reply->LogNumber = rsp->Log;
|
||||
|
|
@ -1090,14 +1095,13 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
|
|||
if (reply->NextNode != 0)
|
||||
{
|
||||
int rootnode = npc->ConversationRoot;
|
||||
const bool isNegative = reply->NextNode < 0;
|
||||
const unsigned next = (unsigned)(rootnode + (isNegative ? -1 : 1) * reply->NextNode - 1);
|
||||
const unsigned next = (unsigned)(rootnode + reply->NextNode - 1);
|
||||
|
||||
if (next < Level->StrifeDialogues.Size())
|
||||
{
|
||||
npc->Conversation = Level->StrifeDialogues[next];
|
||||
|
||||
if (isNegative)
|
||||
if (!(reply->CloseDialog))
|
||||
{
|
||||
if (gameaction != ga_slideshow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ struct FStrifeDialogueNode
|
|||
TArray<FStrifeDialogueItemCheck> ItemCheck;
|
||||
int ThisNodeNum = 0; // location of this node in StrifeDialogues
|
||||
int ItemCheckNode = 0; // index into StrifeDialogues
|
||||
FString ThisNodeName = nullptr;
|
||||
FString ItemCheckNodeName = nullptr;
|
||||
|
||||
PClassActor *SpeakerType = nullptr;
|
||||
FString SpeakerName;
|
||||
|
|
@ -54,7 +56,9 @@ struct FStrifeDialogueReply
|
|||
FString LogString;
|
||||
int NextNode = 0; // index into StrifeDialogues
|
||||
int LogNumber = 0;
|
||||
FString NextNodeName = nullptr;
|
||||
bool NeedsGold = false;
|
||||
bool CloseDialog = true;
|
||||
};
|
||||
|
||||
struct MapData;
|
||||
|
|
|
|||
|
|
@ -1143,7 +1143,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
|
|||
// Handle active damage modifiers (e.g. PowerDamage)
|
||||
if (damage > 0 && !(flags & DMG_NO_ENHANCE))
|
||||
{
|
||||
damage = source->GetModifiedDamage(mod, damage, false, inflictor, source, flags);
|
||||
damage = source->GetModifiedDamage(mod, damage, false, inflictor, target, flags);
|
||||
}
|
||||
}
|
||||
// Handle passive damage modifiers (e.g. PowerProtection), provided they are not afflicted with protection penetrating powers.
|
||||
|
|
|
|||
101
src/p_usdf.cpp
101
src/p_usdf.cpp
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#define Zd 1
|
||||
#define St 2
|
||||
#define Gz 4
|
||||
|
||||
class USDFParser : public UDMFParserBase
|
||||
{
|
||||
|
|
@ -62,7 +63,7 @@ class USDFParser : public UDMFParserBase
|
|||
{
|
||||
type = GetStrifeType(CheckInt(key));
|
||||
}
|
||||
else if (namespace_bits == Zd)
|
||||
else if (namespace_bits & ( Zd | Gz ))
|
||||
{
|
||||
PClassActor *cls = PClass::FindActor(CheckString(key));
|
||||
if (cls == nullptr)
|
||||
|
|
@ -188,7 +189,10 @@ class USDFParser : public UDMFParserBase
|
|||
break;
|
||||
|
||||
case NAME_Nextpage:
|
||||
reply->NextNode = CheckInt(key);
|
||||
if (namespace_bits != Gz || sc.TokenType == TK_IntConst)
|
||||
reply->NextNode = CheckInt(key);
|
||||
else
|
||||
reply->NextNodeName = CheckString(key);
|
||||
break;
|
||||
|
||||
case NAME_Closedialog:
|
||||
|
|
@ -202,7 +206,7 @@ class USDFParser : public UDMFParserBase
|
|||
break;
|
||||
|
||||
case NAME_SpecialName:
|
||||
if (namespace_bits == Zd)
|
||||
if (namespace_bits & ( Zd | Gz ))
|
||||
reply->ActionSpecial = P_FindLineSpecial(CheckString(key));
|
||||
break;
|
||||
|
||||
|
|
@ -225,7 +229,7 @@ class USDFParser : public UDMFParserBase
|
|||
case NAME_Require:
|
||||
case NAME_Exclude:
|
||||
// Require and Exclude are exclusive to namespace ZDoom. [FishyClockwork]
|
||||
if (key == NAME_Cost || namespace_bits == Zd)
|
||||
if (key == NAME_Cost || (namespace_bits & ( Zd | Gz )))
|
||||
{
|
||||
ParseCostRequireExclude(reply, key);
|
||||
break;
|
||||
|
|
@ -256,7 +260,15 @@ class USDFParser : public UDMFParserBase
|
|||
reply->QuickNo = "";
|
||||
}
|
||||
reply->LogString = LogString;
|
||||
if(!closeDialog) reply->NextNode *= -1;
|
||||
if (reply->NextNode < 0) // compatibility: handle negative numbers
|
||||
{
|
||||
reply->CloseDialog = !closeDialog;
|
||||
reply->NextNode *= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
reply->CloseDialog = closeDialog;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -318,6 +330,13 @@ class USDFParser : public UDMFParserBase
|
|||
{
|
||||
switch(key)
|
||||
{
|
||||
case NAME_Pagename:
|
||||
if (namespace_bits != Gz)
|
||||
sc.ScriptMessage("'PageName' keyword only supported in the GZDoom namespace!");
|
||||
else
|
||||
node->ThisNodeName = CheckString(key);
|
||||
break;
|
||||
|
||||
case NAME_Name:
|
||||
SpeakerName = CheckString(key);
|
||||
break;
|
||||
|
|
@ -327,7 +346,7 @@ class USDFParser : public UDMFParserBase
|
|||
break;
|
||||
|
||||
case NAME_Userstring:
|
||||
if (namespace_bits == Zd)
|
||||
if (namespace_bits & ( Zd | Gz ))
|
||||
{
|
||||
node->UserData = CheckString(key);
|
||||
}
|
||||
|
|
@ -341,7 +360,7 @@ class USDFParser : public UDMFParserBase
|
|||
FString soundname = "svox/";
|
||||
soundname += name;
|
||||
node->SpeakerVoice = FSoundID(S_FindSound(soundname));
|
||||
if (node->SpeakerVoice == 0 && namespace_bits == Zd)
|
||||
if (node->SpeakerVoice == 0 && (namespace_bits & ( Zd | Gz )))
|
||||
{
|
||||
node->SpeakerVoice = FSoundID(S_FindSound(name));
|
||||
}
|
||||
|
|
@ -358,12 +377,15 @@ class USDFParser : public UDMFParserBase
|
|||
break;
|
||||
|
||||
case NAME_Link:
|
||||
node->ItemCheckNode = CheckInt(key);
|
||||
if (namespace_bits != Gz || sc.TokenType == TK_IntConst)
|
||||
node->ItemCheckNode = CheckInt(key);
|
||||
else
|
||||
node->ItemCheckNodeName = CheckString(key);
|
||||
break;
|
||||
|
||||
case NAME_Goodbye:
|
||||
// Custom goodbyes are exclusive to namespace ZDoom. [FishyClockwork]
|
||||
if (namespace_bits == Zd)
|
||||
if (namespace_bits & ( Zd | Gz ))
|
||||
{
|
||||
Goodbye = CheckString(key);
|
||||
}
|
||||
|
|
@ -425,14 +447,14 @@ class USDFParser : public UDMFParserBase
|
|||
break;
|
||||
|
||||
case NAME_Id:
|
||||
if (namespace_bits == Zd)
|
||||
if (namespace_bits & ( Zd | Gz ))
|
||||
{
|
||||
dlgid = CheckInt(key);
|
||||
}
|
||||
break;
|
||||
|
||||
case NAME_Class:
|
||||
if (namespace_bits == Zd)
|
||||
if (namespace_bits & ( Zd | Gz ))
|
||||
{
|
||||
clsid = CheckString(key);
|
||||
}
|
||||
|
|
@ -487,6 +509,9 @@ public:
|
|||
namespc = sc.String;
|
||||
switch(namespc)
|
||||
{
|
||||
case NAME_GZDoom:
|
||||
namespace_bits = Gz;
|
||||
break;
|
||||
case NAME_ZDoom:
|
||||
namespace_bits = Zd;
|
||||
break;
|
||||
|
|
@ -501,7 +526,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptMessage("Map does not define a namespace.\n");
|
||||
sc.ScriptMessage("Dialog script does not define a namespace.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -524,6 +549,58 @@ public:
|
|||
Skip();
|
||||
}
|
||||
}
|
||||
|
||||
if (namespace_bits == Gz) // string page name linker
|
||||
{
|
||||
int numnodes = Level->StrifeDialogues.Size();
|
||||
int usedstrings = false;
|
||||
|
||||
TMap<FString, int> nameToIndex;
|
||||
for (int i = 0; i < numnodes; i++)
|
||||
{
|
||||
FString key = Level->StrifeDialogues[i]->ThisNodeName;
|
||||
if (key.IsNotEmpty())
|
||||
{
|
||||
key.ToLower();
|
||||
if (nameToIndex.CheckKey(key))
|
||||
Printf("Warning! Duplicate page name '%s'!\n", Level->StrifeDialogues[i]->ThisNodeName.GetChars());
|
||||
else
|
||||
nameToIndex[key] = i;
|
||||
usedstrings = true;
|
||||
}
|
||||
}
|
||||
if (usedstrings)
|
||||
{
|
||||
for (int i = 0; i < numnodes; i++)
|
||||
{
|
||||
FString itemLinkKey = Level->StrifeDialogues[i]->ItemCheckNodeName;
|
||||
if (itemLinkKey.IsNotEmpty())
|
||||
{
|
||||
itemLinkKey.ToLower();
|
||||
if (nameToIndex.CheckKey(itemLinkKey))
|
||||
Level->StrifeDialogues[i]->ItemCheckNode = nameToIndex[itemLinkKey] + 1;
|
||||
else
|
||||
Printf("Warning! Reference to non-existent item-linked dialogue page name '%s' in page %i!\n", Level->StrifeDialogues[i]->ItemCheckNodeName.GetChars(), i);
|
||||
}
|
||||
|
||||
FStrifeDialogueReply *NodeCheck = Level->StrifeDialogues[i]->Children;
|
||||
while (NodeCheck)
|
||||
{
|
||||
if (NodeCheck->NextNodeName.IsNotEmpty())
|
||||
{
|
||||
FString key = NodeCheck->NextNodeName;
|
||||
key.ToLower();
|
||||
if (nameToIndex.CheckKey(key))
|
||||
NodeCheck->NextNode = nameToIndex[key] + 1;
|
||||
else
|
||||
Printf("Warning! Reference to non-existent reply-linked dialogue page name '%s' in page %i!\n", NodeCheck->NextNodeName.GetChars(), i);
|
||||
}
|
||||
NodeCheck = NodeCheck->Next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -379,7 +379,12 @@ void MessagePump (const SDL_Event &sev)
|
|||
else
|
||||
{
|
||||
event.type = EV_KeyDown;
|
||||
event.data1 = sev.wheel.y > 0 ? KEY_MWHEELUP : KEY_MWHEELDOWN;
|
||||
|
||||
if (sev.wheel.y != 0)
|
||||
event.data1 = sev.wheel.y > 0 ? KEY_MWHEELUP : KEY_MWHEELDOWN;
|
||||
else
|
||||
event.data1 = sev.wheel.x > 0 ? KEY_MWHEELRIGHT : KEY_MWHEELLEFT;
|
||||
|
||||
D_PostEvent (&event);
|
||||
event.type = EV_KeyUp;
|
||||
D_PostEvent (&event);
|
||||
|
|
|
|||
|
|
@ -565,6 +565,7 @@ xx(Monsterpush)
|
|||
xx(ZDoom)
|
||||
xx(ZDoomTranslated)
|
||||
xx(Vavoom)
|
||||
xx(GZDoom)
|
||||
|
||||
xx(Xpanningfloor)
|
||||
xx(Ypanningfloor)
|
||||
|
|
@ -742,6 +743,7 @@ xx(Require)
|
|||
xx(Exclude)
|
||||
xx(Userstring)
|
||||
xx(Sky)
|
||||
xx(Pagename)
|
||||
|
||||
// Special menus
|
||||
xx(Mainmenu)
|
||||
|
|
|
|||
|
|
@ -990,9 +990,9 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
return new FSingleLumpFont (name, lump);
|
||||
}
|
||||
}
|
||||
FTextureID picnum = TexMan.CheckForTexture (name, ETextureType::Any);
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FTextureID picnum = TexMan.CheckForTexture (name, ETextureType::Any);
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FTexture *tex = TexMan.GetTexture(picnum);
|
||||
if (tex && tex->GetSourceLump() >= folderfile)
|
||||
{
|
||||
|
|
@ -1002,7 +1002,7 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
if (folderdata.Size() > 0)
|
||||
{
|
||||
return new FFont(name, nullptr, name, HU_FONTSTART, HU_FONTSIZE, 1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
|
@ -1111,22 +1111,22 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
int position = '!' + i;
|
||||
mysnprintf(buffer, countof(buffer), nametemplate, i + start);
|
||||
|
||||
lump = TexMan.CheckForTexture(buffer, ETextureType::MiscPatch);
|
||||
if (doomtemplate && lump.isValid() && i + start == 121)
|
||||
{ // HACKHACK: Don't load STCFN121 in doom(2), because
|
||||
// it's not really a lower-case 'y' but a '|'.
|
||||
// Because a lot of wads with their own font seem to foolishly
|
||||
// copy STCFN121 and make it a '|' themselves, wads must
|
||||
// provide STCFN120 (x) and STCFN122 (z) for STCFN121 to load as a 'y'.
|
||||
if (!TexMan.CheckForTexture("STCFN120", ETextureType::MiscPatch).isValid() ||
|
||||
!TexMan.CheckForTexture("STCFN122", ETextureType::MiscPatch).isValid())
|
||||
{
|
||||
// insert the incorrectly named '|' graphic in its correct position.
|
||||
position = 124;
|
||||
}
|
||||
}
|
||||
if (lump.isValid())
|
||||
lump = TexMan.CheckForTexture(buffer, ETextureType::MiscPatch);
|
||||
if (doomtemplate && lump.isValid() && i + start == 121)
|
||||
{ // HACKHACK: Don't load STCFN121 in doom(2), because
|
||||
// it's not really a lower-case 'y' but a '|'.
|
||||
// Because a lot of wads with their own font seem to foolishly
|
||||
// copy STCFN121 and make it a '|' themselves, wads must
|
||||
// provide STCFN120 (x) and STCFN122 (z) for STCFN121 to load as a 'y'.
|
||||
if (!TexMan.CheckForTexture("STCFN120", ETextureType::MiscPatch).isValid() ||
|
||||
!TexMan.CheckForTexture("STCFN122", ETextureType::MiscPatch).isValid())
|
||||
{
|
||||
// insert the incorrectly named '|' graphic in its correct position.
|
||||
position = 124;
|
||||
}
|
||||
}
|
||||
if (lump.isValid())
|
||||
{
|
||||
if (position < minchar) minchar = position;
|
||||
if (position > maxchar) maxchar = position;
|
||||
charMap.Insert(position, TexMan.GetTexture(lump));
|
||||
|
|
@ -1189,7 +1189,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
{
|
||||
Chars[i].OriginalPic = pic;
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1 (pic->GetImage()), "");
|
||||
Chars[i].TranslatedPic->Scale = pic->Scale;
|
||||
Chars[i].TranslatedPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
|
|
@ -1209,18 +1209,18 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
|
||||
if (SpaceWidth == 0) // An explicit override from the .inf file must always take precedence
|
||||
{
|
||||
if (spacewidth != -1)
|
||||
{
|
||||
SpaceWidth = spacewidth;
|
||||
}
|
||||
if (spacewidth != -1)
|
||||
{
|
||||
SpaceWidth = spacewidth;
|
||||
}
|
||||
else if ('N'-FirstChar >= 0 && 'N'-FirstChar < count && Chars['N' - FirstChar].TranslatedPic != nullptr)
|
||||
{
|
||||
{
|
||||
SpaceWidth = (Chars['N' - FirstChar].XMove + 1) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpaceWidth = 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SpaceWidth = 4;
|
||||
}
|
||||
}
|
||||
if (FontHeight == 0) FontHeight = fontheight;
|
||||
|
||||
|
|
@ -2381,7 +2381,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l
|
|||
if (!noTranslate)
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1 (charlumps[i]->GetImage()), "");
|
||||
Chars[i].TranslatedPic->Scale = charlumps[i]->Scale;
|
||||
Chars[i].TranslatedPic->CopySize(charlumps[i]);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
|
|
@ -3059,29 +3059,29 @@ void V_InitFonts()
|
|||
{
|
||||
SmallFont2 = new FFont ("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(BigFont = V_GetFont("BigFont")))
|
||||
{
|
||||
if (gameinfo.gametype & GAME_Raven)
|
||||
{
|
||||
BigFont = new FFont ("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(ConFont = V_GetFont("ConsoleFont", "CONFONT")))
|
||||
{
|
||||
{
|
||||
ConFont = SmallFont;
|
||||
}
|
||||
}
|
||||
if (!(IntermissionFont = FFont::FindFont("IntermissionFont")))
|
||||
{
|
||||
{
|
||||
if (gameinfo.gametype & GAME_DoomChex)
|
||||
{
|
||||
{
|
||||
IntermissionFont = FFont::FindFont("IntermissionFont_Doom");
|
||||
}
|
||||
}
|
||||
if (IntermissionFont == nullptr)
|
||||
{
|
||||
{
|
||||
IntermissionFont = BigFont;
|
||||
}
|
||||
}
|
||||
}
|
||||
// This can only happen if gzdoom.pk3 is corrupted. ConFont should always be present.
|
||||
if (ConFont == nullptr)
|
||||
{
|
||||
|
|
@ -3095,11 +3095,11 @@ void V_InitFonts()
|
|||
if (SmallFont2 == nullptr)
|
||||
{
|
||||
SmallFont2 = SmallFont;
|
||||
}
|
||||
}
|
||||
if (BigFont == nullptr)
|
||||
{
|
||||
{
|
||||
BigFont = SmallFont;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue