From 74364b84f9d0563eae4fba2cd111ca52bed9e6b5 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 8 Jan 2020 14:26:47 -0800 Subject: [PATCH 1/2] Revert "Oh right, the keywords..." This reverts commit a00dfcf4205f88cd6149daf73fec4831a7d7c2e5. --- src/dehacked.c | 5 +++++ src/doomstat.h | 1 + src/g_game.c | 3 +++ src/lua_maplib.c | 2 ++ src/p_setup.c | 1 + 5 files changed, 12 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 8220f5aa3..8b4b92494 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1629,6 +1629,11 @@ static void readlevelheader(MYFILE *f, INT32 num) mapheaderinfo[num-1]->typeoflevel = tol; } } + else if (fastcmp(word, "KEYWORD")) + { + deh_strlcpy(mapheaderinfo[num-1]->keyword, word2, + sizeof(mapheaderinfo[num-1]->keyword), va("Level header %d: keyword", num)); + } else if (fastcmp(word, "MUSIC")) { if (fastcmp(word2, "NONE")) diff --git a/src/doomstat.h b/src/doomstat.h index 7e961677f..0fad811d9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -289,6 +289,7 @@ typedef struct UINT8 actnum; ///< Act number or 0 for none. UINT32 typeoflevel; ///< Combination of typeoflevel flags. INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. + char keyword[33]; ///< Keywords separated by space to search for. 32 characters. char musname[7]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. UINT32 muspos; ///< Music position to jump to. diff --git a/src/g_game.c b/src/g_game.c index f7778df8f..45730adac 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4761,6 +4761,9 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep, measurekeywords(&freq[freqc], &freq[freqc].matchd, &freq[freqc].matchc, realmapname, mapname, wanttable); + measurekeywords(&freq[freqc], + &freq[freqc].keywhd, &freq[freqc].keywhc, + mapheaderinfo[i]->keyword, mapname, wanttable); if (freq[freqc].total) freqc++; } diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 309ba86a1..64e60c99a 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2014,6 +2014,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->typeoflevel); else if (fastcmp(field,"nextlevel")) lua_pushinteger(L, header->nextlevel); + else if (fastcmp(field,"keyword")) + lua_pushstring(L, header->keyword); else if (fastcmp(field,"musname")) lua_pushstring(L, header->musname); else if (fastcmp(field,"mustrack")) diff --git a/src/p_setup.c b/src/p_setup.c index 104b4e5a0..a9585d0c2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -222,6 +222,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->typeoflevel = 0; mapheaderinfo[num]->nextlevel = (INT16)(i + 1); mapheaderinfo[num]->startrings = 0; + mapheaderinfo[num]->keyword[0] = '\0'; snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0; From 735289502c0fb9e91615f06dec94bf7b799fd560 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 8 Jan 2020 14:41:38 -0800 Subject: [PATCH 2/2] Call it KEYWORDS --- src/dehacked.c | 6 +++--- src/doomstat.h | 2 +- src/g_game.c | 2 +- src/lua_maplib.c | 4 ++-- src/p_setup.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8b4b92494..91d67c63f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1629,10 +1629,10 @@ static void readlevelheader(MYFILE *f, INT32 num) mapheaderinfo[num-1]->typeoflevel = tol; } } - else if (fastcmp(word, "KEYWORD")) + else if (fastcmp(word, "KEYWORDS")) { - deh_strlcpy(mapheaderinfo[num-1]->keyword, word2, - sizeof(mapheaderinfo[num-1]->keyword), va("Level header %d: keyword", num)); + deh_strlcpy(mapheaderinfo[num-1]->keywords, word2, + sizeof(mapheaderinfo[num-1]->keywords), va("Level header %d: keywords", num)); } else if (fastcmp(word, "MUSIC")) { diff --git a/src/doomstat.h b/src/doomstat.h index 0fad811d9..c7c12632a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -289,7 +289,7 @@ typedef struct UINT8 actnum; ///< Act number or 0 for none. UINT32 typeoflevel; ///< Combination of typeoflevel flags. INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. - char keyword[33]; ///< Keywords separated by space to search for. 32 characters. + char keywords[33]; ///< Keywords separated by space to search for. 32 characters. char musname[7]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. UINT32 muspos; ///< Music position to jump to. diff --git a/src/g_game.c b/src/g_game.c index 45730adac..dd7540ae8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4763,7 +4763,7 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep, realmapname, mapname, wanttable); measurekeywords(&freq[freqc], &freq[freqc].keywhd, &freq[freqc].keywhc, - mapheaderinfo[i]->keyword, mapname, wanttable); + mapheaderinfo[i]->keywords, mapname, wanttable); if (freq[freqc].total) freqc++; } diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 64e60c99a..3d98bee33 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2014,8 +2014,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->typeoflevel); else if (fastcmp(field,"nextlevel")) lua_pushinteger(L, header->nextlevel); - else if (fastcmp(field,"keyword")) - lua_pushstring(L, header->keyword); + else if (fastcmp(field,"keywords")) + lua_pushstring(L, header->keywords); else if (fastcmp(field,"musname")) lua_pushstring(L, header->musname); else if (fastcmp(field,"mustrack")) diff --git a/src/p_setup.c b/src/p_setup.c index a9585d0c2..14bdca2e3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -222,7 +222,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->typeoflevel = 0; mapheaderinfo[num]->nextlevel = (INT16)(i + 1); mapheaderinfo[num]->startrings = 0; - mapheaderinfo[num]->keyword[0] = '\0'; + mapheaderinfo[num]->keywords[0] = '\0'; snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0;