foxygit / doom Log in
commit 1629170f97ab1c62524e1a2b8cbbf4c9f96e7d54
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Thu Jun 26 12:46:54 2025 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Thu Jun 26 12:46:54 2025 +0200

    Strife: Initialize floor->type and floor->crush fields in EV_BuildStairs()
---
 src/strife/p_floor.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/strife/p_floor.c b/src/strife/p_floor.c
index 9b89168e..8efb52cc 100644
--- a/src/strife/p_floor.c
+++ b/src/strife/p_floor.c
@@ -30,6 +30,8 @@
 // Data.
 #include "sounds.h"

+//entryway
+#define STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE 10

 //
 // FLOORS
@@ -530,6 +532,12 @@ EV_BuildStairs
         floor->speed = speed;
         height = sec->floorheight + stairsize;
         floor->floordestheight = height;
+        // Initialize
+        floor->type = lowerFloor;
+        // entryway
+        // Uninitialized crush field will not be equal to 0 or 1 (true)
+        // with high probability. So, initialize it with any other value
+        floor->crush = STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE;

         texture = sec->floorpic;

@@ -573,6 +581,12 @@ EV_BuildStairs
                 floor->sector = sec;
                 floor->speed = speed;
                 floor->floordestheight = height;
+                // Initialize
+                floor->type = lowerFloor;
+                // entryway
+                // Uninitialized crush field will not be equal to 0 or 1 (true)
+                // with high probability. So, initialize it with any other value
+                floor->crush = STAIRS_UNINITIALIZED_CRUSH_FIELD_VALUE;
                 ok = 1;
                 break;
             }