2024-04-20 15:57:49 +00:00
|
|
|
/*
|
2024-07-28 01:27:05 +00:00
|
|
|
* Descent 3
|
2024-04-20 15:57:49 +00:00
|
|
|
* Copyright (C) 2024 Parallax Software
|
|
|
|
*
|
|
|
|
* This program 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, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2024-05-06 15:12:44 +00:00
|
|
|
--- HISTORICAL COMMENTS FOLLOW ---
|
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
* $Logfile: /DescentIII/Main/lib/collide.h $
|
|
|
|
* $Revision: 15 $
|
|
|
|
* $Date: 6/10/99 6:41p $
|
|
|
|
* $Author: Chris $
|
|
|
|
*
|
|
|
|
* Descent III collide code
|
|
|
|
*
|
|
|
|
* $Log: /DescentIII/Main/lib/collide.h $
|
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 15 6/10/99 6:41p Chris
|
|
|
|
* Added ned_physics support
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 14 4/23/99 9:22p Matt
|
|
|
|
* Changed weapons to keep going after breaking glass.
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 13 4/14/99 3:59a Jeff
|
|
|
|
* fixed case mismatches in #includes
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 12 1/29/99 5:09p Chris
|
|
|
|
* Made changes for ROCKS
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 11 1/01/99 4:10p Chris
|
|
|
|
* Added some const parameters, improved ray cast object collide/rejection
|
|
|
|
* code
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 10 10/09/98 7:47p Chris
|
|
|
|
* Added ObjSetDeadFlag
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 9 6/15/98 7:01a Chris
|
|
|
|
* Cleaned out DII stuff and added new PhysicsSim extern's
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 8 5/07/98 2:22p Chris
|
|
|
|
* Hit die dot
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 7 5/05/98 3:42p Chris
|
|
|
|
* Code cleanup and fixed the collide_XXX_with_wall code. The wall_normal
|
|
|
|
* was know by fvi; so, it is passed to the function (instead of
|
|
|
|
* generating it again)
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 6 2/05/98 2:02p Chris
|
|
|
|
* Fixed the hitseg and hitwall in collide_object_with_wall and
|
|
|
|
* scrape_object_with_wall
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 5 10/21/97 4:15p Chris
|
|
|
|
* Incremental integration of the fvi/physics/collide code
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 4 10/20/97 11:55a Chris
|
|
|
|
* Added some support for the new collide system.
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 3 9/17/97 10:59a Chris
|
|
|
|
* Added a new way to compute radi
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 2 9/15/97 5:17a Chris
|
|
|
|
* Removed the Explosion Vclips since they do not play correctly in
|
|
|
|
* Hardware
|
2024-04-16 18:56:40 +00:00
|
|
|
* Added support for building collisons.
|
2024-04-16 03:43:29 +00:00
|
|
|
* working on SPhere to non-moving sphere collisions
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
2024-04-16 03:43:29 +00:00
|
|
|
* 5 3/15/97 1:29p Chris
|
2024-04-16 18:56:40 +00:00
|
|
|
*
|
|
|
|
* $NoKeywords: $
|
|
|
|
*/
|
2024-04-16 03:43:29 +00:00
|
|
|
|
2024-07-28 01:27:05 +00:00
|
|
|
#ifndef COLLIDE_H
|
|
|
|
#define COLLIDE_H
|
2024-04-16 03:43:29 +00:00
|
|
|
|
2024-07-28 01:27:05 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
#include "findintersection.h"
|
2024-04-16 03:43:29 +00:00
|
|
|
#include "object.h"
|
|
|
|
#include "vecmat.h"
|
|
|
|
|
2024-05-24 03:07:26 +00:00
|
|
|
extern uint8_t CollisionResult[MAX_OBJECT_TYPES][MAX_OBJECT_TYPES];
|
|
|
|
extern uint8_t CollisionRayResult[MAX_OBJECT_TYPES];
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
void CollideInit();
|
2024-04-16 18:56:40 +00:00
|
|
|
void collide_two_objects(object *A, object *B, vector *collision_point, vector *collision_normal,
|
2024-07-28 01:27:05 +00:00
|
|
|
fvi_info *hit_info = nullptr);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
// Process a collision between an object and a wall
|
|
|
|
// Returns true if the object hits the wall, and false if should keep going though the wall (for breakable glass)
|
|
|
|
bool collide_object_with_wall(object *A, float hitspeed, int hitseg, int hitwall, vector *hitpt, vector *wall_normal,
|
|
|
|
float hit_dot);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
2024-05-07 21:35:28 +00:00
|
|
|
extern void FindHitpointUV(float *u, float *v, vector *point, room *rp, int facenum);
|
|
|
|
|
2024-04-16 03:43:29 +00:00
|
|
|
void ConvertEulerToAxisAmount(vector *e, vector *n, float *w);
|
|
|
|
void ConvertAxisAmountToEuler(vector *n, float *w, vector *e);
|
|
|
|
|
|
|
|
void bump_obj_against_fixed(object *obj, vector *collision_point, vector *collision_normal);
|
|
|
|
|
|
|
|
#ifndef NED_PHYSICS
|
2024-04-16 18:56:40 +00:00
|
|
|
#define RESULT_NOTHING 0
|
|
|
|
#define RESULT_CHECK_SPHERE_SPHERE 1
|
|
|
|
#define RESULT_CHECK_SPHERE_POLY 2
|
|
|
|
#define RESULT_CHECK_POLY_SPHERE 3
|
|
|
|
#define RESULT_CHECK_BBOX_POLY 4
|
|
|
|
#define RESULT_CHECK_POLY_BBOX 5
|
|
|
|
#define RESULT_CHECK_BBOX_BBOX 6
|
|
|
|
#define RESULT_CHECK_BBOX_SPHERE 7
|
|
|
|
#define RESULT_CHECK_SPHERE_BBOX 8
|
|
|
|
#define RESULT_CHECK_SPHERE_ROOM 9
|
|
|
|
#define RESULT_CHECK_BBOX_ROOM 10
|
2024-04-16 03:43:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|