From: Samual Lenks Date: Sat, 25 Jan 2014 22:21:36 +0000 (-0500) Subject: Move the supercontents/nativecontents functions to util.qc X-Git-Tag: xonotic-v0.8.0~233^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=865c96c6f00d5912f86165ddc9066993c0c6b1b4;p=xonotic%2Fxonotic-data.pk3dir.git Move the supercontents/nativecontents functions to util.qc --- diff --git a/qcsrc/client/movetypes.qc b/qcsrc/client/movetypes.qc index 88e921cbe..a4122d261 100644 --- a/qcsrc/client/movetypes.qc +++ b/qcsrc/client/movetypes.qc @@ -10,41 +10,6 @@ void _Movetype_CheckVelocity() // SV_CheckVelocity { } -float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents) -{ - switch(nativecontents) - { - case CONTENT_EMPTY: - return 0; - case CONTENT_SOLID: - return DPCONTENTS_SOLID | DPCONTENTS_OPAQUE; - case CONTENT_WATER: - return DPCONTENTS_WATER; - case CONTENT_SLIME: - return DPCONTENTS_SLIME; - case CONTENT_LAVA: - return DPCONTENTS_LAVA | DPCONTENTS_NODROP; - case CONTENT_SKY: - return DPCONTENTS_SKY | DPCONTENTS_NODROP | DPCONTENTS_OPAQUE; // to match behaviour of Q3 maps, let sky count as opaque - } - return 0; -} - -float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents) -{ - if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY)) - return CONTENT_SOLID; - if(supercontents & DPCONTENTS_SKY) - return CONTENT_SKY; - if(supercontents & DPCONTENTS_LAVA) - return CONTENT_LAVA; - if(supercontents & DPCONTENTS_SLIME) - return CONTENT_SLIME; - if(supercontents & DPCONTENTS_WATER) - return CONTENT_WATER; - return CONTENT_EMPTY; -} - float _Movetype_CheckWater(entity ent) // SV_CheckWater { float supercontents; diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 1904e91c1..bdf80e5d1 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -2752,3 +2752,40 @@ float Announcer_PickNumber(float type, float num) return NOTIF_ABORT; // abort sending if none of these numbers were right } #endif + +#ifndef MENUQC +float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents) +{ + switch(nativecontents) + { + case CONTENT_EMPTY: + return 0; + case CONTENT_SOLID: + return DPCONTENTS_SOLID | DPCONTENTS_OPAQUE; + case CONTENT_WATER: + return DPCONTENTS_WATER; + case CONTENT_SLIME: + return DPCONTENTS_SLIME; + case CONTENT_LAVA: + return DPCONTENTS_LAVA | DPCONTENTS_NODROP; + case CONTENT_SKY: + return DPCONTENTS_SKY | DPCONTENTS_NODROP | DPCONTENTS_OPAQUE; // to match behaviour of Q3 maps, let sky count as opaque + } + return 0; +} + +float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents) +{ + if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY)) + return CONTENT_SOLID; + if(supercontents & DPCONTENTS_SKY) + return CONTENT_SKY; + if(supercontents & DPCONTENTS_LAVA) + return CONTENT_LAVA; + if(supercontents & DPCONTENTS_SLIME) + return CONTENT_SLIME; + if(supercontents & DPCONTENTS_WATER) + return CONTENT_WATER; + return CONTENT_EMPTY; +} +#endif diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 978aec94b..820f4f5db 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -436,3 +436,8 @@ void dedicated_print(string input); #define CNT_ROUNDSTART 6 float Announcer_PickNumber(float type, float num); #endif + +#ifndef MENUQC +float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents); +float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents); +#endif