mirror of
https://github.com/halpz/re3.git
synced 2025-07-15 23:28:15 +00:00
Peds, mission switcher & fixes
This commit is contained in:
@ -1801,6 +1801,21 @@ CColSphere::Set(float radius, const CVector ¢er, uint8 surf, uint8 piece)
|
||||
this->piece = piece;
|
||||
}
|
||||
|
||||
bool
|
||||
CColSphere::IntersectRay(CVector const& from, CVector const& dir, CVector &entry, CVector &exit)
|
||||
{
|
||||
CVector distToCenter = from - center;
|
||||
float distToTouchSqr = distToCenter.MagnitudeSqr() - sq(radius);
|
||||
float root1, root2;
|
||||
|
||||
if (!CGeneral::SolveQuadratic(1.0f, DotProduct(distToCenter, dir) * 2.f, distToTouchSqr, root1, root2))
|
||||
return false;
|
||||
|
||||
entry = from + dir * root1;
|
||||
exit = from + dir * root2;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CColBox::Set(const CVector &min, const CVector &max, uint8 surf, uint8 piece)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@ struct CColSphere : public CSphere
|
||||
uint8 piece;
|
||||
|
||||
void Set(float radius, const CVector ¢er, uint8 surf, uint8 piece);
|
||||
bool IntersectRay(CVector const &from, CVector const &dir, CVector &entry, CVector &exit);
|
||||
using CSphere::Set;
|
||||
};
|
||||
|
||||
|
@ -134,6 +134,18 @@ public:
|
||||
return *str2 != '\0';
|
||||
}
|
||||
|
||||
static bool SolveQuadratic(float a, float b, float c, float &root1, float &root2)
|
||||
{
|
||||
float discriminant = b * b - 4.f * a * c;
|
||||
if (discriminant < 0.f)
|
||||
return false;
|
||||
|
||||
float discriminantSqrt = Sqrt(discriminant);
|
||||
root2 = (-b + discriminantSqrt) / (2.f * a);
|
||||
root1 = (-b - discriminantSqrt) / (2.f * a);
|
||||
return true;
|
||||
}
|
||||
|
||||
// not too sure about all these...
|
||||
static uint16 GetRandomNumber(void)
|
||||
{ return myrand() & MYRAND_MAX; }
|
||||
|
@ -202,12 +202,11 @@ enum Config {
|
||||
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
||||
#define FIX_HIGH_FPS_BUGS_ON_FRONTEND
|
||||
|
||||
// Rendering/display
|
||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||
// Just debug menu entries
|
||||
#ifdef DEBUGMENU
|
||||
#define TOGGLEABLE_BETA_FEATURES // not too many things
|
||||
#define RELOADABLES // some debug menu options to reload TXD files
|
||||
#define MISSION_SWITCHER // from debug menu
|
||||
#endif
|
||||
|
||||
// Rendering/display
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "Text.h"
|
||||
#include "WaterLevel.h"
|
||||
#include "main.h"
|
||||
#include "Script.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "assert.h"
|
||||
@ -309,6 +310,15 @@ ResetCamStatics(void)
|
||||
TheCamera.Cams[TheCamera.ActiveCam].ResetStatics = true;
|
||||
}
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
int8 nextMissionToSwitch = 0;
|
||||
static void
|
||||
SwitchToMission(void)
|
||||
{
|
||||
switchMissionTo = nextMissionToSwitch;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *carnames[] = {
|
||||
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "rio", "firetruk", "trash", "stretch", "manana",
|
||||
"infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing",
|
||||
@ -512,7 +522,10 @@ DebugMenuPopulate(void)
|
||||
#ifdef TIMEBARS
|
||||
DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
|
||||
#endif
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
DebugMenuAddInt8("Debug", "Select mission no", &nextMissionToSwitch, nil, 1, 0, 96, nil);
|
||||
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
|
||||
#endif
|
||||
extern bool PrintDebugCode;
|
||||
extern int16 DebugCamMode;
|
||||
DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);
|
||||
|
Reference in New Issue
Block a user