From 1ab9d154812a7c74127c34cc6047b4db76f2c4fc Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Wed, 11 Nov 2015 07:04:04 -0800 Subject: [PATCH 1/5] Make CheckActor*Texture also consider swimmable 3D floors An actor standing within a swimmable floor whose ceiling texture is X and on a solid floor whose texture is Y will now be reported as standing on both. --- src/p_acs.cpp | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 931f3a127..bd594dd52 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4140,16 +4140,26 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b if (floor) { + fixed_t z = actor->z; // Looking through planes from top to bottom for (i = 0; i < numff; ++i) { F3DFloor *ff = sec->e->XFloor.ffloors[i]; + if (!(ff->flags & FF_EXISTS)) + continue; - if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && - actor->Z() >= ff->top.plane->ZatPoint(actor)) - { // This floor is beneath our feet. + if (ff->flags & FF_SOLID && + secpic.isNull() && + z >= ff->top.plane->ZatPoint(actor->X(), actor->Y())) + { // This is the highest solid floor beneath our feet secpic = *ff->top.texture; - break; + } + else if (ff->flags & FF_SWIMMABLE && + tex == TexMan[*ff->top.texture] && + z <= ff->top.plane->ZatPoint(actor->x, actor->y) && + z >= ff->bottom.plane->ZatPoint(actor->x, actor->y)) + { // Having your feet within a liquid count as being "on" it + return true; } } if (i == numff) @@ -4165,11 +4175,21 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b { F3DFloor *ff = sec->e->XFloor.ffloors[i]; - if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && - z <= ff->bottom.plane->ZatPoint(actor)) - { // This floor is above our eyes. - secpic = *ff->bottom.texture; - break; + if (!(ff->flags & FF_EXISTS)) + continue; + + if (ff->flags & FF_SOLID && + secpic.isNull() && + z <= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) + { // This is the lowest solid ceiling above our eyes + secpic = *ff->top.texture; + } + else if (ff->flags & FF_SWIMMABLE && + tex == TexMan[*ff->bottom.texture] && + z <= ff->top.plane->ZatPoint(actor->X(), actor->Y()) && + z >= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) + { // Having your eyes within a liquid count as being "under" it + return true; } } if (i < 0) From c08d865b1bdf7fbec184661a3ba34946c73e4819 Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Tue, 17 Nov 2015 15:01:58 -0800 Subject: [PATCH 2/5] Extend CheckActor*Texture to look at any non-solid floor Upon deep and personal reflection, I realize this is more consistent with the TERRAIN change I made. --- src/p_acs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index bd594dd52..2c3c4e1e3 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4154,7 +4154,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b { // This is the highest solid floor beneath our feet secpic = *ff->top.texture; } - else if (ff->flags & FF_SWIMMABLE && + else if (!(ff->flags & FF_SOLID) && tex == TexMan[*ff->top.texture] && z <= ff->top.plane->ZatPoint(actor->x, actor->y) && z >= ff->bottom.plane->ZatPoint(actor->x, actor->y)) @@ -4184,7 +4184,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b { // This is the lowest solid ceiling above our eyes secpic = *ff->top.texture; } - else if (ff->flags & FF_SWIMMABLE && + else if (!(ff->flags & FF_SOLID) && tex == TexMan[*ff->bottom.texture] && z <= ff->top.plane->ZatPoint(actor->X(), actor->Y()) && z >= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) From 85a82bc6e8243a8f0e83a951f45f1f249736fce1 Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Thu, 21 Jan 2016 16:45:58 -0800 Subject: [PATCH 3/5] Fix minor typo in comments --- src/p_acs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2c3c4e1e3..8725303a0 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4158,7 +4158,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b tex == TexMan[*ff->top.texture] && z <= ff->top.plane->ZatPoint(actor->x, actor->y) && z >= ff->bottom.plane->ZatPoint(actor->x, actor->y)) - { // Having your feet within a liquid count as being "on" it + { // Having your feet within a liquid counts as being "on" it return true; } } @@ -4188,7 +4188,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b tex == TexMan[*ff->bottom.texture] && z <= ff->top.plane->ZatPoint(actor->X(), actor->Y()) && z >= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) - { // Having your eyes within a liquid count as being "under" it + { // Having your eyes within a liquid counts as being "under" it return true; } } From 3e28b195ce38affb93e20c496bb58bb788d1b6f7 Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Thu, 21 Jan 2016 16:54:49 -0800 Subject: [PATCH 4/5] Fix a couple old uses of actor->x and friends --- src/p_acs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 8725303a0..35116f7e6 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4140,7 +4140,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b if (floor) { - fixed_t z = actor->z; + fixed_t z = actor->Z(); // Looking through planes from top to bottom for (i = 0; i < numff; ++i) { @@ -4156,8 +4156,8 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b } else if (!(ff->flags & FF_SOLID) && tex == TexMan[*ff->top.texture] && - z <= ff->top.plane->ZatPoint(actor->x, actor->y) && - z >= ff->bottom.plane->ZatPoint(actor->x, actor->y)) + z <= ff->top.plane->ZatPoint(actor->X(), actor->Y()) && + z >= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) { // Having your feet within a liquid counts as being "on" it return true; } From 24f6f1297ae9e66c6cdc3886601d6de97c2f619a Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Fri, 22 Jan 2016 16:38:29 -0800 Subject: [PATCH 5/5] Use ZatPoint(actor) --- src/p_acs.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 35116f7e6..f3931283a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4150,14 +4150,14 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b if (ff->flags & FF_SOLID && secpic.isNull() && - z >= ff->top.plane->ZatPoint(actor->X(), actor->Y())) + z >= ff->top.plane->ZatPoint(actor)) { // This is the highest solid floor beneath our feet secpic = *ff->top.texture; } else if (!(ff->flags & FF_SOLID) && tex == TexMan[*ff->top.texture] && - z <= ff->top.plane->ZatPoint(actor->X(), actor->Y()) && - z >= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) + z <= ff->top.plane->ZatPoint(actor) && + z >= ff->bottom.plane->ZatPoint(actor)) { // Having your feet within a liquid counts as being "on" it return true; } @@ -4180,14 +4180,14 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b if (ff->flags & FF_SOLID && secpic.isNull() && - z <= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) + z <= ff->bottom.plane->ZatPoint(actor)) { // This is the lowest solid ceiling above our eyes secpic = *ff->top.texture; } else if (!(ff->flags & FF_SOLID) && tex == TexMan[*ff->bottom.texture] && - z <= ff->top.plane->ZatPoint(actor->X(), actor->Y()) && - z >= ff->bottom.plane->ZatPoint(actor->X(), actor->Y())) + z <= ff->top.plane->ZatPoint(actor) && + z >= ff->bottom.plane->ZatPoint(actor)) { // Having your eyes within a liquid counts as being "under" it return true; }