/* Formatright © 2010, ConnorMcLeod Bubble Trails is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Bubble Trails; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #define VERSION "0.0.1" #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers ) #define write_coord_f(%1) engfunc(EngFunc_WriteCoord,%1) const DONT_CHECK_WEAPONS_BITSUM = (1< 255) { iCount = 255 } message_begin( MSG_BROADCAST, SVC_TEMPENTITY ) { write_byte( TE_BUBBLETRAIL ) write_coord_f( vecSource[0] ) // mins write_coord_f( vecSource[1] ) write_coord_f( vecSource[2] ) write_coord_f( vecTo[0] ) // maxz write_coord_f( vecTo[1] ) write_coord_f( vecTo[2] ) write_coord_f( flHeight ) // height write_short( g_sModelIndexBubbles ) write_byte( iCount ) // count write_coord( 8 ) // speed } message_end() } Float:UTIL_WaterLevel( Float:position[3], Float:minz, Float:maxz ) { new Float:midUp[3] midUp[0] = position[0] midUp[1] = position[1] midUp[2] = minz if (engfunc(EngFunc_PointContents, midUp) != CONTENTS_WATER) return minz midUp[2] = maxz if (engfunc(EngFunc_PointContents, midUp) == CONTENTS_WATER) return maxz new Float:diff = maxz - minz while(diff > 1.0) { midUp[2] = minz + diff/2.0 if (engfunc(EngFunc_PointContents, midUp) == CONTENTS_WATER) { minz = midUp[2] } else { maxz = midUp[2] } diff = maxz - minz } return midUp[2] }