Skip to content
Snippets Groups Projects
Select Git revision
  • 56223c9e80157c48f216e2ee68b7435fb6543f25
  • next default protected
  • woof-midi-port
  • move-aatree-comparator-and-deallocator-initializations
  • expose-touching-sectorlist-to-lua
  • expose-texture-width-and-height
  • mobj-hit-floor-hook
  • wad-start-and-end-from-srb2classic
  • fix-emerald-hunt
  • fix-1425
  • expose-path-traverse
  • can-hurt-self-score-fix
  • post-mobj-thinker
  • hms-useragent
  • gitlab-ci
  • nightshoopsanity
  • fullscreen-toggle
  • next-test
  • bbox
  • cmake-enable-cxx
  • master
  • SRB2_release_2.2.10
  • SRB2_release_2.2.9
  • SRB2_release_2.2.8
  • SRB2_release_2.2.7
  • SRB2_release_2.2.6
  • SRB2_release_2.2.5
  • SRB2_release_2.2.4
  • SRB2_release_2.2.3
  • SRB2_release_2.2.2
  • SRB2_release_2.2.1
  • SRB2_release_2.2.0
  • SRB2_release_2.1.25
  • SRB2_release_2.1.24
  • SRB2_release_2.1.23
  • SRB2_release_2.1.22
  • SRB2_release_2.1.21
  • SRB2_release_2.1.20
  • SRB2_release_2.1.19
  • SRB2_release_2.1.18
  • td-release-v1.0.0
41 results

r_segs.c

Blame
  • Forked from STJr / SRB2
    Source project has a limited visibility.
    m_bbox.c 2.12 KiB
    // SONIC ROBO BLAST 2
    //-----------------------------------------------------------------------------
    // Copyright (C) 1993-1996 by id Software, Inc.
    // Copyright (C) 1998-2000 by DooM Legacy Team.
    // Copyright (C) 1999-2014 by Sonic Team Junior.
    //
    // This program is free software distributed under the
    // terms of the GNU General Public License, version 2.
    // See the 'LICENSE' file for more details.
    //-----------------------------------------------------------------------------
    /// \file  m_bbox.c
    /// \brief bounding boxes
    
    #include "doomtype.h"
    #include "m_bbox.h"
    /**	\brief	The M_ClearBox function
    
    	\param	box	a fixed_t array of 4 to be cleaned
    
    	\return	void
    
    
    */
    
    void M_ClearBox(fixed_t *box)
    {
    	box[BOXTOP] = box[BOXRIGHT] = INT32_MIN;
    	box[BOXBOTTOM] = box[BOXLEFT] = INT32_MAX;
    }
    /**	\brief	The M_AddToBox function
    
    	\param	box	a fixed_t array of 4 to be added with
    	\param	x	x of box
    	\param	y	y of box
    
    	\return	void
    
    
    */
    
    void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y)
    {
    	if (x < box[BOXLEFT])
    		box[BOXLEFT] = x;
    	if (x > box[BOXRIGHT])
    		box[BOXRIGHT] = x;
    
    	if (y < box[BOXBOTTOM])
    		box[BOXBOTTOM] = y;
    	if (y > box[BOXTOP])
    		box[BOXTOP] = y;
    }
    /**	\brief	The M_PointInBox function
    
    	\param	box	a fixed_t array of 4 to be checked with
    	\param	x	x of box
    	\param	y	y of box
    
    	\return	if it's in the box
    
    
    */
    
    boolean M_PointInBox(fixed_t *box, fixed_t x, fixed_t y)
    {
    	if (x < box[BOXLEFT])
    		return false;
    	if (x > box[BOXRIGHT])
    		return false;
    	if (y < box[BOXBOTTOM])
    		return false;
    	if (y > box[BOXTOP])
    		return false;
    
    	return true;
    }
    /**	\brief	The M_CircleTouchBox function
    
    	\param	box	a parameter of type fixed_t *
    	\param	circlex	a parameter of type fixed_t
    	\param	circley	a parameter of type fixed_t
    	\param	circleradius	a parameter of type fixed_t
    
    	\return	boolean
    
    
    */
    
    boolean M_CircleTouchBox(fixed_t *box, fixed_t circlex, fixed_t circley, fixed_t circleradius)
    {
    	if (box[BOXLEFT] - circleradius > circlex)
    		return false;
    	if (box[BOXRIGHT] + circleradius < circlex)
    		return false;
    	if (box[BOXBOTTOM] - circleradius > circley)
    		return false;
    	if (box[BOXTOP] + circleradius < circley)
    		return false;
    	return true;
    }