diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg
index 6abf14a35882157e710eb2b5891fbe9b9babe7f6..1559c23c37ea6e8356e34fc440a464089897c4eb 100644
--- a/extras/conf/SRB2-22.cfg
+++ b/extras/conf/SRB2-22.cfg
@@ -2065,6 +2065,30 @@ linedeftypes
 			prefix = "(342)";
 		}
 
+		343
+		{
+			title = "Gravity Check - Continuous";
+			flags2text = "[1] Check temporary reverse gravity";
+			flags64text = "[6] Check for reverse gravity";
+			prefix = "(343)";
+		}
+
+		344
+		{
+			title = "Gravity Check - Each Time";
+			flags2text = "[1] Check temporary reverse gravity";
+			flags64text = "[6] Check for reverse gravity";
+			prefix = "(344)";
+		}
+
+		345
+		{
+			title = "Gravity Check - Once";
+			flags2text = "[1] Check temporary reverse gravity";
+			flags64text = "[6] Check for reverse gravity";
+			prefix = "(345)";
+		}
+
 		399
 		{
 			title = "Level Load";
diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg
index 681955b3551015928ce23735b3352ab2786d3a6b..af4a7bfae92e9b87eb2aaedcda48f0d7bc4311d4 100644
--- a/extras/conf/udb/Includes/SRB222_linedefs.cfg
+++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg
@@ -779,6 +779,21 @@ doom
 			title = "NiGHTS Mare - Once";
 			prefix = "(342)";
 		}
+		343
+		{
+			title = "Gravity Check - Continuous";
+			prefix = "(343)";
+		}
+		344
+		{
+			title = "Gravity Check - Each Time";
+			prefix = "(344)";
+		}
+		345
+		{
+			title = "Gravity Check - Once";
+			prefix = "(345)";
+		}
 		399
 		{
 			title = "Level Load";
@@ -3581,6 +3596,29 @@ udmf
 			}
 		}
 
+		343
+		{
+			title = "Gravity Check";
+			prefix = "(343)";
+			arg0
+			{
+				title = "Trigger type";
+				type = 11;
+				enum = "triggertype";
+			}
+			arg1
+			{
+				title = "Gravity";
+				type = 11;
+				enum
+				{
+					0 = "Normal gravity";
+					1 = "Reverse gravity";
+					2 = "Reverse gravity (no MF2_OBJECTFLIP)";
+				}
+			}
+		}
+
 		399
 		{
 			title = "Level Load";
diff --git a/src/p_setup.c b/src/p_setup.c
index 1a6d9444ed40cd5dcd46c23dd127b6648c6c5e5c..46b530e2134a817bb68bb96cf0142d42b62cc9e7 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -4893,6 +4893,21 @@ static void P_ConvertBinaryLinedefTypes(void)
 				lines[i].args[2] = TMC_EQUAL;
 			lines[i].special = 340;
 			break;
+		case 343: //Gravity check - continuous
+		case 344: //Gravity check - each time
+		case 345: //Gravity check - once
+			if (lines[i].special == 345)
+				lines[i].args[0] = TMT_ONCE;
+			else if (lines[i].special == 344)
+				lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER;
+			else
+				lines[i].args[0] = TMT_CONTINUOUS;
+			if (lines[i].flags & ML_BLOCKMONSTERS)
+				lines[i].args[1] = TMG_TEMPREVERSE;
+			else if (lines[i].flags & ML_NOCLIMB)
+				lines[i].args[1] = TMG_REVERSE;
+			lines[i].special = 343;
+			break;
 		case 400: //Set tagged sector's floor height/texture
 		case 401: //Set tagged sector's ceiling height/texture
 			lines[i].args[0] = tag;
diff --git a/src/p_spec.c b/src/p_spec.c
index 2b9d672f32d6c78beed1f8f632472b812d015fa2..f9205511715c50ef3a68b3426cbf9f58b44a55fe 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1862,6 +1862,12 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
 			if (!P_CheckPlayerMare(triggerline))
 				return false;
 			break;
+		case 343: // gravity check
+			if ((!(actor->flags2 & MF2_OBJECTFLIP) != !(actor->player->powers[pw_gravityboots])) && triggerline->args[1] == TMG_TEMPREVERSE)
+				return false;
+			if (!(actor->eflags & MFE_VERTICALFLIP) != (triggerline->args[1] == TMG_NORMAL))
+				return false;
+			break;
 		default:
 			break;
 	}
@@ -1899,7 +1905,8 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
 			|| specialtype == 319 // Unlockable
 			|| specialtype == 331 // Player skin
 			|| specialtype == 334 // Object dye
-			|| specialtype == 337) // Emerald check
+			|| specialtype == 337 // Emerald check
+			|| specialtype == 343) // Gravity check
 			&& triggerline->args[0] == TMT_ONCE)
 			triggerline->special = 0;
 	}
@@ -1949,7 +1956,8 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
 			|| lines[masterline].special == 319 // Unlockable trigger
 			|| lines[masterline].special == 331 // Player skin
 			|| lines[masterline].special == 334 // Object dye
-			|| lines[masterline].special == 337) // Emerald check
+			|| lines[masterline].special == 337 // Emerald check
+			|| lines[masterline].special == 343) // Gravity check
 			&& lines[masterline].args[0] > TMT_EACHTIMEMASK)
 			continue;
 
@@ -6906,6 +6914,7 @@ void P_SpawnSpecials(boolean fromnetsave)
 			case 331: // Player skin
 			case 334: // Object dye
 			case 337: // Emerald check
+			case 343: // Gravity check
 				if (lines[i].args[0] > TMT_EACHTIMEMASK)
 					P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT);
 				break;
diff --git a/src/p_spec.h b/src/p_spec.h
index 33d18d63e5aeef7ddf955406045655d70755c64b..a04cfb62b085362fa2eeb3a9ec6b1e10bd206a8f 100644
--- a/src/p_spec.h
+++ b/src/p_spec.h
@@ -254,6 +254,13 @@ typedef enum
 	TMC_GTE   = 2,
 } textmapcomparison_t;
 
+typedef enum
+{
+	TMG_NORMAL  = 0,
+	TMG_REVERSE = 1,
+	TMG_TEMPREVERSE = 2,
+} textmapgravity_t;
+
 typedef enum
 {
 	TMNP_FASTEST   = 0,