FName FMapInfoParser::ParseEndGame() { EndSequence newSeq; static int generated = 0; newSeq.EndType = -1; newSeq.PlayTheEnd = false; newSeq.MusicLooping = true; while (!sc.CheckString("}")) { sc.MustGetString(); if (sc.Compare("pic")) { ParseAssign(); sc.MustGetString(); newSeq.EndType = END_Pic; newSeq.PicName = sc.String; } else if (sc.Compare("hscroll")) { ParseAssign(); newSeq.EndType = END_Bunny; sc.MustGetString(); newSeq.PicName = sc.String; ParseComma(); sc.MustGetString(); newSeq.PicName2 = sc.String; if (CheckNumber()) newSeq.PlayTheEnd = !!sc.Number; } else if (sc.Compare("vscroll")) { ParseAssign(); newSeq.EndType = END_Demon; sc.MustGetString(); newSeq.PicName = sc.String; ParseComma(); sc.MustGetString(); newSeq.PicName2 = sc.String; } else if (sc.Compare("cast")) { newSeq.EndType = END_Cast; if (newSeq.PicName.IsEmpty()) newSeq.PicName = "$bgcastcall"; } else if (sc.Compare("music")) { ParseAssign(); sc.MustGetString(); newSeq.Music = sc.String; if (CheckNumber()) { newSeq.MusicLooping = !!sc.Number; } } else { if (format_type == FMT_New) { // Unknown sc.ScriptMessage("Unknown property '%s' found in endgame definition\n", sc.String); SkipToNext(); } else { sc.ScriptError("Unknown property '%s' found in endgame definition\n", sc.String); } } } FIntermissionDescriptor *desc = new FIntermissionDescriptor; FIntermissionAction *action = NULL; switch (newSeq.EndType) { case END_Pic: action = new FIntermissionAction; break; case END_Bunny: { FIntermissionActionScroller *bunny = new FIntermissionActionScroller; bunny->mSecondPic = newSeq.PicName2; bunny->mScrollDir = SCROLL_Left; bunny->mScrollDelay = 230; bunny->mScrollTime = 640; bunny->mDuration = 1130; action = bunny; if (newSeq.PlayTheEnd) desc->mLink = "TheEnd"; break; } case END_Demon: { FIntermissionActionScroller *demon = new FIntermissionActionScroller; demon->mSecondPic = newSeq.PicName2; demon->mScrollDir = SCROLL_Up; demon->mScrollDelay = 70; demon->mScrollTime = 600; action = demon; break; } case END_Cast: action = new FIntermissionAction; action->mDuration = 1; desc->mLink = "Doom2Cast"; break; } if (action == NULL) { sc.ScriptError("Endgame type was not defined"); return NAME_None; // We won't really get here. } else { action->mBackground = newSeq.PicName; action->mMusic = newSeq.Music; action->mMusicLooping = newSeq.MusicLooping; desc->mActions.Push(action); FString seq; seq.Format("@EndSequence_%d_", generated++); ReplaceIntermission(seq, desc); return FName(seq); } }
void FMapInfoParser::ParseSkill () { FSkillInfo skill; bool thisisdefault = false; bool acsreturnisset = false; skill.AmmoFactor = FRACUNIT; skill.DoubleAmmoFactor = 2*FRACUNIT; skill.DropAmmoFactor = -1; skill.DamageFactor = FRACUNIT; skill.FastMonsters = false; skill.SlowMonsters = false; skill.DisableCheats = false; skill.EasyBossBrain = false; skill.EasyKey = false; skill.AutoUseHealth = false; skill.RespawnCounter = 0; skill.RespawnLimit = 0; skill.Aggressiveness = FRACUNIT; skill.SpawnFilter = 0; skill.ACSReturn = 0; skill.MustConfirm = false; skill.Shortcut = 0; skill.TextColor = ""; skill.Replace.Clear(); skill.Replaced.Clear(); skill.MonsterHealth = FRACUNIT; skill.FriendlyHealth = FRACUNIT; skill.NoPain = false; skill.ArmorFactor = FRACUNIT; skill.Infighting = 0; skill.HealthFactor = FRACUNIT; sc.MustGetString(); skill.Name = sc.String; ParseOpenBrace(); while (sc.GetString ()) { if (sc.Compare ("ammofactor")) { ParseAssign(); sc.MustGetFloat (); skill.AmmoFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("doubleammofactor")) { ParseAssign(); sc.MustGetFloat (); skill.DoubleAmmoFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("dropammofactor")) { ParseAssign(); sc.MustGetFloat (); skill.DropAmmoFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("damagefactor")) { ParseAssign(); sc.MustGetFloat (); skill.DamageFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("fastmonsters")) { skill.FastMonsters = true; } else if (sc.Compare ("slowmonsters")) { skill.SlowMonsters = true; } else if (sc.Compare ("disablecheats")) { skill.DisableCheats = true; } else if (sc.Compare ("easybossbrain")) { skill.EasyBossBrain = true; } else if (sc.Compare ("easykey")) { skill.EasyKey = true; } else if (sc.Compare("autousehealth")) { skill.AutoUseHealth = true; } else if (sc.Compare("respawntime")) { ParseAssign(); sc.MustGetFloat (); skill.RespawnCounter = int(sc.Float*TICRATE); } else if (sc.Compare("respawnlimit")) { ParseAssign(); sc.MustGetNumber (); skill.RespawnLimit = sc.Number; } else if (sc.Compare("Aggressiveness")) { ParseAssign(); sc.MustGetFloat (); skill.Aggressiveness = FRACUNIT - FLOAT2FIXED(clamp(sc.Float, 0.,1.)); } else if (sc.Compare("SpawnFilter")) { ParseAssign(); if (sc.CheckNumber()) { if (sc.Number > 0) skill.SpawnFilter |= (1<<(sc.Number-1)); } else { sc.MustGetString (); if (sc.Compare("baby")) skill.SpawnFilter |= 1; else if (sc.Compare("easy")) skill.SpawnFilter |= 2; else if (sc.Compare("normal")) skill.SpawnFilter |= 4; else if (sc.Compare("hard")) skill.SpawnFilter |= 8; else if (sc.Compare("nightmare")) skill.SpawnFilter |= 16; } } else if (sc.Compare("ACSReturn")) { ParseAssign(); sc.MustGetNumber (); skill.ACSReturn = sc.Number; acsreturnisset = true; } else if (sc.Compare("ReplaceActor")) { ParseAssign(); sc.MustGetString(); FName replaced = sc.String; ParseComma(); sc.MustGetString(); FName replacer = sc.String; skill.SetReplacement(replaced, replacer); skill.SetReplacedBy(replacer, replaced); } else if (sc.Compare("Name")) { ParseAssign(); sc.MustGetString (); skill.MenuName = sc.String; } else if (sc.Compare("PlayerClassName")) { ParseAssign(); sc.MustGetString (); FName pc = sc.String; ParseComma(); sc.MustGetString (); skill.MenuNamesForPlayerClass[pc]=sc.String; } else if (sc.Compare("PicName")) { ParseAssign(); sc.MustGetString (); skill.PicName = sc.String; } else if (sc.Compare("MustConfirm")) { skill.MustConfirm = true; if (format_type == FMT_New) { if (CheckAssign()) { sc.MustGetString(); skill.MustConfirmText = sc.String; } } else { if (sc.CheckToken(TK_StringConst)) { skill.MustConfirmText = sc.String; } } } else if (sc.Compare("Key")) { ParseAssign(); sc.MustGetString(); skill.Shortcut = tolower(sc.String[0]); } else if (sc.Compare("TextColor")) { ParseAssign(); sc.MustGetString(); skill.TextColor.Format("[%s]", sc.String); } else if (sc.Compare("MonsterHealth")) { ParseAssign(); sc.MustGetFloat(); skill.MonsterHealth = FLOAT2FIXED(sc.Float); } else if (sc.Compare("FriendlyHealth")) { ParseAssign(); sc.MustGetFloat(); skill.FriendlyHealth = FLOAT2FIXED(sc.Float); } else if (sc.Compare("NoPain")) { skill.NoPain = true; } else if (sc.Compare("ArmorFactor")) { ParseAssign(); sc.MustGetFloat(); skill.ArmorFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare("HealthFactor")) { ParseAssign(); sc.MustGetFloat(); skill.HealthFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare("NoInfighting")) { skill.Infighting = LEVEL2_NOINFIGHTING; } else if (sc.Compare("TotalInfighting")) { skill.Infighting = LEVEL2_TOTALINFIGHTING; } else if (sc.Compare("DefaultSkill")) { if (DefaultSkill >= 0) { sc.ScriptError("%s is already the default skill\n", AllSkills[DefaultSkill].Name.GetChars()); } thisisdefault = true; } else if (!ParseCloseBrace()) { // Unknown sc.ScriptMessage("Unknown property '%s' found in skill definition\n", sc.String); SkipToNext(); } else { break; } } CheckEndOfFile("skill"); for(unsigned int i = 0; i < AllSkills.Size(); i++) { if (AllSkills[i].Name == skill.Name) { if (!acsreturnisset) { // Use the ACS return for the skill we are overwriting. skill.ACSReturn = AllSkills[i].ACSReturn; } AllSkills[i] = skill; if (thisisdefault) { DefaultSkill = i; } return; } } if (!acsreturnisset) { skill.ACSReturn = AllSkills.Size(); } if (thisisdefault) { DefaultSkill = AllSkills.Size(); } AllSkills.Push(skill); }
void FMapInfoParser::ParseGameInfo() { sc.MustGetToken('{'); while(sc.GetToken()) { if (sc.TokenType == '}') return; sc.TokenMustBe(TK_Identifier); FString nextKey = sc.String; sc.MustGetToken('='); if (nextKey.CompareNoCase("weaponslot") == 0) { sc.MustGetToken(TK_IntConst); if (sc.Number < 0 || sc.Number >= 10) { sc.ScriptError("Weapon slot index must be in range [0..9].\n"); } int i = sc.Number; gameinfo.DefaultWeaponSlots[i].Clear(); sc.MustGetToken(','); do { sc.MustGetString(); FName val = sc.String; gameinfo.DefaultWeaponSlots[i].Push(val); } while (sc.CheckToken(',')); } else if(nextKey.CompareNoCase("border") == 0) { if(sc.CheckToken(TK_Identifier)) { switch(sc.MustMatchString(GameInfoBorders)) { default: gameinfo.border = &DoomBorder; break; case 1: gameinfo.border = &HereticBorder; break; case 2: gameinfo.border = &StrifeBorder; break; } } else { // border = {size, offset, tr, t, tl, r, l ,br, b, bl}; char *graphics[8] = {DoomBorder.tr, DoomBorder.t, DoomBorder.tl, DoomBorder.r, DoomBorder.l, DoomBorder.br, DoomBorder.b, DoomBorder.bl}; sc.MustGetToken(TK_IntConst); DoomBorder.offset = sc.Number; sc.MustGetToken(','); sc.MustGetToken(TK_IntConst); DoomBorder.size = sc.Number; for(int i = 0;i < 8;i++) { sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); int len = int(strlen(sc.String)); if(len > 8) sc.ScriptError("Border graphic can not be more than 8 characters long.\n"); memcpy(graphics[i], sc.String, len); if(len < 8) // end with a null byte if the string is less than 8 chars. graphics[i][len] = 0; } } } else if(nextKey.CompareNoCase("armoricons") == 0) { sc.MustGetToken(TK_StringConst); strncpy(gameinfo.ArmorIcon1, sc.String, 8); gameinfo.ArmorIcon1[8] = 0; if (sc.CheckToken(',')) { sc.MustGetToken(TK_FloatConst); gameinfo.Armor2Percent = FLOAT2FIXED(sc.Float); sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); strncpy(gameinfo.ArmorIcon2, sc.String, 8); gameinfo.ArmorIcon2[8] = 0; } } else if(nextKey.CompareNoCase("maparrow") == 0) { sc.MustGetToken(TK_StringConst); gameinfo.mMapArrow = sc.String; if (sc.CheckToken(',')) { sc.MustGetToken(TK_StringConst); gameinfo.mCheatMapArrow = sc.String; } else gameinfo.mCheatMapArrow = ""; } // Insert valid keys here. GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8) GAMEINFOKEY_STRINGARRAY(creditPages, "addcreditPage", 8, false) GAMEINFOKEY_STRINGARRAY(creditPages, "CreditPage", 8, true) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "addplayerclasses", 0, false) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "playerclasses", 0, true) GAMEINFOKEY_MUSIC(titleMusic, titleOrder, "titleMusic") GAMEINFOKEY_FLOAT(titleTime, "titleTime") GAMEINFOKEY_FLOAT(advisoryTime, "advisoryTime") GAMEINFOKEY_FLOAT(pageTime, "pageTime") GAMEINFOKEY_STRING(chatSound, "chatSound") GAMEINFOKEY_MUSIC(finaleMusic, finaleOrder, "finaleMusic") GAMEINFOKEY_CSTRING(finaleFlat, "finaleFlat", 8) GAMEINFOKEY_STRINGARRAY(finalePages, "finalePage", 8, true) GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false) GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8, true) GAMEINFOKEY_CSTRING(PauseSign, "pausesign", 8) GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_CSTRING(borderFlat, "borderFlat", 8) GAMEINFOKEY_FIXED(telefogheight, "telefogheight") GAMEINFOKEY_FIXED(gibfactor, "gibfactor") GAMEINFOKEY_INT(defKickback, "defKickback") GAMEINFOKEY_CSTRING(SkyFlatName, "SkyFlatName", 8) GAMEINFOKEY_STRING(translator, "translator") GAMEINFOKEY_COLOR(pickupcolor, "pickupcolor") GAMEINFOKEY_COLOR(defaultbloodcolor, "defaultbloodcolor") GAMEINFOKEY_COLOR(defaultbloodparticlecolor, "defaultbloodparticlecolor") GAMEINFOKEY_STRING(backpacktype, "backpacktype") GAMEINFOKEY_STRING(statusbar, "statusbar") GAMEINFOKEY_MUSIC(intermissionMusic, intermissionOrder, "intermissionMusic") GAMEINFOKEY_STRING(CursorPic, "CursorPic") GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") GAMEINFOKEY_BOOL(swapmenu, "swapmenu") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") GAMEINFOKEY_FLOAT(dimamount, "dimamount") GAMEINFOKEY_INT(definventorymaxamount, "definventorymaxamount") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultdropstyle, "defaultdropstyle") GAMEINFOKEY_CSTRING(Endoom, "endoom", 8) GAMEINFOKEY_INT(player5start, "player5start") GAMEINFOKEY_STRINGARRAY(quitmessages, "addquitmessages", 0, false) GAMEINFOKEY_STRINGARRAY(quitmessages, "quitmessages", 0, true) GAMEINFOKEY_STRING(mTitleColor, "menufontcolor_title") GAMEINFOKEY_STRING(mFontColor, "menufontcolor_label") GAMEINFOKEY_STRING(mFontColorValue, "menufontcolor_value") GAMEINFOKEY_STRING(mFontColorMore, "menufontcolor_action") GAMEINFOKEY_STRING(mFontColorHeader, "menufontcolor_header") GAMEINFOKEY_STRING(mFontColorHighlight, "menufontcolor_highlight") GAMEINFOKEY_STRING(mFontColorSelection, "menufontcolor_selection") GAMEINFOKEY_CSTRING(mBackButton, "menubackbutton", 8) GAMEINFOKEY_INT(TextScreenX, "textscreenx") GAMEINFOKEY_INT(TextScreenY, "textscreeny") GAMEINFOKEY_STRING(DefaultEndSequence, "defaultendsequence") GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont") GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont") GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont") GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch") GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch") GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass") else { // ignore unkown keys. sc.UnGet(); SkipToNext(); } } }
void FMapInfoParser::ParseIntermissionAction(FIntermissionDescriptor *desc) { FIntermissionAction *ac = NULL; sc.MustGetToken(TK_Identifier); if (sc.Compare("image")) { ac = new FIntermissionAction; } else if (sc.Compare("scroller")) { ac = new FIntermissionActionScroller; } else if (sc.Compare("cast")) { ac = new FIntermissionActionCast; } else if (sc.Compare("Fader")) { ac = new FIntermissionActionFader; } else if (sc.Compare("Wiper")) { ac = new FIntermissionActionWiper; } else if (sc.Compare("TextScreen")) { ac = new FIntermissionActionTextscreen; } else if (sc.Compare("GotoTitle")) { ac = new FIntermissionAction; ac->mClass = TITLE_ID; } else if (sc.Compare("Link")) { sc.MustGetToken('='); sc.MustGetToken(TK_Identifier); desc->mLink = sc.String; return; } else { sc.ScriptMessage("Unknown intermission type '%s'", sc.String); } sc.MustGetToken('{'); while (!sc.CheckToken('}')) { bool success = false; if (!sc.CheckToken(TK_Sound)) { sc.MustGetToken(TK_Identifier); } if (ac != NULL) { success = ac->ParseKey(sc); if (!success) { sc.ScriptMessage("Unknown key name '%s'\n", sc.String); } } if (!success) SkipToNext(); } if (ac != NULL) desc->mActions.Push(ac); }
void FMapInfoParser::ParseNextMap(char *mapname) { EndSequence newSeq; bool useseq = false; if (sc.CheckNumber()) { if (HexenHack) { mysnprintf (mapname, 9, "&wt@%02d", sc.Number); } else { mysnprintf (mapname, 9, "MAP%02d", sc.Number); } } else { sc.MustGetString(); if (sc.Compare("endgame")) { if (!sc.CheckString("{")) { // Make Demon Eclipse work again sc.UnGet(); goto standard_endgame; } newSeq.Advanced = true; newSeq.EndType = END_Pic1; newSeq.PlayTheEnd = false; newSeq.MusicLooping = true; while (!sc.CheckString("}")) { sc.MustGetString(); if (sc.Compare("pic")) { ParseAssign(); sc.MustGetString(); newSeq.EndType = END_Pic; newSeq.PicName = sc.String; } else if (sc.Compare("hscroll")) { ParseAssign(); newSeq.EndType = END_Bunny; sc.MustGetString(); newSeq.PicName = sc.String; ParseComma(); sc.MustGetString(); newSeq.PicName2 = sc.String; if (CheckNumber()) newSeq.PlayTheEnd = !!sc.Number; } else if (sc.Compare("vscroll")) { ParseAssign(); newSeq.EndType = END_Demon; sc.MustGetString(); newSeq.PicName = sc.String; ParseComma(); sc.MustGetString(); newSeq.PicName2 = sc.String; } else if (sc.Compare("cast")) { newSeq.EndType = END_Cast; } else if (sc.Compare("music")) { ParseAssign(); sc.MustGetString(); newSeq.Music = sc.String; if (CheckNumber()) { newSeq.MusicLooping = !!sc.Number; } } else { if (format_type == FMT_New) { // Unknown sc.ScriptMessage("Unknown property '%s' found in endgame definition\n", sc.String); SkipToNext(); } else { sc.ScriptError("Unknown property '%s' found in endgame definition\n", sc.String); } } } useseq = true; } else if (strnicmp (sc.String, "EndGame", 7) == 0) { // If we're in a multiplayer game, don't do the finale, just go back to the // beginning. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { switch (sc.String[7]) { case '1': sprintf (sc.String, "E1M1"); break; case '2': sprintf (sc.String, "E2M1"); break; case '3': sprintf (sc.String, "E3M1"); break; case '4': sprintf (sc.String, "E4M1"); break; case 'C': sprintf (sc.String, "MAP01"); break; // case 'W': type = END_Underwater; break; // case 'S': type = END_Strife; break; default: sprintf (sc.String, "MAP01"); break; } strncpy (mapname, sc.String, 8); } else { int type; switch (sc.String[7]) { case '1': type = END_Pic1; break; case '2': type = END_Pic2; break; case '3': type = END_Bunny; break; case 'C': type = END_Cast; break; case 'W': type = END_Underwater; break; case 'S': type = END_Strife; break; standard_endgame: default: type = END_Pic3; break; } newSeq.EndType = type; useseq = true; } } else if (sc.Compare("endpic")) { ParseComma(); sc.MustGetString (); newSeq.EndType = END_Pic; newSeq.PicName = sc.String; useseq = true; } else if (sc.Compare("endbunny")) { newSeq.EndType = END_Bunny; useseq = true; } else if (sc.Compare("endcast")) { newSeq.EndType = END_Cast; useseq = true; } else if (sc.Compare("enddemon")) { newSeq.EndType = END_Demon; useseq = true; } else if (sc.Compare("endchess")) { newSeq.EndType = END_Chess; useseq = true; } else if (sc.Compare("endunderwater")) { newSeq.EndType = END_Underwater; useseq = true; } else if (sc.Compare("endbuystrife")) { newSeq.EndType = END_BuyStrife; useseq = true; } else if (sc.Compare("endtitle")) { newSeq.EndType = END_TitleScreen; useseq = true; } else { strncpy (mapname, sc.String, 8); } if (useseq) { int seqnum = -1; if (!newSeq.Advanced) { seqnum = FindEndSequence (newSeq.EndType, newSeq.PicName); } if (seqnum == -1) { seqnum = (int)EndSequences.Push (newSeq); } strcpy (mapname, "enDSeQ"); *((WORD *)(mapname + 6)) = (WORD)seqnum; } } }
void FMapInfoParser::ParseCluster() { sc.MustGetNumber (); int clusterindex = FindWadClusterInfo (sc.Number); if (clusterindex == -1) { clusterindex = wadclusterinfos.Reserve(1); } cluster_info_t *clusterinfo = &wadclusterinfos[clusterindex]; clusterinfo->Reset(); clusterinfo->cluster = sc.Number; ParseOpenBrace(); while (sc.GetString()) { if (sc.Compare("name")) { ParseAssign(); if (ParseLookupName(clusterinfo->ClusterName)) clusterinfo->flags |= CLUSTER_LOOKUPCLUSTERNAME; } else if (sc.Compare("entertext")) { ParseAssign(); if (ParseLookupName(clusterinfo->EnterText)) clusterinfo->flags |= CLUSTER_LOOKUPENTERTEXT; } else if (sc.Compare("exittext")) { ParseAssign(); if (ParseLookupName(clusterinfo->ExitText)) clusterinfo->flags |= CLUSTER_LOOKUPEXITTEXT; } else if (sc.Compare("music")) { int order = 0; ParseAssign(); ParseMusic(clusterinfo->MessageMusic, clusterinfo->musicorder); } else if (sc.Compare("flat")) { ParseAssign(); ParseLumpOrTextureName(clusterinfo->finaleflat); } else if (sc.Compare("pic")) { ParseAssign(); ParseLumpOrTextureName(clusterinfo->finaleflat); clusterinfo->flags |= CLUSTER_FINALEPIC; } else if (sc.Compare("hub")) { clusterinfo->flags |= CLUSTER_HUB; } else if (sc.Compare("cdtrack")) { ParseAssign(); sc.MustGetNumber(); clusterinfo->cdtrack = sc.Number; } else if (sc.Compare("cdid")) { ParseAssign(); sc.MustGetString(); clusterinfo->cdid = strtoul (sc.String, NULL, 16); } else if (sc.Compare("entertextislump")) { clusterinfo->flags |= CLUSTER_ENTERTEXTINLUMP; } else if (sc.Compare("exittextislump")) { clusterinfo->flags |= CLUSTER_EXITTEXTINLUMP; } else if (!ParseCloseBrace()) { // Unknown sc.ScriptMessage("Unknown property '%s' found in map definition\n", sc.String); SkipToNext(); } else { break; } } CheckEndOfFile("cluster"); }
void FMapInfoParser::ParseGameInfo() { sc.MustGetToken('{'); while(sc.GetToken()) { if (sc.TokenType == '}') return; sc.TokenMustBe(TK_Identifier); FString nextKey = sc.String; sc.MustGetToken('='); if (nextKey.CompareNoCase("weaponslot") == 0) { sc.MustGetToken(TK_IntConst); if (sc.Number < 0 || sc.Number >= 10) { sc.ScriptError("Weapon slot index must be in range [0..9].\n"); } int i = sc.Number; gameinfo.DefaultWeaponSlots[i].Clear(); sc.MustGetToken(','); do { sc.MustGetString(); FName val = sc.String; gameinfo.DefaultWeaponSlots[i].Push(val); } while (sc.CheckToken(',')); } else if(nextKey.CompareNoCase("border") == 0) { staticgameborder_t *b; if (sc.CheckToken(TK_Identifier)) { switch(sc.MustMatchString(GameInfoBorders)) { default: b = &DoomBorder; break; case 1: b = &HereticBorder; break; case 2: b = &StrifeBorder; break; } gameinfo.Border = *b; } else { // border = {size, offset, tr, t, tl, r, l ,br, b, bl}; FString *graphics[8] = { &gameinfo.Border.tr, &gameinfo.Border.t, &gameinfo.Border.tl, &gameinfo.Border.r, &gameinfo.Border.l, &gameinfo.Border.br, &gameinfo.Border.b, &gameinfo.Border.bl }; sc.MustGetToken(TK_IntConst); gameinfo.Border.offset = sc.Number; sc.MustGetToken(','); sc.MustGetToken(TK_IntConst); gameinfo.Border.size = sc.Number; for(int i = 0;i < 8;i++) { sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); (*graphics[i]) = sc.String; } } } else if(nextKey.CompareNoCase("armoricons") == 0) { sc.MustGetToken(TK_StringConst); gameinfo.ArmorIcon1 = sc.String; if (sc.CheckToken(',')) { sc.MustGetToken(TK_FloatConst); gameinfo.Armor2Percent = sc.Float; sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); gameinfo.ArmorIcon2 = sc.String; } } else if(nextKey.CompareNoCase("maparrow") == 0) { sc.MustGetToken(TK_StringConst); gameinfo.mMapArrow = sc.String; if (sc.CheckToken(',')) { sc.MustGetToken(TK_StringConst); gameinfo.mCheatMapArrow = sc.String; } else gameinfo.mCheatMapArrow = ""; } // Insert valid keys here. GAMEINFOKEY_STRING(mCheatKey, "cheatKey") GAMEINFOKEY_STRING(mEasyKey, "easyKey") GAMEINFOKEY_STRING(TitlePage, "titlePage") GAMEINFOKEY_STRINGARRAY(creditPages, "addcreditPage", 8, false) GAMEINFOKEY_STRINGARRAY(creditPages, "CreditPage", 8, true) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "addplayerclasses", 0, false) GAMEINFOKEY_STRINGARRAY(PlayerClasses, "playerclasses", 0, true) GAMEINFOKEY_MUSIC(titleMusic, titleOrder, "titleMusic") GAMEINFOKEY_FLOAT(titleTime, "titleTime") GAMEINFOKEY_FLOAT(advisoryTime, "advisoryTime") GAMEINFOKEY_FLOAT(pageTime, "pageTime") GAMEINFOKEY_STRING(chatSound, "chatSound") GAMEINFOKEY_MUSIC(finaleMusic, finaleOrder, "finaleMusic") GAMEINFOKEY_STRING(FinaleFlat, "finaleFlat") GAMEINFOKEY_STRINGARRAY(finalePages, "finalePage", 8, true) GAMEINFOKEY_STRINGARRAY(infoPages, "addinfoPage", 8, false) GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8, true) GAMEINFOKEY_STRING(PauseSign, "pausesign") GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_STRING(BorderFlat, "borderFlat") GAMEINFOKEY_DOUBLE(telefogheight, "telefogheight") GAMEINFOKEY_DOUBLE(gibfactor, "gibfactor") GAMEINFOKEY_INT(defKickback, "defKickback") GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName") GAMEINFOKEY_STRING(translator, "translator") GAMEINFOKEY_COLOR(pickupcolor, "pickupcolor") GAMEINFOKEY_COLOR(defaultbloodcolor, "defaultbloodcolor") GAMEINFOKEY_COLOR(defaultbloodparticlecolor, "defaultbloodparticlecolor") GAMEINFOKEY_STRING(backpacktype, "backpacktype") GAMEINFOKEY_STRING(statusbar, "statusbar") GAMEINFOKEY_MUSIC(intermissionMusic, intermissionOrder, "intermissionMusic") GAMEINFOKEY_STRING(CursorPic, "CursorPic") GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") GAMEINFOKEY_BOOL(swapmenu, "swapmenu") GAMEINFOKEY_BOOL(dontcrunchcorpses, "dontcrunchcorpses") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") GAMEINFOKEY_FLOAT(dimamount, "dimamount") GAMEINFOKEY_INT(definventorymaxamount, "definventorymaxamount") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultdropstyle, "defaultdropstyle") GAMEINFOKEY_STRING(Endoom, "endoom") GAMEINFOKEY_STRINGARRAY(quitmessages, "addquitmessages", 0, false) GAMEINFOKEY_STRINGARRAY(quitmessages, "quitmessages", 0, true) GAMEINFOKEY_STRING(mTitleColor, "menufontcolor_title") GAMEINFOKEY_STRING(mFontColor, "menufontcolor_label") GAMEINFOKEY_STRING(mFontColorValue, "menufontcolor_value") GAMEINFOKEY_STRING(mFontColorMore, "menufontcolor_action") GAMEINFOKEY_STRING(mFontColorHeader, "menufontcolor_header") GAMEINFOKEY_STRING(mFontColorHighlight, "menufontcolor_highlight") GAMEINFOKEY_STRING(mFontColorSelection, "menufontcolor_selection") GAMEINFOKEY_STRING(mBackButton, "menubackbutton") GAMEINFOKEY_INT(TextScreenX, "textscreenx") GAMEINFOKEY_INT(TextScreenY, "textscreeny") GAMEINFOKEY_STRING(DefaultEndSequence, "defaultendsequence") GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont") GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont") GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont") GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch") GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch") GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass") GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.) else { // ignore unkown keys. sc.UnGet(); SkipToNext(); } } }
void FMapInfoParser::ParseSkill () { FSkillInfo skill; skill.AmmoFactor = FRACUNIT; skill.DoubleAmmoFactor = 2*FRACUNIT; skill.DropAmmoFactor = -1; skill.DamageFactor = FRACUNIT; skill.FastMonsters = false; skill.DisableCheats = false; skill.EasyBossBrain = false; skill.AutoUseHealth = false; skill.RespawnCounter = 0; skill.RespawnLimit = 0; skill.Aggressiveness = FRACUNIT; skill.SpawnFilter = 0; skill.ACSReturn = AllSkills.Size(); skill.MenuNameIsLump = false; skill.MustConfirm = false; skill.Shortcut = 0; skill.TextColor = ""; sc.MustGetString(); skill.Name = sc.String; ParseOpenBrace(); while (sc.GetString ()) { if (sc.Compare ("ammofactor")) { ParseAssign(); sc.MustGetFloat (); skill.AmmoFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("doubleammofactor")) { ParseAssign(); sc.MustGetFloat (); skill.DoubleAmmoFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("dropammofactor")) { ParseAssign(); sc.MustGetFloat (); skill.DropAmmoFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("damagefactor")) { ParseAssign(); sc.MustGetFloat (); skill.DamageFactor = FLOAT2FIXED(sc.Float); } else if (sc.Compare ("fastmonsters")) { skill.FastMonsters = true; } else if (sc.Compare ("disablecheats")) { skill.DisableCheats = true; } else if (sc.Compare ("easybossbrain")) { skill.EasyBossBrain = true; } else if (sc.Compare("autousehealth")) { skill.AutoUseHealth = true; } else if (sc.Compare("respawntime")) { ParseAssign(); sc.MustGetFloat (); skill.RespawnCounter = int(sc.Float*TICRATE); } else if (sc.Compare("respawnlimit")) { ParseAssign(); sc.MustGetNumber (); skill.RespawnLimit = sc.Number; } else if (sc.Compare("Aggressiveness")) { ParseAssign(); sc.MustGetFloat (); skill.Aggressiveness = FRACUNIT - FLOAT2FIXED(clamp(sc.Float, 0.,1.)); } else if (sc.Compare("SpawnFilter")) { ParseAssign(); if (sc.CheckNumber()) { if (sc.Number > 0) skill.SpawnFilter |= (1<<(sc.Number-1)); } else { sc.MustGetString (); if (sc.Compare("baby")) skill.SpawnFilter |= 1; else if (sc.Compare("easy")) skill.SpawnFilter |= 2; else if (sc.Compare("normal")) skill.SpawnFilter |= 4; else if (sc.Compare("hard")) skill.SpawnFilter |= 8; else if (sc.Compare("nightmare")) skill.SpawnFilter |= 16; } } else if (sc.Compare("ACSReturn")) { ParseAssign(); sc.MustGetNumber (); skill.ACSReturn = sc.Number; } else if (sc.Compare("Name")) { ParseAssign(); sc.MustGetString (); skill.MenuName = sc.String; skill.MenuNameIsLump = false; } else if (sc.Compare("PlayerClassName")) { ParseAssign(); sc.MustGetString (); FName pc = sc.String; ParseComma(); sc.MustGetString (); skill.MenuNamesForPlayerClass[pc]=sc.String; } else if (sc.Compare("PicName")) { ParseAssign(); sc.MustGetString (); skill.MenuName = sc.String; skill.MenuNameIsLump = true; } else if (sc.Compare("MustConfirm")) { skill.MustConfirm = true; if (format_type == FMT_New) { if (CheckAssign()) { sc.MustGetString(); skill.MustConfirmText = sc.String; } } else { if (sc.CheckToken(TK_StringConst)) { skill.MustConfirmText = sc.String; } } } else if (sc.Compare("Key")) { ParseAssign(); sc.MustGetString(); skill.Shortcut = tolower(sc.String[0]); } else if (sc.Compare("TextColor")) { ParseAssign(); sc.MustGetString(); skill.TextColor.Format("[%s]", sc.String); } else if (!ParseCloseBrace()) { // Unknown sc.ScriptMessage("Unknown property '%s' found in skill definition\n", sc.String); SkipToNext(); } else { break; } } CheckEndOfFile("skill"); for(unsigned int i = 0; i < AllSkills.Size(); i++) { if (AllSkills[i].Name == skill.Name) { AllSkills[i] = skill; return; } } AllSkills.Push(skill); }
void FMapInfoParser::ParseGameInfo() { sc.MustGetToken('{'); while(sc.GetToken()) { if (sc.TokenType == '}') return; sc.TokenMustBe(TK_Identifier); FString nextKey = sc.String; sc.MustGetToken('='); if (nextKey.CompareNoCase("weaponslot") == 0) { sc.MustGetToken(TK_IntConst); if (sc.Number < 0 || sc.Number >= 10) { sc.ScriptError("Weapon slot index must be in range [0..9].\n"); } int i = sc.Number; gameinfo.DefaultWeaponSlots[i].Clear(); sc.MustGetToken(','); do { sc.MustGetString(); FName val = sc.String; gameinfo.DefaultWeaponSlots[i].Push(val); } while (sc.CheckToken(',')); } else if(nextKey.CompareNoCase("border") == 0) { if(sc.CheckToken(TK_Identifier)) { switch(sc.MustMatchString(GameInfoBoarders)) { default: gameinfo.border = &DoomBorder; break; case 1: gameinfo.border = &HereticBorder; break; case 2: gameinfo.border = &StrifeBorder; break; } } else { // border = {size, offset, tr, t, tl, r, l ,br, b, bl}; char *graphics[8] = {DoomBorder.tr, DoomBorder.t, DoomBorder.tl, DoomBorder.r, DoomBorder.l, DoomBorder.br, DoomBorder.b, DoomBorder.bl}; sc.MustGetToken('{'); sc.MustGetToken(TK_IntConst); DoomBorder.offset = sc.Number; sc.MustGetToken(','); sc.MustGetToken(TK_IntConst); DoomBorder.size = sc.Number; for(int i = 0;i < 8;i++) { sc.MustGetToken(','); sc.MustGetToken(TK_StringConst); int len = int(strlen(sc.String)); if(len > 8) sc.ScriptError("Border graphic can not be more than 8 characters long.\n"); memcpy(graphics[i], sc.String, len); if(len < 8) // end with a null byte if the string is less than 8 chars. graphics[i][len] = 0; } sc.MustGetToken('}'); } } // Insert valid keys here. GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8) GAMEINFOKEY_STRINGARRAY(creditPages, "creditPage", 8) GAMEINFOKEY_STRING(titleMusic, "titleMusic") GAMEINFOKEY_FLOAT(titleTime, "titleTime") GAMEINFOKEY_FLOAT(advisoryTime, "advisoryTime") GAMEINFOKEY_FLOAT(pageTime, "pageTime") GAMEINFOKEY_STRING(chatSound, "chatSound") GAMEINFOKEY_STRING(finaleMusic, "finaleMusic") GAMEINFOKEY_CSTRING(finaleFlat, "finaleFlat", 8) GAMEINFOKEY_STRINGARRAY(finalePages, "finalePage", 8) GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8) GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_CSTRING(borderFlat, "borderFlat", 8) GAMEINFOKEY_FIXED(telefogheight, "telefogheight") GAMEINFOKEY_INT(defKickback, "defKickback") GAMEINFOKEY_CSTRING(SkyFlatName, "SkyFlatName", 8) GAMEINFOKEY_STRING(translator, "translator") GAMEINFOKEY_COLOR(defaultbloodcolor, "defaultbloodcolor") GAMEINFOKEY_COLOR(defaultbloodparticlecolor, "defaultbloodparticlecolor") GAMEINFOKEY_STRING(backpacktype, "backpacktype") GAMEINFOKEY_STRING(statusbar, "statusbar") GAMEINFOKEY_STRING(intermissionMusic, "intermissionMusic") GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic") GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis") else { // ignore unkown keys. sc.UnGet(); SkipToNext(); } } }