]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Use qbool for some trace_s members, other tidying
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 15 Jul 2023 12:28:42 +0000 (22:28 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 15 Jul 2023 12:28:42 +0000 (22:28 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
collision.h
dpdefs/dpextensions.qc
phys.c
svvm_cmds.c

index f62356b02ca85eb6e1ae4381fd043bfa422e116e..71bc57f0caa81e8c99611804fbb2a7f5c5786ae1 100644 (file)
@@ -21,19 +21,19 @@ struct texture_s;
 typedef struct trace_s
 {
        // if true, the entire trace was in solid (see hitsupercontentsmask)
-       int allsolid;
+       qbool allsolid;
        // if true, the initial point was in solid (see hitsupercontentsmask)
-       int startsolid;
+       qbool startsolid;
        // this is set to true in world.c if startsolid was set in a trace against world
-       int worldstartsolid;
+       qbool worldstartsolid;
        // this is set to true in world.c if startsolid was set in a trace against a SOLID_BSP entity, in other words this is true if the entity is stuck in a door or wall, but not if stuck in another normal entity
-       int bmodelstartsolid;
+       qbool bmodelstartsolid;
        // if true, the trace passed through empty somewhere
        // (set only by Q1BSP tracing)
-       int inopen;
+       qbool inopen;
        // if true, the trace passed through water/slime/lava somewhere
        // (set only by Q1BSP tracing)
-       int inwater;
+       qbool inwater;
        // fraction of the total distance that was traveled before impact
        // in case of impact this is actually nudged a bit off the surface
        // (1.0 = did not hit anything)
@@ -62,7 +62,7 @@ typedef struct trace_s
        const struct texture_s *hittexture;
        // initially false, set when the start leaf is found
        // (set only by Q1BSP tracing and entity box tracing)
-       int startfound;
+       qbool startfound;
        // if startsolid, contains the minimum penetration depth found in the
        // trace, and the normal needed to push it out of that solid
        double startdepth;
index b616980a77c7fc06a3ed7a2dc3322cb76def9fbc..73996cbf4eda687fcd986157a1e9a19a2cb277e6 100644 (file)
@@ -2644,7 +2644,6 @@ void(string cmdname) registercommand = #352;
 //description:
 //Adds a new console command which will take priority over a previous command of the same name (including engine commands) and in CSQC is removed when the VM shuts down. This will call CSQC_ConsoleCommand(string command) or ConsoleCmd(string command) in SVQC.  Return value should be true if QC handled the command, otherwise return false to have the engine handle it.
 
-
 //DP_QC_FINDBOX
 //idea: Mario
 //darkplaces implementation: bones_was_here
diff --git a/phys.c b/phys.c
index bf6c525dd63a7c543e9f47d12d883ed63805c295..7128ea3ddc9a440dc42b88bd581ebd0dcd824c9a 100644 (file)
--- a/phys.c
+++ b/phys.c
@@ -12,7 +12,6 @@ int PHYS_NudgeOutOfSolid(prvm_prog_t *prog, prvm_edict_t *ent)
        trace_t stucktrace;
        vec3_t stuckorigin;
        vec3_t stuckmins, stuckmaxs;
-       vec_t nudge;
        vec_t separation;
        model_t *worldmodel;
 
@@ -64,8 +63,8 @@ int PHYS_NudgeOutOfSolid(prvm_prog_t *prog, prvm_edict_t *ent)
                                VectorCopy(stuckorigin, PRVM_serveredictvector(ent, origin));
                                return bump || pass ? 1 : -1; // -1 means it wasn't stuck
                        }
-                       nudge = -stucktrace.startdepth;
-                       VectorMA(stuckorigin, nudge, stucktrace.startdepthnormal, stuckorigin);
+
+                       VectorMA(stuckorigin, -stucktrace.startdepth, stucktrace.startdepthnormal, stuckorigin);
                }
        }
        return 0;
index b97ee20841a27f9dacd45f03624a9f976ebc1399..3692bc2f42c588d099bdca2fdc12f3788fe50120 100644 (file)
@@ -100,6 +100,7 @@ const char *vm_sv_extensions[] = {
 "DP_QC_ENTITYSTRING",
 "DP_QC_ETOS",
 "DP_QC_EXTRESPONSEPACKET",
+"DP_QC_FINDBOX",
 "DP_QC_FINDCHAIN",
 "DP_QC_FINDCHAINFLAGS",
 "DP_QC_FINDCHAINFLOAT",
@@ -107,6 +108,7 @@ const char *vm_sv_extensions[] = {
 "DP_QC_FINDFLAGS",
 "DP_QC_FINDFLOAT",
 "DP_QC_FS_SEARCH",
+"DP_QC_FS_SEARCH_PACKFILE",
 "DP_QC_GETLIGHT",
 "DP_QC_GETSURFACE",
 "DP_QC_GETSURFACETRIANGLE",
@@ -229,8 +231,6 @@ const char *vm_sv_extensions[] = {
 "TW_SV_STEPCONTROL",
 "ZQ_PAUSE",
 "DP_RM_CLIPGROUP",
-"DP_QC_FS_SEARCH_PACKFILE",
-"DP_QC_FINDBOX",
 NULL
 //"EXT_CSQC" // not ready yet
 };