mirror of
https://github.com/GTAmodding/re3.git
synced 2021-02-19 17:49:54 +01:00
Peds, mission switcher & fixes
This commit is contained in:
parent
f78f707935
commit
db6110e996
@ -166,6 +166,9 @@ bool doingMissionRetry;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
int switchMissionTo = -1;
|
||||
#endif
|
||||
|
||||
const uint32 CRunningScript::nSaveStructSize =
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
@ -886,10 +889,18 @@ void CRunningScript::Process()
|
||||
|
||||
int8 CRunningScript::ProcessOneCommand()
|
||||
{
|
||||
++CTheScripts::CommandsExecuted;
|
||||
int32 command = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||
m_bNotFlag = (command & 0x8000);
|
||||
command &= 0x7FFF;
|
||||
int32 command;
|
||||
#ifdef MISSION_SWITCHER
|
||||
if (switchMissionTo != -1)
|
||||
command = COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
++CTheScripts::CommandsExecuted;
|
||||
command = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||
m_bNotFlag = (command & 0x8000);
|
||||
command &= 0x7FFF;
|
||||
}
|
||||
if (command < 100)
|
||||
return ProcessCommands0To99(command);
|
||||
if (command < 200)
|
||||
@ -2032,7 +2043,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
ped->ClearAll();
|
||||
int8 path = ScriptParams[1];
|
||||
if (ScriptParams[1] < 0 || ScriptParams[1] > 7)
|
||||
// Max number GetRandomNumberInRange returns is max-1
|
||||
#ifdef FIX_BUGS
|
||||
path = CGeneral::GetRandomNumberInRange(0, 8);
|
||||
#else
|
||||
path = CGeneral::GetRandomNumberInRange(0, 7);
|
||||
#endif
|
||||
|
||||
ped->SetWanderPath(path);
|
||||
return 0;
|
||||
}
|
||||
@ -2051,10 +2068,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
eMoveState state;
|
||||
switch (ScriptParams[5]) {
|
||||
case 0: state = PEDMOVE_WALK; break;
|
||||
case 1: state = PEDMOVE_SPRINT; break;
|
||||
case 1: state = PEDMOVE_RUN; break;
|
||||
default: assert(0);
|
||||
}
|
||||
ped->ClearAll();
|
||||
ped->m_pathNodeTimer = 0;
|
||||
ped->SetFollowPath(pos, radius, state, nil, nil, 999999);
|
||||
return 0;
|
||||
}
|
||||
@ -9125,7 +9143,14 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
return 0;
|
||||
case COMMAND_LOAD_AND_LAUNCH_MISSION_INTERNAL:
|
||||
{
|
||||
#ifdef MISSION_SWITCHER
|
||||
if (switchMissionTo != -1) {
|
||||
ScriptParams[0] = switchMissionTo;
|
||||
switchMissionTo = -1;
|
||||
} else
|
||||
#endif
|
||||
CollectParameters(&m_nIp, 1);
|
||||
|
||||
if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2)
|
||||
return 0;
|
||||
#ifdef MISSION_REPLAY
|
||||
@ -10676,7 +10701,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
|
||||
assert(pTargetPed);
|
||||
pPed->bScriptObjectiveCompleted = false;
|
||||
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING, pPed);
|
||||
pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING, pTargetPed);
|
||||
return 0;
|
||||
}
|
||||
//case COMMAND_IS_PICKUP_IN_ZONE:
|
||||
@ -14220,7 +14245,7 @@ void CTheScripts::CleanUpThisPed(CPed* pPed)
|
||||
pPed->CharCreatedBy = RANDOM_CHAR;
|
||||
if (pPed->m_nPedType == PEDTYPE_PROSTITUTE)
|
||||
pPed->m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 30000;
|
||||
if (pPed->bInVehicle) {
|
||||
if (pPed->InVehicle()) {
|
||||
if (pPed->m_pMyVehicle->pDriver == pPed) {
|
||||
if (pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_CAR) {
|
||||
CCarCtrl::JoinCarWithRoadSystem(pPed->m_pMyVehicle);
|
||||
@ -14245,10 +14270,14 @@ void CTheScripts::CleanUpThisPed(CPed* pPed)
|
||||
pPed->ClearObjective();
|
||||
pPed->bRespondsToThreats = true;
|
||||
pPed->bScriptObjectiveCompleted = false;
|
||||
pPed->bKindaStayInSamePlace = false;
|
||||
pPed->ClearLeader();
|
||||
if (pPed->IsPedInControl())
|
||||
pPed->SetWanderPath(CGeneral::GetRandomNumber() & 7);
|
||||
if (flees) {
|
||||
if (pPed->m_nPedState == PED_FOLLOW_PATH && state != PED_FOLLOW_PATH)
|
||||
pPed->ClearFollowPath();
|
||||
|
||||
pPed->m_nPedState = state;
|
||||
pPed->SetMoveState(ms);
|
||||
}
|
||||
|
@ -545,4 +545,8 @@ void RetryMission(int, int);
|
||||
|
||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||
extern int scriptToLoad;
|
||||
#endif
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
extern int switchMissionTo;
|
||||
#endif
|
@ -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);
|
||||
|
800
src/peds/Ped.cpp
800
src/peds/Ped.cpp
File diff suppressed because it is too large
Load Diff
@ -10,11 +10,11 @@
|
||||
#include "Weapon.h"
|
||||
#include "WeaponInfo.h"
|
||||
#include "AnimationId.h"
|
||||
#include "PathFind.h"
|
||||
|
||||
#define FEET_OFFSET 1.04f
|
||||
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
|
||||
|
||||
struct CPathNode;
|
||||
class CAccident;
|
||||
class CObject;
|
||||
class CFire;
|
||||
@ -346,6 +346,9 @@ enum eMoveState {
|
||||
PEDMOVE_NONE,
|
||||
PEDMOVE_STILL,
|
||||
PEDMOVE_WALK,
|
||||
|
||||
PEDMOVE_UNK,
|
||||
|
||||
PEDMOVE_RUN,
|
||||
PEDMOVE_SPRINT,
|
||||
};
|
||||
@ -521,13 +524,20 @@ public:
|
||||
int32 m_nPrevMoveState;
|
||||
eWaitState m_nWaitState;
|
||||
uint32 m_nWaitTimer;
|
||||
void *m_pPathNodesStates[8]; // unused, probably leftover from VC
|
||||
CVector2D m_stPathNodeStates[10];
|
||||
uint16 m_nPathNodes;
|
||||
int16 m_nCurPathNode;
|
||||
int8 m_nPathDir;
|
||||
CPathNode *m_pLastPathNode;
|
||||
CPathNode *m_pNextPathNode;
|
||||
CPathNode* m_pathNodesToGo[8];
|
||||
int16 m_nNumPathNodes;
|
||||
int16 m_nCurPathNodeId;
|
||||
CEntity* m_followPathWalkAroundEnt;
|
||||
CEntity* m_followPathTargetEnt;
|
||||
uint32 m_pathNodeTimer;
|
||||
CPathNode m_pathNodeObjPool[8];
|
||||
CPathNode* m_pCurPathNode;
|
||||
char m_nPathDir;
|
||||
CPathNode* m_pLastPathNode;
|
||||
CPathNode* m_pNextPathNode;
|
||||
CVector m_followPathDestPos;
|
||||
float m_followPathAbortDist;
|
||||
eMoveState m_followPathMoveState;
|
||||
float m_fHealth;
|
||||
float m_fArmour;
|
||||
uint32 m_nExtendedRangeTimer;
|
||||
@ -756,6 +766,7 @@ public:
|
||||
void RemoveInCarAnims(void);
|
||||
void CollideWithPed(CPed*);
|
||||
void SetDirectionToWalkAroundObject(CEntity*);
|
||||
bool SetDirectionToWalkAroundVehicle(CVehicle*);
|
||||
void RemoveWeaponAnims(int, float);
|
||||
void CreateDeadPedMoney(void);
|
||||
void CreateDeadPedWeaponPickups(void);
|
||||
@ -778,7 +789,7 @@ public:
|
||||
bool FindBestCoordsFromNodes(CVector, CVector*);
|
||||
void Wait(void);
|
||||
void ProcessObjective(void);
|
||||
bool SeekFollowingPath(CVector*);
|
||||
CVector *SeekFollowingPath(void);
|
||||
void Flee(void);
|
||||
void FollowPath(void);
|
||||
CVector GetFormationPosition(void);
|
||||
|
@ -4,47 +4,65 @@
|
||||
#include "General.h"
|
||||
#include "Ped.h"
|
||||
|
||||
// --MIAMI: Done
|
||||
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
|
||||
PedAudioData CommentWaitTime[39] = {
|
||||
{500, 800, 500, 2},
|
||||
{500, 800, 500, 2},
|
||||
{500, 800, 500, 2},
|
||||
{500, 800, 500, 2},
|
||||
{100, 2, 100, 2},
|
||||
{700, 500, 1000, 500},
|
||||
{700, 500, 1000, 500},
|
||||
{5000, 2000, 15000, 3000},
|
||||
{5000, 2000, 15000, 3000},
|
||||
{5000, 2000, 15000, 3000},
|
||||
{6000, 6000, 6000, 6000},
|
||||
{1000, 1000, 2000, 2000},
|
||||
{1000, 500, 2000, 1500},
|
||||
{1000, 500, 2000, 1500},
|
||||
{800, 200, 1000, 500},
|
||||
{800, 200, 1000, 500},
|
||||
{800, 400, 2000, 1000},
|
||||
{800, 400, 2000, 1000},
|
||||
{400, 300, 2000, 1000},
|
||||
{2000, 1000, 2500, 1500},
|
||||
{200, 200, 200, 200},
|
||||
{6000, 3000, 5000, 6000},
|
||||
{6000, 3000, 9000, 5000},
|
||||
{6000, 3000, 9000, 5000},
|
||||
{6000, 3000, 9000, 5000},
|
||||
{400, 300, 4000, 1000},
|
||||
{400, 300, 4000, 1000},
|
||||
{400, 300, 4000, 1000},
|
||||
{1000, 500, 3000, 1000},
|
||||
{1000, 500, 1000, 1000},
|
||||
{3000, 2000, 3000, 2000},
|
||||
{1000, 500, 3000, 6000},
|
||||
{1000, 500, 2000, 4000},
|
||||
{1000, 500, 2000, 5000},
|
||||
{1000, 500, 3000, 2000},
|
||||
{1600, 1000, 2000, 2000},
|
||||
{3000, 2000, 5000, 3000},
|
||||
{1000, 1000, 1000, 1000},
|
||||
{1000, 1000, 5000, 5000},
|
||||
PedAudioData CommentWaitTime[56] = {
|
||||
{ 500, 800, 500, 2 },
|
||||
{ 500, 800, 500, 2 },
|
||||
{ 500, 800, 500, 2 },
|
||||
{ 500, 800, 500, 2 },
|
||||
{ 100, 2, 100, 2 },
|
||||
{ 500, 500, 2000, 1000 },
|
||||
{ 2000, 50, 2050, 1000 },
|
||||
{ 5000, 2000, 7000, 3000 },
|
||||
{ 5000, 2000, 7000, 3000 },
|
||||
{ 300, 200, 500, 200 },
|
||||
{ 3000, 1000, 4000, 1000 },
|
||||
{ 6000, 6000, 6000, 6000 },
|
||||
{ 4000, 1000, 5000, 1000 },
|
||||
{ 3000, 1000, 4000, 1000 },
|
||||
{ 1000, 1000, 2000, 2000 },
|
||||
{ 1000, 500, 2000, 1500 },
|
||||
{ 1700, 1000, 3000, 1000 },
|
||||
{ 800, 200, 1000, 500 },
|
||||
{ 800, 200, 1000, 500 },
|
||||
{ 800, 400, 2000, 1000 },
|
||||
{ 800, 400, 2000, 1000 },
|
||||
{ 2000, 2000, 4000, 4000 },
|
||||
{ 2000, 2000, 4000, 1000 },
|
||||
{ 4000, 1000, 5000, 1000 },
|
||||
{ 800, 400, 1200, 500 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 5000, 1000, 6000, 2000 },
|
||||
{ 4000, 2000, 7000, 2000 },
|
||||
{ 1000, 300, 2000, 1000 },
|
||||
{ 1500, 1000, 2500, 1000 },
|
||||
{ 200, 200, 200, 200 },
|
||||
{ 2000, 1000, 4000, 1000 },
|
||||
{ 2000, 1000, 4000, 1000 },
|
||||
{ 1000, 500, 3000, 1000 },
|
||||
{ 1000, 500, 1000, 1000 },
|
||||
{ 3000, 2000, 5000, 1000 },
|
||||
{ 3000, 2000, 5000, 1000 },
|
||||
{ 3000, 2000, 3000, 2000 },
|
||||
{ 2000, 1000, 3000, 1000 },
|
||||
{ 2500, 1000, 5000, 5000 },
|
||||
{ 2000, 1000, 3000, 2000 },
|
||||
{ 4000, 1000, 5000, 1000 },
|
||||
{ 1000, 500, 2000, 4000 },
|
||||
{ 1000, 500, 2000, 5000 },
|
||||
{ 2000, 500, 2500, 500 },
|
||||
{ 1000, 500, 3000, 2000 },
|
||||
{ 1600, 1000, 2000, 2000 },
|
||||
{ 2000, 1000, 4000, 2000 },
|
||||
{ 1500, 1000, 2500, 1000 },
|
||||
{ 1000, 1000, 5000, 5000 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
// --MIAMI: Done
|
||||
@ -54,7 +72,7 @@ CPed::ServiceTalkingWhenDead(void)
|
||||
return m_queuedSound == SOUND_PED_DEATH;
|
||||
}
|
||||
|
||||
// --MIAMI: Done except ifdef
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPed::ServiceTalking(void)
|
||||
{
|
||||
@ -84,7 +102,7 @@ CPed::ServiceTalking(void)
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done except ifdef
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPed::Say(uint16 audio)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user