mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-30 04:54:15 +01:00
Try to build with mingw
This commit is contained in:
parent
0f07a323c9
commit
370c4e48cd
@ -1,5 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "ctype.h"
|
||||||
|
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "AnimManager.h"
|
#include "AnimManager.h"
|
||||||
@ -75,12 +77,21 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
|
|||||||
c2 = *s2;
|
c2 = *s2;
|
||||||
if(c1) s1++;
|
if(c1) s1++;
|
||||||
if(c2) s2++;
|
if(c2) s2++;
|
||||||
if(c1 == '\0' && c2 == '\0')
|
if(c1 == '\0' && c2 == '\0') return true;
|
||||||
return true;
|
#if defined _WIN32 && !defined __MINGW32__
|
||||||
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
||||||
|
#else
|
||||||
|
if(iswdigit(c1) && iswdigit(c2))
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
|
#if defined _WIN32 && !defined __MINGW32__
|
||||||
c1 = __ascii_toupper(c1);
|
c1 = __ascii_toupper(c1);
|
||||||
c2 = __ascii_toupper(c2);
|
c2 = __ascii_toupper(c2);
|
||||||
|
#else
|
||||||
|
c1 = toupper(c1);
|
||||||
|
c2 = toupper(c2);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(c1 != c2)
|
if(c1 != c2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||||||
if(blendAmount <= 0.0f && blendDelta < 0.0f){
|
if(blendAmount <= 0.0f && blendDelta < 0.0f){
|
||||||
// We're faded out and are not fading in
|
// We're faded out and are not fading in
|
||||||
blendAmount = 0.0f;
|
blendAmount = 0.0f;
|
||||||
blendDelta = max(0.0f, blendDelta);
|
blendDelta = Max(0.0f, blendDelta);
|
||||||
if(flags & ASSOC_DELETEFADEDOUT){
|
if(flags & ASSOC_DELETEFADEDOUT){
|
||||||
if(callbackType == CB_FINISH || callbackType == CB_DELETE)
|
if(callbackType == CB_FINISH || callbackType == CB_DELETE)
|
||||||
callback(this, callbackArg);
|
callback(this, callbackArg);
|
||||||
@ -197,7 +197,7 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
|||||||
if(blendAmount > 1.0f){
|
if(blendAmount > 1.0f){
|
||||||
// Maximally faded in, clamp values
|
// Maximally faded in, clamp values
|
||||||
blendAmount = 1.0f;
|
blendAmount = 1.0f;
|
||||||
blendDelta = min(0.0f, blendDelta);
|
blendDelta = Min(0.0f, blendDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,7 +36,7 @@ CAnimBlendHierarchy::CalcTotalTime(void)
|
|||||||
float seqTime = 0.0f;
|
float seqTime = 0.0f;
|
||||||
for(j = 0; j < sequences[i].numFrames; j++)
|
for(j = 0; j < sequences[i].numFrames; j++)
|
||||||
seqTime += sequences[i].GetKeyFrame(j)->deltaTime;
|
seqTime += sequences[i].GetKeyFrame(j)->deltaTime;
|
||||||
totalTime = max(totalTime, seqTime);
|
totalTime = Max(totalTime, seqTime);
|
||||||
}
|
}
|
||||||
totalLength = totalTime;
|
totalLength = totalTime;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AnimBlendHierarchy.h"
|
#include "AnimBlendHierarchy.h"
|
||||||
|
#include "AnimationId.h"
|
||||||
|
|
||||||
enum AssocGroupId
|
enum AssocGroupId
|
||||||
{
|
{
|
||||||
@ -33,185 +34,6 @@ enum AssocGroupId
|
|||||||
NUM_ANIM_ASSOC_GROUPS
|
NUM_ANIM_ASSOC_GROUPS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AnimationId
|
|
||||||
{
|
|
||||||
ANIM_WALK,
|
|
||||||
ANIM_RUN,
|
|
||||||
ANIM_SPRINT,
|
|
||||||
ANIM_IDLE_STANCE,
|
|
||||||
ANIM_WALK_START,
|
|
||||||
ANIM_RUN_STOP,
|
|
||||||
ANIM_RUN_STOP_R,
|
|
||||||
ANIM_IDLE_CAM,
|
|
||||||
ANIM_IDLE_HBHB,
|
|
||||||
ANIM_IDLE_TIRED,
|
|
||||||
ANIM_IDLE_ARMED,
|
|
||||||
ANIM_IDLE_CHAT,
|
|
||||||
ANIM_IDLE_TAXI,
|
|
||||||
ANIM_KO_SHOT_FRONT1,
|
|
||||||
ANIM_KO_SHOT_FRONT2,
|
|
||||||
ANIM_KO_SHOT_FRONT3,
|
|
||||||
ANIM_KO_SHOT_FRONT4,
|
|
||||||
ANIM_KO_SHOT_FACE,
|
|
||||||
ANIM_KO_SHOT_STOM,
|
|
||||||
ANIM_KO_SHOT_ARML,
|
|
||||||
ANIM_KO_SHOT_ARMR,
|
|
||||||
ANIM_KO_SHOT_LEGL,
|
|
||||||
ANIM_KO_SHOT_LEGR,
|
|
||||||
ANIM_KD_LEFT,
|
|
||||||
ANIM_KD_RIGHT,
|
|
||||||
ANIM_KO_SKID_FRONT,
|
|
||||||
ANIM_KO_SPIN_R, // named left in VC
|
|
||||||
ANIM_KO_SKID_BACK,
|
|
||||||
ANIM_KO_SPIN_L, // named right in VC
|
|
||||||
ANIM_SHOT_FRONT_PARTIAL,
|
|
||||||
ANIM_SHOT_LEFT_PARTIAL,
|
|
||||||
ANIM_SHOT_BACK_PARTIAL,
|
|
||||||
ANIM_SHOT_RIGHT_PARTIAL,
|
|
||||||
ANIM_HIT_FRONT,
|
|
||||||
ANIM_HIT_LEFT,
|
|
||||||
ANIM_HIT_BACK,
|
|
||||||
ANIM_HIT_RIGHT,
|
|
||||||
ANIM_FLOOR_HIT,
|
|
||||||
ANIM_HIT_BODYBLOW,
|
|
||||||
ANIM_HIT_CHEST,
|
|
||||||
ANIM_HIT_HEAD,
|
|
||||||
ANIM_HIT_WALK,
|
|
||||||
ANIM_HIT_WALL,
|
|
||||||
ANIM_FLOOR_HIT_F,
|
|
||||||
ANIM_HIT_BEHIND,
|
|
||||||
ANIM_PUNCH_R,
|
|
||||||
ANIM_KICK_FLOOR,
|
|
||||||
ANIM_WEAPON_BAT_H,
|
|
||||||
ANIM_WEAPON_BAT_V,
|
|
||||||
ANIM_WEAPON_HGUN_BODY,
|
|
||||||
ANIM_WEAPON_AK_BODY,
|
|
||||||
ANIM_WEAPON_PUMP,
|
|
||||||
ANIM_WEAPON_SNIPER,
|
|
||||||
ANIM_WEAPON_THROW,
|
|
||||||
ANIM_WEAPON_THROWU,
|
|
||||||
ANIM_WEAPON_START_THROW,
|
|
||||||
ANIM_BOMBER,
|
|
||||||
ANIM_HGUN_RELOAD,
|
|
||||||
ANIM_AK_RELOAD,
|
|
||||||
ANIM_FPS_PUNCH,
|
|
||||||
ANIM_FPS_BAT,
|
|
||||||
ANIM_FPS_UZI,
|
|
||||||
ANIM_FPS_PUMP,
|
|
||||||
ANIM_FPS_AK,
|
|
||||||
ANIM_FPS_M16,
|
|
||||||
ANIM_FPS_ROCKET,
|
|
||||||
ANIM_FIGHT_IDLE,
|
|
||||||
ANIM_FIGHT2_IDLE,
|
|
||||||
ANIM_FIGHT_SH_F,
|
|
||||||
ANIM_FIGHT_BODYBLOW,
|
|
||||||
ANIM_FIGHT_HEAD,
|
|
||||||
ANIM_FIGHT_KICK,
|
|
||||||
ANIM_FIGHT_KNEE,
|
|
||||||
ANIM_FIGHT_LHOOK,
|
|
||||||
ANIM_FIGHT_PUNCH,
|
|
||||||
ANIM_FIGHT_ROUNDHOUSE,
|
|
||||||
ANIM_FIGHT_LONGKICK,
|
|
||||||
ANIM_FIGHT_PPUNCH,
|
|
||||||
ANIM_CAR_JACKED_RHS,
|
|
||||||
ANIM_CAR_LJACKED_RHS,
|
|
||||||
ANIM_CAR_JACKED_LHS,
|
|
||||||
ANIM_CAR_LJACKED_LHS,
|
|
||||||
ANIM_CAR_QJACK,
|
|
||||||
ANIM_CAR_QJACKED,
|
|
||||||
ANIM_CAR_ALIGN_LHS,
|
|
||||||
ANIM_CAR_ALIGNHI_LHS,
|
|
||||||
ANIM_CAR_OPEN_LHS,
|
|
||||||
ANIM_CAR_DOORLOCKED_LHS,
|
|
||||||
ANIM_CAR_PULLOUT_LHS,
|
|
||||||
ANIM_CAR_PULLOUT_LOW_LHS,
|
|
||||||
ANIM_CAR_GETIN_LHS,
|
|
||||||
ANIM_CAR_GETIN_LOW_LHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_LHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_LOW_LHS,
|
|
||||||
ANIM_CAR_ROLLDOOR,
|
|
||||||
ANIM_CAR_ROLLDOOR_LOW,
|
|
||||||
ANIM_CAR_GETOUT_LHS,
|
|
||||||
ANIM_CAR_GETOUT_LOW_LHS,
|
|
||||||
ANIM_CAR_CLOSE_LHS,
|
|
||||||
ANIM_CAR_ALIGN_RHS,
|
|
||||||
ANIM_CAR_ALIGNHI_RHS,
|
|
||||||
ANIM_CAR_OPEN_RHS,
|
|
||||||
ANIM_CAR_DOORLOCKED_RHS,
|
|
||||||
ANIM_CAR_PULLOUT_RHS,
|
|
||||||
ANIM_CAR_PULLOUT_LOW_RHS,
|
|
||||||
ANIM_CAR_GETIN_RHS,
|
|
||||||
ANIM_CAR_GETIN_LOW_RHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_RHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_LOW_RHS,
|
|
||||||
ANIM_CAR_SHUFFLE_RHS,
|
|
||||||
ANIM_CAR_LSHUFFLE_RHS,
|
|
||||||
ANIM_CAR_SIT,
|
|
||||||
ANIM_CAR_LSIT,
|
|
||||||
ANIM_CAR_SITP,
|
|
||||||
ANIM_CAR_SITPLO,
|
|
||||||
ANIM_DRIVE_L,
|
|
||||||
ANIM_DRIVE_R,
|
|
||||||
ANIM_DRIVE_LOW_L,
|
|
||||||
ANIM_DRIVE_LOW_R,
|
|
||||||
ANIM_DRIVEBY_L,
|
|
||||||
ANIM_DRIVEBY_R,
|
|
||||||
ANIM_CAR_LB,
|
|
||||||
ANIM_DRIVE_BOAT,
|
|
||||||
ANIM_CAR_GETOUT_RHS,
|
|
||||||
ANIM_CAR_GETOUT_LOW_RHS,
|
|
||||||
ANIM_CAR_CLOSE_RHS,
|
|
||||||
ANIM_CAR_HOOKERTALK,
|
|
||||||
ANIM_COACH_OPEN_L,
|
|
||||||
ANIM_COACH_OPEN_R,
|
|
||||||
ANIM_COACH_IN_L,
|
|
||||||
ANIM_COACH_IN_R,
|
|
||||||
ANIM_COACH_OUT_L,
|
|
||||||
ANIM_TRAIN_GETIN,
|
|
||||||
ANIM_TRAIN_GETOUT,
|
|
||||||
ANIM_CAR_CRAWLOUT_RHS,
|
|
||||||
ANIM_CAR_CRAWLOUT_RHS2,
|
|
||||||
ANIM_VAN_OPEN_L,
|
|
||||||
ANIM_VAN_GETIN_L,
|
|
||||||
ANIM_VAN_CLOSE_L,
|
|
||||||
ANIM_VAN_GETOUT_L,
|
|
||||||
ANIM_VAN_OPEN,
|
|
||||||
ANIM_VAN_GETIN,
|
|
||||||
ANIM_VAN_CLOSE,
|
|
||||||
ANIM_VAN_GETOUT,
|
|
||||||
ANIM_GETUP1,
|
|
||||||
ANIM_GETUP2,
|
|
||||||
ANIM_GETUP3,
|
|
||||||
ANIM_GETUP_FRONT,
|
|
||||||
ANIM_JUMP_LAUNCH,
|
|
||||||
ANIM_JUMP_GLIDE,
|
|
||||||
ANIM_JUMP_LAND,
|
|
||||||
ANIM_FALL_FALL,
|
|
||||||
ANIM_FALL_GLIDE,
|
|
||||||
ANIM_FALL_LAND,
|
|
||||||
ANIM_FALL_COLLAPSE,
|
|
||||||
ANIM_EV_STEP,
|
|
||||||
ANIM_EV_DIVE,
|
|
||||||
ANIM_XPRESS_SCRATCH,
|
|
||||||
ANIM_ROAD_CROSS,
|
|
||||||
ANIM_TURN_180,
|
|
||||||
ANIM_ARREST_GUN,
|
|
||||||
ANIM_DROWN,
|
|
||||||
ANIM_CPR,
|
|
||||||
ANIM_DUCK_DOWN,
|
|
||||||
ANIM_DUCK_LOW,
|
|
||||||
ANIM_RBLOCK_CSHOOT,
|
|
||||||
ANIM_WEAPON_THROWU2,
|
|
||||||
ANIM_HANDSUP,
|
|
||||||
ANIM_HANDSCOWER,
|
|
||||||
ANIM_FUCKU,
|
|
||||||
ANIM_PHONE_IN,
|
|
||||||
ANIM_PHONE_OUT,
|
|
||||||
ANIM_PHONE_TALK,
|
|
||||||
|
|
||||||
NUM_ANIMS
|
|
||||||
};
|
|
||||||
|
|
||||||
class CAnimBlendAssociation;
|
class CAnimBlendAssociation;
|
||||||
class CAnimBlendAssocGroup;
|
class CAnimBlendAssocGroup;
|
||||||
|
|
||||||
|
180
src/animation/AnimationId.h
Normal file
180
src/animation/AnimationId.h
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum AnimationId
|
||||||
|
{
|
||||||
|
ANIM_WALK,
|
||||||
|
ANIM_RUN,
|
||||||
|
ANIM_SPRINT,
|
||||||
|
ANIM_IDLE_STANCE,
|
||||||
|
ANIM_WALK_START,
|
||||||
|
ANIM_RUN_STOP,
|
||||||
|
ANIM_RUN_STOP_R,
|
||||||
|
ANIM_IDLE_CAM,
|
||||||
|
ANIM_IDLE_HBHB,
|
||||||
|
ANIM_IDLE_TIRED,
|
||||||
|
ANIM_IDLE_ARMED,
|
||||||
|
ANIM_IDLE_CHAT,
|
||||||
|
ANIM_IDLE_TAXI,
|
||||||
|
ANIM_KO_SHOT_FRONT1,
|
||||||
|
ANIM_KO_SHOT_FRONT2,
|
||||||
|
ANIM_KO_SHOT_FRONT3,
|
||||||
|
ANIM_KO_SHOT_FRONT4,
|
||||||
|
ANIM_KO_SHOT_FACE,
|
||||||
|
ANIM_KO_SHOT_STOM,
|
||||||
|
ANIM_KO_SHOT_ARML,
|
||||||
|
ANIM_KO_SHOT_ARMR,
|
||||||
|
ANIM_KO_SHOT_LEGL,
|
||||||
|
ANIM_KO_SHOT_LEGR,
|
||||||
|
ANIM_KD_LEFT,
|
||||||
|
ANIM_KD_RIGHT,
|
||||||
|
ANIM_KO_SKID_FRONT,
|
||||||
|
ANIM_KO_SPIN_R, // named left in VC
|
||||||
|
ANIM_KO_SKID_BACK,
|
||||||
|
ANIM_KO_SPIN_L, // named right in VC
|
||||||
|
ANIM_SHOT_FRONT_PARTIAL,
|
||||||
|
ANIM_SHOT_LEFT_PARTIAL,
|
||||||
|
ANIM_SHOT_BACK_PARTIAL,
|
||||||
|
ANIM_SHOT_RIGHT_PARTIAL,
|
||||||
|
ANIM_HIT_FRONT,
|
||||||
|
ANIM_HIT_LEFT,
|
||||||
|
ANIM_HIT_BACK,
|
||||||
|
ANIM_HIT_RIGHT,
|
||||||
|
ANIM_FLOOR_HIT,
|
||||||
|
ANIM_HIT_BODYBLOW,
|
||||||
|
ANIM_HIT_CHEST,
|
||||||
|
ANIM_HIT_HEAD,
|
||||||
|
ANIM_HIT_WALK,
|
||||||
|
ANIM_HIT_WALL,
|
||||||
|
ANIM_FLOOR_HIT_F,
|
||||||
|
ANIM_HIT_BEHIND,
|
||||||
|
ANIM_PUNCH_R,
|
||||||
|
ANIM_KICK_FLOOR,
|
||||||
|
ANIM_WEAPON_BAT_H,
|
||||||
|
ANIM_WEAPON_BAT_V,
|
||||||
|
ANIM_WEAPON_HGUN_BODY,
|
||||||
|
ANIM_WEAPON_AK_BODY,
|
||||||
|
ANIM_WEAPON_PUMP,
|
||||||
|
ANIM_WEAPON_SNIPER,
|
||||||
|
ANIM_WEAPON_THROW,
|
||||||
|
ANIM_WEAPON_THROWU,
|
||||||
|
ANIM_WEAPON_START_THROW,
|
||||||
|
ANIM_BOMBER,
|
||||||
|
ANIM_HGUN_RELOAD,
|
||||||
|
ANIM_AK_RELOAD,
|
||||||
|
ANIM_FPS_PUNCH,
|
||||||
|
ANIM_FPS_BAT,
|
||||||
|
ANIM_FPS_UZI,
|
||||||
|
ANIM_FPS_PUMP,
|
||||||
|
ANIM_FPS_AK,
|
||||||
|
ANIM_FPS_M16,
|
||||||
|
ANIM_FPS_ROCKET,
|
||||||
|
ANIM_FIGHT_IDLE,
|
||||||
|
ANIM_FIGHT2_IDLE,
|
||||||
|
ANIM_FIGHT_SH_F,
|
||||||
|
ANIM_FIGHT_BODYBLOW,
|
||||||
|
ANIM_FIGHT_HEAD,
|
||||||
|
ANIM_FIGHT_KICK,
|
||||||
|
ANIM_FIGHT_KNEE,
|
||||||
|
ANIM_FIGHT_LHOOK,
|
||||||
|
ANIM_FIGHT_PUNCH,
|
||||||
|
ANIM_FIGHT_ROUNDHOUSE,
|
||||||
|
ANIM_FIGHT_LONGKICK,
|
||||||
|
ANIM_FIGHT_PPUNCH,
|
||||||
|
ANIM_CAR_JACKED_RHS,
|
||||||
|
ANIM_CAR_LJACKED_RHS,
|
||||||
|
ANIM_CAR_JACKED_LHS,
|
||||||
|
ANIM_CAR_LJACKED_LHS,
|
||||||
|
ANIM_CAR_QJACK,
|
||||||
|
ANIM_CAR_QJACKED,
|
||||||
|
ANIM_CAR_ALIGN_LHS,
|
||||||
|
ANIM_CAR_ALIGNHI_LHS,
|
||||||
|
ANIM_CAR_OPEN_LHS,
|
||||||
|
ANIM_CAR_DOORLOCKED_LHS,
|
||||||
|
ANIM_CAR_PULLOUT_LHS,
|
||||||
|
ANIM_CAR_PULLOUT_LOW_LHS,
|
||||||
|
ANIM_CAR_GETIN_LHS,
|
||||||
|
ANIM_CAR_GETIN_LOW_LHS,
|
||||||
|
ANIM_CAR_CLOSEDOOR_LHS,
|
||||||
|
ANIM_CAR_CLOSEDOOR_LOW_LHS,
|
||||||
|
ANIM_CAR_ROLLDOOR,
|
||||||
|
ANIM_CAR_ROLLDOOR_LOW,
|
||||||
|
ANIM_CAR_GETOUT_LHS,
|
||||||
|
ANIM_CAR_GETOUT_LOW_LHS,
|
||||||
|
ANIM_CAR_CLOSE_LHS,
|
||||||
|
ANIM_CAR_ALIGN_RHS,
|
||||||
|
ANIM_CAR_ALIGNHI_RHS,
|
||||||
|
ANIM_CAR_OPEN_RHS,
|
||||||
|
ANIM_CAR_DOORLOCKED_RHS,
|
||||||
|
ANIM_CAR_PULLOUT_RHS,
|
||||||
|
ANIM_CAR_PULLOUT_LOW_RHS,
|
||||||
|
ANIM_CAR_GETIN_RHS,
|
||||||
|
ANIM_CAR_GETIN_LOW_RHS,
|
||||||
|
ANIM_CAR_CLOSEDOOR_RHS,
|
||||||
|
ANIM_CAR_CLOSEDOOR_LOW_RHS,
|
||||||
|
ANIM_CAR_SHUFFLE_RHS,
|
||||||
|
ANIM_CAR_LSHUFFLE_RHS,
|
||||||
|
ANIM_CAR_SIT,
|
||||||
|
ANIM_CAR_LSIT,
|
||||||
|
ANIM_CAR_SITP,
|
||||||
|
ANIM_CAR_SITPLO,
|
||||||
|
ANIM_DRIVE_L,
|
||||||
|
ANIM_DRIVE_R,
|
||||||
|
ANIM_DRIVE_LOW_L,
|
||||||
|
ANIM_DRIVE_LOW_R,
|
||||||
|
ANIM_DRIVEBY_L,
|
||||||
|
ANIM_DRIVEBY_R,
|
||||||
|
ANIM_CAR_LB,
|
||||||
|
ANIM_DRIVE_BOAT,
|
||||||
|
ANIM_CAR_GETOUT_RHS,
|
||||||
|
ANIM_CAR_GETOUT_LOW_RHS,
|
||||||
|
ANIM_CAR_CLOSE_RHS,
|
||||||
|
ANIM_CAR_HOOKERTALK,
|
||||||
|
ANIM_COACH_OPEN_L,
|
||||||
|
ANIM_COACH_OPEN_R,
|
||||||
|
ANIM_COACH_IN_L,
|
||||||
|
ANIM_COACH_IN_R,
|
||||||
|
ANIM_COACH_OUT_L,
|
||||||
|
ANIM_TRAIN_GETIN,
|
||||||
|
ANIM_TRAIN_GETOUT,
|
||||||
|
ANIM_CAR_CRAWLOUT_RHS,
|
||||||
|
ANIM_CAR_CRAWLOUT_RHS2,
|
||||||
|
ANIM_VAN_OPEN_L,
|
||||||
|
ANIM_VAN_GETIN_L,
|
||||||
|
ANIM_VAN_CLOSE_L,
|
||||||
|
ANIM_VAN_GETOUT_L,
|
||||||
|
ANIM_VAN_OPEN,
|
||||||
|
ANIM_VAN_GETIN,
|
||||||
|
ANIM_VAN_CLOSE,
|
||||||
|
ANIM_VAN_GETOUT,
|
||||||
|
ANIM_GETUP1,
|
||||||
|
ANIM_GETUP2,
|
||||||
|
ANIM_GETUP3,
|
||||||
|
ANIM_GETUP_FRONT,
|
||||||
|
ANIM_JUMP_LAUNCH,
|
||||||
|
ANIM_JUMP_GLIDE,
|
||||||
|
ANIM_JUMP_LAND,
|
||||||
|
ANIM_FALL_FALL,
|
||||||
|
ANIM_FALL_GLIDE,
|
||||||
|
ANIM_FALL_LAND,
|
||||||
|
ANIM_FALL_COLLAPSE,
|
||||||
|
ANIM_EV_STEP,
|
||||||
|
ANIM_EV_DIVE,
|
||||||
|
ANIM_XPRESS_SCRATCH,
|
||||||
|
ANIM_ROAD_CROSS,
|
||||||
|
ANIM_TURN_180,
|
||||||
|
ANIM_ARREST_GUN,
|
||||||
|
ANIM_DROWN,
|
||||||
|
ANIM_CPR,
|
||||||
|
ANIM_DUCK_DOWN,
|
||||||
|
ANIM_DUCK_LOW,
|
||||||
|
ANIM_RBLOCK_CSHOOT,
|
||||||
|
ANIM_WEAPON_THROWU2,
|
||||||
|
ANIM_HANDSUP,
|
||||||
|
ANIM_HANDSCOWER,
|
||||||
|
ANIM_FUCKU,
|
||||||
|
ANIM_PHONE_IN,
|
||||||
|
ANIM_PHONE_OUT,
|
||||||
|
ANIM_PHONE_TALK,
|
||||||
|
|
||||||
|
NUM_ANIMS
|
||||||
|
};
|
@ -226,7 +226,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
|
|||||||
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio = 0.25f * ratio;
|
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio = 0.25f * ratio;
|
||||||
if(s1 == SURFACE_METAL6 && ratio < 0.6f) {
|
if(s1 == SURFACE_METAL6 && ratio < 0.6f) {
|
||||||
s1 = SURFACE_BILLBOARD;
|
s1 = SURFACE_BILLBOARD;
|
||||||
ratio = min(1.f, 2.f * ratio);
|
ratio = Min(1.f, 2.f * ratio);
|
||||||
}
|
}
|
||||||
emittingVol = 40.f * ratio;
|
emittingVol = 40.f * ratio;
|
||||||
if(emittingVol) {
|
if(emittingVol) {
|
||||||
|
@ -635,9 +635,9 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
|
|||||||
float speedOfSource = (dist / m_bTimeSpent) * speedMultiplier;
|
float speedOfSource = (dist / m_bTimeSpent) * speedMultiplier;
|
||||||
if(m_fSpeedOfSound > Abs(speedOfSource)) {
|
if(m_fSpeedOfSound > Abs(speedOfSource)) {
|
||||||
if(speedOfSource < 0.0f) {
|
if(speedOfSource < 0.0f) {
|
||||||
speedOfSource = max(speedOfSource, -1.5f);
|
speedOfSource = Max(speedOfSource, -1.5f);
|
||||||
} else {
|
} else {
|
||||||
speedOfSource = min(speedOfSource, 1.5f);
|
speedOfSource = Min(speedOfSource, 1.5f);
|
||||||
}
|
}
|
||||||
newFreq =
|
newFreq =
|
||||||
(oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound);
|
(oldFreq * m_fSpeedOfSound) / (speedOfSource + m_fSpeedOfSound);
|
||||||
@ -650,10 +650,10 @@ cAudioManager::ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1,
|
|||||||
int32
|
int32
|
||||||
cAudioManager::ComputePan(float dist, CVector *vec)
|
cAudioManager::ComputePan(float dist, CVector *vec)
|
||||||
{
|
{
|
||||||
int32 index = min(63, Abs(vec->x / (dist / 64.f)));
|
int32 index = Min(63, Abs(vec->x / (dist / 64.f)));
|
||||||
|
|
||||||
if(vec->x > 0.f) return max(20, 63 - panTable[index]);
|
if(vec->x > 0.f) return Max(20, 63 - panTable[index]);
|
||||||
return min(107, panTable[index] + 63);
|
return Min(107, panTable[index] + 63);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8
|
uint8
|
||||||
@ -2894,7 +2894,7 @@ cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobil
|
|||||||
relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f;
|
relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f;
|
||||||
|
|
||||||
} else if(wheelState == WHEEL_STATE_SKIDDING) {
|
} else if(wheelState == WHEEL_STATE_SKIDDING) {
|
||||||
relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
|
relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
|
||||||
} else if(wheelState == WHEEL_STATE_FIXED) {
|
} else if(wheelState == WHEEL_STATE_FIXED) {
|
||||||
modificator = 0.4f;
|
modificator = 0.4f;
|
||||||
relativeVelChange = gasPedalAudio;
|
relativeVelChange = gasPedalAudio;
|
||||||
@ -2905,7 +2905,7 @@ cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobil
|
|||||||
velChange = Abs(velocityChange);
|
velChange = Abs(velocityChange);
|
||||||
if(relativeVelChange > 0.4f) relativeVelChange = relativeVelChange * modificator;
|
if(relativeVelChange > 0.4f) relativeVelChange = relativeVelChange * modificator;
|
||||||
if(velChange > 0.04f) {
|
if(velChange > 0.04f) {
|
||||||
relativeVel = min(1.0f, velChange / transmission->fMaxVelocity);
|
relativeVel = Min(1.0f, velChange / transmission->fMaxVelocity);
|
||||||
} else {
|
} else {
|
||||||
relativeVel = 0.0f;
|
relativeVel = 0.0f;
|
||||||
}
|
}
|
||||||
@ -2914,7 +2914,7 @@ cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobil
|
|||||||
relativeVelChange = 0.0f;
|
relativeVelChange = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return max(relativeVelChange, min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
|
return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
@ -2924,12 +2924,12 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automo
|
|||||||
float relativeVelChange;
|
float relativeVelChange;
|
||||||
|
|
||||||
if(automobile->m_aWheelState[wheel] == 2) {
|
if(automobile->m_aWheelState[wheel] == 2) {
|
||||||
relativeVelChange = min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
|
relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity);
|
||||||
} else {
|
} else {
|
||||||
relativeVelChange = 0.0f;
|
relativeVelChange = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return max(relativeVelChange, min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
|
return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -3326,7 +3326,7 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
if(field_4) {
|
if(field_4) {
|
||||||
emittingVol =
|
emittingVol =
|
||||||
2 *
|
2 *
|
||||||
min(63,
|
Min(63,
|
||||||
sample.m_bEmittingVolume);
|
sample.m_bEmittingVolume);
|
||||||
} else {
|
} else {
|
||||||
emittingVol =
|
emittingVol =
|
||||||
@ -3353,13 +3353,13 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
if(sample.m_nFrequency <=
|
if(sample.m_nFrequency <=
|
||||||
m_asActiveSamples[j]
|
m_asActiveSamples[j]
|
||||||
.m_nFrequency) {
|
.m_nFrequency) {
|
||||||
freq = max(
|
freq = Max(
|
||||||
sample.m_nFrequency,
|
sample.m_nFrequency,
|
||||||
m_asActiveSamples[j]
|
m_asActiveSamples[j]
|
||||||
.m_nFrequency -
|
.m_nFrequency -
|
||||||
6000);
|
6000);
|
||||||
} else {
|
} else {
|
||||||
freq = min(
|
freq = Min(
|
||||||
sample.m_nFrequency,
|
sample.m_nFrequency,
|
||||||
m_asActiveSamples[j]
|
m_asActiveSamples[j]
|
||||||
.m_nFrequency +
|
.m_nFrequency +
|
||||||
@ -3376,14 +3376,14 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
if(sample.m_bEmittingVolume <=
|
if(sample.m_bEmittingVolume <=
|
||||||
m_asActiveSamples[j]
|
m_asActiveSamples[j]
|
||||||
.m_bEmittingVolume) {
|
.m_bEmittingVolume) {
|
||||||
vol = max(
|
vol = Max(
|
||||||
m_asActiveSamples[j]
|
m_asActiveSamples[j]
|
||||||
.m_bEmittingVolume -
|
.m_bEmittingVolume -
|
||||||
10,
|
10,
|
||||||
sample
|
sample
|
||||||
.m_bEmittingVolume);
|
.m_bEmittingVolume);
|
||||||
} else {
|
} else {
|
||||||
vol = min(
|
vol = Min(
|
||||||
m_asActiveSamples[j]
|
m_asActiveSamples[j]
|
||||||
.m_bEmittingVolume +
|
.m_bEmittingVolume +
|
||||||
10,
|
10,
|
||||||
@ -3394,7 +3394,7 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
uint8 emittingVol;
|
uint8 emittingVol;
|
||||||
if(field_4) {
|
if(field_4) {
|
||||||
emittingVol =
|
emittingVol =
|
||||||
2 * min(63, vol);
|
2 * Min(63, vol);
|
||||||
} else {
|
} else {
|
||||||
emittingVol = vol;
|
emittingVol = vol;
|
||||||
}
|
}
|
||||||
@ -3461,7 +3461,7 @@ cAudioManager::ProcessActiveQueues()
|
|||||||
&position);
|
&position);
|
||||||
if(field_4) {
|
if(field_4) {
|
||||||
emittingVol =
|
emittingVol =
|
||||||
2 * min(63, m_asActiveSamples[j]
|
2 * Min(63, m_asActiveSamples[j]
|
||||||
.m_bEmittingVolume);
|
.m_bEmittingVolume);
|
||||||
} else {
|
} else {
|
||||||
emittingVol =
|
emittingVol =
|
||||||
@ -3783,7 +3783,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams *params)
|
|||||||
velocityChange = Abs(params->m_fVelocityChange);
|
velocityChange = Abs(params->m_fVelocityChange);
|
||||||
if(velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) return true;
|
if(velocityChange <= 0.0005f && params->m_pVehicle->GetPosition().y) return true;
|
||||||
|
|
||||||
velocityChange = min(0.75f, velocityChange);
|
velocityChange = Min(0.75f, velocityChange);
|
||||||
multiplier = (velocityChange - 0.0005f) * 1.3342f;
|
multiplier = (velocityChange - 0.0005f) * 1.3342f;
|
||||||
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
||||||
vol = (30.f * multiplier);
|
vol = (30.f * multiplier);
|
||||||
@ -5044,7 +5044,7 @@ void
|
|||||||
cAudioManager::ProcessJumboDecel(CPlane *plane)
|
cAudioManager::ProcessJumboDecel(CPlane *plane)
|
||||||
{
|
{
|
||||||
if(SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) {
|
if(SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) {
|
||||||
const float modificator = min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f);
|
const float modificator = Min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f);
|
||||||
SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000);
|
SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000);
|
||||||
SetupJumboWhineSound(18, 29500);
|
SetupJumboWhineSound(18, 29500);
|
||||||
}
|
}
|
||||||
@ -7259,7 +7259,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
|
|||||||
CurrentPretendGear = 1;
|
CurrentPretendGear = 1;
|
||||||
}
|
}
|
||||||
if(CReplay::IsPlayingBack()) {
|
if(CReplay::IsPlayingBack()) {
|
||||||
accelerateState = 255.f * max(0.0f, min(1.0f, automobile->m_fGasPedal));
|
accelerateState = 255.f * Max(0.0f, Min(1.0f, automobile->m_fGasPedal));
|
||||||
} else {
|
} else {
|
||||||
accelerateState = Pads->GetAccelerate();
|
accelerateState = Pads->GetAccelerate();
|
||||||
}
|
}
|
||||||
@ -7268,7 +7268,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
|
|||||||
velocityChange = params->m_fVelocityChange;
|
velocityChange = params->m_fVelocityChange;
|
||||||
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
|
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
|
||||||
|
|
||||||
accelerationMultipler = min(min(1.f, relativeVelocityChange), 0.f);
|
accelerationMultipler = Min(Min(1.f, relativeVelocityChange), 0.f);
|
||||||
gasPedalAudio = accelerationMultipler;
|
gasPedalAudio = accelerationMultipler;
|
||||||
currentGear = params->m_pVehicle->m_nCurrentGear;
|
currentGear = params->m_pVehicle->m_nCurrentGear;
|
||||||
|
|
||||||
@ -7290,9 +7290,9 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
|
|||||||
if(0.0f != velocityChange) {
|
if(0.0f != velocityChange) {
|
||||||
time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange;
|
time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange;
|
||||||
if(time <= 0.0f) {
|
if(time <= 0.0f) {
|
||||||
freqModifier = max(-0.2f, time) * -15000.f;
|
freqModifier = Max(-0.2f, time) * -15000.f;
|
||||||
} else {
|
} else {
|
||||||
freqModifier = -(min(0.2f, time) * 15000.f);
|
freqModifier = -(Min(0.2f, time) * 15000.f);
|
||||||
}
|
}
|
||||||
if(params->m_fVelocityChange < -0.001f) freqModifier = -freqModifier;
|
if(params->m_fVelocityChange < -0.001f) freqModifier = -freqModifier;
|
||||||
} else {
|
} else {
|
||||||
@ -7311,10 +7311,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
|
|||||||
gasPedalAudio = automobile->m_fGasPedalAudio;
|
gasPedalAudio = automobile->m_fGasPedalAudio;
|
||||||
} else {
|
} else {
|
||||||
gasPedalAudio =
|
gasPedalAudio =
|
||||||
min(1.0f, params->m_fVelocityChange /
|
Min(1.0f, params->m_fVelocityChange /
|
||||||
params->m_pTransmission->fMaxReverseVelocity);
|
params->m_pTransmission->fMaxReverseVelocity);
|
||||||
}
|
}
|
||||||
gasPedalAudio = max(0.0f, gasPedalAudio);
|
gasPedalAudio = Max(0.0f, gasPedalAudio);
|
||||||
automobile->m_fGasPedalAudio = gasPedalAudio;
|
automobile->m_fGasPedalAudio = gasPedalAudio;
|
||||||
} else if(LastAccel > 0) {
|
} else if(LastAccel > 0) {
|
||||||
if(channelUsed) {
|
if(channelUsed) {
|
||||||
@ -7343,7 +7343,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
|
|||||||
AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq,
|
AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq,
|
||||||
(engineSoundType + SFX_CAR_REV_10), 0, 52, 1);
|
(engineSoundType + SFX_CAR_REV_10), 0, 52, 1);
|
||||||
|
|
||||||
CurrentPretendGear = max(1, currentGear);
|
CurrentPretendGear = Max(1, currentGear);
|
||||||
LastAccel = accelerateState;
|
LastAccel = accelerateState;
|
||||||
|
|
||||||
bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
|
bHandbrakeOnLastFrame = automobile->bIsHandbrakeOn;
|
||||||
@ -8005,7 +8005,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
|
|||||||
if(params->m_fVelocityChange > 0.0f) {
|
if(params->m_fVelocityChange > 0.0f) {
|
||||||
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
|
||||||
train = (CTrain *)params->m_pVehicle;
|
train = (CTrain *)params->m_pVehicle;
|
||||||
speedMultipler = min(1.0f, train->m_fSpeed * 250.f / 51.f);
|
speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
|
||||||
emittingVol = (75.f * speedMultipler);
|
emittingVol = (75.f * speedMultipler);
|
||||||
if(train->m_fWagonPosition == 0.0f) {
|
if(train->m_fWagonPosition == 0.0f) {
|
||||||
m_sQueueSample.m_bVolume =
|
m_sQueueSample.m_bVolume =
|
||||||
@ -8176,7 +8176,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
|
|||||||
if(automobile->Damage.GetDoorStatus(i) == 2) {
|
if(automobile->Damage.GetDoorStatus(i) == 2) {
|
||||||
doorState = automobile->Doors[i].m_nDoorState;
|
doorState = automobile->Doors[i].m_nDoorState;
|
||||||
if(doorState == 1 || doorState == 2) {
|
if(doorState == 1 || doorState == 2) {
|
||||||
velocity = min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
|
velocity = Min(0.3f, Abs(automobile->Doors[i].m_fAngVel));
|
||||||
if(velocity > 0.0035f) {
|
if(velocity > 0.0035f) {
|
||||||
emittingVol = (100.f * velocity * 10.f / 3.f);
|
emittingVol = (100.f * velocity * 10.f / 3.f);
|
||||||
m_sQueueSample.m_bVolume = ComputeVolume(
|
m_sQueueSample.m_bVolume = ComputeVolume(
|
||||||
@ -8599,7 +8599,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams *params)
|
|||||||
m_sQueueSample.m_fSoundIntensity = 30.0f;
|
m_sQueueSample.m_fSoundIntensity = 30.0f;
|
||||||
break;
|
break;
|
||||||
case SOUND_CAR_JUMP:
|
case SOUND_CAR_JUMP:
|
||||||
emittingVol = max(
|
emittingVol = Max(
|
||||||
80.f,
|
80.f,
|
||||||
2 * (100.f *
|
2 * (100.f *
|
||||||
m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]));
|
m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]));
|
||||||
@ -9081,7 +9081,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
|
|||||||
params->m_fDistance);
|
params->m_fDistance);
|
||||||
emittingVol =
|
emittingVol =
|
||||||
30.f *
|
30.f *
|
||||||
min(1.f,
|
Min(1.f,
|
||||||
velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
|
velocity / (0.5f * params->m_pTransmission->fMaxVelocity));
|
||||||
m_sQueueSample.m_bVolume =
|
m_sQueueSample.m_bVolume =
|
||||||
ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance);
|
ComputeVolume(emittingVol, 95.f, m_sQueueSample.m_fDistance);
|
||||||
@ -9397,7 +9397,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
|
|||||||
CalculateDistance(params->m_bDistanceCalculated,
|
CalculateDistance(params->m_bDistanceCalculated,
|
||||||
params->m_fDistance);
|
params->m_fDistance);
|
||||||
relativeVelocity =
|
relativeVelocity =
|
||||||
min(1.0f,
|
Min(1.0f,
|
||||||
velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
|
velChange / (0.5f * params->m_pTransmission->fMaxVelocity));
|
||||||
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
|
emittingVol = 23.0f * relativeVelocity * CWeather::WetRoads;
|
||||||
m_sQueueSample.m_bVolume =
|
m_sQueueSample.m_bVolume =
|
||||||
@ -10035,7 +10035,7 @@ cAudioManager::UpdateReflections()
|
|||||||
if(CWorld::ProcessVerticalLine(
|
if(CWorld::ProcessVerticalLine(
|
||||||
camPos, m_avecReflectionsPos[4].z, colpoint,
|
camPos, m_avecReflectionsPos[4].z, colpoint,
|
||||||
ent, true, false, false, false, true, false,
|
ent, true, false, false, false, true, false,
|
||||||
false)) {
|
nil)) {
|
||||||
m_afReflectionsDistances[4] =
|
m_afReflectionsDistances[4] =
|
||||||
colpoint.point.z - camPos.z;
|
colpoint.point.z - camPos.z;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "audio_enums.h"
|
#include "audio_enums.h"
|
||||||
|
#include "Crime.h"
|
||||||
|
|
||||||
enum eSound : int16
|
enum eSound : int16
|
||||||
{
|
{
|
||||||
@ -179,7 +180,6 @@ enum eSound : int16
|
|||||||
|
|
||||||
class cAudioScriptObject;
|
class cAudioScriptObject;
|
||||||
class CEntity;
|
class CEntity;
|
||||||
enum eCrimeType;
|
|
||||||
|
|
||||||
class cDMAudio
|
class cDMAudio
|
||||||
{
|
{
|
||||||
|
@ -705,7 +705,7 @@ cMusicManager::GetTrackStartPos(uint8 track)
|
|||||||
result = m_aTracks[track].m_nPosition;
|
result = m_aTracks[track].m_nPosition;
|
||||||
m_aTracks[track].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
m_aTracks[track].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
|
||||||
} else
|
} else
|
||||||
result = min(CTimer::GetTimeInMillisecondsPauseMode() - timer, 90000) + m_aTracks[track].m_nPosition;
|
result = Min(CTimer::GetTimeInMillisecondsPauseMode() - timer, 90000) + m_aTracks[track].m_nPosition;
|
||||||
|
|
||||||
if (result > m_aTracks[track].m_nLength) result %= m_aTracks[track].m_nLength;
|
if (result > m_aTracks[track].m_nLength) result %= m_aTracks[track].m_nLength;
|
||||||
return result;
|
return result;
|
||||||
|
@ -1986,50 +1986,59 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
|||||||
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
|
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
|
||||||
{
|
{
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
|
do {
|
||||||
if ( !_bIsMp3Active ) goto FIND_MP3TRACK;
|
if(i != 0 || _bIsMp3Active) {
|
||||||
|
if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0;
|
||||||
do
|
|
||||||
{
|
_CurMP3Pos = 0;
|
||||||
if ( ++_CurMP3Index >= nNumMP3s )
|
|
||||||
_CurMP3Index = 0;
|
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
|
||||||
|
|
||||||
_CurMP3Pos = 0;
|
if(mp3) {
|
||||||
|
mp3 = _pMP3List;
|
||||||
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
|
if(mp3 == NULL) {
|
||||||
|
_bIsMp3Active = false;
|
||||||
if ( mp3 )
|
nFile = 0;
|
||||||
{
|
strcpy(filename, m_szCDRomRootPath);
|
||||||
mp3 = _pMP3List;
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
if ( mp3 == NULL )
|
|
||||||
{
|
mp3Stream[nStream] =
|
||||||
_bIsMp3Active = false;
|
AIL_open_stream(DIG, filename, 0);
|
||||||
nFile = 0;
|
if(mp3Stream[nStream]) {
|
||||||
goto PLAY_STREAMEDTRACK;
|
AIL_set_stream_loop_count(
|
||||||
|
mp3Stream[nStream], 1);
|
||||||
|
AIL_set_stream_ms_position(
|
||||||
|
mp3Stream[nStream], position);
|
||||||
|
AIL_pause_stream(mp3Stream[nStream],
|
||||||
|
0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mp3->pLinkPath != NULL)
|
||||||
|
mp3Stream[nStream] =
|
||||||
|
AIL_open_stream(DIG, mp3->pLinkPath, 0);
|
||||||
|
else {
|
||||||
|
strcpy(filename, _mp3DirectoryPath);
|
||||||
|
strcat(filename, mp3->aFilename);
|
||||||
|
|
||||||
|
mp3Stream[nStream] =
|
||||||
|
AIL_open_stream(DIG, filename, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mp3Stream[nStream]) {
|
||||||
|
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
|
||||||
|
AIL_set_stream_ms_position(mp3Stream[nStream], 0);
|
||||||
|
AIL_pause_stream(mp3Stream[nStream], 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_bIsMp3Active = false;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mp3->pLinkPath != NULL )
|
|
||||||
mp3Stream[nStream] = AIL_open_stream(DIG, mp3->pLinkPath, 0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy(filename, _mp3DirectoryPath);
|
|
||||||
strcat(filename, mp3->aFilename);
|
|
||||||
|
|
||||||
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mp3Stream[nStream] )
|
|
||||||
{
|
|
||||||
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
|
|
||||||
AIL_set_stream_ms_position(mp3Stream[nStream], 0);
|
|
||||||
AIL_pause_stream(mp3Stream[nStream], 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto NEXT_MP3TRACK;
|
|
||||||
|
|
||||||
FIND_MP3TRACK:
|
|
||||||
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
|
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|
||||||
@ -2039,10 +2048,23 @@ FIND_MP3TRACK:
|
|||||||
if ( e == NULL )
|
if ( e == NULL )
|
||||||
{
|
{
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
goto PLAY_STREAMEDTRACK;
|
strcpy(filename, m_szCDRomRootPath);
|
||||||
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
|
mp3Stream[nStream] =
|
||||||
|
AIL_open_stream(DIG, filename, 0);
|
||||||
|
if(mp3Stream[nStream]) {
|
||||||
|
AIL_set_stream_loop_count(
|
||||||
|
mp3Stream[nStream], 1);
|
||||||
|
AIL_set_stream_ms_position(
|
||||||
|
mp3Stream[nStream], position);
|
||||||
|
AIL_pause_stream(mp3Stream[nStream], 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e->pLinkPath != NULL )
|
if ( e->pLinkPath != NULL )
|
||||||
mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0);
|
mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0);
|
||||||
else
|
else
|
||||||
@ -2064,17 +2086,14 @@ FIND_MP3TRACK:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NEXT_MP3TRACK:
|
|
||||||
_bIsMp3Active = false;
|
_bIsMp3Active = false;
|
||||||
|
|
||||||
} while ( ++i < nNumMP3s );
|
} while(++i < nNumMP3s);
|
||||||
|
|
||||||
position = 0;
|
position = 0;
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
goto PLAY_STREAMEDTRACK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAY_STREAMEDTRACK:
|
|
||||||
strcpy(filename, m_szCDRomRootPath);
|
strcpy(filename, m_szCDRomRootPath);
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
void CAutoPilot::ModifySpeed(float speed)
|
void CAutoPilot::ModifySpeed(float speed)
|
||||||
{
|
{
|
||||||
m_fMaxTrafficSpeed = max(0.01f, speed);
|
m_fMaxTrafficSpeed = Max(0.01f, speed);
|
||||||
float positionBetweenNodes = (float)(CTimer::GetTimeInMilliseconds() - m_nTimeEnteredCurve) / m_nTimeToSpendOnCurrentCurve;
|
float positionBetweenNodes = (float)(CTimer::GetTimeInMilliseconds() - m_nTimeEnteredCurve) / m_nTimeToSpendOnCurrentCurve;
|
||||||
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo];
|
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo];
|
||||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[m_nNextPathNodeInfo];
|
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[m_nNextPathNodeInfo];
|
||||||
|
@ -374,7 +374,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 750;
|
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 750;
|
||||||
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
if (pVehicle->VehicleCreatedBy == RANDOM_VEHICLE)
|
if (pVehicle->VehicleCreatedBy == RANDOM_VEHICLE)
|
||||||
pVehicle->AutoPilot.m_nDrivingStyle = max(DRIVINGSTYLE_AVOID_CARS, pVehicle->AutoPilot.m_nDrivingStyle);
|
pVehicle->AutoPilot.m_nDrivingStyle = Max(DRIVINGSTYLE_AVOID_CARS, pVehicle->AutoPilot.m_nDrivingStyle);
|
||||||
pVehicle->PlayCarHorn();
|
pVehicle->PlayCarHorn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ void CCarAI::TellCarToRamOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
|||||||
pTarget->RegisterReference((CEntity**)&pVehicle->AutoPilot.m_pTargetCar);
|
pTarget->RegisterReference((CEntity**)&pVehicle->AutoPilot.m_pTargetCar);
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_RAMCAR_FARAWAY;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_RAMCAR_FARAWAY;
|
||||||
pVehicle->bEngineOn = true;
|
pVehicle->bEngineOn = true;
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
|
pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
||||||
@ -519,7 +519,7 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
|||||||
pTarget->RegisterReference((CEntity**)&pVehicle->AutoPilot.m_pTargetCar);
|
pTarget->RegisterReference((CEntity**)&pVehicle->AutoPilot.m_pTargetCar);
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKCAR_FARAWAY;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKCAR_FARAWAY;
|
||||||
pVehicle->bEngineOn = true;
|
pVehicle->bEngineOn = true;
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
|
pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
|
||||||
}
|
}
|
||||||
eCarMission CCarAI::FindPoliceCarMissionForWantedLevel()
|
eCarMission CCarAI::FindPoliceCarMissionForWantedLevel()
|
||||||
{
|
{
|
||||||
|
@ -362,7 +362,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||||||
if (distanceBetweenNodes / 2 < carLength)
|
if (distanceBetweenNodes / 2 < carLength)
|
||||||
positionBetweenNodes = 0.5f;
|
positionBetweenNodes = 0.5f;
|
||||||
else
|
else
|
||||||
positionBetweenNodes = min(1.0f - carLength / distanceBetweenNodes, max(carLength / distanceBetweenNodes, positionBetweenNodes));
|
positionBetweenNodes = Min(1.0f - carLength / distanceBetweenNodes, Max(carLength / distanceBetweenNodes, positionBetweenNodes));
|
||||||
pCar->AutoPilot.m_nNextDirection = (curNodeId >= nextNodeId) ? 1 : -1;
|
pCar->AutoPilot.m_nNextDirection = (curNodeId >= nextNodeId) ? 1 : -1;
|
||||||
if (pCurNode->numLinks == 1){
|
if (pCurNode->numLinks == 1){
|
||||||
/* Do not create vehicle if there is nowhere to go. */
|
/* Do not create vehicle if there is nowhere to go. */
|
||||||
@ -804,10 +804,10 @@ CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
|
|||||||
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
|
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||||
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
|
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
|
||||||
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
|
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||||
int xstart = max(0, CWorld::GetSectorIndexX(left));
|
int xstart = Max(0, CWorld::GetSectorIndexX(left));
|
||||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||||
int ystart = max(0, CWorld::GetSectorIndexY(top));
|
int ystart = Max(0, CWorld::GetSectorIndexY(top));
|
||||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||||
assert(xstart <= xend);
|
assert(xstart <= xend);
|
||||||
assert(ystart <= yend);
|
assert(ystart <= yend);
|
||||||
|
|
||||||
@ -838,10 +838,10 @@ CCarCtrl::ScanForPedDanger(CVehicle* pVehicle)
|
|||||||
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
|
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||||
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
|
float top = pVehicle->GetPosition().y - DISTANCE_TO_SCAN_FOR_DANGER;
|
||||||
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
|
float bottom = pVehicle->GetPosition().y + DISTANCE_TO_SCAN_FOR_DANGER;
|
||||||
int xstart = max(0, CWorld::GetSectorIndexX(left));
|
int xstart = Max(0, CWorld::GetSectorIndexX(left));
|
||||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||||
int ystart = max(0, CWorld::GetSectorIndexY(top));
|
int ystart = Max(0, CWorld::GetSectorIndexY(top));
|
||||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||||
assert(xstart <= xend);
|
assert(xstart <= xend);
|
||||||
assert(ystart <= yend);
|
assert(ystart <= yend);
|
||||||
|
|
||||||
@ -873,12 +873,12 @@ CCarCtrl::SlowCarOnRailsDownForTrafficAndLights(CVehicle* pVehicle)
|
|||||||
float curSpeed = pVehicle->AutoPilot.m_fMaxTrafficSpeed;
|
float curSpeed = pVehicle->AutoPilot.m_fMaxTrafficSpeed;
|
||||||
if (maxSpeed >= curSpeed){
|
if (maxSpeed >= curSpeed){
|
||||||
if (maxSpeed > curSpeed)
|
if (maxSpeed > curSpeed)
|
||||||
pVehicle->AutoPilot.ModifySpeed(min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
|
pVehicle->AutoPilot.ModifySpeed(Min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
|
||||||
}else if (curSpeed != 0.0f) {
|
}else if (curSpeed != 0.0f) {
|
||||||
if (curSpeed < 0.1f)
|
if (curSpeed < 0.1f)
|
||||||
pVehicle->AutoPilot.ModifySpeed(0.0f);
|
pVehicle->AutoPilot.ModifySpeed(0.0f);
|
||||||
else
|
else
|
||||||
pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
|
pVehicle->AutoPilot.ModifySpeed(Max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,7 +979,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
|
|||||||
if (distanceUntilHit < 10.0f){
|
if (distanceUntilHit < 10.0f){
|
||||||
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS ||
|
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS ||
|
||||||
pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_SLOW_DOWN_FOR_CARS){
|
pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_SLOW_DOWN_FOR_CARS){
|
||||||
*pSpeed = min(*pSpeed, ABS(distanceUntilHit - 1.0f) * 0.1f * curSpeed);
|
*pSpeed = Min(*pSpeed, ABS(distanceUntilHit - 1.0f) * 0.1f * curSpeed);
|
||||||
pVehicle->AutoPilot.m_bSlowedDownBecauseOfPeds = true;
|
pVehicle->AutoPilot.m_bSlowedDownBecauseOfPeds = true;
|
||||||
if (distanceUntilHit < 2.0f){
|
if (distanceUntilHit < 2.0f){
|
||||||
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
|
||||||
@ -1028,11 +1028,11 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle,
|
|||||||
float projectionY = speedOtherY - forwardA.y * curSpeed;
|
float projectionY = speedOtherY - forwardA.y * curSpeed;
|
||||||
float proximityA = TestCollisionBetween2MovingRects(pOtherVehicle, pVehicle, projectionX, projectionY, &forwardA, &forwardB, 0);
|
float proximityA = TestCollisionBetween2MovingRects(pOtherVehicle, pVehicle, projectionX, projectionY, &forwardA, &forwardB, 0);
|
||||||
float proximityB = TestCollisionBetween2MovingRects(pVehicle, pOtherVehicle, -projectionX, -projectionY, &forwardB, &forwardA, 1);
|
float proximityB = TestCollisionBetween2MovingRects(pVehicle, pOtherVehicle, -projectionX, -projectionY, &forwardB, &forwardA, 1);
|
||||||
float minProximity = min(proximityA, proximityB);
|
float minProximity = Min(proximityA, proximityB);
|
||||||
if (minProximity >= 0.0f && minProximity < 1.0f){
|
if (minProximity >= 0.0f && minProximity < 1.0f){
|
||||||
minProximity = max(0.0f, (minProximity - 0.2f) * 1.25f);
|
minProximity = Max(0.0f, (minProximity - 0.2f) * 1.25f);
|
||||||
pVehicle->AutoPilot.m_bSlowedDownBecauseOfCars = true;
|
pVehicle->AutoPilot.m_bSlowedDownBecauseOfCars = true;
|
||||||
*pSpeed = min(*pSpeed, minProximity * curSpeed);
|
*pSpeed = Min(*pSpeed, minProximity * curSpeed);
|
||||||
}
|
}
|
||||||
if (minProximity >= 0.0f && minProximity < 0.5f && pOtherEntity->IsVehicle() &&
|
if (minProximity >= 0.0f && minProximity < 0.5f && pOtherEntity->IsVehicle() &&
|
||||||
CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission > 15000 &&
|
CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission > 15000 &&
|
||||||
@ -1041,7 +1041,7 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle,
|
|||||||
if (pOtherEntity != FindPlayerVehicle() &&
|
if (pOtherEntity != FindPlayerVehicle() &&
|
||||||
DotProduct2D(pVehicle->GetForward(), pOtherVehicle->GetForward()) < 0.5f &&
|
DotProduct2D(pVehicle->GetForward(), pOtherVehicle->GetForward()) < 0.5f &&
|
||||||
pVehicle < pOtherVehicle){ /* that comparasion though... */
|
pVehicle < pOtherVehicle){ /* that comparasion though... */
|
||||||
*pSpeed = max(curSpeed / 5, *pSpeed);
|
*pSpeed = Max(curSpeed / 5, *pSpeed);
|
||||||
if (pVehicle->m_status == STATUS_SIMPLE){
|
if (pVehicle->m_status == STATUS_SIMPLE){
|
||||||
pVehicle->m_status = STATUS_PHYSICS;
|
pVehicle->m_status = STATUS_PHYSICS;
|
||||||
SwitchVehicleToRealPhysics(pVehicle);
|
SwitchVehicleToRealPhysics(pVehicle);
|
||||||
@ -1097,7 +1097,7 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
|
|||||||
float proximityWidth = -(widthDistance - widthB) / widthProjection;
|
float proximityWidth = -(widthDistance - widthB) / widthProjection;
|
||||||
if (proximityWidth < 1.0f){
|
if (proximityWidth < 1.0f){
|
||||||
baseWidthProximity = proximityWidth;
|
baseWidthProximity = proximityWidth;
|
||||||
fullWidthProximity = min(1.0f, proximityWidth - fullWidthB / widthProjection);
|
fullWidthProximity = Min(1.0f, proximityWidth - fullWidthB / widthProjection);
|
||||||
}else{
|
}else{
|
||||||
baseWidthProximity = 1.0f;
|
baseWidthProximity = 1.0f;
|
||||||
}
|
}
|
||||||
@ -1110,7 +1110,7 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
|
|||||||
float proximityWidth = -(widthDistance + widthB) / widthProjection;
|
float proximityWidth = -(widthDistance + widthB) / widthProjection;
|
||||||
if (proximityWidth < 1.0f) {
|
if (proximityWidth < 1.0f) {
|
||||||
baseWidthProximity = proximityWidth;
|
baseWidthProximity = proximityWidth;
|
||||||
fullWidthProximity = min(1.0f, proximityWidth + fullWidthB / widthProjection);
|
fullWidthProximity = Min(1.0f, proximityWidth + fullWidthB / widthProjection);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
baseWidthProximity = 1.0f;
|
baseWidthProximity = 1.0f;
|
||||||
@ -1135,7 +1135,7 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
|
|||||||
float proximityLength = -(lenDistance - lenB) / lenProjection;
|
float proximityLength = -(lenDistance - lenB) / lenProjection;
|
||||||
if (proximityLength < 1.0f) {
|
if (proximityLength < 1.0f) {
|
||||||
baseLengthProximity = proximityLength;
|
baseLengthProximity = proximityLength;
|
||||||
fullLengthProximity = min(1.0f, proximityLength - fullLenB / lenProjection);
|
fullLengthProximity = Min(1.0f, proximityLength - fullLenB / lenProjection);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
baseLengthProximity = 1.0f;
|
baseLengthProximity = 1.0f;
|
||||||
@ -1151,7 +1151,7 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
|
|||||||
float proximityLength = -(lenDistance + backLenB) / lenProjection;
|
float proximityLength = -(lenDistance + backLenB) / lenProjection;
|
||||||
if (proximityLength < 1.0f) {
|
if (proximityLength < 1.0f) {
|
||||||
baseLengthProximity = proximityLength;
|
baseLengthProximity = proximityLength;
|
||||||
fullLengthProximity = min(1.0f, proximityLength + fullLenB / lenProjection);
|
fullLengthProximity = Min(1.0f, proximityLength + fullLenB / lenProjection);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
baseLengthProximity = 1.0f;
|
baseLengthProximity = 1.0f;
|
||||||
@ -1168,24 +1168,24 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
|
|||||||
else if (lenProjection < 0.0f) {
|
else if (lenProjection < 0.0f) {
|
||||||
fullLengthProximity = -(backLenB + lenDistance) / lenProjection;
|
fullLengthProximity = -(backLenB + lenDistance) / lenProjection;
|
||||||
}
|
}
|
||||||
float baseProximity = max(baseWidthProximity, baseLengthProximity);
|
float baseProximity = Max(baseWidthProximity, baseLengthProximity);
|
||||||
if (baseProximity < fullWidthProximity && baseProximity < fullLengthProximity)
|
if (baseProximity < fullWidthProximity && baseProximity < fullLengthProximity)
|
||||||
proximity = min(proximity, baseProximity);
|
proximity = Min(proximity, baseProximity);
|
||||||
}
|
}
|
||||||
return proximity;
|
return proximity;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCarCtrl::FindAngleToWeaveThroughTraffic(CVehicle* pVehicle, CPhysical* pTarget, float angleToTarget, float angleForward)
|
float CCarCtrl::FindAngleToWeaveThroughTraffic(CVehicle* pVehicle, CPhysical* pTarget, float angleToTarget, float angleForward)
|
||||||
{
|
{
|
||||||
float distanceToTest = min(2.0f, pVehicle->GetMoveSpeed().Magnitude2D() * 2.5f + 1.0f) * 12.0f;
|
float distanceToTest = Min(2.0f, pVehicle->GetMoveSpeed().Magnitude2D() * 2.5f + 1.0f) * 12.0f;
|
||||||
float left = pVehicle->GetPosition().x - distanceToTest;
|
float left = pVehicle->GetPosition().x - distanceToTest;
|
||||||
float right = pVehicle->GetPosition().x + distanceToTest;
|
float right = pVehicle->GetPosition().x + distanceToTest;
|
||||||
float top = pVehicle->GetPosition().y - distanceToTest;
|
float top = pVehicle->GetPosition().y - distanceToTest;
|
||||||
float bottom = pVehicle->GetPosition().y + distanceToTest;
|
float bottom = pVehicle->GetPosition().y + distanceToTest;
|
||||||
int xstart = max(0, CWorld::GetSectorIndexX(left));
|
int xstart = Max(0, CWorld::GetSectorIndexX(left));
|
||||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(right));
|
||||||
int ystart = max(0, CWorld::GetSectorIndexY(top));
|
int ystart = Max(0, CWorld::GetSectorIndexY(top));
|
||||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(bottom));
|
||||||
assert(xstart <= xend);
|
assert(xstart <= xend);
|
||||||
assert(ystart <= yend);
|
assert(ystart <= yend);
|
||||||
|
|
||||||
@ -1566,8 +1566,8 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
|||||||
pVehicle->AutoPilot.m_nNextLane -= 1;
|
pVehicle->AutoPilot.m_nNextLane -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pVehicle->AutoPilot.m_nNextLane = min(lanesOnNextNode - 1, pVehicle->AutoPilot.m_nNextLane);
|
pVehicle->AutoPilot.m_nNextLane = Min(lanesOnNextNode - 1, pVehicle->AutoPilot.m_nNextLane);
|
||||||
pVehicle->AutoPilot.m_nNextLane = max(0, pVehicle->AutoPilot.m_nNextLane);
|
pVehicle->AutoPilot.m_nNextLane = Max(0, pVehicle->AutoPilot.m_nNextLane);
|
||||||
}else{
|
}else{
|
||||||
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane;
|
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane;
|
||||||
}
|
}
|
||||||
@ -1595,7 +1595,7 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
|||||||
if (pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve < 10)
|
if (pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve < 10)
|
||||||
/* Oh hey there Obbe */
|
/* Oh hey there Obbe */
|
||||||
printf("fout\n");
|
printf("fout\n");
|
||||||
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = max(10, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve);
|
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = Max(10, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 CCarCtrl::FindPathDirection(int32 prevNode, int32 curNode, int32 nextNode)
|
uint8 CCarCtrl::FindPathDirection(int32 prevNode, int32 curNode, int32 nextNode)
|
||||||
@ -1746,8 +1746,8 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
|||||||
pVehicle->AutoPilot.m_nNextLane -= 1;
|
pVehicle->AutoPilot.m_nNextLane -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pVehicle->AutoPilot.m_nNextLane = min(lanesOnNextNode - 1, pVehicle->AutoPilot.m_nNextLane);
|
pVehicle->AutoPilot.m_nNextLane = Min(lanesOnNextNode - 1, pVehicle->AutoPilot.m_nNextLane);
|
||||||
pVehicle->AutoPilot.m_nNextLane = max(0, pVehicle->AutoPilot.m_nNextLane);
|
pVehicle->AutoPilot.m_nNextLane = Max(0, pVehicle->AutoPilot.m_nNextLane);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane;
|
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane;
|
||||||
@ -1773,7 +1773,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
|||||||
directionCurrentLinkX, directionCurrentLinkY,
|
directionCurrentLinkX, directionCurrentLinkY,
|
||||||
directionNextLinkX, directionNextLinkY
|
directionNextLinkX, directionNextLinkY
|
||||||
) * (1000.0f / pVehicle->AutoPilot.m_fMaxTrafficSpeed);
|
) * (1000.0f / pVehicle->AutoPilot.m_fMaxTrafficSpeed);
|
||||||
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = max(10, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve);
|
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = Max(10, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
||||||
@ -1826,8 +1826,8 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
|||||||
else
|
else
|
||||||
pVehicle->AutoPilot.m_nNextLane -= 1;
|
pVehicle->AutoPilot.m_nNextLane -= 1;
|
||||||
}
|
}
|
||||||
pVehicle->AutoPilot.m_nNextLane = min(lanesOnNextNode - 1, pVehicle->AutoPilot.m_nNextLane);
|
pVehicle->AutoPilot.m_nNextLane = Min(lanesOnNextNode - 1, pVehicle->AutoPilot.m_nNextLane);
|
||||||
pVehicle->AutoPilot.m_nNextLane = max(0, pVehicle->AutoPilot.m_nNextLane);
|
pVehicle->AutoPilot.m_nNextLane = Max(0, pVehicle->AutoPilot.m_nNextLane);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane;
|
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane;
|
||||||
@ -1853,7 +1853,7 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
|||||||
directionCurrentLinkX, directionCurrentLinkY,
|
directionCurrentLinkX, directionCurrentLinkY,
|
||||||
directionNextLinkX, directionNextLinkY
|
directionNextLinkX, directionNextLinkY
|
||||||
) * (1000.0f / pVehicle->AutoPilot.m_fMaxTrafficSpeed);
|
) * (1000.0f / pVehicle->AutoPilot.m_fMaxTrafficSpeed);
|
||||||
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = max(10, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve);
|
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = Max(10, pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1965,7 +1965,7 @@ float CCarCtrl::FindSpeedMultiplier(float angleChange, float minAngle, float max
|
|||||||
{
|
{
|
||||||
float angle = Abs(LimitRadianAngle(angleChange));
|
float angle = Abs(LimitRadianAngle(angleChange));
|
||||||
float n = angle - minAngle;
|
float n = angle - minAngle;
|
||||||
n = max(0.0f, n);
|
n = Max(0.0f, n);
|
||||||
float d = maxAngle - minAngle;
|
float d = maxAngle - minAngle;
|
||||||
float mult = 1.0f - n / d * (1.0f - coef);
|
float mult = 1.0f - n / d * (1.0f - coef);
|
||||||
if (n > d)
|
if (n > d)
|
||||||
@ -2252,9 +2252,9 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
|||||||
angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward);
|
angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward);
|
||||||
float steerAngle = LimitRadianAngle(angleCurrentLink - angleForward);
|
float steerAngle = LimitRadianAngle(angleCurrentLink - angleForward);
|
||||||
float maxAngle = FindMaxSteerAngle(pVehicle);
|
float maxAngle = FindMaxSteerAngle(pVehicle);
|
||||||
steerAngle = min(maxAngle, max(-maxAngle, steerAngle));
|
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
|
||||||
if (pVehicle->GetMoveSpeed().Magnitude() > MIN_SPEED_TO_START_LIMITING_STEER)
|
if (pVehicle->GetMoveSpeed().Magnitude() > MIN_SPEED_TO_START_LIMITING_STEER)
|
||||||
steerAngle = min(MAX_ANGLE_TO_STEER_AT_HIGH_SPEED, max(-MAX_ANGLE_TO_STEER_AT_HIGH_SPEED, steerAngle));
|
steerAngle = Min(MAX_ANGLE_TO_STEER_AT_HIGH_SPEED, Max(-MAX_ANGLE_TO_STEER_AT_HIGH_SPEED, steerAngle));
|
||||||
float currentForwardSpeed = DotProduct(pVehicle->GetMoveSpeed(), pVehicle->GetForward()) * GAME_SPEED_TO_CARAI_SPEED;
|
float currentForwardSpeed = DotProduct(pVehicle->GetMoveSpeed(), pVehicle->GetForward()) * GAME_SPEED_TO_CARAI_SPEED;
|
||||||
float speedStyleMultiplier;
|
float speedStyleMultiplier;
|
||||||
switch (pVehicle->AutoPilot.m_nDrivingStyle) {
|
switch (pVehicle->AutoPilot.m_nDrivingStyle) {
|
||||||
@ -2298,21 +2298,21 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
|||||||
speedNodesMultiplier = 1.0f -
|
speedNodesMultiplier = 1.0f -
|
||||||
(1.0f - scalarDistanceToNextNode / DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN) *
|
(1.0f - scalarDistanceToNextNode / DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN) *
|
||||||
(1.0f - tmpWideMultiplier);
|
(1.0f - tmpWideMultiplier);
|
||||||
float speedMultiplier = min(speedStyleMultiplier, min(speedAngleMultiplier, speedNodesMultiplier));
|
float speedMultiplier = Min(speedStyleMultiplier, Min(speedAngleMultiplier, speedNodesMultiplier));
|
||||||
float speed = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
float speed = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
||||||
float speedDifference = speed - currentForwardSpeed;
|
float speedDifference = speed - currentForwardSpeed;
|
||||||
if (speed < 0.05f && speedDifference < 0.03f){
|
if (speed < 0.05f && speedDifference < 0.03f){
|
||||||
*pBrake = 1.0f;
|
*pBrake = 1.0f;
|
||||||
*pAccel = 0.0f;
|
*pAccel = 0.0f;
|
||||||
}else if (speedDifference <= 0.0f){
|
}else if (speedDifference <= 0.0f){
|
||||||
*pBrake = min(0.5f, -speedDifference * 0.05f);
|
*pBrake = Min(0.5f, -speedDifference * 0.05f);
|
||||||
*pAccel = 0.0f;
|
*pAccel = 0.0f;
|
||||||
}else if (currentForwardSpeed < 2.0f){
|
}else if (currentForwardSpeed < 2.0f){
|
||||||
*pBrake = 0.0f;
|
*pBrake = 0.0f;
|
||||||
*pAccel = min(1.0f, speedDifference * 0.25f);
|
*pAccel = Min(1.0f, speedDifference * 0.25f);
|
||||||
}else{
|
}else{
|
||||||
*pBrake = 0.0f;
|
*pBrake = 0.0f;
|
||||||
*pAccel = min(1.0f, speedDifference * 0.125f);
|
*pAccel = Min(1.0f, speedDifference * 0.125f);
|
||||||
}
|
}
|
||||||
*pSwerve = steerAngle;
|
*pSwerve = steerAngle;
|
||||||
*pHandbrake = false;
|
*pHandbrake = false;
|
||||||
@ -2332,7 +2332,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
|
|||||||
if (ABS(steerAngle) > MIN_ANGLE_TO_APPLY_HANDBRAKE)
|
if (ABS(steerAngle) > MIN_ANGLE_TO_APPLY_HANDBRAKE)
|
||||||
*pHandbrake = true;
|
*pHandbrake = true;
|
||||||
float maxAngle = FindMaxSteerAngle(pVehicle);
|
float maxAngle = FindMaxSteerAngle(pVehicle);
|
||||||
steerAngle = min(maxAngle, max(-maxAngle, steerAngle));
|
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
|
||||||
float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
|
float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
|
||||||
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||||
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
||||||
@ -2340,9 +2340,9 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
|
|||||||
float speedDiff = speedTarget - currentSpeed;
|
float speedDiff = speedTarget - currentSpeed;
|
||||||
if (speedDiff <= 0.0f){
|
if (speedDiff <= 0.0f){
|
||||||
*pAccel = 0.0f;
|
*pAccel = 0.0f;
|
||||||
*pBrake = min(0.5f, -speedDiff * 0.05f);
|
*pBrake = Min(0.5f, -speedDiff * 0.05f);
|
||||||
}else if (currentSpeed < 25.0f){
|
}else if (currentSpeed < 25.0f){
|
||||||
*pAccel = min(1.0f, speedDiff * 0.1f);
|
*pAccel = Min(1.0f, speedDiff * 0.1f);
|
||||||
*pBrake = 0.0f;
|
*pBrake = 0.0f;
|
||||||
}else{
|
}else{
|
||||||
*pAccel = 1.0f;
|
*pAccel = 1.0f;
|
||||||
@ -2414,7 +2414,7 @@ void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CBoat* pBoat, float target
|
|||||||
float angleToTarget = CGeneral::GetATanOfXY(distanceToTarget.x, distanceToTarget.y);
|
float angleToTarget = CGeneral::GetATanOfXY(distanceToTarget.x, distanceToTarget.y);
|
||||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||||
float angleDiff = LimitRadianAngle(angleToTarget - angleForward);
|
float angleDiff = LimitRadianAngle(angleToTarget - angleForward);
|
||||||
angleDiff = min(DEFAULT_MAX_STEER_ANGLE, max(-DEFAULT_MAX_STEER_ANGLE, angleDiff));
|
angleDiff = Min(DEFAULT_MAX_STEER_ANGLE, Max(-DEFAULT_MAX_STEER_ANGLE, angleDiff));
|
||||||
float currentSpeed = pBoat->GetMoveSpeed().Magnitude2D(); // +0.0f for some reason
|
float currentSpeed = pBoat->GetMoveSpeed().Magnitude2D(); // +0.0f for some reason
|
||||||
float speedDiff = pBoat->AutoPilot.m_nCruiseSpeed - currentSpeed * 60.0f;
|
float speedDiff = pBoat->AutoPilot.m_nCruiseSpeed - currentSpeed * 60.0f;
|
||||||
if (speedDiff > 0.0f){
|
if (speedDiff > 0.0f){
|
||||||
|
@ -284,7 +284,7 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode
|
|||||||
|
|
||||||
if (FindPlayerVehicle()) {
|
if (FindPlayerVehicle()) {
|
||||||
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
player->m_currentWeapon = player->m_nSelectedWepSlot;
|
||||||
player->GetWeapon()->m_nAmmoInClip = min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
|
player->GetWeapon()->m_nAmmoInClip = Min(player->GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(player->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
|
||||||
player->ClearWeaponTarget();
|
player->ClearWeaponTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
|
#include "WeaponType.h"
|
||||||
|
|
||||||
class CVehicle;
|
class CVehicle;
|
||||||
class CPed;
|
class CPed;
|
||||||
enum eWeaponType;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ CGameLogic::Update()
|
|||||||
if (pPlayerInfo.m_bGetOutOfHospitalFree) {
|
if (pPlayerInfo.m_bGetOutOfHospitalFree) {
|
||||||
pPlayerInfo.m_bGetOutOfHospitalFree = false;
|
pPlayerInfo.m_bGetOutOfHospitalFree = false;
|
||||||
} else {
|
} else {
|
||||||
pPlayerInfo.m_nMoney = max(0, pPlayerInfo.m_nMoney - 1000);
|
pPlayerInfo.m_nMoney = Max(0, pPlayerInfo.m_nMoney - 1000);
|
||||||
pPlayerInfo.m_pPed->ClearWeapons();
|
pPlayerInfo.m_pPed->ClearWeapons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ CGameLogic::Update()
|
|||||||
if (pPlayerInfo.m_bGetOutOfJailFree) {
|
if (pPlayerInfo.m_bGetOutOfJailFree) {
|
||||||
pPlayerInfo.m_bGetOutOfJailFree = false;
|
pPlayerInfo.m_bGetOutOfJailFree = false;
|
||||||
} else {
|
} else {
|
||||||
pPlayerInfo.m_nMoney = max(0, pPlayerInfo.m_nMoney - takeMoney);
|
pPlayerInfo.m_nMoney = Max(0, pPlayerInfo.m_nMoney - takeMoney);
|
||||||
pPlayerInfo.m_pPed->ClearWeapons();
|
pPlayerInfo.m_pPed->ClearWeapons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,12 +206,12 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float Z
|
|||||||
return NumGarages++;
|
return NumGarages++;
|
||||||
}
|
}
|
||||||
CGarage* pGarage = &aGarages[NumGarages];
|
CGarage* pGarage = &aGarages[NumGarages];
|
||||||
pGarage->m_fX1 = min(X1, X2);
|
pGarage->m_fX1 = Min(X1, X2);
|
||||||
pGarage->m_fX2 = max(X1, X2);
|
pGarage->m_fX2 = Max(X1, X2);
|
||||||
pGarage->m_fY1 = min(Y1, Y2);
|
pGarage->m_fY1 = Min(Y1, Y2);
|
||||||
pGarage->m_fY2 = max(Y1, Y2);
|
pGarage->m_fY2 = Max(Y1, Y2);
|
||||||
pGarage->m_fZ1 = min(Z1, Z2);
|
pGarage->m_fZ1 = Min(Z1, Z2);
|
||||||
pGarage->m_fZ2 = max(Z1, Z2);
|
pGarage->m_fZ2 = Max(Z1, Z2);
|
||||||
pGarage->m_pDoor1 = nil;
|
pGarage->m_pDoor1 = nil;
|
||||||
pGarage->m_pDoor2 = nil;
|
pGarage->m_pDoor2 = nil;
|
||||||
pGarage->m_fDoor1Z = Z1;
|
pGarage->m_fDoor1Z = Z1;
|
||||||
@ -361,7 +361,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_RESPRAY;
|
m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_RESPRAY;
|
||||||
@ -440,7 +440,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
if (bTakeMoney) {
|
if (bTakeMoney) {
|
||||||
if (!CGarages::RespraysAreFree)
|
if (!CGarages::RespraysAreFree)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - RESPRAY_PRICE);
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - RESPRAY_PRICE);
|
||||||
CGarages::TriggerMessage("GA_2", -1, 4000, -1); // New engine and paint job. The cops won't recognize you!
|
CGarages::TriggerMessage("GA_2", -1, 4000, -1); // New engine and paint job. The cops won't recognize you!
|
||||||
}
|
}
|
||||||
else if (bChangedColour) {
|
else if (bChangedColour) {
|
||||||
@ -458,7 +458,7 @@ void CGarage::Update()
|
|||||||
m_fY2 + DISTANCE_TO_CALL_OFF_CHASE);
|
m_fY2 + DISTANCE_TO_CALL_OFF_CHASE);
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -503,7 +503,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_SETUP_BOMB;
|
m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_SETUP_BOMB;
|
||||||
@ -520,7 +520,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
m_eGarageState = GS_OPENING;
|
m_eGarageState = GS_OPENING;
|
||||||
if (!CGarages::BombsAreFree)
|
if (!CGarages::BombsAreFree)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - BOMB_PRICE);
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - BOMB_PRICE);
|
||||||
if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar()) {
|
if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar()) {
|
||||||
((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
|
((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType);
|
||||||
((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
|
((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
|
||||||
@ -562,7 +562,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -597,7 +597,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
if (m_bClosingWithoutTargetCar)
|
if (m_bClosingWithoutTargetCar)
|
||||||
@ -626,7 +626,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -663,7 +663,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
@ -710,7 +710,7 @@ void CGarage::Update()
|
|||||||
m_pTarget = FindPlayerVehicle();
|
m_pTarget = FindPlayerVehicle();
|
||||||
m_pTarget->RegisterReference((CEntity**)&m_pTarget);
|
m_pTarget->RegisterReference((CEntity**)&m_pTarget);
|
||||||
}
|
}
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -759,7 +759,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
@ -799,7 +799,7 @@ void CGarage::Update()
|
|||||||
m_pTarget = FindPlayerVehicle();
|
m_pTarget = FindPlayerVehicle();
|
||||||
m_pTarget->RegisterReference((CEntity**)&m_pTarget);
|
m_pTarget->RegisterReference((CEntity**)&m_pTarget);
|
||||||
}
|
}
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -820,7 +820,7 @@ void CGarage::Update()
|
|||||||
m_eGarageState = GS_CLOSING;
|
m_eGarageState = GS_CLOSING;
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
@ -831,7 +831,7 @@ void CGarage::Update()
|
|||||||
case GS_FULLYCLOSED:
|
case GS_FULLYCLOSED:
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -865,7 +865,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
if (m_pTarget) {
|
if (m_pTarget) {
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - CRUSHER_CRANE_SPEED * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - CRUSHER_CRANE_SPEED * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos < TWOPI / 5) {
|
if (m_fDoorPos < TWOPI / 5) {
|
||||||
m_pTarget->bUsesCollision = false;
|
m_pTarget->bUsesCollision = false;
|
||||||
m_pTarget->bAffectedByGravity = false;
|
m_pTarget->bAffectedByGravity = false;
|
||||||
@ -876,7 +876,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
CGarages::CrushedCarId = CPools::GetVehiclePool()->GetIndex(m_pTarget);
|
CGarages::CrushedCarId = CPools::GetVehiclePool()->GetIndex(m_pTarget);
|
||||||
float reward = min(CRUSHER_MAX_REWARD, CRUSHER_MIN_REWARD + m_pTarget->pHandling->nMonetaryValue * m_pTarget->m_fHealth * CRUSHER_REWARD_COEFFICIENT);
|
float reward = Min(CRUSHER_MAX_REWARD, CRUSHER_MIN_REWARD + m_pTarget->pHandling->nMonetaryValue * m_pTarget->m_fHealth * CRUSHER_REWARD_COEFFICIENT);
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += reward;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += reward;
|
||||||
DestroyVehicleAndDriverAndPassengers(m_pTarget);
|
DestroyVehicleAndDriverAndPassengers(m_pTarget);
|
||||||
++CStats::CarsCrushed;
|
++CStats::CarsCrushed;
|
||||||
@ -900,7 +900,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(HALFPI, m_fDoorPos + CTimer::GetTimeStep() * CRUSHER_CRANE_SPEED);
|
m_fDoorPos = Min(HALFPI, m_fDoorPos + CTimer::GetTimeStep() * CRUSHER_CRANE_SPEED);
|
||||||
if (m_fDoorPos == HALFPI) {
|
if (m_fDoorPos == HALFPI) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -933,7 +933,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
if (m_bClosingWithoutTargetCar)
|
if (m_bClosingWithoutTargetCar)
|
||||||
@ -961,7 +961,7 @@ void CGarage::Update()
|
|||||||
m_eGarageState = GS_OPENING;
|
m_eGarageState = GS_OPENING;
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -981,7 +981,7 @@ void CGarage::Update()
|
|||||||
case GARAGE_FOR_SCRIPT_TO_OPEN:
|
case GARAGE_FOR_SCRIPT_TO_OPEN:
|
||||||
switch (m_eGarageState) {
|
switch (m_eGarageState) {
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -1001,7 +1001,7 @@ void CGarage::Update()
|
|||||||
case GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE:
|
case GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE:
|
||||||
switch (m_eGarageState) {
|
switch (m_eGarageState) {
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
@ -1009,7 +1009,7 @@ void CGarage::Update()
|
|||||||
UpdateDoorsHeight();
|
UpdateDoorsHeight();
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -1050,7 +1050,7 @@ void CGarage::Update()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - HIDEOUT_DOOR_SPEED_COEFFICIENT * (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - HIDEOUT_DOOR_SPEED_COEFFICIENT * (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (!IsPlayerOutsideGarage())
|
if (!IsPlayerOutsideGarage())
|
||||||
m_eGarageState = GS_OPENING;
|
m_eGarageState = GS_OPENING;
|
||||||
else if (m_fDoorPos == 0.0f) {
|
else if (m_fDoorPos == 0.0f) {
|
||||||
@ -1096,7 +1096,7 @@ void CGarage::Update()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + HIDEOUT_DOOR_SPEED_COEFFICIENT * (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + HIDEOUT_DOOR_SPEED_COEFFICIENT * (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -1121,7 +1121,7 @@ void CGarage::Update()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GS_CLOSING:
|
case GS_CLOSING:
|
||||||
m_fDoorPos = max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == 0.0f) {
|
if (m_fDoorPos == 0.0f) {
|
||||||
m_eGarageState = GS_FULLYCLOSED;
|
m_eGarageState = GS_FULLYCLOSED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_CLOSED, 1.0f);
|
||||||
@ -1137,7 +1137,7 @@ void CGarage::Update()
|
|||||||
m_eGarageState = GS_OPENING;
|
m_eGarageState = GS_OPENING;
|
||||||
break;
|
break;
|
||||||
case GS_OPENING:
|
case GS_OPENING:
|
||||||
m_fDoorPos = min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep());
|
||||||
if (m_fDoorPos == m_fDoorHeight) {
|
if (m_fDoorPos == m_fDoorHeight) {
|
||||||
m_eGarageState = GS_OPENED;
|
m_eGarageState = GS_OPENED;
|
||||||
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
DMAudio.PlayOneShot(CGarages::AudioEntity, SOUND_GARAGE_DOOR_OPENED, 1.0f);
|
||||||
@ -1695,17 +1695,17 @@ float CGarage::CalcSmallestDistToGarageDoorSquared(float X, float Y)
|
|||||||
dist1 = SQR(m_fDoor1X - X) + SQR(m_fDoor1Y - Y);
|
dist1 = SQR(m_fDoor1X - X) + SQR(m_fDoor1Y - Y);
|
||||||
if (m_pDoor2)
|
if (m_pDoor2)
|
||||||
dist2 = SQR(m_fDoor2X - X) + SQR(m_fDoor2Y - Y);
|
dist2 = SQR(m_fDoor2X - X) + SQR(m_fDoor2Y - Y);
|
||||||
return min(dist1, dist2);
|
return Min(dist1, dist2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGarage::FindDoorsEntities()
|
void CGarage::FindDoorsEntities()
|
||||||
{
|
{
|
||||||
m_pDoor1 = nil;
|
m_pDoor1 = nil;
|
||||||
m_pDoor2 = nil;
|
m_pDoor2 = nil;
|
||||||
int xstart = max(0, CWorld::GetSectorIndexX(m_fX1));
|
int xstart = Max(0, CWorld::GetSectorIndexX(m_fX1));
|
||||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(m_fX2));
|
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(m_fX2));
|
||||||
int ystart = max(0, CWorld::GetSectorIndexY(m_fY1));
|
int ystart = Max(0, CWorld::GetSectorIndexY(m_fY1));
|
||||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(m_fY2));
|
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(m_fY2));
|
||||||
assert(xstart <= xend);
|
assert(xstart <= xend);
|
||||||
assert(ystart <= yend);
|
assert(ystart <= yend);
|
||||||
|
|
||||||
@ -1891,7 +1891,7 @@ void CGarage::StoreAndRemoveCarsForThisHideout(CStoredCar* aCars, int32 nMax)
|
|||||||
pVehicle->GetPosition().y > m_fY1 && pVehicle->GetPosition().y < m_fY2 &&
|
pVehicle->GetPosition().y > m_fY1 && pVehicle->GetPosition().y < m_fY2 &&
|
||||||
pVehicle->GetPosition().z > m_fZ1 && pVehicle->GetPosition().z < m_fZ2) {
|
pVehicle->GetPosition().z > m_fZ1 && pVehicle->GetPosition().z < m_fZ2) {
|
||||||
if (pVehicle->VehicleCreatedBy != MISSION_VEHICLE) {
|
if (pVehicle->VehicleCreatedBy != MISSION_VEHICLE) {
|
||||||
if (index < max(NUM_GARAGE_STORED_CARS, nMax) && !EntityHasASphereWayOutsideGarage(pVehicle, 1.0f))
|
if (index < Max(NUM_GARAGE_STORED_CARS, nMax) && !EntityHasASphereWayOutsideGarage(pVehicle, 1.0f))
|
||||||
aCars[index++].StoreCar(pVehicle);
|
aCars[index++].StoreCar(pVehicle);
|
||||||
CWorld::Players[CWorld::PlayerInFocus].CancelPlayerEnteringCars(pVehicle);
|
CWorld::Players[CWorld::PlayerInFocus].CancelPlayerEnteringCars(pVehicle);
|
||||||
CWorld::Remove(pVehicle);
|
CWorld::Remove(pVehicle);
|
||||||
|
@ -55,10 +55,10 @@ CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVe
|
|||||||
}
|
}
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
if (pathType != ROUTE_NO_BLOCKADE) {
|
if (pathType != ROUTE_NO_BLOCKADE) {
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for (int32 y = nStartY; y <= nEndY; y++) {
|
for (int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for (int32 x = nStartX; x <= nEndX; x++) {
|
for (int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -397,8 +397,8 @@ CPathFind::PreparePathData(void)
|
|||||||
numExtern++;
|
numExtern++;
|
||||||
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
|
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes)
|
||||||
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
|
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
|
||||||
maxX = max(maxX, Abs(InfoForTileCars[k].x));
|
maxX = Max(maxX, Abs(InfoForTileCars[k].x));
|
||||||
maxY = max(maxY, Abs(InfoForTileCars[k].y));
|
maxY = Max(maxY, Abs(InfoForTileCars[k].y));
|
||||||
}else if(InfoForTileCars[k].type == NodeTypeIntern)
|
}else if(InfoForTileCars[k].type == NodeTypeIntern)
|
||||||
numIntern++;
|
numIntern++;
|
||||||
}
|
}
|
||||||
@ -582,7 +582,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||||||
if(Abs(dx) < nearestDist){
|
if(Abs(dx) < nearestDist){
|
||||||
dy = tempnodes[k].pos.y - CoorsXFormed.y;
|
dy = tempnodes[k].pos.y - CoorsXFormed.y;
|
||||||
if(Abs(dy) < nearestDist){
|
if(Abs(dy) < nearestDist){
|
||||||
nearestDist = max(Abs(dx), Abs(dy));
|
nearestDist = Max(Abs(dx), Abs(dy));
|
||||||
nearestId = k;
|
nearestId = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -691,13 +691,13 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
|||||||
|
|
||||||
// Find i inside path segment
|
// Find i inside path segment
|
||||||
iseg = 0;
|
iseg = 0;
|
||||||
for(j = max(oldNumPathNodes, i-12); j < i; j++)
|
for(j = Max(oldNumPathNodes, i-12); j < i; j++)
|
||||||
if(m_pathNodes[j].objectIndex == m_pathNodes[i].objectIndex)
|
if(m_pathNodes[j].objectIndex == m_pathNodes[i].objectIndex)
|
||||||
iseg++;
|
iseg++;
|
||||||
|
|
||||||
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex;
|
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex;
|
||||||
// Add links to other internal nodes
|
// Add links to other internal nodes
|
||||||
for(j = max(oldNumPathNodes, i-12); j < min(m_numPathNodes, i+12); j++){
|
for(j = Max(oldNumPathNodes, i-12); j < Min(m_numPathNodes, i+12); j++){
|
||||||
if(m_pathNodes[i].objectIndex != m_pathNodes[j].objectIndex || i == j)
|
if(m_pathNodes[i].objectIndex != m_pathNodes[j].objectIndex || i == j)
|
||||||
continue;
|
continue;
|
||||||
// N.B.: in every path segment, the externals have to be at the end
|
// N.B.: in every path segment, the externals have to be at the end
|
||||||
@ -1466,8 +1466,11 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
|
|||||||
targetNode = FindNodeClosestToCoors(target, type, distLimit);
|
targetNode = FindNodeClosestToCoors(target, type, distLimit);
|
||||||
else
|
else
|
||||||
targetNode = forcedTargetNode;
|
targetNode = forcedTargetNode;
|
||||||
if(targetNode < 0)
|
if(targetNode < 0) {
|
||||||
goto fail;
|
*pNumNodes = 0;
|
||||||
|
if(pDist) *pDist = 100000.0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find start
|
// Find start
|
||||||
int numPathsToTry;
|
int numPathsToTry;
|
||||||
@ -1486,19 +1489,28 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
|
|||||||
numPathsToTry = 1;
|
numPathsToTry = 1;
|
||||||
startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex];
|
startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex];
|
||||||
}
|
}
|
||||||
if(numPathsToTry == 0)
|
if(numPathsToTry == 0) {
|
||||||
goto fail;
|
*pNumNodes = 0;
|
||||||
|
if(pDist) *pDist = 100000.0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(startNodeId < 0){
|
if(startNodeId < 0){
|
||||||
// why only check node 0?
|
// why only check node 0?
|
||||||
if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != m_pathNodes[targetNode].group)
|
if(m_pathNodes[startObj->m_nodeIndices[type][0]].group !=
|
||||||
goto fail;
|
m_pathNodes[targetNode].group) {
|
||||||
|
*pNumNodes = 0;
|
||||||
|
if(pDist) *pDist = 100000.0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group)
|
if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) {
|
||||||
goto fail;
|
*pNumNodes = 0;
|
||||||
|
if(pDist) *pDist = 100000.0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < 512; i++)
|
for(i = 0; i < 512; i++)
|
||||||
m_searchNodes[i].next = nil;
|
m_searchNodes[i].next = nil;
|
||||||
AddNodeToList(&m_pathNodes[targetNode], 0);
|
AddNodeToList(&m_pathNodes[targetNode], 0);
|
||||||
@ -1576,11 +1588,6 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
|
|||||||
for(i = 0; i < numNodesToBeCleared; i++)
|
for(i = 0; i < numNodesToBeCleared; i++)
|
||||||
apNodesToBeCleared[i]->distance = MAX_DIST;
|
apNodesToBeCleared[i]->distance = MAX_DIST;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
|
||||||
*pNumNodes = 0;
|
|
||||||
if(pDist)
|
|
||||||
*pDist = 100000.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPathNode *pNodeList[32];
|
static CPathNode *pNodeList[32];
|
||||||
|
@ -296,7 +296,7 @@ void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
|
|||||||
case STATE_PLAYBACK:
|
case STATE_PLAYBACK:
|
||||||
{
|
{
|
||||||
TimeMultiplier += CTimer::GetTimeStepNonClippedInSeconds();
|
TimeMultiplier += CTimer::GetTimeStepNonClippedInSeconds();
|
||||||
float EndOfFrameTime = CHASE_SCENE_FRAMES_PER_SECOND * min(CHASE_SCENE_LENGTH_IN_SECONDS, TimeMultiplier);
|
float EndOfFrameTime = CHASE_SCENE_FRAMES_PER_SECOND * Min(CHASE_SCENE_LENGTH_IN_SECONDS, TimeMultiplier);
|
||||||
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
||||||
if (!pBaseMemForCar[i])
|
if (!pBaseMemForCar[i])
|
||||||
continue;
|
continue;
|
||||||
@ -371,7 +371,7 @@ void CRecordDataForChase::RestoreInfoForCar(CAutomobile* pCar, CCarStateEachFram
|
|||||||
else
|
else
|
||||||
pCar->GetModelInfo()->ChooseVehicleColour(pCar->m_currentColour1, pCar->m_currentColour2);
|
pCar->GetModelInfo()->ChooseVehicleColour(pCar->m_currentColour1, pCar->m_currentColour2);
|
||||||
}
|
}
|
||||||
pCar->m_fHealth = min(pCar->m_fHealth, 500.0f);
|
pCar->m_fHealth = Min(pCar->m_fHealth, 500.0f);
|
||||||
if (stop) {
|
if (stop) {
|
||||||
pCar->m_fGasPedal = 0.0f;
|
pCar->m_fGasPedal = 0.0f;
|
||||||
pCar->m_fBrakePedal = 0.0f;
|
pCar->m_fBrakePedal = 0.0f;
|
||||||
|
@ -681,9 +681,9 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
|
|||||||
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
|
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
|
||||||
vp->acceleration = vehicle->m_fGasPedal * 100.0f;
|
vp->acceleration = vehicle->m_fGasPedal * 100.0f;
|
||||||
vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0;
|
vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->Damage.m_panelStatus : 0;
|
||||||
vp->velocityX = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().x)); /* 8000!? */
|
vp->velocityX = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().x)); /* 8000!? */
|
||||||
vp->velocityY = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().y));
|
vp->velocityY = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().y));
|
||||||
vp->velocityZ = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetMoveSpeed().z));
|
vp->velocityZ = 8000.0f * Max(-4.0f, Min(4.0f, vehicle->GetMoveSpeed().z));
|
||||||
vp->mi = vehicle->GetModelIndex();
|
vp->mi = vehicle->GetModelIndex();
|
||||||
vp->primary_color = vehicle->m_currentColour1;
|
vp->primary_color = vehicle->m_currentColour1;
|
||||||
vp->secondary_color = vehicle->m_currentColour2;
|
vp->secondary_color = vehicle->m_currentColour2;
|
||||||
@ -1512,9 +1512,9 @@ void CReplay::ProcessLookAroundCam(void)
|
|||||||
--FramesActiveLookAroundCam;
|
--FramesActiveLookAroundCam;
|
||||||
fBetaAngleLookAroundCam += x_moved;
|
fBetaAngleLookAroundCam += x_moved;
|
||||||
if (CPad::NewMouseControllerState.LMB && CPad::NewMouseControllerState.RMB)
|
if (CPad::NewMouseControllerState.LMB && CPad::NewMouseControllerState.RMB)
|
||||||
fDistanceLookAroundCam = max(3.0f, min(15.0f, fDistanceLookAroundCam + 2.0f * y_moved));
|
fDistanceLookAroundCam = Max(3.0f, Min(15.0f, fDistanceLookAroundCam + 2.0f * y_moved));
|
||||||
else
|
else
|
||||||
fAlphaAngleLookAroundCam = max(0.1f, min(1.5f, fAlphaAngleLookAroundCam + y_moved));
|
fAlphaAngleLookAroundCam = Max(0.1f, Min(1.5f, fAlphaAngleLookAroundCam + y_moved));
|
||||||
CVector camera_pt(
|
CVector camera_pt(
|
||||||
fDistanceLookAroundCam * Sin(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
fDistanceLookAroundCam * Sin(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
||||||
fDistanceLookAroundCam * Cos(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
fDistanceLookAroundCam * Cos(fBetaAngleLookAroundCam) * Cos(fAlphaAngleLookAroundCam),
|
||||||
|
@ -569,7 +569,7 @@ void CSceneEdit::ProcessCommand(void)
|
|||||||
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
||||||
pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS;
|
pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS;
|
||||||
pActors[m_nActor]->m_pMyVehicle->bEngineOn = true;
|
pActors[m_nActor]->m_pMyVehicle->bEngineOn = true;
|
||||||
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
|
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = Max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
|
||||||
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
TheCamera.TakeControl(pActors[m_nActor]->m_pMyVehicle, CCam::MODE_BEHINDCAR, JUMP_CUT, CAMCONTROL_SCRIPT);
|
TheCamera.TakeControl(pActors[m_nActor]->m_pMyVehicle, CCam::MODE_BEHINDCAR, JUMP_CUT, CAMCONTROL_SCRIPT);
|
||||||
}
|
}
|
||||||
@ -847,7 +847,7 @@ void CSceneEdit::PlayBack(void)
|
|||||||
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
||||||
pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS;
|
pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS;
|
||||||
pActors[m_nActor]->m_pMyVehicle->bEngineOn = true;
|
pActors[m_nActor]->m_pMyVehicle->bEngineOn = true;
|
||||||
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
|
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = Max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
|
||||||
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
if (m_nCurrentCommand != MOVIE_GOTO_WAIT)
|
if (m_nCurrentCommand != MOVIE_GOTO_WAIT)
|
||||||
++m_nCurrentMovieCommand;
|
++m_nCurrentMovieCommand;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include "ScriptCommands.h"
|
#include "ScriptCommands.h"
|
||||||
|
|
||||||
|
#include "AnimBlendAssociation.h"
|
||||||
#include "Boat.h"
|
#include "Boat.h"
|
||||||
#include "BulletInfo.h"
|
#include "BulletInfo.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
@ -18,11 +19,12 @@
|
|||||||
#include "Cranes.h"
|
#include "Cranes.h"
|
||||||
#include "Credits.h"
|
#include "Credits.h"
|
||||||
#include "CutsceneMgr.h"
|
#include "CutsceneMgr.h"
|
||||||
#include "Darkel.h"
|
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
|
#include "Darkel.h"
|
||||||
#include "EmergencyPed.h"
|
#include "EmergencyPed.h"
|
||||||
#include "Explosion.h"
|
#include "Explosion.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
|
#include "Fire.h"
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "Gangs.h"
|
#include "Gangs.h"
|
||||||
#include "Garages.h"
|
#include "Garages.h"
|
||||||
@ -31,7 +33,6 @@
|
|||||||
#include "Heli.h"
|
#include "Heli.h"
|
||||||
#include "Hud.h"
|
#include "Hud.h"
|
||||||
#include "Lines.h"
|
#include "Lines.h"
|
||||||
#include "main.h"
|
|
||||||
#include "Messages.h"
|
#include "Messages.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
@ -48,13 +49,12 @@
|
|||||||
#include "Population.h"
|
#include "Population.h"
|
||||||
#include "PowerPoints.h"
|
#include "PowerPoints.h"
|
||||||
#include "ProjectileInfo.h"
|
#include "ProjectileInfo.h"
|
||||||
|
#include "Radar.h"
|
||||||
#include "Record.h"
|
#include "Record.h"
|
||||||
#include "Remote.h"
|
#include "Remote.h"
|
||||||
#include "Restart.h"
|
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
|
#include "Restart.h"
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "AnimBlendAssociation.h"
|
|
||||||
#include "Fire.h"
|
|
||||||
#include "Rubbish.h"
|
#include "Rubbish.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
@ -67,7 +67,7 @@
|
|||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "Radar.h"
|
#include "main.h"
|
||||||
|
|
||||||
#define PICKUP_PLACEMENT_OFFSET 0.5f
|
#define PICKUP_PLACEMENT_OFFSET 0.5f
|
||||||
#define PED_FIND_Z_OFFSET 5.0f
|
#define PED_FIND_Z_OFFSET 5.0f
|
||||||
@ -2010,7 +2010,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
||||||
car->m_status = STATUS_PHYSICS;
|
car->m_status = STATUS_PHYSICS;
|
||||||
car->bEngineOn = true;
|
car->bEngineOn = true;
|
||||||
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
|
car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
|
||||||
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2022,7 +2022,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
CCarCtrl::JoinCarWithRoadSystem(car);
|
CCarCtrl::JoinCarWithRoadSystem(car);
|
||||||
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||||
car->bEngineOn = true;
|
car->bEngineOn = true;
|
||||||
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
|
car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
|
||||||
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2106,7 +2106,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||||
assert(car);
|
assert(car);
|
||||||
car->AutoPilot.m_nCruiseSpeed = min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CAR_DRIVING_STYLE:
|
case COMMAND_SET_CAR_DRIVING_STYLE:
|
||||||
@ -3645,7 +3645,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
pos.x = (infX + supX) / 2;
|
pos.x = (infX + supX) / 2;
|
||||||
pos.y = (infY + supY) / 2;
|
pos.y = (infY + supY) / 2;
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
float radius = max(pos.x - infX, pos.y - infY);
|
float radius = Max(pos.x - infX, pos.y - infY);
|
||||||
pPed->bScriptObjectiveCompleted = false;
|
pPed->bScriptObjectiveCompleted = false;
|
||||||
pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos, radius);
|
pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos, radius);
|
||||||
return 0;
|
return 0;
|
||||||
@ -4151,7 +4151,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
pos.x = (infX + supX) / 2;
|
pos.x = (infX + supX) / 2;
|
||||||
pos.y = (infY + supY) / 2;
|
pos.y = (infY + supY) / 2;
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
float radius = max(pos.x - infX, pos.y - infY);
|
float radius = Max(pos.x - infX, pos.y - infY);
|
||||||
pPed->bScriptObjectiveCompleted = false;
|
pPed->bScriptObjectiveCompleted = false;
|
||||||
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
|
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius);
|
||||||
return 0;
|
return 0;
|
||||||
@ -4947,7 +4947,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||||||
pos.x = (infX + supX) / 2;
|
pos.x = (infX + supX) / 2;
|
||||||
pos.y = (infY + supY) / 2;
|
pos.y = (infY + supY) / 2;
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
float radius = max(pos.x - infX, pos.y - infY);
|
float radius = Max(pos.x - infX, pos.y - infY);
|
||||||
pPed->bScriptObjectiveCompleted = false;
|
pPed->bScriptObjectiveCompleted = false;
|
||||||
pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos, radius);
|
pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos, radius);
|
||||||
return 0;
|
return 0;
|
||||||
@ -5369,7 +5369,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
|
|||||||
pos.x = (infX + supX) / 2;
|
pos.x = (infX + supX) / 2;
|
||||||
pos.y = (infY + supY) / 2;
|
pos.y = (infY + supY) / 2;
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
float radius = max(pos.x - infX, pos.y - infY);
|
float radius = Max(pos.x - infX, pos.y - infY);
|
||||||
pPed->bScriptObjectiveCompleted = false;
|
pPed->bScriptObjectiveCompleted = false;
|
||||||
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
|
pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius);
|
||||||
return 0;
|
return 0;
|
||||||
@ -5606,7 +5606,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE;
|
||||||
pVehicle->m_status = STATUS_PHYSICS;
|
pVehicle->m_status = STATUS_PHYSICS;
|
||||||
pVehicle->bEngineOn = true;
|
pVehicle->bEngineOn = true;
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
|
pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
|
||||||
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5721,7 +5721,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS;
|
pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS;
|
||||||
pBoat->AutoPilot.m_vecDestinationCoors = pos;
|
pBoat->AutoPilot.m_vecDestinationCoors = pos;
|
||||||
pBoat->m_status = STATUS_PHYSICS;
|
pBoat->m_status = STATUS_PHYSICS;
|
||||||
pBoat->AutoPilot.m_nCruiseSpeed = max(6, pBoat->AutoPilot.m_nCruiseSpeed);
|
pBoat->AutoPilot.m_nCruiseSpeed = Max(6, pBoat->AutoPilot.m_nCruiseSpeed);
|
||||||
pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -6306,23 +6306,23 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REGISTER_JUMP_DISTANCE:
|
case COMMAND_REGISTER_JUMP_DISTANCE:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CStats::MaximumJumpDistance = max(CStats::MaximumJumpDistance, *(float*)&ScriptParams[0]);
|
CStats::MaximumJumpDistance = Max(CStats::MaximumJumpDistance, *(float*)&ScriptParams[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REGISTER_JUMP_HEIGHT:
|
case COMMAND_REGISTER_JUMP_HEIGHT:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CStats::MaximumJumpHeight = max(CStats::MaximumJumpHeight, *(float*)&ScriptParams[0]);
|
CStats::MaximumJumpHeight = Max(CStats::MaximumJumpHeight, *(float*)&ScriptParams[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REGISTER_JUMP_FLIPS:
|
case COMMAND_REGISTER_JUMP_FLIPS:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CStats::MaximumJumpFlips = max(CStats::MaximumJumpFlips, ScriptParams[0]);
|
CStats::MaximumJumpFlips = Max(CStats::MaximumJumpFlips, ScriptParams[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REGISTER_JUMP_SPINS:
|
case COMMAND_REGISTER_JUMP_SPINS:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CStats::MaximumJumpSpins = max(CStats::MaximumJumpSpins, ScriptParams[0]);
|
CStats::MaximumJumpSpins = Max(CStats::MaximumJumpSpins, ScriptParams[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REGISTER_JUMP_STUNT:
|
case COMMAND_REGISTER_JUMP_STUNT:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CStats::BestStuntJump = max(CStats::BestStuntJump, ScriptParams[0]);
|
CStats::BestStuntJump = Max(CStats::BestStuntJump, ScriptParams[0]);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REGISTER_UNIQUE_JUMP_FOUND:
|
case COMMAND_REGISTER_UNIQUE_JUMP_FOUND:
|
||||||
++CStats::NumberOfUniqueJumpsFound;
|
++CStats::NumberOfUniqueJumpsFound;
|
||||||
@ -6855,10 +6855,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
CVector cp4 = tmp_matrix * CVector(pColModel->boundingBox.min.x, pColModel->boundingBox.min.y, pColModel->boundingBox.max.z);
|
CVector cp4 = tmp_matrix * CVector(pColModel->boundingBox.min.x, pColModel->boundingBox.min.y, pColModel->boundingBox.max.z);
|
||||||
int16 collisions;
|
int16 collisions;
|
||||||
CWorld::FindObjectsIntersectingAngledCollisionBox(pColModel->boundingBox, tmp_matrix, pos,
|
CWorld::FindObjectsIntersectingAngledCollisionBox(pColModel->boundingBox, tmp_matrix, pos,
|
||||||
min(cp1.x, min(cp2.x, min(cp3.x, cp4.x))),
|
Min(cp1.x, Min(cp2.x, Min(cp3.x, cp4.x))),
|
||||||
min(cp1.y, min(cp2.y, min(cp3.y, cp4.y))),
|
Min(cp1.y, Min(cp2.y, Min(cp3.y, cp4.y))),
|
||||||
max(cp1.x, max(cp2.x, max(cp3.x, cp4.x))),
|
Max(cp1.x, Max(cp2.x, Max(cp3.x, cp4.x))),
|
||||||
max(cp1.y, max(cp2.y, max(cp3.y, cp4.y))),
|
Max(cp1.y, Max(cp2.y, Max(cp3.y, cp4.y))),
|
||||||
&collisions, 2, nil, false, true, true, false, false);
|
&collisions, 2, nil, false, true, true, false, false);
|
||||||
if (collisions > 0)
|
if (collisions > 0)
|
||||||
obstacleInPath = true;
|
obstacleInPath = true;
|
||||||
@ -6910,10 +6910,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
CVector cp4 = tmp_matrix * CVector(pColModel->boundingBox.min.x, pColModel->boundingBox.min.y, pColModel->boundingBox.max.z);
|
CVector cp4 = tmp_matrix * CVector(pColModel->boundingBox.min.x, pColModel->boundingBox.min.y, pColModel->boundingBox.max.z);
|
||||||
int16 collisions;
|
int16 collisions;
|
||||||
CWorld::FindObjectsIntersectingAngledCollisionBox(pColModel->boundingBox, tmp_matrix, newPosition,
|
CWorld::FindObjectsIntersectingAngledCollisionBox(pColModel->boundingBox, tmp_matrix, newPosition,
|
||||||
min(cp1.x, min(cp2.x, min(cp3.x, cp4.x))),
|
Min(cp1.x, Min(cp2.x, Min(cp3.x, cp4.x))),
|
||||||
min(cp1.y, min(cp2.y, min(cp3.y, cp4.y))),
|
Min(cp1.y, Min(cp2.y, Min(cp3.y, cp4.y))),
|
||||||
max(cp1.x, max(cp2.x, max(cp3.x, cp4.x))),
|
Max(cp1.x, Max(cp2.x, Max(cp3.x, cp4.x))),
|
||||||
max(cp1.y, max(cp2.y, max(cp3.y, cp4.y))),
|
Max(cp1.y, Max(cp2.y, Max(cp3.y, cp4.y))),
|
||||||
&collisions, 2, nil, false, true, true, false, false);
|
&collisions, 2, nil, false, true, true, false, false);
|
||||||
if (collisions > 0)
|
if (collisions > 0)
|
||||||
obstacleInPath = true;
|
obstacleInPath = true;
|
||||||
@ -7746,7 +7746,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||||||
CVector pos = *(CVector*)&ScriptParams[1];
|
CVector pos = *(CVector*)&ScriptParams[1];
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
float size = max(0.0f, *(float*)&ScriptParams[7]);
|
float size = Max(0.0f, *(float*)&ScriptParams[7]);
|
||||||
eParticleObjectType type = (eParticleObjectType)ScriptParams[0];
|
eParticleObjectType type = (eParticleObjectType)ScriptParams[0];
|
||||||
RwRGBA color;
|
RwRGBA color;
|
||||||
if (type == POBJECT_SMOKE_TRAIL){
|
if (type == POBJECT_SMOKE_TRAIL){
|
||||||
@ -11456,22 +11456,22 @@ void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, fl
|
|||||||
supY = infY = Y;
|
supY = infY = Y;
|
||||||
X = (x2 + x3) / 2;
|
X = (x2 + x3) / 2;
|
||||||
Y = (y2 + y3) / 2;
|
Y = (y2 + y3) / 2;
|
||||||
infX = min(infX, X);
|
infX = Min(infX, X);
|
||||||
supX = max(supX, X);
|
supX = Max(supX, X);
|
||||||
infY = min(infY, Y);
|
infY = Min(infY, Y);
|
||||||
supY = max(supY, Y);
|
supY = Max(supY, Y);
|
||||||
X = (x3 + x4) / 2;
|
X = (x3 + x4) / 2;
|
||||||
Y = (y3 + y4) / 2;
|
Y = (y3 + y4) / 2;
|
||||||
infX = min(infX, X);
|
infX = Min(infX, X);
|
||||||
supX = max(supX, X);
|
supX = Max(supX, X);
|
||||||
infY = min(infY, Y);
|
infY = Min(infY, Y);
|
||||||
supY = max(supY, Y);
|
supY = Max(supY, Y);
|
||||||
X = (x4 + x1) / 2;
|
X = (x4 + x1) / 2;
|
||||||
Y = (y4 + y1) / 2;
|
Y = (y4 + y1) / 2;
|
||||||
infX = min(infX, X);
|
infX = Min(infX, X);
|
||||||
supX = max(supX, X);
|
supX = Max(supX, X);
|
||||||
infY = min(infY, Y);
|
infY = Min(infY, Y);
|
||||||
supY = max(supY, Y);
|
supY = Max(supY, Y);
|
||||||
CVector center;
|
CVector center;
|
||||||
center.x = (infX + supX) / 2;
|
center.x = (infX + supX) / 2;
|
||||||
center.y = (infY + supY) / 2;
|
center.y = (infY + supY) / 2;
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "General.h"
|
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "World.h"
|
|
||||||
#include "PathFind.h"
|
|
||||||
#include "Timer.h"
|
|
||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
#include "Weather.h"
|
|
||||||
#include "Timecycle.h"
|
|
||||||
#include "Pointlights.h"
|
|
||||||
#include "Shadows.h"
|
|
||||||
#include "Coronas.h"
|
#include "Coronas.h"
|
||||||
|
#include "General.h"
|
||||||
|
#include "PathFind.h"
|
||||||
|
#include "PointLights.h"
|
||||||
|
#include "Shadows.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "Vehicle.h"
|
#include "Timecycle.h"
|
||||||
|
#include "Timer.h"
|
||||||
#include "TrafficLights.h"
|
#include "TrafficLights.h"
|
||||||
|
#include "Vehicle.h"
|
||||||
|
#include "Weather.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
// TODO: figure out the meaning of this
|
// TODO: figure out the meaning of this
|
||||||
enum { SOME_FLAG = 0x80 };
|
enum { SOME_FLAG = 0x80 };
|
||||||
@ -39,10 +39,10 @@ CTrafficLights::DisplayActualLight(CEntity *ent)
|
|||||||
float zMax = mi->Get2dEffect(0)->pos.z;
|
float zMax = mi->Get2dEffect(0)->pos.z;
|
||||||
for(i = 1; i < 6; i++){
|
for(i = 1; i < 6; i++){
|
||||||
assert(mi->Get2dEffect(i));
|
assert(mi->Get2dEffect(i));
|
||||||
yMin = min(yMin, mi->Get2dEffect(i)->pos.y);
|
yMin = Min(yMin, mi->Get2dEffect(i)->pos.y);
|
||||||
yMax = max(yMax, mi->Get2dEffect(i)->pos.y);
|
yMax = Max(yMax, mi->Get2dEffect(i)->pos.y);
|
||||||
zMin = min(zMin, mi->Get2dEffect(i)->pos.z);
|
zMin = Min(zMin, mi->Get2dEffect(i)->pos.z);
|
||||||
zMax = max(zMax, mi->Get2dEffect(i)->pos.z);
|
zMax = Max(zMax, mi->Get2dEffect(i)->pos.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
CVector pos1, pos2;
|
CVector pos1, pos2;
|
||||||
|
@ -117,9 +117,9 @@ CCam::Process(void)
|
|||||||
float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x;
|
float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x;
|
||||||
float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y;
|
float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y;
|
||||||
if(FwdSpeedX + FwdSpeedY > 0.0f)
|
if(FwdSpeedX + FwdSpeedY > 0.0f)
|
||||||
TargetSpeedVar = min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/0.9f, 1.0f);
|
TargetSpeedVar = Min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/0.9f, 1.0f);
|
||||||
else
|
else
|
||||||
TargetSpeedVar = -min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/1.8f, 0.5f);
|
TargetSpeedVar = -Min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/1.8f, 0.5f);
|
||||||
SpeedVar = 0.895f*SpeedVar + 0.105*TargetSpeedVar;
|
SpeedVar = 0.895f*SpeedVar + 0.105*TargetSpeedVar;
|
||||||
}else{
|
}else{
|
||||||
CameraTarget = CamTargetEntity->GetPosition();
|
CameraTarget = CamTargetEntity->GetPosition();
|
||||||
@ -341,7 +341,7 @@ WellBufferMe(float Target, float *CurrentValue, float *CurrentSpeed, float MaxSp
|
|||||||
else if(TargetSpeed > 0.0f && *CurrentSpeed > TargetSpeed)
|
else if(TargetSpeed > 0.0f && *CurrentSpeed > TargetSpeed)
|
||||||
*CurrentSpeed = TargetSpeed;
|
*CurrentSpeed = TargetSpeed;
|
||||||
|
|
||||||
*CurrentValue += *CurrentSpeed * min(10.0f, CTimer::GetTimeStep());
|
*CurrentValue += *CurrentSpeed * Min(10.0f, CTimer::GetTimeStep());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -467,7 +467,7 @@ CCam::ProcessSpecialHeightRoutines(void)
|
|||||||
vehicle->IsVehicle()){
|
vehicle->IsVehicle()){
|
||||||
float height = vehicle->GetColModel()->boundingBox.GetSize().z;
|
float height = vehicle->GetColModel()->boundingBox.GetSize().z;
|
||||||
if(FoundCar){
|
if(FoundCar){
|
||||||
HighestCar = max(HighestCar, height);
|
HighestCar = Max(HighestCar, height);
|
||||||
}else{
|
}else{
|
||||||
FoundCar = true;
|
FoundCar = true;
|
||||||
HighestCar = height;
|
HighestCar = height;
|
||||||
@ -481,7 +481,7 @@ CCam::ProcessSpecialHeightRoutines(void)
|
|||||||
vehicle->IsVehicle()){
|
vehicle->IsVehicle()){
|
||||||
float height = vehicle->GetColModel()->boundingBox.GetSize().z;
|
float height = vehicle->GetColModel()->boundingBox.GetSize().z;
|
||||||
if(FoundCar){
|
if(FoundCar){
|
||||||
HighestCar = max(HighestCar, height);
|
HighestCar = Max(HighestCar, height);
|
||||||
}else{
|
}else{
|
||||||
FoundCar = true;
|
FoundCar = true;
|
||||||
HighestCar = height;
|
HighestCar = height;
|
||||||
@ -1323,7 +1323,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
else if(ReqSpeed > 0.0f && BetaSpeed > ReqSpeed)
|
else if(ReqSpeed > 0.0f && BetaSpeed > ReqSpeed)
|
||||||
BetaSpeed = ReqSpeed;
|
BetaSpeed = ReqSpeed;
|
||||||
|
|
||||||
Beta += BetaSpeed * min(10.0f, CTimer::GetTimeStep());
|
Beta += BetaSpeed * Min(10.0f, CTimer::GetTimeStep());
|
||||||
*/
|
*/
|
||||||
WellBufferMe(FixedTargetOrientation, &Beta, &BetaSpeed, MaxSpeed, Acceleration, true);
|
WellBufferMe(FixedTargetOrientation, &Beta, &BetaSpeed, MaxSpeed, Acceleration, true);
|
||||||
|
|
||||||
@ -1398,7 +1398,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
// Process height offset to avoid peds and cars
|
// Process height offset to avoid peds and cars
|
||||||
|
|
||||||
float TargetZOffSet = m_fRoadOffSet + m_fDimensionOfHighestNearCar;
|
float TargetZOffSet = m_fRoadOffSet + m_fDimensionOfHighestNearCar;
|
||||||
TargetZOffSet = max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
|
TargetZOffSet = Max(TargetZOffSet, m_fPedBetweenCameraHeightOffset);
|
||||||
float TargetHeight = CameraTarget.z + TargetZOffSet - Source.z;
|
float TargetHeight = CameraTarget.z + TargetZOffSet - Source.z;
|
||||||
|
|
||||||
if(TargetHeight > m_fCamBufferedHeight){
|
if(TargetHeight > m_fCamBufferedHeight){
|
||||||
@ -1454,7 +1454,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetCoors.z += min(1.0f, m_fCamBufferedHeight/2.0f);
|
TargetCoors.z += Min(1.0f, m_fCamBufferedHeight/2.0f);
|
||||||
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
||||||
|
|
||||||
Front = TargetCoors - Source;
|
Front = TargetCoors - Source;
|
||||||
@ -1553,7 +1553,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
|
|||||||
#else
|
#else
|
||||||
if(Alpha > fBaseDist) // comparing an angle against a distance?
|
if(Alpha > fBaseDist) // comparing an angle against a distance?
|
||||||
#endif
|
#endif
|
||||||
CamDist = fBaseDist + Cos(min(Alpha*fFalloff, HALFPI))*fAngleDist;
|
CamDist = fBaseDist + Cos(Min(Alpha*fFalloff, HALFPI))*fAngleDist;
|
||||||
else
|
else
|
||||||
CamDist = fBaseDist + Cos(Alpha)*fAngleDist;
|
CamDist = fBaseDist + Cos(Alpha)*fAngleDist;
|
||||||
|
|
||||||
@ -1585,14 +1585,14 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
|
|||||||
PedColDist = (TargetCoors - colPoint.point).Magnitude();
|
PedColDist = (TargetCoors - colPoint.point).Magnitude();
|
||||||
Source = colPoint.point;
|
Source = colPoint.point;
|
||||||
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(PedColDist-0.3f, 0.05f));
|
||||||
}else{
|
}else{
|
||||||
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, DEFAULT_NEAR));
|
RwCameraSetNearClipPlane(Scene.camera, Min(ColCamDist-0.35f, DEFAULT_NEAR));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
Source = colPoint.point;
|
Source = colPoint.point;
|
||||||
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(PedColDist-0.3f, 0.05f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CWorld::pIgnoreEntity = nil;
|
CWorld::pIgnoreEntity = nil;
|
||||||
@ -1609,7 +1609,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
|
|||||||
float dist = (CamToCol - Front*frontDist).Magnitude() / ViewPlaneWidth;
|
float dist = (CamToCol - Front*frontDist).Magnitude() / ViewPlaneWidth;
|
||||||
|
|
||||||
// Try to decrease near clip
|
// Try to decrease near clip
|
||||||
dist = max(min(Near, dist), 0.1f);
|
dist = Max(Min(Near, dist), 0.1f);
|
||||||
if(dist < Near)
|
if(dist < Near)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, dist);
|
RwCameraSetNearClipPlane(Scene.camera, dist);
|
||||||
|
|
||||||
@ -1639,7 +1639,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
|
|||||||
float PlayerDist = (Source - player->GetPosition()).Magnitude();
|
float PlayerDist = (Source - player->GetPosition()).Magnitude();
|
||||||
if(PlayerDist < 2.75f)
|
if(PlayerDist < 2.75f)
|
||||||
Near = PlayerDist/2.75f * DEFAULT_NEAR - 0.3f;
|
Near = PlayerDist/2.75f * DEFAULT_NEAR - 0.3f;
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(Near, 0.1f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(Near, 0.1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1881,7 +1881,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
|
|||||||
}
|
}
|
||||||
if(FoundCamRoof){
|
if(FoundCamRoof){
|
||||||
// Camera is under something
|
// Camera is under something
|
||||||
float roof = FoundRoofCenter ? min(CamRoof, CarRoof) : CamRoof;
|
float roof = FoundRoofCenter ? Min(CamRoof, CarRoof) : CamRoof;
|
||||||
// Same weirdness again?
|
// Same weirdness again?
|
||||||
TargetAlpha = CGeneral::GetATanOfXY(CA_MAX_DISTANCE, roof - CamTargetZ - 1.5f);
|
TargetAlpha = CGeneral::GetATanOfXY(CA_MAX_DISTANCE, roof - CamTargetZ - 1.5f);
|
||||||
CamClear = false;
|
CamClear = false;
|
||||||
@ -2139,7 +2139,7 @@ void
|
|||||||
CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
|
CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
|
||||||
{
|
{
|
||||||
CA_MAX_DISTANCE = BaseDist + 0.1f + TheCamera.CarZoomValueSmooth;
|
CA_MAX_DISTANCE = BaseDist + 0.1f + TheCamera.CarZoomValueSmooth;
|
||||||
CA_MIN_DISTANCE = min(BaseDist*0.6f, 3.5f);
|
CA_MIN_DISTANCE = Min(BaseDist*0.6f, 3.5f);
|
||||||
|
|
||||||
CVector Dist = Source - TargetCoors;
|
CVector Dist = Source - TargetCoors;
|
||||||
|
|
||||||
@ -2361,7 +2361,7 @@ CCam::Process_TopDownPed(const CVector &CameraTarget, float TargetOrientation, f
|
|||||||
if(FindPlayerPed()->m_pPointGunAt){
|
if(FindPlayerPed()->m_pPointGunAt){
|
||||||
Dist = (FindPlayerPed()->m_pPointGunAt->GetPosition() - CameraTarget).Magnitude2D();
|
Dist = (FindPlayerPed()->m_pPointGunAt->GetPosition() - CameraTarget).Magnitude2D();
|
||||||
if(Dist > 6.0f)
|
if(Dist > 6.0f)
|
||||||
HeightTarget = max(HeightTarget, Dist/22.0f*37.0f);
|
HeightTarget = Max(HeightTarget, Dist/22.0f*37.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Source = TargetCoors + CVector(0.0f, -1.0f, 9.0f);
|
Source = TargetCoors + CVector(0.0f, -1.0f, 9.0f);
|
||||||
@ -2813,13 +2813,13 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
|
|||||||
m_vecBufferedPlayerBodyOffset.z =
|
m_vecBufferedPlayerBodyOffset.z =
|
||||||
TheCamera.m_fGaitSwayBuffer * m_vecBufferedPlayerBodyOffset.z +
|
TheCamera.m_fGaitSwayBuffer * m_vecBufferedPlayerBodyOffset.z +
|
||||||
(1.0f-TheCamera.m_fGaitSwayBuffer) * HeadPos.z;
|
(1.0f-TheCamera.m_fGaitSwayBuffer) * HeadPos.z;
|
||||||
HeadPos = RwV3d(CamTargetEntity->GetMatrix() * m_vecBufferedPlayerBodyOffset);
|
HeadPos = (CamTargetEntity->GetMatrix() * m_vecBufferedPlayerBodyOffset).toRwV3d();
|
||||||
}else{
|
}else{
|
||||||
float HeadDelta = (HeadPos - InitialHeadPos).Magnitude2D();
|
float HeadDelta = (HeadPos - InitialHeadPos).Magnitude2D();
|
||||||
CVector Fwd = CamTargetEntity->GetForward();
|
CVector Fwd = CamTargetEntity->GetForward();
|
||||||
Fwd.z = 0.0f;
|
Fwd.z = 0.0f;
|
||||||
Fwd.Normalise();
|
Fwd.Normalise();
|
||||||
HeadPos = RwV3d(HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition());
|
HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition()).toRwV3d();
|
||||||
HeadPos.z += 0.59f;
|
HeadPos.z += 0.59f;
|
||||||
}
|
}
|
||||||
Source = HeadPos;
|
Source = HeadPos;
|
||||||
@ -3125,7 +3125,7 @@ CCam::Process_Syphon(const CVector &CameraTarget, float, float, float)
|
|||||||
Front = TargetCoors - Source;
|
Front = TargetCoors - Source;
|
||||||
m_fMinDistAwayFromCamWhenInterPolating = Front.Magnitude2D();
|
m_fMinDistAwayFromCamWhenInterPolating = Front.Magnitude2D();
|
||||||
if(m_fMinDistAwayFromCamWhenInterPolating < 1.1f)
|
if(m_fMinDistAwayFromCamWhenInterPolating < 1.1f)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(m_fMinDistAwayFromCamWhenInterPolating - 0.35f, 0.05f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(m_fMinDistAwayFromCamWhenInterPolating - 0.35f, 0.05f));
|
||||||
Front.Normalise();
|
Front.Normalise();
|
||||||
GetVectorsReadyForRW();
|
GetVectorsReadyForRW();
|
||||||
}
|
}
|
||||||
@ -3382,7 +3382,7 @@ CCam::Process_Fight_Cam(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
WellBufferMe(TargetOrientation, &m_fBufferedTargetOrientation, &m_fBufferedTargetOrientationSpeed, 0.07f, 0.004f, true);
|
WellBufferMe(TargetOrientation, &m_fBufferedTargetOrientation, &m_fBufferedTargetOrientationSpeed, 0.07f, 0.004f, true);
|
||||||
TargetCoors = CameraTarget + 0.5f*CVector(Cos(m_fBufferedTargetOrientation), Sin(m_fBufferedTargetOrientation), 0.0f);
|
TargetCoors = CameraTarget + 0.5f*CVector(Cos(m_fBufferedTargetOrientation), Sin(m_fBufferedTargetOrientation), 0.0f);
|
||||||
|
|
||||||
TargetCamHeight = CameraTarget.z - Source.z + max(m_fPedBetweenCameraHeightOffset, m_fRoadOffSet + m_fDimensionOfHighestNearCar) - 0.5f;
|
TargetCamHeight = CameraTarget.z - Source.z + Max(m_fPedBetweenCameraHeightOffset, m_fRoadOffSet + m_fDimensionOfHighestNearCar) - 0.5f;
|
||||||
if(TargetCamHeight > m_fCamBufferedHeight)
|
if(TargetCamHeight > m_fCamBufferedHeight)
|
||||||
WellBufferMe(TargetCamHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.15f, 0.04f, false);
|
WellBufferMe(TargetCamHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.15f, 0.04f, false);
|
||||||
else
|
else
|
||||||
@ -4556,14 +4556,14 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
|
|||||||
PedColDist = (TargetCoors - colPoint.point).Magnitude();
|
PedColDist = (TargetCoors - colPoint.point).Magnitude();
|
||||||
Source = colPoint.point;
|
Source = colPoint.point;
|
||||||
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(PedColDist-0.3f, 0.05f));
|
||||||
}else{
|
}else{
|
||||||
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, DEFAULT_NEAR));
|
RwCameraSetNearClipPlane(Scene.camera, Min(ColCamDist-0.35f, DEFAULT_NEAR));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
Source = colPoint.point;
|
Source = colPoint.point;
|
||||||
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
if(PedColDist < DEFAULT_NEAR + 0.3f)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(PedColDist-0.3f, 0.05f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CWorld::pIgnoreEntity = nil;
|
CWorld::pIgnoreEntity = nil;
|
||||||
@ -4580,7 +4580,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
|
|||||||
float dist = (CamToCol - Front*frontDist).Magnitude() / ViewPlaneWidth;
|
float dist = (CamToCol - Front*frontDist).Magnitude() / ViewPlaneWidth;
|
||||||
|
|
||||||
// Try to decrease near clip
|
// Try to decrease near clip
|
||||||
dist = max(min(Near, dist), 0.1f);
|
dist = Max(Min(Near, dist), 0.1f);
|
||||||
if(dist < Near)
|
if(dist < Near)
|
||||||
RwCameraSetNearClipPlane(Scene.camera, dist);
|
RwCameraSetNearClipPlane(Scene.camera, dist);
|
||||||
|
|
||||||
@ -4714,7 +4714,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
minDistForVehType = minDistForVehType * 0.65f;
|
minDistForVehType = minDistForVehType * 0.65f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float nextDistance = max(newDistance, minDistForVehType);
|
float nextDistance = Max(newDistance, minDistForVehType);
|
||||||
|
|
||||||
CA_MAX_DISTANCE = newDistance;
|
CA_MAX_DISTANCE = newDistance;
|
||||||
CA_MIN_DISTANCE = 3.5f;
|
CA_MIN_DISTANCE = 3.5f;
|
||||||
@ -4811,7 +4811,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
|
|
||||||
float betaChangeMult2 = (car->m_vecMoveSpeed - DotProduct(car->m_vecMoveSpeed, Front) * Front).Magnitude();
|
float betaChangeMult2 = (car->m_vecMoveSpeed - DotProduct(car->m_vecMoveSpeed, Front) * Front).Magnitude();
|
||||||
|
|
||||||
float betaChange = min(1.0f, betaChangeMult1 * betaChangeMult2) * (velocityRightHeading - camRightHeading);
|
float betaChange = Min(1.0f, betaChangeMult1 * betaChangeMult2) * (velocityRightHeading - camRightHeading);
|
||||||
if (betaChange <= betaChangeLimit) {
|
if (betaChange <= betaChangeLimit) {
|
||||||
if (betaChange < -betaChangeLimit)
|
if (betaChange < -betaChangeLimit)
|
||||||
betaChange = -betaChangeLimit;
|
betaChange = -betaChangeLimit;
|
||||||
@ -4827,7 +4827,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
|
|
||||||
float carPosChange = (TargetCoors - m_aTargetHistoryPosTwo).Magnitude();
|
float carPosChange = (TargetCoors - m_aTargetHistoryPosTwo).Magnitude();
|
||||||
if (carPosChange < newDistance && newDistance > minDistForThisCar) {
|
if (carPosChange < newDistance && newDistance > minDistForThisCar) {
|
||||||
newDistance = max(minDistForThisCar, carPosChange);
|
newDistance = Max(minDistForThisCar, carPosChange);
|
||||||
}
|
}
|
||||||
float maxAlphaAllowed = CARCAM_SET[camSetArrPos][13];
|
float maxAlphaAllowed = CARCAM_SET[camSetArrPos][13];
|
||||||
|
|
||||||
@ -4851,7 +4851,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
v200 = (1.5f - carCol->boundingBox.min.y) / Cos(v88);
|
v200 = (1.5f - carCol->boundingBox.min.y) / Cos(v88);
|
||||||
} else {
|
} else {
|
||||||
float a6g = 1.2f + carCol->boundingBox.max.x;
|
float a6g = 1.2f + carCol->boundingBox.max.x;
|
||||||
v200 = a6g / Cos(max(0.0f, HALFPI - v88));
|
v200 = a6g / Cos(Max(0.0f, HALFPI - v88));
|
||||||
}
|
}
|
||||||
maxAlphaAllowed = Cos(Beta - (car->GetForward().Heading() - HALFPI)) * Atan2(car->GetForward().z, car->GetForward().Magnitude2D())
|
maxAlphaAllowed = Cos(Beta - (car->GetForward().Heading() - HALFPI)) * Atan2(car->GetForward().z, car->GetForward().Magnitude2D())
|
||||||
+ Atan2(TargetCoors.z - car->GetPosition().z + car->GetHeightAboveRoad(), v200 * 1.2f);
|
+ Atan2(TargetCoors.z - car->GetPosition().z + car->GetHeightAboveRoad(), v200 * 1.2f);
|
||||||
@ -4944,7 +4944,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
yMovement = 0.0;
|
yMovement = 0.0;
|
||||||
xMovement = 0.0;
|
xMovement = 0.0;
|
||||||
targetAlpha = Alpha;
|
targetAlpha = Alpha;
|
||||||
stepsLeftToChangeBetaByMouse = max(0.0f, stepsLeftToChangeBetaByMouse - CTimer::GetTimeStep());
|
stepsLeftToChangeBetaByMouse = Max(0.0f, stepsLeftToChangeBetaByMouse - CTimer::GetTimeStep());
|
||||||
mouseChangesBeta = true;
|
mouseChangesBeta = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4963,7 +4963,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
|
|
||||||
float newAngleSpeedMaxBlendAmount = CARCAM_SET[camSetArrPos][9];
|
float newAngleSpeedMaxBlendAmount = CARCAM_SET[camSetArrPos][9];
|
||||||
float angleChangeStep = pow(CARCAM_SET[camSetArrPos][8], CTimer::GetTimeStep());
|
float angleChangeStep = pow(CARCAM_SET[camSetArrPos][8], CTimer::GetTimeStep());
|
||||||
float targetBetaWithStickBlendAmount = betaSpeedFromStickX + (targetBeta - Beta) / max(CTimer::GetTimeStep(), 1.0f);
|
float targetBetaWithStickBlendAmount = betaSpeedFromStickX + (targetBeta - Beta) / Max(CTimer::GetTimeStep(), 1.0f);
|
||||||
|
|
||||||
if (targetBetaWithStickBlendAmount < -newAngleSpeedMaxBlendAmount)
|
if (targetBetaWithStickBlendAmount < -newAngleSpeedMaxBlendAmount)
|
||||||
targetBetaWithStickBlendAmount = -newAngleSpeedMaxBlendAmount;
|
targetBetaWithStickBlendAmount = -newAngleSpeedMaxBlendAmount;
|
||||||
@ -5088,7 +5088,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
if (!foundEnt->IsPed() || obstacleCamDist <= 1.0f) {
|
if (!foundEnt->IsPed() || obstacleCamDist <= 1.0f) {
|
||||||
Source = foundCol.point;
|
Source = foundCol.point;
|
||||||
if (obstacleTargetDist < 1.2f) {
|
if (obstacleTargetDist < 1.2f) {
|
||||||
RwCameraSetNearClipPlane(Scene.camera, max(0.05f, obstacleTargetDist - 0.3f));
|
RwCameraSetNearClipPlane(Scene.camera, Max(0.05f, obstacleTargetDist - 0.3f));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) {
|
if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) {
|
||||||
|
@ -467,7 +467,7 @@ CCamera::Process(void)
|
|||||||
GetPosition().z += shakeOffset*(((shakeRand&0xF00)>>8)-7);
|
GetPosition().z += shakeOffset*(((shakeRand&0xF00)>>8)-7);
|
||||||
|
|
||||||
if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER)
|
if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER)
|
||||||
SetMotionBlurAlpha(min((int)(shakeStrength*255.0f) + 25, 150));
|
SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150));
|
||||||
if(Cams[ActiveCam].Mode == CCam::MODE_1STPERSON && FindPlayerVehicle() && FindPlayerVehicle()->GetUp().z < 0.2f)
|
if(Cams[ActiveCam].Mode == CCam::MODE_1STPERSON && FindPlayerVehicle() && FindPlayerVehicle()->GetUp().z < 0.2f)
|
||||||
SetMotionBlur(230, 230, 230, 215, MBLUR_NORMAL);
|
SetMotionBlur(230, 230, 230, 215, MBLUR_NORMAL);
|
||||||
|
|
||||||
@ -489,19 +489,19 @@ CCamera::Process(void)
|
|||||||
CDraw::SetFOV(Cams[2].FOV);
|
CDraw::SetFOV(Cams[2].FOV);
|
||||||
m_vecGameCamPos = Cams[ActiveCam].Source;
|
m_vecGameCamPos = Cams[ActiveCam].Source;
|
||||||
|
|
||||||
*RwMatrixGetPos(RwFrameGetMatrix(frame)) = (RwV3d)GetPosition();
|
*RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d();
|
||||||
*RwMatrixGetAt(RwFrameGetMatrix(frame)) = (RwV3d)GetForward();
|
*RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d();
|
||||||
*RwMatrixGetUp(RwFrameGetMatrix(frame)) = (RwV3d)GetUp();
|
*RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d();
|
||||||
*RwMatrixGetRight(RwFrameGetMatrix(frame)) = (RwV3d)GetRight();
|
*RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d();
|
||||||
RwMatrixUpdate(RwFrameGetMatrix(frame));
|
RwMatrixUpdate(RwFrameGetMatrix(frame));
|
||||||
RwFrameUpdateObjects(frame);
|
RwFrameUpdateObjects(frame);
|
||||||
}else{
|
}else{
|
||||||
RwFrame *frame = RwCameraGetFrame(m_pRwCamera);
|
RwFrame *frame = RwCameraGetFrame(m_pRwCamera);
|
||||||
m_vecGameCamPos = GetPosition();
|
m_vecGameCamPos = GetPosition();
|
||||||
*RwMatrixGetPos(RwFrameGetMatrix(frame)) = (RwV3d)GetPosition();
|
*RwMatrixGetPos(RwFrameGetMatrix(frame)) = GetPosition().toRwV3d();
|
||||||
*RwMatrixGetAt(RwFrameGetMatrix(frame)) = (RwV3d)GetForward();
|
*RwMatrixGetAt(RwFrameGetMatrix(frame)) = GetForward().toRwV3d();
|
||||||
*RwMatrixGetUp(RwFrameGetMatrix(frame)) = (RwV3d)GetUp();
|
*RwMatrixGetUp(RwFrameGetMatrix(frame)) = GetUp().toRwV3d();
|
||||||
*RwMatrixGetRight(RwFrameGetMatrix(frame)) = (RwV3d)GetRight();
|
*RwMatrixGetRight(RwFrameGetMatrix(frame)) = GetRight().toRwV3d();
|
||||||
RwMatrixUpdate(RwFrameGetMatrix(frame));
|
RwMatrixUpdate(RwFrameGetMatrix(frame));
|
||||||
RwFrameUpdateObjects(frame);
|
RwFrameUpdateObjects(frame);
|
||||||
}
|
}
|
||||||
@ -768,27 +768,27 @@ CCamera::CamControl(void)
|
|||||||
if(m_bUseScriptZoomValueCar){
|
if(m_bUseScriptZoomValueCar){
|
||||||
if(CarZoomValueSmooth < m_fCarZoomValueScript){
|
if(CarZoomValueSmooth < m_fCarZoomValueScript){
|
||||||
CarZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
CarZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
||||||
CarZoomValueSmooth = min(CarZoomValueSmooth, m_fCarZoomValueScript);
|
CarZoomValueSmooth = Min(CarZoomValueSmooth, m_fCarZoomValueScript);
|
||||||
}else{
|
}else{
|
||||||
CarZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
CarZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
||||||
CarZoomValueSmooth = max(CarZoomValueSmooth, m_fCarZoomValueScript);
|
CarZoomValueSmooth = Max(CarZoomValueSmooth, m_fCarZoomValueScript);
|
||||||
}
|
}
|
||||||
}else if(m_bFailedCullZoneTestPreviously){
|
}else if(m_bFailedCullZoneTestPreviously){
|
||||||
CloseInCarHeightTarget = 0.65f;
|
CloseInCarHeightTarget = 0.65f;
|
||||||
if(CarZoomValueSmooth < -0.65f){
|
if(CarZoomValueSmooth < -0.65f){
|
||||||
CarZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
CarZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
||||||
CarZoomValueSmooth = min(CarZoomValueSmooth, -0.65f);
|
CarZoomValueSmooth = Min(CarZoomValueSmooth, -0.65f);
|
||||||
}else{
|
}else{
|
||||||
CarZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
CarZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
||||||
CarZoomValueSmooth = max(CarZoomValueSmooth, -0.65f);
|
CarZoomValueSmooth = Max(CarZoomValueSmooth, -0.65f);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(CarZoomValueSmooth < CarZoomValue){
|
if(CarZoomValueSmooth < CarZoomValue){
|
||||||
CarZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
CarZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
||||||
CarZoomValueSmooth = min(CarZoomValueSmooth, CarZoomValue);
|
CarZoomValueSmooth = Min(CarZoomValueSmooth, CarZoomValue);
|
||||||
}else{
|
}else{
|
||||||
CarZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
CarZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
||||||
CarZoomValueSmooth = max(CarZoomValueSmooth, CarZoomValue);
|
CarZoomValueSmooth = Max(CarZoomValueSmooth, CarZoomValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,28 +872,28 @@ CCamera::CamControl(void)
|
|||||||
if(m_bUseScriptZoomValuePed){
|
if(m_bUseScriptZoomValuePed){
|
||||||
if(m_fPedZoomValueSmooth < m_fPedZoomValueScript){
|
if(m_fPedZoomValueSmooth < m_fPedZoomValueScript){
|
||||||
m_fPedZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
m_fPedZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
||||||
m_fPedZoomValueSmooth = min(m_fPedZoomValueSmooth, m_fPedZoomValueScript);
|
m_fPedZoomValueSmooth = Min(m_fPedZoomValueSmooth, m_fPedZoomValueScript);
|
||||||
}else{
|
}else{
|
||||||
m_fPedZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
m_fPedZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
||||||
m_fPedZoomValueSmooth = max(m_fPedZoomValueSmooth, m_fPedZoomValueScript);
|
m_fPedZoomValueSmooth = Max(m_fPedZoomValueSmooth, m_fPedZoomValueScript);
|
||||||
}
|
}
|
||||||
}else if(m_bFailedCullZoneTestPreviously){
|
}else if(m_bFailedCullZoneTestPreviously){
|
||||||
static float PedZoomedInVal = 0.5f;
|
static float PedZoomedInVal = 0.5f;
|
||||||
CloseInPedHeightTarget = 0.7f;
|
CloseInPedHeightTarget = 0.7f;
|
||||||
if(m_fPedZoomValueSmooth < PedZoomedInVal){
|
if(m_fPedZoomValueSmooth < PedZoomedInVal){
|
||||||
m_fPedZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
m_fPedZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
||||||
m_fPedZoomValueSmooth = min(m_fPedZoomValueSmooth, PedZoomedInVal);
|
m_fPedZoomValueSmooth = Min(m_fPedZoomValueSmooth, PedZoomedInVal);
|
||||||
}else{
|
}else{
|
||||||
m_fPedZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
m_fPedZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
||||||
m_fPedZoomValueSmooth = max(m_fPedZoomValueSmooth, PedZoomedInVal);
|
m_fPedZoomValueSmooth = Max(m_fPedZoomValueSmooth, PedZoomedInVal);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(m_fPedZoomValueSmooth < m_fPedZoomValue){
|
if(m_fPedZoomValueSmooth < m_fPedZoomValue){
|
||||||
m_fPedZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
m_fPedZoomValueSmooth += 0.12f * CTimer::GetTimeStep();
|
||||||
m_fPedZoomValueSmooth = min(m_fPedZoomValueSmooth, m_fPedZoomValue);
|
m_fPedZoomValueSmooth = Min(m_fPedZoomValueSmooth, m_fPedZoomValue);
|
||||||
}else{
|
}else{
|
||||||
m_fPedZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
m_fPedZoomValueSmooth -= 0.12f * CTimer::GetTimeStep();
|
||||||
m_fPedZoomValueSmooth = max(m_fPedZoomValueSmooth, m_fPedZoomValue);
|
m_fPedZoomValueSmooth = Max(m_fPedZoomValueSmooth, m_fPedZoomValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2256,7 +2256,7 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
|
|||||||
|
|
||||||
if(fwd.Magnitude() < 2.0f)
|
if(fwd.Magnitude() < 2.0f)
|
||||||
// very close, fix near clip
|
// very close, fix near clip
|
||||||
SetNearClipScript(max(fwd.Magnitude()*0.5f, 0.05f));
|
SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
|
||||||
// too far and driving away from cam
|
// too far and driving away from cam
|
||||||
if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
|
||||||
return true;
|
return true;
|
||||||
|
@ -153,10 +153,10 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
|
|||||||
// on water we expect to be between levels
|
// on water we expect to be between levels
|
||||||
multipleLevels = true;
|
multipleLevels = true;
|
||||||
}else{
|
}else{
|
||||||
xmin = max(sx - 1, 0);
|
xmin = Max(sx - 1, 0);
|
||||||
xmax = min(sx + 1, NUMSECTORS_X-1);
|
xmax = Min(sx + 1, NUMSECTORS_X-1);
|
||||||
ymin = max(sy - 1, 0);
|
ymin = Max(sy - 1, 0);
|
||||||
ymax = min(sy + 1, NUMSECTORS_Y-1);
|
ymax = Min(sy + 1, NUMSECTORS_Y-1);
|
||||||
|
|
||||||
for(x = xmin; x <= xmax; x++)
|
for(x = xmin; x <= xmax; x++)
|
||||||
for(y = ymin; y <= ymax; y++){
|
for(y = ymin; y <= ymax; y++){
|
||||||
|
36
src/core/Crime.h
Normal file
36
src/core/Crime.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum eCrimeType {
|
||||||
|
CRIME_NONE,
|
||||||
|
CRIME_POSSESSION_GUN,
|
||||||
|
CRIME_HIT_PED,
|
||||||
|
CRIME_HIT_COP,
|
||||||
|
CRIME_SHOOT_PED,
|
||||||
|
CRIME_SHOOT_COP,
|
||||||
|
CRIME_STEAL_CAR,
|
||||||
|
CRIME_RUN_REDLIGHT,
|
||||||
|
CRIME_RECKLESS_DRIVING,
|
||||||
|
CRIME_SPEEDING,
|
||||||
|
CRIME_RUNOVER_PED,
|
||||||
|
CRIME_RUNOVER_COP,
|
||||||
|
CRIME_SHOOT_HELI,
|
||||||
|
CRIME_PED_BURNED,
|
||||||
|
CRIME_COP_BURNED,
|
||||||
|
CRIME_VEHICLE_BURNED,
|
||||||
|
CRIME_DESTROYED_CESSNA,
|
||||||
|
NUM_CRIME_TYPES
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCrimeBeingQd
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
eCrimeType m_nType;
|
||||||
|
uint32 m_nId;
|
||||||
|
uint32 m_nTime;
|
||||||
|
CVector m_vecPosn;
|
||||||
|
bool m_bReported;
|
||||||
|
bool m_bPoliceDoesntCare;
|
||||||
|
|
||||||
|
CCrimeBeingQd() { };
|
||||||
|
~CCrimeBeingQd() { };
|
||||||
|
};
|
@ -349,8 +349,8 @@ CMenuManager::PageUpList(bool playSoundOnSuccess)
|
|||||||
if(playSoundOnSuccess)
|
if(playSoundOnSuccess)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
|
||||||
|
|
||||||
m_nFirstVisibleRowOnList = max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_LIST_ROW);
|
m_nFirstVisibleRowOnList = Max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_LIST_ROW);
|
||||||
m_nSelectedListRow = min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1);
|
m_nSelectedListRow = Min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW - 1);
|
||||||
} else {
|
} else {
|
||||||
m_nFirstVisibleRowOnList = 0;
|
m_nFirstVisibleRowOnList = 0;
|
||||||
m_nSelectedListRow = 0;
|
m_nSelectedListRow = 0;
|
||||||
@ -367,8 +367,8 @@ CMenuManager::PageDownList(bool playSoundOnSuccess)
|
|||||||
if(playSoundOnSuccess)
|
if(playSoundOnSuccess)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
|
||||||
|
|
||||||
m_nFirstVisibleRowOnList = min(m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW, m_nTotalListRow - MAX_VISIBLE_LIST_ROW);
|
m_nFirstVisibleRowOnList = Min(m_nFirstVisibleRowOnList + MAX_VISIBLE_LIST_ROW, m_nTotalListRow - MAX_VISIBLE_LIST_ROW);
|
||||||
m_nSelectedListRow = max(m_nSelectedListRow, m_nFirstVisibleRowOnList);
|
m_nSelectedListRow = Max(m_nSelectedListRow, m_nFirstVisibleRowOnList);
|
||||||
} else {
|
} else {
|
||||||
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
|
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW;
|
||||||
m_nSelectedListRow = m_nTotalListRow - 1;
|
m_nSelectedListRow = m_nTotalListRow - 1;
|
||||||
@ -643,7 +643,7 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR
|
|||||||
} else
|
} else
|
||||||
color = CRGBA(185, 120, 0, FadeIn(255));
|
color = CRGBA(185, 120, 0, FadeIn(255));
|
||||||
|
|
||||||
maxBarHeight = max(mostLeftBarSize, mostRightBarSize);
|
maxBarHeight = Max(mostLeftBarSize, mostRightBarSize);
|
||||||
|
|
||||||
float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f;
|
float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f;
|
||||||
float left = curBarX;
|
float left = curBarX;
|
||||||
@ -2492,7 +2492,7 @@ CMenuManager::DrawPlayerSetupScreen()
|
|||||||
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "(", 1);
|
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "(", 1);
|
||||||
if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "}", 1))
|
if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "}", 1))
|
||||||
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], ")", 1);
|
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], ")", 1);
|
||||||
if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "£", 1))
|
if (!strncmp(&m_pSelectedSkin->skinNameDisplayed[k], "<EFBFBD>", 1))
|
||||||
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "$", 1);
|
strncpy(&m_pSelectedSkin->skinNameDisplayed[k], "$", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2829,7 +2829,7 @@ CMenuManager::FadeIn(int alpha)
|
|||||||
m_nCurrScreen == MENUPAGE_DELETING)
|
m_nCurrScreen == MENUPAGE_DELETING)
|
||||||
return alpha;
|
return alpha;
|
||||||
|
|
||||||
return min(m_nMenuFadeAlpha, alpha);
|
return Min(m_nMenuFadeAlpha, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -5393,7 +5393,7 @@ CMenuManager::PrintMap(void)
|
|||||||
if (fMapCenterY + fMapSize < SCREEN_HEIGHT - MENU_Y(60.0f))
|
if (fMapCenterY + fMapSize < SCREEN_HEIGHT - MENU_Y(60.0f))
|
||||||
fMapCenterY = SCREEN_HEIGHT - MENU_Y(60.0f) - fMapSize;
|
fMapCenterY = SCREEN_HEIGHT - MENU_Y(60.0f) - fMapSize;
|
||||||
|
|
||||||
fMapCenterY = min(fMapCenterY, fMapSize); // To not show beyond north border
|
fMapCenterY = Min(fMapCenterY, fMapSize); // To not show beyond north border
|
||||||
|
|
||||||
bMenuMapActive = false;
|
bMenuMapActive = false;
|
||||||
|
|
||||||
@ -5455,7 +5455,7 @@ CMenuManager::ConstructStatLine(int rowIdx)
|
|||||||
|
|
||||||
int percentCompleted = (CStats::TotalProgressInGame == 0 ? 0 :
|
int percentCompleted = (CStats::TotalProgressInGame == 0 ? 0 :
|
||||||
CStats::ProgressMade * 100.0f / (CGame::nastyGame ? CStats::TotalProgressInGame : CStats::TotalProgressInGame - 1));
|
CStats::ProgressMade * 100.0f / (CGame::nastyGame ? CStats::TotalProgressInGame : CStats::TotalProgressInGame - 1));
|
||||||
percentCompleted = min(percentCompleted, 100);
|
percentCompleted = Min(percentCompleted, 100);
|
||||||
|
|
||||||
STAT_LINE("PER_COM", &percentCompleted, false, nil);
|
STAT_LINE("PER_COM", &percentCompleted, false, nil);
|
||||||
STAT_LINE("NMISON", &CStats::MissionsGiven, false, nil);
|
STAT_LINE("NMISON", &CStats::MissionsGiven, false, nil);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#pragma
|
#pragma once
|
||||||
|
|
||||||
#include "Sprite2d.h"
|
#include "Sprite2d.h"
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "SurfaceTable.h"
|
#include "SurfaceTable.h"
|
||||||
#include "TempColModels.h"
|
#include "TempColModels.h"
|
||||||
#include "TimeCycle.h"
|
#include "Timecycle.h"
|
||||||
#include "TrafficLights.h"
|
#include "TrafficLights.h"
|
||||||
#include "Train.h"
|
#include "Train.h"
|
||||||
#include "TxdStore.h"
|
#include "TxdStore.h"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum eLevelName
|
enum eLevelName {
|
||||||
{
|
|
||||||
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
|
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
|
||||||
LEVEL_NONE = 0,
|
LEVEL_NONE = 0,
|
||||||
LEVEL_INDUSTRIAL,
|
LEVEL_INDUSTRIAL,
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
static bool faststricmp(const char *str1, const char *str2)
|
static bool faststricmp(const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
for (; *str1; str1++, str2++) {
|
for (; *str1; str1++, str2++) {
|
||||||
#if MUCH_SLOWER
|
#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__
|
||||||
if (toupper(*str1) != toupper(*str2))
|
if (toupper(*str1) != toupper(*str2))
|
||||||
#else
|
#else
|
||||||
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
||||||
|
@ -17,10 +17,10 @@ void CIniFile::LoadIniFile()
|
|||||||
if (f){
|
if (f){
|
||||||
CFileMgr::ReadLine(f, gString, 200);
|
CFileMgr::ReadLine(f, gString, 200);
|
||||||
sscanf(gString, "%f", &PedNumberMultiplier);
|
sscanf(gString, "%f", &PedNumberMultiplier);
|
||||||
PedNumberMultiplier = min(3.0f, max(0.5f, PedNumberMultiplier));
|
PedNumberMultiplier = Min(3.0f, Max(0.5f, PedNumberMultiplier));
|
||||||
CFileMgr::ReadLine(f, gString, 200);
|
CFileMgr::ReadLine(f, gString, 200);
|
||||||
sscanf(gString, "%f", &CarNumberMultiplier);
|
sscanf(gString, "%f", &CarNumberMultiplier);
|
||||||
CarNumberMultiplier = min(3.0f, max(0.5f, CarNumberMultiplier));
|
CarNumberMultiplier = Min(3.0f, Max(0.5f, CarNumberMultiplier));
|
||||||
CFileMgr::CloseFile(f);
|
CFileMgr::CloseFile(f);
|
||||||
}
|
}
|
||||||
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
|
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
#include <Xinput.h>
|
#include <xinput.h>
|
||||||
#pragma comment( lib, "Xinput9_1_0.lib" )
|
#pragma comment( lib, "Xinput9_1_0.lib" )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ void ArmourCheat()
|
|||||||
void WantedLevelUpCheat()
|
void WantedLevelUpCheat()
|
||||||
{
|
{
|
||||||
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
|
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
|
||||||
FindPlayerPed()->SetWantedLevel(min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6));
|
FindPlayerPed()->SetWantedLevel(Min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WantedLevelDownCheat()
|
void WantedLevelDownCheat()
|
||||||
@ -513,10 +513,10 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
|
|||||||
{ if ( State1.button || State2.button ) ReconState.button = 255; }
|
{ if ( State1.button || State2.button ) ReconState.button = 255; }
|
||||||
|
|
||||||
#define _RECONCILE_AXIS_POSITIVE(axis) \
|
#define _RECONCILE_AXIS_POSITIVE(axis) \
|
||||||
{ if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = max(State1.axis, State2.axis); }
|
{ if ( State1.axis >= 0 && State2.axis >= 0 ) ReconState.axis = Max(State1.axis, State2.axis); }
|
||||||
|
|
||||||
#define _RECONCILE_AXIS_NEGATIVE(axis) \
|
#define _RECONCILE_AXIS_NEGATIVE(axis) \
|
||||||
{ if ( State1.axis <= 0 && State2.axis <= 0 ) ReconState.axis = min(State1.axis, State2.axis); }
|
{ if ( State1.axis <= 0 && State2.axis <= 0 ) ReconState.axis = Min(State1.axis, State2.axis); }
|
||||||
|
|
||||||
#define _RECONCILE_AXIS(axis) \
|
#define _RECONCILE_AXIS(axis) \
|
||||||
{ _RECONCILE_AXIS_POSITIVE(axis); _RECONCILE_AXIS_NEGATIVE(axis); }
|
{ _RECONCILE_AXIS_POSITIVE(axis); _RECONCILE_AXIS_NEGATIVE(axis); }
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "Automobile.h"
|
||||||
#include "PlayerPed.h"
|
#include "Bridge.h"
|
||||||
#include "Wanted.h"
|
#include "Camera.h"
|
||||||
#include "PlayerInfo.h"
|
#include "Cranes.h"
|
||||||
|
#include "Darkel.h"
|
||||||
|
#include "Explosion.h"
|
||||||
#include "Fire.h"
|
#include "Fire.h"
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "PlayerSkin.h"
|
|
||||||
#include "Darkel.h"
|
|
||||||
#include "Messages.h"
|
|
||||||
#include "Text.h"
|
|
||||||
#include "Stats.h"
|
|
||||||
#include "Remote.h"
|
|
||||||
#include "World.h"
|
|
||||||
#include "Replay.h"
|
|
||||||
#include "Camera.h"
|
|
||||||
#include "Pad.h"
|
|
||||||
#include "ProjectileInfo.h"
|
|
||||||
#include "Explosion.h"
|
|
||||||
#include "Script.h"
|
|
||||||
#include "Automobile.h"
|
|
||||||
#include "HandlingMgr.h"
|
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "SpecialFX.h"
|
#include "HandlingMgr.h"
|
||||||
#include "Cranes.h"
|
#include "Messages.h"
|
||||||
#include "Bridge.h"
|
#include "Pad.h"
|
||||||
#include "WaterLevel.h"
|
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
#include "ZoneCull.h"
|
#include "PlayerInfo.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
|
#include "PlayerSkin.h"
|
||||||
|
#include "ProjectileInfo.h"
|
||||||
|
#include "Remote.h"
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
|
#include "Replay.h"
|
||||||
|
#include "Script.h"
|
||||||
|
#include "SpecialFX.h"
|
||||||
|
#include "Stats.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
|
#include "Text.h"
|
||||||
|
#include "Wanted.h"
|
||||||
|
#include "WaterLevel.h"
|
||||||
|
#include "World.h"
|
||||||
|
#include "ZoneCull.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
CPlayerInfo::SetPlayerSkin(char *skin)
|
CPlayerInfo::SetPlayerSkin(char *skin)
|
||||||
@ -184,7 +184,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
|
|||||||
m_pPed->bExplosionProof = true;
|
m_pPed->bExplosionProof = true;
|
||||||
m_pPed->m_bCanBeDamaged = false;
|
m_pPed->m_bCanBeDamaged = false;
|
||||||
((CPlayerPed*)m_pPed)->ClearAdrenaline();
|
((CPlayerPed*)m_pPed)->ClearAdrenaline();
|
||||||
CancelPlayerEnteringCars(false);
|
CancelPlayerEnteringCars(nil);
|
||||||
gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
|
gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
|
||||||
CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
|
CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
|
||||||
CProjectileInfo::RemoveAllProjectiles();
|
CProjectileInfo::RemoveAllProjectiles();
|
||||||
|
@ -110,7 +110,7 @@ INITSAVEBUF
|
|||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
int32 slot = ReadSaveBuf<int32>(buf);
|
int32 slot = ReadSaveBuf<int32>(buf);
|
||||||
CVehicle* pVehicle;
|
CVehicle* pVehicle;
|
||||||
char* vbuf = new char[max(sizeof(CAutomobile), sizeof(CBoat))];
|
char* vbuf = new char[Max(sizeof(CAutomobile), sizeof(CBoat))];
|
||||||
if (type == VEHICLE_TYPE_BOAT) {
|
if (type == VEHICLE_TYPE_BOAT) {
|
||||||
memcpy(vbuf, buf, sizeof(CBoat));
|
memcpy(vbuf, buf, sizeof(CBoat));
|
||||||
SkipSaveBuf(buf, sizeof(CBoat));
|
SkipSaveBuf(buf, sizeof(CBoat));
|
||||||
|
@ -52,20 +52,20 @@ void CProfile::SuspendProfile(eProfile profile)
|
|||||||
|
|
||||||
void CProfile::ShowResults()
|
void CProfile::ShowResults()
|
||||||
{
|
{
|
||||||
ms_afMaxEndTime[PROFILE_FRAME_RATE] = max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
|
ms_afMaxEndTime[PROFILE_FRAME_RATE] = Max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
|
||||||
ms_afMaxEndTime[PROFILE_PHYSICS] = max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
|
ms_afMaxEndTime[PROFILE_PHYSICS] = Max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
|
||||||
ms_afMaxEndTime[PROFILE_COLLISION] = max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
|
ms_afMaxEndTime[PROFILE_COLLISION] = Max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
|
||||||
ms_afMaxEndTime[PROFILE_PED_AI] = max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
|
ms_afMaxEndTime[PROFILE_PED_AI] = Max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
|
||||||
ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
|
ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = Max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
|
||||||
ms_afMaxEndTime[PROFILE_RENDERING_TIME] = max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
|
ms_afMaxEndTime[PROFILE_RENDERING_TIME] = Max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
|
||||||
ms_afMaxEndTime[PROFILE_TOTAL] = max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
|
ms_afMaxEndTime[PROFILE_TOTAL] = Max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
|
||||||
|
|
||||||
ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
|
ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = Max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
|
||||||
ms_afMaxCumulativeTime[PROFILE_PHYSICS] = max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
|
ms_afMaxCumulativeTime[PROFILE_PHYSICS] = Max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
|
||||||
ms_afMaxCumulativeTime[PROFILE_COLLISION] = max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
|
ms_afMaxCumulativeTime[PROFILE_COLLISION] = Max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
|
||||||
ms_afMaxCumulativeTime[PROFILE_PED_AI] = max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
|
ms_afMaxCumulativeTime[PROFILE_PED_AI] = Max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
|
||||||
ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
|
ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = Max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
|
||||||
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
|
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = Max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
|
||||||
ms_afMaxCumulativeTime[PROFILE_TOTAL] = max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
|
ms_afMaxCumulativeTime[PROFILE_TOTAL] = Max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -121,13 +121,13 @@ void CStats::RegisterFastestTime(int32 index, int32 time)
|
|||||||
if (FastestTimes[index] == 0)
|
if (FastestTimes[index] == 0)
|
||||||
FastestTimes[index] = time;
|
FastestTimes[index] = time;
|
||||||
else
|
else
|
||||||
FastestTimes[index] = min(FastestTimes[index], time);
|
FastestTimes[index] = Min(FastestTimes[index], time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStats::RegisterHighestScore(int32 index, int32 score)
|
void CStats::RegisterHighestScore(int32 index, int32 score)
|
||||||
{
|
{
|
||||||
assert(index >= 0 && index < TOTAL_HIGHEST_SCORES);
|
assert(index >= 0 && index < TOTAL_HIGHEST_SCORES);
|
||||||
HighestScores[index] = max(HighestScores[index], score);
|
HighestScores[index] = Max(HighestScores[index], score);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStats::RegisterElBurroTime(int32 time)
|
void CStats::RegisterElBurroTime(int32 time)
|
||||||
@ -167,7 +167,7 @@ void CStats::AnotherCriminalCaught()
|
|||||||
|
|
||||||
void CStats::RegisterLevelAmbulanceMission(int32 level)
|
void CStats::RegisterLevelAmbulanceMission(int32 level)
|
||||||
{
|
{
|
||||||
HighestLevelAmbulanceMission = max(HighestLevelAmbulanceMission, level);
|
HighestLevelAmbulanceMission = Max(HighestLevelAmbulanceMission, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStats::AnotherFireExtinguished()
|
void CStats::AnotherFireExtinguished()
|
||||||
@ -177,7 +177,7 @@ void CStats::AnotherFireExtinguished()
|
|||||||
|
|
||||||
void CStats::RegisterLongestFlightInDodo(int32 time)
|
void CStats::RegisterLongestFlightInDodo(int32 time)
|
||||||
{
|
{
|
||||||
LongestFlightInDodo = max(LongestFlightInDodo, time);
|
LongestFlightInDodo = Max(LongestFlightInDodo, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStats::RegisterTimeTakenDefuseMission(int32 time)
|
void CStats::RegisterTimeTakenDefuseMission(int32 time)
|
||||||
|
@ -1950,7 +1950,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float
|
|||||||
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
|
CTimeModelInfo *mi = (CTimeModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex());
|
||||||
if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
|
if(mi->m_type != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff())){
|
||||||
lodDistSq = sq(mi->GetLargestLodDistance());
|
lodDistSq = sq(mi->GetLargestLodDistance());
|
||||||
lodDistSq = min(lodDistSq, sq(STREAM_DIST));
|
lodDistSq = Min(lodDistSq, sq(STREAM_DIST));
|
||||||
pos = CVector2D(e->GetPosition());
|
pos = CVector2D(e->GetPosition());
|
||||||
if(xmin < pos.x && pos.x < xmax &&
|
if(xmin < pos.x && pos.x < xmax &&
|
||||||
ymin < pos.y && pos.y < ymax &&
|
ymin < pos.y && pos.y < ymax &&
|
||||||
@ -2170,20 +2170,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
if(Abs(TheCamera.GetForward().x) > Abs(TheCamera.GetForward().y)){
|
if(Abs(TheCamera.GetForward().x) > Abs(TheCamera.GetForward().y)){
|
||||||
// looking west/east
|
// looking west/east
|
||||||
|
|
||||||
ymin = max(iy - 10, 0);
|
ymin = Max(iy - 10, 0);
|
||||||
ymax = min(iy + 10, NUMSECTORS_Y - 1);
|
ymax = Min(iy + 10, NUMSECTORS_Y - 1);
|
||||||
assert(ymin <= ymax);
|
assert(ymin <= ymax);
|
||||||
|
|
||||||
// Delete a block of sectors that we know is behind the camera
|
// Delete a block of sectors that we know is behind the camera
|
||||||
if(TheCamera.GetForward().x > 0){
|
if(TheCamera.GetForward().x > 0){
|
||||||
// looking east
|
// looking east
|
||||||
xmax = max(ix - 2, 0);
|
xmax = Max(ix - 2, 0);
|
||||||
xmin = max(ix - 10, 0);
|
xmin = Max(ix - 10, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking west
|
// looking west
|
||||||
xmax = min(ix + 2, NUMSECTORS_X - 1);
|
xmax = Min(ix + 2, NUMSECTORS_X - 1);
|
||||||
xmin = min(ix + 10, NUMSECTORS_X - 1);
|
xmin = Min(ix + 10, NUMSECTORS_X - 1);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(y = ymin; y <= ymax; y++){
|
for(y = ymin; y <= ymax; y++){
|
||||||
@ -2199,13 +2199,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
// Now a block that intersects with the camera's frustum
|
// Now a block that intersects with the camera's frustum
|
||||||
if(TheCamera.GetForward().x > 0){
|
if(TheCamera.GetForward().x > 0){
|
||||||
// looking east
|
// looking east
|
||||||
xmax = max(ix + 10, 0);
|
xmax = Max(ix + 10, 0);
|
||||||
xmin = max(ix - 2, 0);
|
xmin = Max(ix - 2, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking west
|
// looking west
|
||||||
xmax = min(ix - 10, NUMSECTORS_X - 1);
|
xmax = Min(ix - 10, NUMSECTORS_X - 1);
|
||||||
xmin = min(ix + 2, NUMSECTORS_X - 1);
|
xmin = Min(ix + 2, NUMSECTORS_X - 1);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(y = ymin; y <= ymax; y++){
|
for(y = ymin; y <= ymax; y++){
|
||||||
@ -2234,20 +2234,20 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
}else{
|
}else{
|
||||||
// looking north/south
|
// looking north/south
|
||||||
|
|
||||||
xmin = max(ix - 10, 0);
|
xmin = Max(ix - 10, 0);
|
||||||
xmax = min(ix + 10, NUMSECTORS_X - 1);
|
xmax = Min(ix + 10, NUMSECTORS_X - 1);
|
||||||
assert(xmin <= xmax);
|
assert(xmin <= xmax);
|
||||||
|
|
||||||
// Delete a block of sectors that we know is behind the camera
|
// Delete a block of sectors that we know is behind the camera
|
||||||
if(TheCamera.GetForward().y > 0){
|
if(TheCamera.GetForward().y > 0){
|
||||||
// looking north
|
// looking north
|
||||||
ymax = max(iy - 2, 0);
|
ymax = Max(iy - 2, 0);
|
||||||
ymin = max(iy - 10, 0);
|
ymin = Max(iy - 10, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking south
|
// looking south
|
||||||
ymax = min(iy + 2, NUMSECTORS_Y - 1);
|
ymax = Min(iy + 2, NUMSECTORS_Y - 1);
|
||||||
ymin = min(iy + 10, NUMSECTORS_Y - 1);
|
ymin = Min(iy + 10, NUMSECTORS_Y - 1);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(x = xmin; x <= xmax; x++){
|
for(x = xmin; x <= xmax; x++){
|
||||||
@ -2263,13 +2263,13 @@ CStreaming::DeleteRwObjectsBehindCamera(int32 mem)
|
|||||||
// Now a block that intersects with the camera's frustum
|
// Now a block that intersects with the camera's frustum
|
||||||
if(TheCamera.GetForward().y > 0){
|
if(TheCamera.GetForward().y > 0){
|
||||||
// looking north
|
// looking north
|
||||||
ymax = max(iy + 10, 0);
|
ymax = Max(iy + 10, 0);
|
||||||
ymin = max(iy - 2, 0);
|
ymin = Max(iy - 2, 0);
|
||||||
inc = 1;
|
inc = 1;
|
||||||
}else{
|
}else{
|
||||||
// looking south
|
// looking south
|
||||||
ymax = min(iy - 10, NUMSECTORS_Y - 1);
|
ymax = Min(iy - 10, NUMSECTORS_Y - 1);
|
||||||
ymin = min(iy + 2, NUMSECTORS_Y - 1);
|
ymin = Min(iy + 2, NUMSECTORS_Y - 1);
|
||||||
inc = -1;
|
inc = -1;
|
||||||
}
|
}
|
||||||
for(x = xmin; x <= xmax; x++){
|
for(x = xmin; x <= xmax; x++){
|
||||||
|
@ -71,7 +71,6 @@ struct CStreamingChannel
|
|||||||
};
|
};
|
||||||
|
|
||||||
class CDirectory;
|
class CDirectory;
|
||||||
enum eLevelName;
|
|
||||||
class CPtrList;
|
class CPtrList;
|
||||||
|
|
||||||
class CStreaming
|
class CStreaming
|
||||||
|
@ -138,7 +138,7 @@ void CTimer::Update(void)
|
|||||||
|
|
||||||
if ( !CRecordDataForGame::IsPlayingBack() )
|
if ( !CRecordDataForGame::IsPlayingBack() )
|
||||||
{
|
{
|
||||||
ms_fTimeStep = min(3.0f, ms_fTimeStep);
|
ms_fTimeStep = Min(3.0f, ms_fTimeStep);
|
||||||
|
|
||||||
if ( (m_snTimeInMilliseconds - m_snPreviousTimeInMilliseconds) > 60 )
|
if ( (m_snTimeInMilliseconds - m_snPreviousTimeInMilliseconds) > 60 )
|
||||||
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
|
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
|
||||||
|
@ -212,7 +212,7 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
|
|||||||
else
|
else
|
||||||
sensitivity = m_fCrimeSensitivity;
|
sensitivity = m_fCrimeSensitivity;
|
||||||
|
|
||||||
wantedLevelDrop = min(CCullZones::GetWantedLevelDrop(), 100);
|
wantedLevelDrop = Min(CCullZones::GetWantedLevelDrop(), 100);
|
||||||
|
|
||||||
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
|
chaos = (1.0f - wantedLevelDrop/100.0f) * sensitivity;
|
||||||
if (policeDoesntCare)
|
if (policeDoesntCare)
|
||||||
@ -371,7 +371,7 @@ CWanted::Update(void)
|
|||||||
CVector playerPos = FindPlayerCoors();
|
CVector playerPos = FindPlayerCoors();
|
||||||
if (WorkOutPolicePresence(playerPos, radius) == 0) {
|
if (WorkOutPolicePresence(playerPos, radius) == 0) {
|
||||||
m_nLastUpdateTime = CTimer::GetTimeInMilliseconds();
|
m_nLastUpdateTime = CTimer::GetTimeInMilliseconds();
|
||||||
m_nChaos = max(0, m_nChaos - 1);
|
m_nChaos = Max(0, m_nChaos - 1);
|
||||||
UpdateWantedLevel();
|
UpdateWantedLevel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Crime.h"
|
||||||
|
|
||||||
class CEntity;
|
class CEntity;
|
||||||
class CCopPed;
|
class CCopPed;
|
||||||
|
|
||||||
enum eCrimeType
|
|
||||||
{
|
|
||||||
CRIME_NONE,
|
|
||||||
CRIME_POSSESSION_GUN,
|
|
||||||
CRIME_HIT_PED,
|
|
||||||
CRIME_HIT_COP,
|
|
||||||
CRIME_SHOOT_PED,
|
|
||||||
CRIME_SHOOT_COP,
|
|
||||||
CRIME_STEAL_CAR,
|
|
||||||
CRIME_RUN_REDLIGHT,
|
|
||||||
CRIME_RECKLESS_DRIVING,
|
|
||||||
CRIME_SPEEDING,
|
|
||||||
CRIME_RUNOVER_PED,
|
|
||||||
CRIME_RUNOVER_COP,
|
|
||||||
CRIME_SHOOT_HELI,
|
|
||||||
CRIME_PED_BURNED,
|
|
||||||
CRIME_COP_BURNED,
|
|
||||||
CRIME_VEHICLE_BURNED,
|
|
||||||
CRIME_DESTROYED_CESSNA,
|
|
||||||
NUM_CRIME_TYPES
|
|
||||||
};
|
|
||||||
|
|
||||||
class CCrimeBeingQd
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
eCrimeType m_nType;
|
|
||||||
uint32 m_nId;
|
|
||||||
uint32 m_nTime;
|
|
||||||
CVector m_vecPosn;
|
|
||||||
bool m_bReported;
|
|
||||||
bool m_bPoliceDoesntCare;
|
|
||||||
|
|
||||||
CCrimeBeingQd() { };
|
|
||||||
~CCrimeBeingQd() { };
|
|
||||||
};
|
|
||||||
|
|
||||||
class CWanted
|
class CWanted
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -777,10 +777,10 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float
|
|||||||
*nEntitiesFound = 0;
|
*nEntitiesFound = 0;
|
||||||
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
||||||
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -1045,10 +1045,10 @@ CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bC
|
|||||||
*nCollidingEntities = 0;
|
*nCollidingEntities = 0;
|
||||||
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
||||||
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -1124,10 +1124,10 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
|
|||||||
{
|
{
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
*nIntersecting = 0;
|
*nIntersecting = 0;
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -1205,10 +1205,10 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co
|
|||||||
{
|
{
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
*nEntitiesFound = 0;
|
*nEntitiesFound = 0;
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -1285,10 +1285,10 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CV
|
|||||||
{
|
{
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
*nIntersecting = 0;
|
*nIntersecting = 0;
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -1499,10 +1499,10 @@ CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2)
|
|||||||
float fStartY = y1 - 10.0f;
|
float fStartY = y1 - 10.0f;
|
||||||
float fEndX = x2 + 10.0f;
|
float fEndX = x2 + 10.0f;
|
||||||
float fEndY = y2 + 10.0f;
|
float fEndY = y2 + 10.0f;
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -1544,13 +1544,13 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1
|
|||||||
}
|
}
|
||||||
if(bInsideSphere) {
|
if(bInsideSphere) {
|
||||||
if(pVehicle->GetPosition().x <= (x1 + x2) * 0.5f)
|
if(pVehicle->GetPosition().x <= (x1 + x2) * 0.5f)
|
||||||
pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f);
|
pVehicle->m_vecMoveSpeed.x = Min(pVehicle->m_vecMoveSpeed.x, 0.0f);
|
||||||
else
|
else
|
||||||
pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f);
|
pVehicle->m_vecMoveSpeed.x = Max(pVehicle->m_vecMoveSpeed.x, 0.0f);
|
||||||
if(pVehicle->GetPosition().y <= (y1 + y2) * 0.5f)
|
if(pVehicle->GetPosition().y <= (y1 + y2) * 0.5f)
|
||||||
pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f);
|
pVehicle->m_vecMoveSpeed.y = Min(pVehicle->m_vecMoveSpeed.y, 0.0f);
|
||||||
else
|
else
|
||||||
pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f);
|
pVehicle->m_vecMoveSpeed.y = Max(pVehicle->m_vecMoveSpeed.y, 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2086,10 +2086,10 @@ CWorld::TriggerExplosion(const CVector &position, float fRadius, float fPower, C
|
|||||||
{
|
{
|
||||||
CVector2D vecStartPos(position.x - fRadius, position.y - fRadius);
|
CVector2D vecStartPos(position.x - fRadius, position.y - fRadius);
|
||||||
CVector2D vecEndPos(position.x + fRadius, position.y + fRadius);
|
CVector2D vecEndPos(position.x + fRadius, position.y + fRadius);
|
||||||
const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
||||||
const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
||||||
const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = CWorld::GetSector(x, y);
|
CSector *pSector = CWorld::GetSector(x, y);
|
||||||
@ -2144,7 +2144,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
|
|||||||
if(pEntity->bIsStatic) {
|
if(pEntity->bIsStatic) {
|
||||||
float fDamageMultiplier =
|
float fDamageMultiplier =
|
||||||
(fRadius - fMagnitude) * 2.0f / fRadius;
|
(fRadius - fMagnitude) * 2.0f / fRadius;
|
||||||
float fDamage = 300.0f * min(fDamageMultiplier, 1.0f);
|
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
|
||||||
pObject->ObjectDamage(fDamage);
|
pObject->ObjectDamage(fDamage);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2153,18 +2153,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!pEntity->bIsStatic) {
|
if(!pEntity->bIsStatic) {
|
||||||
float fDamageMultiplier = min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
|
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
|
||||||
CVector vecForceDir =
|
CVector vecForceDir =
|
||||||
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
|
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
|
||||||
max(fMagnitude, 0.01f));
|
Max(fMagnitude, 0.01f));
|
||||||
vecForceDir.z = max(vecForceDir.z, 0.0f);
|
vecForceDir.z = Max(vecForceDir.z, 0.0f);
|
||||||
if(pEntity == FindPlayerPed()) vecForceDir.z = min(vecForceDir.z, 1.0f);
|
if(pEntity == FindPlayerPed()) vecForceDir.z = Min(vecForceDir.z, 1.0f);
|
||||||
pEntity->ApplyMoveForce(vecForceDir);
|
pEntity->ApplyMoveForce(vecForceDir);
|
||||||
if(!pEntity->bPedPhysics) {
|
if(!pEntity->bPedPhysics) {
|
||||||
float fBoundRadius = pEntity->GetBoundRadius();
|
float fBoundRadius = pEntity->GetBoundRadius();
|
||||||
float fDistanceZ = position.z - pEntity->GetPosition().z;
|
float fDistanceZ = position.z - pEntity->GetPosition().z;
|
||||||
float fPointZ = fBoundRadius;
|
float fPointZ = fBoundRadius;
|
||||||
if(max(fDistanceZ, -fBoundRadius) < fBoundRadius) {
|
if(Max(fDistanceZ, -fBoundRadius) < fBoundRadius) {
|
||||||
if(fDistanceZ <= -fBoundRadius)
|
if(fDistanceZ <= -fBoundRadius)
|
||||||
fPointZ = -fBoundRadius;
|
fPointZ = -fBoundRadius;
|
||||||
else
|
else
|
||||||
|
@ -289,7 +289,7 @@ CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel)
|
|||||||
coors.z >= aAttributeZones[i].minz && coors.z <= aAttributeZones[i].maxz){
|
coors.z >= aAttributeZones[i].minz && coors.z <= aAttributeZones[i].maxz){
|
||||||
attribs |= aAttributeZones[i].attributes;
|
attribs |= aAttributeZones[i].attributes;
|
||||||
if(wantedLevel)
|
if(wantedLevel)
|
||||||
*wantedLevel = max(*wantedLevel, aAttributeZones[i].wantedLevel);
|
*wantedLevel = Max(*wantedLevel, aAttributeZones[i].wantedLevel);
|
||||||
}
|
}
|
||||||
return attribs;
|
return attribs;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef WITHWINDOWS
|
#ifdef WITHWINDOWS
|
||||||
#include <Windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITHD3D
|
#ifdef WITHD3D
|
||||||
@ -42,12 +42,8 @@
|
|||||||
#undef near
|
#undef near
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef max
|
#define Max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
#define Min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
|
||||||
#ifndef min
|
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef uint8_t uint8;
|
typedef uint8_t uint8;
|
||||||
typedef int8_t int8;
|
typedef int8_t int8;
|
||||||
@ -62,7 +58,7 @@ typedef int64_t int64;
|
|||||||
typedef uint16_t wchar;
|
typedef uint16_t wchar;
|
||||||
|
|
||||||
#ifndef nil
|
#ifndef nil
|
||||||
#define nil nullptr
|
#define nil NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -276,7 +272,7 @@ class CTweakFunc : public CTweakVar
|
|||||||
void (*m_pFunc)();
|
void (*m_pFunc)();
|
||||||
public:
|
public:
|
||||||
CTweakFunc(void (*pFunc)(), const char *strName, const char *strPath) :
|
CTweakFunc(void (*pFunc)(), const char *strName, const char *strPath) :
|
||||||
m_pFunc(pFunc), m_pVarName(strName), m_pPath(strPath)
|
m_pPath(strPath), m_pVarName(strName), m_pFunc(pFunc)
|
||||||
{
|
{
|
||||||
CTweakVars::Add(this);
|
CTweakVars::Add(this);
|
||||||
}
|
}
|
||||||
@ -290,7 +286,7 @@ class CTweakBool : public CTweakVar
|
|||||||
bool *m_pBoolVar;
|
bool *m_pBoolVar;
|
||||||
public:
|
public:
|
||||||
CTweakBool(bool *pBool, const char *strName, const char *strPath) :
|
CTweakBool(bool *pBool, const char *strName, const char *strPath) :
|
||||||
m_pBoolVar(pBool), m_pVarName(strName), m_pPath(strPath)
|
m_pPath(strPath), m_pVarName(strName), m_pBoolVar(pBool)
|
||||||
{
|
{
|
||||||
CTweakVars::Add(this);
|
CTweakVars::Add(this);
|
||||||
}
|
}
|
||||||
@ -306,9 +302,10 @@ class CTweakSwitch : public CTweakVar
|
|||||||
const char **m_aStr;
|
const char **m_aStr;
|
||||||
void (*m_pFunc)();
|
void (*m_pFunc)();
|
||||||
public:
|
public:
|
||||||
CTweakSwitch(void *pInt, const char *strName, int32 nMin, int32 nMax, const char **aStr, void (*pFunc)(), const char *strPath) :
|
CTweakSwitch(void *pInt, const char *strName, int32 nMin, int32 nMax, const char **aStr,
|
||||||
m_pVarName(strName), m_pPath(strPath),
|
void (*pFunc)(), const char *strPath)
|
||||||
m_aStr(aStr), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax)
|
: m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax),
|
||||||
|
m_aStr(aStr)
|
||||||
{
|
{
|
||||||
CTweakVars::Add(this);
|
CTweakVars::Add(this);
|
||||||
}
|
}
|
||||||
@ -316,22 +313,24 @@ public:
|
|||||||
void AddDBG(const char *path);
|
void AddDBG(const char *path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _TWEEKCLASS(name, type) \
|
#define _TWEEKCLASS(name, type) \
|
||||||
class name : public CTweakVar \
|
class name : public CTweakVar \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
const char *m_pPath, *m_pVarName; \
|
const char *m_pPath, *m_pVarName; \
|
||||||
type *m_pIntVar, m_nLoawerBound, m_nUpperBound, m_nStep; \
|
type *m_pIntVar, m_nLoawerBound, m_nUpperBound, m_nStep; \
|
||||||
\
|
\
|
||||||
name(type *pInt, const char *strName, type nLower, type nUpper, type nStep, const char *strPath) : \
|
name(type *pInt, const char *strName, type nLower, type nUpper, type nStep, \
|
||||||
m_pIntVar(pInt), m_nLoawerBound(nLower), m_nUpperBound(nUpper), m_nStep(nStep), \
|
const char *strPath) \
|
||||||
m_pVarName(strName), m_pPath(strPath) \
|
: m_pPath(strPath), m_pVarName(strName), m_pIntVar(pInt), \
|
||||||
{ \
|
m_nLoawerBound(nLower), m_nUpperBound(nUpper), m_nStep(nStep) \
|
||||||
CTweakVars::Add(this); \
|
\
|
||||||
} \
|
{ \
|
||||||
\
|
CTweakVars::Add(this); \
|
||||||
void AddDBG(const char *path); \
|
} \
|
||||||
};
|
\
|
||||||
|
void AddDBG(const char *path); \
|
||||||
|
};
|
||||||
|
|
||||||
_TWEEKCLASS(CTweakInt8, int8);
|
_TWEEKCLASS(CTweakInt8, int8);
|
||||||
_TWEEKCLASS(CTweakUInt8, uint8);
|
_TWEEKCLASS(CTweakUInt8, uint8);
|
||||||
|
@ -205,7 +205,7 @@ DoFade(void)
|
|||||||
CRGBA fadeColor;
|
CRGBA fadeColor;
|
||||||
CRect rect;
|
CRect rect;
|
||||||
int fadeValue = CDraw::FadeValue;
|
int fadeValue = CDraw::FadeValue;
|
||||||
float brightness = min(CMenuManager::m_PrefsBrightness, 256);
|
float brightness = Min(CMenuManager::m_PrefsBrightness, 256);
|
||||||
if(brightness <= 50)
|
if(brightness <= 50)
|
||||||
brightness = 50;
|
brightness = 50;
|
||||||
if(FrontEndMenuManager.m_bMenuActive)
|
if(FrontEndMenuManager.m_bMenuActive)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
StaticPatcher *StaticPatcher::ms_head;
|
StaticPatcher *StaticPatcher::ms_head;
|
||||||
|
|
||||||
|
@ -102,14 +102,14 @@ void tbDisplay()
|
|||||||
#ifndef FINAL
|
#ifndef FINAL
|
||||||
// Timers output (my own implementation)
|
// Timers output (my own implementation)
|
||||||
for (uint32 i = 0; i < TimerBar.count; i++) {
|
for (uint32 i = 0; i < TimerBar.count; i++) {
|
||||||
MaxTimes[i] = max(MaxTimes[i], TimerBar.Timers[i].endTime - TimerBar.Timers[i].startTime);
|
MaxTimes[i] = Max(MaxTimes[i], TimerBar.Timers[i].endTime - TimerBar.Timers[i].startTime);
|
||||||
sprintf(temp, "%s: %.2f", &TimerBar.Timers[i].name[0], MaxTimes[i]);
|
sprintf(temp, "%s: %.2f", &TimerBar.Timers[i].name[0], MaxTimes[i]);
|
||||||
AsciiToUnicode(temp, wtemp);
|
AsciiToUnicode(temp, wtemp);
|
||||||
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / DEFAULT_SCREEN_HEIGHT), wtemp);
|
CFont::PrintString(RsGlobal.maximumWidth * (4.0f / DEFAULT_SCREEN_WIDTH), RsGlobal.maximumHeight * ((8.0f * (i + 2)) / DEFAULT_SCREEN_HEIGHT), wtemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FRAMETIME
|
#ifdef FRAMETIME
|
||||||
MaxFrameTime = max(MaxFrameTime, FrameEndTime - FrameInitTime);
|
MaxFrameTime = Max(MaxFrameTime, FrameEndTime - FrameInitTime);
|
||||||
sprintf(temp, "Frame Time: %.2f", MaxFrameTime);
|
sprintf(temp, "Frame Time: %.2f", MaxFrameTime);
|
||||||
AsciiToUnicode(temp, wtemp);
|
AsciiToUnicode(temp, wtemp);
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
|
|||||||
{
|
{
|
||||||
float compression = 1.0f - springRatio;
|
float compression = 1.0f - springRatio;
|
||||||
if(compression > 0.0f){
|
if(compression > 0.0f){
|
||||||
float step = min(CTimer::GetTimeStep(), 3.0f);
|
float step = Min(CTimer::GetTimeStep(), 3.0f);
|
||||||
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
|
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
|
||||||
ApplyMoveForce(springDir*impulse);
|
ApplyMoveForce(springDir*impulse);
|
||||||
ApplyTurnForce(springDir*impulse, point);
|
ApplyTurnForce(springDir*impulse, point);
|
||||||
@ -471,12 +471,12 @@ CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &poin
|
|||||||
{
|
{
|
||||||
float speedA = DotProduct(speed, springDir);
|
float speedA = DotProduct(speed, springDir);
|
||||||
float speedB = DotProduct(GetSpeed(point), springDir);
|
float speedB = DotProduct(GetSpeed(point), springDir);
|
||||||
float step = min(CTimer::GetTimeStep(), 3.0f);
|
float step = Min(CTimer::GetTimeStep(), 3.0f);
|
||||||
float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f;
|
float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f;
|
||||||
|
|
||||||
// what is this?
|
// what is this?
|
||||||
float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass);
|
float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass);
|
||||||
a = min(a, 1.0f);
|
a = Min(a, 1.0f);
|
||||||
float b = Abs(impulse / (speedB * m_fMass));
|
float b = Abs(impulse / (speedB * m_fMass));
|
||||||
if(a < b)
|
if(a < b)
|
||||||
impulse *= a/b;
|
impulse *= a/b;
|
||||||
@ -646,7 +646,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
|||||||
// positive if B is moving towards A
|
// positive if B is moving towards A
|
||||||
// not interested in how much B moves into A apparently?
|
// not interested in how much B moves into A apparently?
|
||||||
// only interested in cases where A collided into B
|
// only interested in cases where A collided into B
|
||||||
speedB = max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
|
speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
|
||||||
// A has moved into B
|
// A has moved into B
|
||||||
if(speedA < speedB){
|
if(speedA < speedB){
|
||||||
if(!A->bHasHitWall)
|
if(!A->bHasHitWall)
|
||||||
@ -1147,18 +1147,18 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
|||||||
CVector dir = A->GetPosition() - B->GetPosition();
|
CVector dir = A->GetPosition() - B->GetPosition();
|
||||||
dir.Normalise();
|
dir.Normalise();
|
||||||
if(dir.z < 0.0f && dir.z < A->GetForward().z && dir.z < A->GetRight().z)
|
if(dir.z < 0.0f && dir.z < A->GetForward().z && dir.z < A->GetRight().z)
|
||||||
dir.z = min(0.0f, min(A->GetForward().z, A->GetRight().z));
|
dir.z = Min(0.0f, Min(A->GetForward().z, A->GetRight().z));
|
||||||
shift += dir * colpoints[mostColliding].depth * 0.5f;
|
shift += dir * colpoints[mostColliding].depth * 0.5f;
|
||||||
}else if(A->IsPed() && B->IsVehicle() && ((CVehicle*)B)->IsBoat()){
|
}else if(A->IsPed() && B->IsVehicle() && ((CVehicle*)B)->IsBoat()){
|
||||||
CVector dir = colpoints[mostColliding].normal;
|
CVector dir = colpoints[mostColliding].normal;
|
||||||
float f = min(Abs(dir.z), 0.9f);
|
float f = Min(Abs(dir.z), 0.9f);
|
||||||
dir.z = 0.0f;
|
dir.z = 0.0f;
|
||||||
dir.Normalise();
|
dir.Normalise();
|
||||||
shift += dir * colpoints[mostColliding].depth / (1.0f - f);
|
shift += dir * colpoints[mostColliding].depth / (1.0f - f);
|
||||||
boat = B;
|
boat = B;
|
||||||
}else if(B->IsPed() && A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
|
}else if(B->IsPed() && A->IsVehicle() && ((CVehicle*)A)->IsBoat()){
|
||||||
CVector dir = colpoints[mostColliding].normal * -1.0f;
|
CVector dir = colpoints[mostColliding].normal * -1.0f;
|
||||||
float f = min(Abs(dir.z), 0.9f);
|
float f = Min(Abs(dir.z), 0.9f);
|
||||||
dir.z = 0.0f;
|
dir.z = 0.0f;
|
||||||
dir.Normalise();
|
dir.Normalise();
|
||||||
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
|
B->GetPosition() += dir * colpoints[mostColliding].depth / (1.0f - f);
|
||||||
@ -1246,7 +1246,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
}
|
}
|
||||||
}else if(A->bHasContacted){
|
}else if(A->bHasContacted){
|
||||||
CVector savedMoveFriction = A->m_vecMoveFriction;
|
CVector savedMoveFriction = A->m_vecMoveFriction;
|
||||||
@ -1268,7 +1268,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1301,7 +1301,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1328,7 +1328,7 @@ collision:
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1506,7 +1506,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
||||||
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for(i = 0; i < numCollisions; i++){
|
for(i = 0; i < numCollisions; i++){
|
||||||
@ -1527,7 +1527,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
float turnSpeedDiff = A->m_vecTurnSpeed.MagnitudeSqr();
|
||||||
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
float moveSpeedDiff = A->m_vecMoveSpeed.MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, imp, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
float adhesion = CSurfaceTable::GetAdhesiveLimit(aColPoints[i]) / numCollisions;
|
float adhesion = CSurfaceTable::GetAdhesiveLimit(aColPoints[i]) / numCollisions;
|
||||||
|
|
||||||
@ -1545,7 +1545,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
else if(A->GetUp().z > 0.3f)
|
else if(A->GetUp().z > 0.3f)
|
||||||
adhesion = 0.0f;
|
adhesion = 0.0f;
|
||||||
else
|
else
|
||||||
adhesion *= min(5.0f, 0.03f*impulseA + 1.0f);
|
adhesion *= Min(5.0f, 0.03f*impulseA + 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(A->ApplyFriction(adhesion, aColPoints[i]))
|
if(A->ApplyFriction(adhesion, aColPoints[i]))
|
||||||
@ -1594,7 +1594,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
}
|
}
|
||||||
}else if(A->bHasContacted){
|
}else if(A->bHasContacted){
|
||||||
CVector savedMoveFriction = A->m_vecMoveFriction;
|
CVector savedMoveFriction = A->m_vecMoveFriction;
|
||||||
@ -1619,7 +1619,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1655,7 +1655,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1685,7 +1685,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
float turnSpeedDiff = (B->m_vecTurnSpeed - A->m_vecTurnSpeed).MagnitudeSqr();
|
||||||
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
float moveSpeedDiff = (B->m_vecMoveSpeed - A->m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
|
||||||
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, max(turnSpeedDiff, moveSpeedDiff));
|
DMAudio.ReportCollision(A, B, aColPoints[i].surfaceA, aColPoints[i].surfaceB, impulseA, Max(turnSpeedDiff, moveSpeedDiff));
|
||||||
|
|
||||||
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
if(A->ApplyFriction(B, CSurfaceTable::GetAdhesiveLimit(aColPoints[i])/numCollisions, aColPoints[i])){
|
||||||
A->bHasContacted = true;
|
A->bHasContacted = true;
|
||||||
@ -1831,7 +1831,7 @@ CPhysical::ProcessCollision(void)
|
|||||||
|
|
||||||
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
|
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
|
||||||
if(ped->IsPlayer())
|
if(ped->IsPlayer())
|
||||||
n = max(NUMSTEPS(0.2f), 2.0f);
|
n = Max(NUMSTEPS(0.2f), 2.0f);
|
||||||
else
|
else
|
||||||
n = NUMSTEPS(0.3f);
|
n = NUMSTEPS(0.3f);
|
||||||
step = savedTimeStep / n;
|
step = savedTimeStep / n;
|
||||||
@ -1852,7 +1852,7 @@ CPhysical::ProcessCollision(void)
|
|||||||
speedDown = Multiply3x3(GetMatrix(), speedDown);
|
speedDown = Multiply3x3(GetMatrix(), speedDown);
|
||||||
speedUp = GetSpeed(speedUp);
|
speedUp = GetSpeed(speedUp);
|
||||||
speedDown = GetSpeed(speedDown);
|
speedDown = GetSpeed(speedDown);
|
||||||
distSq = max(speedUp.MagnitudeSqr(), speedDown.MagnitudeSqr()) * sq(CTimer::GetTimeStep());
|
distSq = Max(speedUp.MagnitudeSqr(), speedDown.MagnitudeSqr()) * sq(CTimer::GetTimeStep());
|
||||||
if(distSq >= sq(0.3f)){
|
if(distSq >= sq(0.3f)){
|
||||||
n = NUMSTEPS(0.3f);
|
n = NUMSTEPS(0.3f);
|
||||||
step = savedTimeStep / n;
|
step = savedTimeStep / n;
|
||||||
|
@ -9,6 +9,11 @@ public:
|
|||||||
#ifdef RWCORE_H
|
#ifdef RWCORE_H
|
||||||
CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
|
CVector(const RwV3d &v) : x(v.x), y(v.y), z(v.z) {}
|
||||||
|
|
||||||
|
RwV3d toRwV3d(void) const {
|
||||||
|
RwV3d vecRw = { this->x, this->y, this->z };
|
||||||
|
return vecRw;
|
||||||
|
}
|
||||||
|
|
||||||
operator RwV3d (void) const {
|
operator RwV3d (void) const {
|
||||||
RwV3d vecRw = { this->x, this->y, this->z };
|
RwV3d vecRw = { this->x, this->y, this->z };
|
||||||
return vecRw;
|
return vecRw;
|
||||||
|
@ -214,7 +214,7 @@ CObject::ObjectDamage(float amount)
|
|||||||
++nFrameGen;
|
++nFrameGen;
|
||||||
int32 currentFrame = nFrameGen & 3;
|
int32 currentFrame = nFrameGen & 3;
|
||||||
float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
|
float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
|
||||||
RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue, color.alpha };
|
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom) , color.blue, color.alpha };
|
||||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
||||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
||||||
@ -237,7 +237,7 @@ CObject::ObjectDamage(float amount)
|
|||||||
++nFrameGen;
|
++nFrameGen;
|
||||||
int32 currentFrame = nFrameGen & 3;
|
int32 currentFrame = nFrameGen & 3;
|
||||||
float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 0.5f);
|
float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 0.5f);
|
||||||
RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue * fRandom, color.alpha };
|
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom), uint8(color.blue * fRandom), color.alpha };
|
||||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
||||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Placeable.h"
|
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
|
#include "ParticleType.h"
|
||||||
|
#include "Placeable.h"
|
||||||
|
|
||||||
#define MAX_PARTICLEOBJECTS 100
|
#define MAX_PARTICLEOBJECTS 100
|
||||||
#define MAX_AUDIOHYDRANTS 8
|
#define MAX_AUDIOHYDRANTS 8
|
||||||
@ -37,7 +39,6 @@ enum eParticleObjectState
|
|||||||
POBJECTSTATE_FREE,
|
POBJECTSTATE_FREE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum tParticleType;
|
|
||||||
class CParticle;
|
class CParticle;
|
||||||
|
|
||||||
class CParticleObject : public CPlaceable
|
class CParticleObject : public CPlaceable
|
||||||
|
@ -318,12 +318,12 @@ CCivilianPed::ProcessControl(void)
|
|||||||
if (CWorld::Players[CWorld::PlayerInFocus].m_nMoney >= 10 && playerSexFrequency > 250) {
|
if (CWorld::Players[CWorld::PlayerInFocus].m_nMoney >= 10 && playerSexFrequency > 250) {
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + playerSexFrequency;
|
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + playerSexFrequency;
|
||||||
if (playerSexFrequency >= 350) {
|
if (playerSexFrequency >= 350) {
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = max(250, playerSexFrequency - 30);
|
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = Max(250, playerSexFrequency - 30);
|
||||||
} else {
|
} else {
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = max(250, playerSexFrequency - 10);
|
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = Max(250, playerSexFrequency - 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pMyVehicle->pDriver->m_fHealth = min(125.0f, 1.0f + m_pMyVehicle->pDriver->m_fHealth);
|
m_pMyVehicle->pDriver->m_fHealth = Min(125.0f, 1.0f + m_pMyVehicle->pDriver->m_fHealth);
|
||||||
if (CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency == 250)
|
if (CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency == 250)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000;
|
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000;
|
||||||
} else {
|
} else {
|
||||||
@ -357,7 +357,7 @@ CCivilianPed::ProcessControl(void)
|
|||||||
if (playerMoney <= 1) {
|
if (playerMoney <= 1) {
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = 250;
|
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = 250;
|
||||||
} else {
|
} else {
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = max(0, playerMoney - 1);
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, playerMoney - 1);
|
||||||
}
|
}
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexMoneyUpdateTime = CTimer::GetTimeInMilliseconds() + 1000;
|
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexMoneyUpdateTime = CTimer::GetTimeInMilliseconds() + 1000;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ CCopPed::ClearPursuit(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_bIsInPursuit = false;
|
m_bIsInPursuit = false;
|
||||||
for (int i = 0; i < max(wanted->m_MaxCops, wanted->m_CurrentCops); ++i) {
|
for (int i = 0; i < Max(wanted->m_MaxCops, wanted->m_CurrentCops); ++i) {
|
||||||
if (!foundMyself && wanted->m_pCops[i] == this) {
|
if (!foundMyself && wanted->m_pCops[i] == this) {
|
||||||
wanted->m_pCops[i] = nil;
|
wanted->m_pCops[i] = nil;
|
||||||
--wanted->m_CurrentCops;
|
--wanted->m_CurrentCops;
|
||||||
@ -342,7 +342,7 @@ CCopPed::CopAI(void)
|
|||||||
int oldCopNum = wanted->m_CurrentCops;
|
int oldCopNum = wanted->m_CurrentCops;
|
||||||
int maxCops = wanted->m_MaxCops;
|
int maxCops = wanted->m_MaxCops;
|
||||||
|
|
||||||
for (int i = 0; i < max(maxCops, oldCopNum); i++) {
|
for (int i = 0; i < Max(maxCops, oldCopNum); i++) {
|
||||||
CCopPed *cop = wanted->m_pCops[i];
|
CCopPed *cop = wanted->m_pCops[i];
|
||||||
if (cop && cop->m_fDistanceToTarget > copFarthestToTargetDist) {
|
if (cop && cop->m_fDistanceToTarget > copFarthestToTargetDist) {
|
||||||
copFarthestToTargetDist = cop->m_fDistanceToTarget;
|
copFarthestToTargetDist = cop->m_fDistanceToTarget;
|
||||||
|
@ -344,15 +344,15 @@ CPed::DebugRenderOnePedText(void)
|
|||||||
bitAbove.z += 2.0f;
|
bitAbove.z += 2.0f;
|
||||||
if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
|
if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
|
||||||
|
|
||||||
float lineHeight = SCREEN_SCALE_Y(min(height/100.0f, 0.7f) * 22.0f);
|
float lineHeight = SCREEN_SCALE_Y(Min(height/100.0f, 0.7f) * 22.0f);
|
||||||
|
|
||||||
DefinedState();
|
DefinedState();
|
||||||
CFont::SetPropOn();
|
CFont::SetPropOn();
|
||||||
CFont::SetBackgroundOn();
|
CFont::SetBackgroundOn();
|
||||||
|
|
||||||
// Originally both of them were being divided by 60.0f.
|
// Originally both of them were being divided by 60.0f.
|
||||||
float xScale = min(width / 240.0f, 0.7f);
|
float xScale = Min(width / 240.0f, 0.7f);
|
||||||
float yScale = min(height / 80.0f, 0.7f);
|
float yScale = Min(height / 80.0f, 0.7f);
|
||||||
|
|
||||||
CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
|
CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
|
||||||
CFont::SetCentreOn();
|
CFont::SetCentreOn();
|
||||||
@ -1837,7 +1837,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
case ANIM_VAN_GETIN:
|
case ANIM_VAN_GETIN:
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
multExtractedFromAnim = true;
|
multExtractedFromAnim = true;
|
||||||
zBlend = max(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength - 0.3f, 0.0f) / (1.0f - 0.3f);
|
zBlend = Max(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength - 0.3f, 0.0f) / (1.0f - 0.3f);
|
||||||
// fall through
|
// fall through
|
||||||
#endif
|
#endif
|
||||||
case ANIM_CAR_QJACKED:
|
case ANIM_CAR_QJACKED:
|
||||||
@ -1848,7 +1848,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if (!multExtractedFromAnim) {
|
if (!multExtractedFromAnim) {
|
||||||
multExtractedFromAnim = true;
|
multExtractedFromAnim = true;
|
||||||
zBlend = max(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength - 0.5f, 0.0f) / (1.0f - 0.5f);
|
zBlend = Max(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength - 0.5f, 0.0f) / (1.0f - 0.5f);
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
#endif
|
#endif
|
||||||
@ -1863,7 +1863,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if (veh && veh->IsCar() && veh->bIsBus) {
|
if (veh && veh->IsCar() && veh->bIsBus) {
|
||||||
multExtractedFromAnimBus = true;
|
multExtractedFromAnimBus = true;
|
||||||
zBlend = min(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength, 0.5f) / 0.5f;
|
zBlend = Min(m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength, 0.5f) / 0.5f;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
#endif
|
#endif
|
||||||
@ -1943,7 +1943,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
neededPos.z = autoZPos.z;
|
neededPos.z = autoZPos.z;
|
||||||
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
} else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
|
} else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
|
||||||
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
|
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
|
||||||
|
|
||||||
// Smoothly change ped position
|
// Smoothly change ped position
|
||||||
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
|
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
|
||||||
@ -1965,12 +1965,12 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
if (m_pVehicleAnim &&
|
if (m_pVehicleAnim &&
|
||||||
(vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS
|
(vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS
|
||||||
|| vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) {
|
|| vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) {
|
||||||
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
|
adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f);
|
||||||
|
|
||||||
// Smoothly change ped position
|
// Smoothly change ped position
|
||||||
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
|
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
|
||||||
} else if (EnteringCar()) {
|
} else if (EnteringCar()) {
|
||||||
neededPos.z = max(currentZ, autoZPos.z);
|
neededPos.z = Max(currentZ, autoZPos.z);
|
||||||
}
|
}
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
}
|
}
|
||||||
@ -2511,7 +2511,7 @@ CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
|
|||||||
CVector invDamageNormal(-damageNormal->x, -damageNormal->y, 0.0f);
|
CVector invDamageNormal(-damageNormal->x, -damageNormal->y, 0.0f);
|
||||||
invDamageNormal *= 1.0f / collPower;
|
invDamageNormal *= 1.0f / collPower;
|
||||||
CVector estimatedJumpDist = invDamageNormal + collPower * invDamageNormal * ourCol->spheres->radius;
|
CVector estimatedJumpDist = invDamageNormal + collPower * invDamageNormal * ourCol->spheres->radius;
|
||||||
forwardOffset = estimatedJumpDist * min(2.0f / collPower, 4.0f);
|
forwardOffset = estimatedJumpDist * Min(2.0f / collPower, 4.0f);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos.z -= 0.15f;
|
pos.z -= 0.15f;
|
||||||
@ -5155,12 +5155,12 @@ CPed::FightStrike(CVector &touchedNodePos)
|
|||||||
|
|
||||||
float moveMult;
|
float moveMult;
|
||||||
if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) {
|
if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) {
|
||||||
moveMult = min(damageMult * 0.6f, 4.0f);
|
moveMult = Min(damageMult * 0.6f, 4.0f);
|
||||||
} else {
|
} else {
|
||||||
if (nearPed->m_nPedState != PED_DIE || damageMult >= 20) {
|
if (nearPed->m_nPedState != PED_DIE || damageMult >= 20) {
|
||||||
moveMult = damageMult;
|
moveMult = damageMult;
|
||||||
} else {
|
} else {
|
||||||
moveMult = min(damageMult * 2.0f, 14.0f);
|
moveMult = Min(damageMult * 2.0f, 14.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5884,7 +5884,7 @@ CPed::CreateDeadPedWeaponPickups(void)
|
|||||||
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
|
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
|
||||||
}
|
}
|
||||||
if (found)
|
if (found)
|
||||||
CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, min(weaponAmmo, AmmoForWeapon_OnStreet[weapon]));
|
CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, Min(weaponAmmo, AmmoForWeapon_OnStreet[weapon]));
|
||||||
}
|
}
|
||||||
ClearWeapons();
|
ClearWeapons();
|
||||||
}
|
}
|
||||||
@ -5893,7 +5893,7 @@ void
|
|||||||
CPed::SetAttackTimer(uint32 time)
|
CPed::SetAttackTimer(uint32 time)
|
||||||
{
|
{
|
||||||
if (CTimer::GetTimeInMilliseconds() > m_attackTimer)
|
if (CTimer::GetTimeInMilliseconds() > m_attackTimer)
|
||||||
m_attackTimer = max(m_shootTimer, CTimer::GetTimeInMilliseconds()) + time;
|
m_attackTimer = Max(m_shootTimer, CTimer::GetTimeInMilliseconds()) + time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -8676,7 +8676,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
|
|||||||
distVec.Normalise();
|
distVec.Normalise();
|
||||||
|
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
distVec *= min(car->m_fMass / 1400.0f, 1.0f);
|
distVec *= Min(car->m_fMass / 1400.0f, 1.0f);
|
||||||
#endif
|
#endif
|
||||||
car->ApplyMoveForce(distVec * -100.0f);
|
car->ApplyMoveForce(distVec * -100.0f);
|
||||||
Say(SOUND_PED_DEFEND);
|
Say(SOUND_PED_DEFEND);
|
||||||
@ -8709,7 +8709,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
|
|||||||
m_vecMoveSpeed.z = 0.0f;
|
m_vecMoveSpeed.z = 0.0f;
|
||||||
distVec.Normalise();
|
distVec.Normalise();
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
distVec *= min(car->m_fMass / 1400.0f, 1.0f);
|
distVec *= Min(car->m_fMass / 1400.0f, 1.0f);
|
||||||
#endif
|
#endif
|
||||||
car->ApplyMoveForce(distVec * -60.0f);
|
car->ApplyMoveForce(distVec * -60.0f);
|
||||||
Say(SOUND_PED_DEFEND);
|
Say(SOUND_PED_DEFEND);
|
||||||
@ -10027,7 +10027,7 @@ CPed::ProcessControl(void)
|
|||||||
CVector offsetToCheck;
|
CVector offsetToCheck;
|
||||||
m_nPedStateTimer++;
|
m_nPedStateTimer++;
|
||||||
|
|
||||||
float adjustedTs = max(CTimer::GetTimeStep(), 0.01f);
|
float adjustedTs = Max(CTimer::GetTimeStep(), 0.01f);
|
||||||
|
|
||||||
CPad *pad0 = CPad::GetPad(0);
|
CPad *pad0 = CPad::GetPad(0);
|
||||||
if ((m_nPedStateTimer <= 50.0f / (4.0f * adjustedTs) || m_nPedStateTimer * 0.01f <= forceDir.MagnitudeSqr())
|
if ((m_nPedStateTimer <= 50.0f / (4.0f * adjustedTs) || m_nPedStateTimer * 0.01f <= forceDir.MagnitudeSqr())
|
||||||
@ -10051,7 +10051,7 @@ CPed::ProcessControl(void)
|
|||||||
CColPoint obstacleForFlying, obstacleForFlyingOtherDir;
|
CColPoint obstacleForFlying, obstacleForFlyingOtherDir;
|
||||||
|
|
||||||
// Check is there any room for being knocked up in reverse direction of force
|
// Check is there any room for being knocked up in reverse direction of force
|
||||||
if (CWorld::ProcessVerticalLine(posToCheck, -20.0f, obstacleForFlying, foundEnt, true, false, false, false, false, false, false)) {
|
if (CWorld::ProcessVerticalLine(posToCheck, -20.0f, obstacleForFlying, foundEnt, true, false, false, false, false, false, nil)) {
|
||||||
obstacleForFlyingZ = obstacleForFlying.point.z;
|
obstacleForFlyingZ = obstacleForFlying.point.z;
|
||||||
} else {
|
} else {
|
||||||
obstacleForFlyingZ = 500.0f;
|
obstacleForFlyingZ = 500.0f;
|
||||||
@ -10060,7 +10060,7 @@ CPed::ProcessControl(void)
|
|||||||
posToCheck = GetPosition() - offsetToCheck;
|
posToCheck = GetPosition() - offsetToCheck;
|
||||||
|
|
||||||
// Now check for direction of force this time
|
// Now check for direction of force this time
|
||||||
if (CWorld::ProcessVerticalLine(posToCheck, -20.0f, obstacleForFlyingOtherDir, foundEnt, true, false, false, false, false, false, false)) {
|
if (CWorld::ProcessVerticalLine(posToCheck, -20.0f, obstacleForFlyingOtherDir, foundEnt, true, false, false, false, false, false, nil)) {
|
||||||
obstacleForFlyingOtherDirZ = obstacleForFlyingOtherDir.point.z;
|
obstacleForFlyingOtherDirZ = obstacleForFlyingOtherDir.point.z;
|
||||||
} else {
|
} else {
|
||||||
obstacleForFlyingOtherDirZ = 501.0f;
|
obstacleForFlyingOtherDirZ = 501.0f;
|
||||||
@ -10180,7 +10180,7 @@ CPed::ProcessControl(void)
|
|||||||
offsetToCheck = GetPosition();
|
offsetToCheck = GetPosition();
|
||||||
offsetToCheck.z += 0.5f;
|
offsetToCheck.z += 0.5f;
|
||||||
|
|
||||||
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, false)) {
|
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
|
if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
|
||||||
GetPosition().z = FEET_OFFSET + foundCol.point.z;
|
GetPosition().z = FEET_OFFSET + foundCol.point.z;
|
||||||
@ -12245,7 +12245,7 @@ CPed::PlacePedOnDryLand(void)
|
|||||||
CVector posToCheck = 0.5f * potentialGroundDist + gaTempSphereColPoints[0].point;
|
CVector posToCheck = 0.5f * potentialGroundDist + gaTempSphereColPoints[0].point;
|
||||||
posToCheck.z = 3.0f + waterLevel;
|
posToCheck.z = 3.0f + waterLevel;
|
||||||
|
|
||||||
if (CWorld::ProcessVerticalLine(posToCheck, waterLevel - 1.0f, foundCol, foundEnt, true, true, false, true, false, false, false)) {
|
if (CWorld::ProcessVerticalLine(posToCheck, waterLevel - 1.0f, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
|
||||||
foundColZ = foundCol.point.z;
|
foundColZ = foundCol.point.z;
|
||||||
if (foundColZ >= waterLevel) {
|
if (foundColZ >= waterLevel) {
|
||||||
posToCheck.z = 0.8f + foundColZ;
|
posToCheck.z = 0.8f + foundColZ;
|
||||||
@ -12259,7 +12259,7 @@ CPed::PlacePedOnDryLand(void)
|
|||||||
posToCheck = 5.0f * potentialGroundDist + GetPosition();
|
posToCheck = 5.0f * potentialGroundDist + GetPosition();
|
||||||
posToCheck.z = 3.0f + waterLevel;
|
posToCheck.z = 3.0f + waterLevel;
|
||||||
|
|
||||||
if (!CWorld::ProcessVerticalLine(posToCheck, waterLevel - 1.0f, foundCol, foundEnt, true, true, false, true, false, false, false))
|
if (!CWorld::ProcessVerticalLine(posToCheck, waterLevel - 1.0f, foundCol, foundEnt, true, true, false, true, false, false, nil))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foundColZ = foundCol.point.z;
|
foundColZ = foundCol.point.z;
|
||||||
@ -13975,9 +13975,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
|
|||||||
CVector2D adjustedColMin(objColMin.x - 0.35f, objColMin.y - 0.35f);
|
CVector2D adjustedColMin(objColMin.x - 0.35f, objColMin.y - 0.35f);
|
||||||
CVector2D adjustedColMax(objColMax.x + 0.35f, objColMax.y + 0.35f);
|
CVector2D adjustedColMax(objColMax.x + 0.35f, objColMax.y + 0.35f);
|
||||||
|
|
||||||
checkIntervalInDist = max(checkIntervalInDist, 0.5f);
|
checkIntervalInDist = Max(checkIntervalInDist, 0.5f);
|
||||||
checkIntervalInDist = min(checkIntervalInDist, (objColMax.z - objColMin.z) / 2.0f);
|
checkIntervalInDist = Min(checkIntervalInDist, (objColMax.z - objColMin.z) / 2.0f);
|
||||||
checkIntervalInDist = min(checkIntervalInDist, (adjustedColMax.x - adjustedColMin.x) / 2.0f);
|
checkIntervalInDist = Min(checkIntervalInDist, (adjustedColMax.x - adjustedColMin.x) / 2.0f);
|
||||||
|
|
||||||
if (objMat.GetUp().z < 0.0f)
|
if (objMat.GetUp().z < 0.0f)
|
||||||
objUpsideDown = true;
|
objUpsideDown = true;
|
||||||
@ -14649,7 +14649,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
|||||||
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
|
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float damage = 100.0f * max(speed - 0.25f, 0.0f);
|
float damage = 100.0f * Max(speed - 0.25f, 0.0f);
|
||||||
float damage2 = damage;
|
float damage2 = damage;
|
||||||
if (m_vecMoveSpeed.z < -0.25f)
|
if (m_vecMoveSpeed.z < -0.25f)
|
||||||
damage += (-0.25f - m_vecMoveSpeed.z) * 150.0f;
|
damage += (-0.25f - m_vecMoveSpeed.z) * 150.0f;
|
||||||
@ -14727,8 +14727,8 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
|||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
} else {
|
} else {
|
||||||
float speed = m_vecMoveSpeed.Magnitude2D();
|
float speed = m_vecMoveSpeed.Magnitude2D();
|
||||||
sphereNormal.x = -m_vecMoveSpeed.x / max(0.001f, speed);
|
sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed);
|
||||||
sphereNormal.y = -m_vecMoveSpeed.y / max(0.001f, speed);
|
sphereNormal.y = -m_vecMoveSpeed.y / Max(0.001f, speed);
|
||||||
GetPosition().z -= 0.05f;
|
GetPosition().z -= 0.05f;
|
||||||
bSomeVCflag1 = true;
|
bSomeVCflag1 = true;
|
||||||
}
|
}
|
||||||
@ -15093,7 +15093,7 @@ CPed::ProcessBuoyancy(void)
|
|||||||
bTouchingWater = true;
|
bTouchingWater = true;
|
||||||
CEntity *entity;
|
CEntity *entity;
|
||||||
CColPoint point;
|
CColPoint point;
|
||||||
if (CWorld::ProcessVerticalLine(GetPosition(), GetPosition().z - 3.0f, point, entity, false, true, false, false, false, false, false)
|
if (CWorld::ProcessVerticalLine(GetPosition(), GetPosition().z - 3.0f, point, entity, false, true, false, false, false, false, nil)
|
||||||
&& entity->IsVehicle() && ((CVehicle*)entity)->IsBoat()) {
|
&& entity->IsVehicle() && ((CVehicle*)entity)->IsBoat()) {
|
||||||
bIsInWater = false;
|
bIsInWater = false;
|
||||||
return;
|
return;
|
||||||
@ -15470,7 +15470,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
|
|||||||
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, true, false, false, true, false, nil))
|
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, true, false, false, true, false, nil))
|
||||||
foundColZ2 = foundCol.point.z;
|
foundColZ2 = foundCol.point.z;
|
||||||
|
|
||||||
zForPed = max(foundColZ, foundColZ2);
|
zForPed = Max(foundColZ, foundColZ2);
|
||||||
|
|
||||||
if (zForPed > -99.0f)
|
if (zForPed > -99.0f)
|
||||||
GetPosition().z = FEET_OFFSET + zForPed;
|
GetPosition().z = FEET_OFFSET + zForPed;
|
||||||
@ -17069,7 +17069,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
|
|||||||
|
|
||||||
// Because buses have stairs
|
// Because buses have stairs
|
||||||
if (!m_pMyVehicle->bIsBus)
|
if (!m_pMyVehicle->bIsBus)
|
||||||
zDiff = max(0.0f, doorOpenPos.z - GetPosition().z);
|
zDiff = Max(0.0f, doorOpenPos.z - GetPosition().z);
|
||||||
|
|
||||||
m_vecOffsetSeek = doorOpenPos - GetPosition();
|
m_vecOffsetSeek = doorOpenPos - GetPosition();
|
||||||
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
|
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
|
||||||
@ -17220,7 +17220,7 @@ CPed::WarpPedToNearEntityOffScreen(CEntity *warpTo)
|
|||||||
|
|
||||||
CVector appropriatePos = GetPosition();
|
CVector appropriatePos = GetPosition();
|
||||||
CVector zCorrectedPos = appropriatePos;
|
CVector zCorrectedPos = appropriatePos;
|
||||||
int tryCount = min(10, halfOfDist);
|
int tryCount = Min(10, halfOfDist);
|
||||||
for (int i = 0; i < tryCount; ++i) {
|
for (int i = 0; i < tryCount; ++i) {
|
||||||
appropriatePos += halfNormalizedDist;
|
appropriatePos += halfNormalizedDist;
|
||||||
CPedPlacement::FindZCoorForPed(&zCorrectedPos);
|
CPedPlacement::FindZCoorForPed(&zCorrectedPos);
|
||||||
@ -17254,7 +17254,7 @@ CPed::WarpPedToNearLeaderOffScreen(void)
|
|||||||
|
|
||||||
CVector appropriatePos = GetPosition();
|
CVector appropriatePos = GetPosition();
|
||||||
CVector zCorrectedPos = appropriatePos;
|
CVector zCorrectedPos = appropriatePos;
|
||||||
int tryCount = min(10, halfOfDist);
|
int tryCount = Min(10, halfOfDist);
|
||||||
for (int i = 0; i < tryCount; ++i) {
|
for (int i = 0; i < tryCount; ++i) {
|
||||||
appropriatePos += halfNormalizedDist;
|
appropriatePos += halfNormalizedDist;
|
||||||
CPedPlacement::FindZCoorForPed(&zCorrectedPos);
|
CPedPlacement::FindZCoorForPed(&zCorrectedPos);
|
||||||
@ -17296,7 +17296,7 @@ CPed::SetCarJack_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
|
|||||||
car->m_nGettingInFlags |= doorFlag;
|
car->m_nGettingInFlags |= doorFlag;
|
||||||
m_vecOffsetSeek = carEnterPos - GetPosition();
|
m_vecOffsetSeek = carEnterPos - GetPosition();
|
||||||
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
|
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 600;
|
||||||
float zDiff = max(0.0f, carEnterPos.z - GetPosition().z);
|
float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z);
|
||||||
bUsesCollision = false;
|
bUsesCollision = false;
|
||||||
|
|
||||||
if (zDiff > 4.4f) {
|
if (zDiff > 4.4f) {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "AnimManager.h"
|
||||||
|
#include "Crime.h"
|
||||||
|
#include "EventList.h"
|
||||||
|
#include "PedIK.h"
|
||||||
|
#include "PedStats.h"
|
||||||
#include "Physical.h"
|
#include "Physical.h"
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
#include "PedStats.h"
|
|
||||||
#include "PedIK.h"
|
|
||||||
#include "AnimManager.h"
|
|
||||||
#include "WeaponInfo.h"
|
#include "WeaponInfo.h"
|
||||||
#include "EventList.h"
|
|
||||||
|
|
||||||
#define FEET_OFFSET 1.04f
|
#define FEET_OFFSET 1.04f
|
||||||
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
|
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
|
||||||
@ -17,7 +18,6 @@ class CObject;
|
|||||||
class CFire;
|
class CFire;
|
||||||
struct AnimBlendFrameData;
|
struct AnimBlendFrameData;
|
||||||
class CAnimBlendAssociation;
|
class CAnimBlendAssociation;
|
||||||
enum eCrimeType;
|
|
||||||
|
|
||||||
struct PedAudioData
|
struct PedAudioData
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos)
|
|||||||
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
|
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
|
||||||
foundColZ2 = foundCol.point.z;
|
foundColZ2 = foundCol.point.z;
|
||||||
|
|
||||||
zForPed = max(foundColZ, foundColZ2);
|
zForPed = Max(foundColZ, foundColZ2);
|
||||||
|
|
||||||
if (zForPed > -99.0f)
|
if (zForPed > -99.0f)
|
||||||
pos->z = FEET_OFFSET + zForPed;
|
pos->z = FEET_OFFSET + zForPed;
|
||||||
|
@ -182,7 +182,7 @@ CPlayerPed::MakeChangesForNewWeapon(int8 weapon)
|
|||||||
}
|
}
|
||||||
SetCurrentWeapon(weapon);
|
SetCurrentWeapon(weapon);
|
||||||
|
|
||||||
GetWeapon()->m_nAmmoInClip = min(GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
|
GetWeapon()->m_nAmmoInClip = Min(GetWeapon()->m_nAmmoTotal, CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition);
|
||||||
|
|
||||||
if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAim))
|
if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAim))
|
||||||
ClearWeaponTarget();
|
ClearWeaponTarget();
|
||||||
@ -699,7 +699,7 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed)
|
|||||||
#else
|
#else
|
||||||
m_fRotationDest = CGeneral::LimitRadianAngle(TheCamera.Orientation);
|
m_fRotationDest = CGeneral::LimitRadianAngle(TheCamera.Orientation);
|
||||||
#endif
|
#endif
|
||||||
m_fMoveSpeed = min(padMoveInGameUnit, 0.07f * CTimer::GetTimeStep() + m_fMoveSpeed);
|
m_fMoveSpeed = Min(padMoveInGameUnit, 0.07f * CTimer::GetTimeStep() + m_fMoveSpeed);
|
||||||
} else {
|
} else {
|
||||||
m_fMoveSpeed = 0.0f;
|
m_fMoveSpeed = 0.0f;
|
||||||
}
|
}
|
||||||
@ -1186,7 +1186,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
float maxAcc = 0.07f * CTimer::GetTimeStep();
|
float maxAcc = 0.07f * CTimer::GetTimeStep();
|
||||||
m_fMoveSpeed = min(padMoveInGameUnit, m_fMoveSpeed + maxAcc);
|
m_fMoveSpeed = Min(padMoveInGameUnit, m_fMoveSpeed + maxAcc);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_fMoveSpeed = 0.0f;
|
m_fMoveSpeed = 0.0f;
|
||||||
@ -1406,7 +1406,7 @@ CPlayerPed::ProcessControl(void)
|
|||||||
if (bVehEnterDoorIsBlocked || bKindaStayInSamePlace) {
|
if (bVehEnterDoorIsBlocked || bKindaStayInSamePlace) {
|
||||||
m_fMoveSpeed = 0.0f;
|
m_fMoveSpeed = 0.0f;
|
||||||
} else {
|
} else {
|
||||||
m_fMoveSpeed = min(2.0f, 2.0f * (m_vecSeekPos - GetPosition()).Magnitude2D());
|
m_fMoveSpeed = Min(2.0f, 2.0f * (m_vecSeekPos - GetPosition()).Magnitude2D());
|
||||||
}
|
}
|
||||||
if (padUsed && !padUsed->ArePlayerControlsDisabled()) {
|
if (padUsed && !padUsed->ArePlayerControlsDisabled()) {
|
||||||
if (padUsed->GetTarget() || padUsed->GetLeftStickXJustDown() || padUsed->GetLeftStickYJustDown() ||
|
if (padUsed->GetTarget() || padUsed->GetLeftStickXJustDown() || padUsed->GetLeftStickYJustDown() ||
|
||||||
|
@ -595,7 +595,7 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
|
|||||||
}
|
}
|
||||||
// Yeah, float
|
// Yeah, float
|
||||||
float maxPossiblePedsForArea = (zoneInfo.pedDensity + zoneInfo.carDensity) * playerInfo->m_fRoadDensity * PedDensityMultiplier * CIniFile::PedNumberMultiplier;
|
float maxPossiblePedsForArea = (zoneInfo.pedDensity + zoneInfo.carDensity) * playerInfo->m_fRoadDensity * PedDensityMultiplier * CIniFile::PedNumberMultiplier;
|
||||||
maxPossiblePedsForArea = min(maxPossiblePedsForArea, MaxNumberOfPedsInUse);
|
maxPossiblePedsForArea = Min(maxPossiblePedsForArea, MaxNumberOfPedsInUse);
|
||||||
|
|
||||||
if (ms_nTotalPeds < maxPossiblePedsForArea || addCop) {
|
if (ms_nTotalPeds < maxPossiblePedsForArea || addCop) {
|
||||||
int decisionThreshold = CGeneral::GetRandomNumberInRange(0, 1000);
|
int decisionThreshold = CGeneral::GetRandomNumberInRange(0, 1000);
|
||||||
@ -703,7 +703,7 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
|
|||||||
if (!foundGround)
|
if (!foundGround)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
generatedCoors.z = max(generatedCoors.z, groundZ);
|
generatedCoors.z = Max(generatedCoors.z, groundZ);
|
||||||
}
|
}
|
||||||
bool farEnoughToAdd = true;
|
bool farEnoughToAdd = true;
|
||||||
CMatrix mat(TheCamera.GetCameraMatrix());
|
CMatrix mat(TheCamera.GetCameraMatrix());
|
||||||
|
@ -388,7 +388,7 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
|
|||||||
ms_colourBottom.b = topblue;
|
ms_colourBottom.b = topblue;
|
||||||
ms_colourBottom.a = alpha;
|
ms_colourBottom.a = alpha;
|
||||||
|
|
||||||
botpos = min(SCREEN_HEIGHT, topedge);
|
botpos = Min(SCREEN_HEIGHT, topedge);
|
||||||
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
|
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
|
||||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||||
}
|
}
|
||||||
@ -415,18 +415,18 @@ CClouds::RenderHorizon(void)
|
|||||||
if(ms_horizonZ > SCREEN_HEIGHT)
|
if(ms_horizonZ > SCREEN_HEIGHT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
|
float z1 = Min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
|
||||||
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1),
|
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1),
|
||||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||||
|
|
||||||
// This is just weird
|
// This is just weird
|
||||||
float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT +
|
float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT +
|
||||||
SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f);
|
SCREEN_HEIGHT/300.0f * Max(TheCamera.GetPosition().z, 0.0f);
|
||||||
float b = TheCamera.GetUp().z < 0.0f ?
|
float b = TheCamera.GetUp().z < 0.0f ?
|
||||||
SCREEN_HEIGHT :
|
SCREEN_HEIGHT :
|
||||||
SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
|
SCREEN_HEIGHT * Abs(TheCamera.GetRight().z);
|
||||||
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
|
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
|
||||||
z2 = min(z2, SCREEN_HEIGHT);
|
z2 = Min(z2, SCREEN_HEIGHT);
|
||||||
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
|
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
|
||||||
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ CCoronas::Update(void)
|
|||||||
int i;
|
int i;
|
||||||
static int LastCamLook = 0;
|
static int LastCamLook = 0;
|
||||||
|
|
||||||
LightsMult = min(LightsMult + 0.03f * CTimer::GetTimeStep(), 1.0f);
|
LightsMult = Min(LightsMult + 0.03f * CTimer::GetTimeStep(), 1.0f);
|
||||||
|
|
||||||
int CamLook = 0;
|
int CamLook = 0;
|
||||||
if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) CamLook |= 1;
|
if(TheCamera.Cams[TheCamera.ActiveCam].LookingLeft) CamLook |= 1;
|
||||||
@ -118,7 +118,7 @@ CCoronas::Update(void)
|
|||||||
if(LastCamLook != CamLook)
|
if(LastCamLook != CamLook)
|
||||||
bChangeBrightnessImmediately = 3;
|
bChangeBrightnessImmediately = 3;
|
||||||
else
|
else
|
||||||
bChangeBrightnessImmediately = max(bChangeBrightnessImmediately-1, 0);
|
bChangeBrightnessImmediately = Max(bChangeBrightnessImmediately-1, 0);
|
||||||
LastCamLook = CamLook;
|
LastCamLook = CamLook;
|
||||||
|
|
||||||
for(i = 0; i < NUMCORONAS; i++)
|
for(i = 0; i < NUMCORONAS; i++)
|
||||||
@ -305,7 +305,7 @@ CCoronas::Render(void)
|
|||||||
|
|
||||||
// render corona itself
|
// render corona itself
|
||||||
if(aCoronas[i].texture){
|
if(aCoronas[i].texture){
|
||||||
float fogscale = CWeather::Foggyness*min(spriteCoors.z, 40.0f)/40.0f + 1.0f;
|
float fogscale = CWeather::Foggyness*Min(spriteCoors.z, 40.0f)/40.0f + 1.0f;
|
||||||
if(CCoronas::aCoronas[i].id == SUN_CORE)
|
if(CCoronas::aCoronas[i].id == SUN_CORE)
|
||||||
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
|
spriteCoors.z = 0.95f * RwCameraGetFarClipPlane(Scene.camera);
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(aCoronas[i].texture));
|
||||||
@ -316,7 +316,7 @@ CCoronas::Render(void)
|
|||||||
float f = 1.0f - aCoronas[i].someAngle*2.0f/PI;
|
float f = 1.0f - aCoronas[i].someAngle*2.0f/PI;
|
||||||
float wscale = 6.0f*sq(sq(sq(f))) + 0.5f;
|
float wscale = 6.0f*sq(sq(sq(f))) + 0.5f;
|
||||||
float hscale = 0.35f - (wscale - 0.5f) * 0.06f;
|
float hscale = 0.35f - (wscale - 0.5f) * 0.06f;
|
||||||
hscale = max(hscale, 0.15f);
|
hscale = Max(hscale, 0.15f);
|
||||||
|
|
||||||
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||||
spritew * aCoronas[i].size * wscale,
|
spritew * aCoronas[i].size * wscale,
|
||||||
@ -466,7 +466,7 @@ CCoronas::RenderReflections(void)
|
|||||||
float spritew, spriteh;
|
float spritew, spriteh;
|
||||||
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
|
if(CSprite::CalcScreenCoors(coors, spriteCoors, &spritew, &spriteh, true)){
|
||||||
float drawDist = 0.75f * aCoronas[i].drawDist;
|
float drawDist = 0.75f * aCoronas[i].drawDist;
|
||||||
drawDist = min(drawDist, 50.0f);
|
drawDist = Min(drawDist, 50.0f);
|
||||||
if(spriteCoors.z < drawDist){
|
if(spriteCoors.z < drawDist){
|
||||||
float fadeDistance = drawDist / 2.0f;
|
float fadeDistance = drawDist / 2.0f;
|
||||||
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
|
float distanceFade = spriteCoors.z < fadeDistance ? 1.0f : 1.0f - (spriteCoors.z - fadeDistance)/fadeDistance;
|
||||||
@ -545,25 +545,25 @@ CRegisteredCorona::Update(void)
|
|||||||
(CCoronas::SunBlockedByClouds && id == CCoronas::SUN_CORONA ||
|
(CCoronas::SunBlockedByClouds && id == CCoronas::SUN_CORONA ||
|
||||||
!CWorld::GetIsLineOfSightClear(coors, TheCamera.GetPosition(), true, false, false, false, false, false))){
|
!CWorld::GetIsLineOfSightClear(coors, TheCamera.GetPosition(), true, false, false, false, false, false))){
|
||||||
// Corona is blocked, fade out
|
// Corona is blocked, fade out
|
||||||
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
||||||
}else if(offScreen){
|
}else if(offScreen){
|
||||||
// Same when off screen
|
// Same when off screen
|
||||||
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), 0.0f);
|
||||||
}else{
|
}else{
|
||||||
// Visible
|
// Visible
|
||||||
if(alpha > fadeAlpha){
|
if(alpha > fadeAlpha){
|
||||||
// fade in
|
// fade in
|
||||||
fadeAlpha = min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
|
fadeAlpha = Min(fadeAlpha + 15.0f*CTimer::GetTimeStep(), alpha);
|
||||||
if(CCoronas::bChangeBrightnessImmediately)
|
if(CCoronas::bChangeBrightnessImmediately)
|
||||||
fadeAlpha = alpha;
|
fadeAlpha = alpha;
|
||||||
}else if(alpha < fadeAlpha){
|
}else if(alpha < fadeAlpha){
|
||||||
// too visible, decrease alpha but not below alpha
|
// too visible, decrease alpha but not below alpha
|
||||||
fadeAlpha = max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), alpha);
|
fadeAlpha = Max(fadeAlpha - 15.0f*CTimer::GetTimeStep(), alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
// darken scene when the sun is visible
|
// darken scene when the sun is visible
|
||||||
if(id == CCoronas::SUN_CORONA)
|
if(id == CCoronas::SUN_CORONA)
|
||||||
CCoronas::LightsMult = max(CCoronas::LightsMult - CTimer::GetTimeStep()*0.06f, 0.6f);
|
CCoronas::LightsMult = Max(CCoronas::LightsMult - CTimer::GetTimeStep()*0.06f, 0.6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove if invisible
|
// remove if invisible
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "AudioScriptObject.h"
|
#include "AudioScriptObject.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "TimeCycle.h"
|
#include "Timecycle.h"
|
||||||
#include "Particle.h"
|
#include "Particle.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "RenderBuffer.h"
|
#include "RenderBuffer.h"
|
||||||
@ -617,12 +617,12 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
|
|||||||
CVector c = object->GetMatrix() * col->vertices[2];
|
CVector c = object->GetMatrix() * col->vertices[2];
|
||||||
CVector d = object->GetMatrix() * col->vertices[3];
|
CVector d = object->GetMatrix() * col->vertices[3];
|
||||||
|
|
||||||
float minx = min(min(a.x, b.x), min(c.x, d.x));
|
float minx = Min(Min(a.x, b.x), Min(c.x, d.x));
|
||||||
float maxx = max(max(a.x, b.x), max(c.x, d.x));
|
float maxx = Max(Max(a.x, b.x), Max(c.x, d.x));
|
||||||
float miny = min(min(a.y, b.y), min(c.y, d.y));
|
float miny = Min(Min(a.y, b.y), Min(c.y, d.y));
|
||||||
float maxy = max(max(a.y, b.y), max(c.y, d.y));
|
float maxy = Max(Max(a.y, b.y), Max(c.y, d.y));
|
||||||
float minz = min(min(a.z, b.z), min(c.z, d.z));
|
float minz = Min(Min(a.z, b.z), Min(c.z, d.z));
|
||||||
float maxz = max(max(a.z, b.z), max(c.z, d.z));
|
float maxz = Max(Max(a.z, b.z), Max(c.z, d.z));
|
||||||
|
|
||||||
|
|
||||||
if ( amount > 300.0f )
|
if ( amount > 300.0f )
|
||||||
|
@ -136,7 +136,7 @@ void CHud::Draw()
|
|||||||
if (DrawCrossHair || DrawCrossHairPC) {
|
if (DrawCrossHair || DrawCrossHairPC) {
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
|
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
|
||||||
|
|
||||||
SpriteBrightness = min(SpriteBrightness+1, 30);
|
SpriteBrightness = Min(SpriteBrightness+1, 30);
|
||||||
|
|
||||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ void CHud::Draw()
|
|||||||
} else {
|
} else {
|
||||||
int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer);
|
int counter = atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
counter = min(counter, 100);
|
counter = Min(counter, 100);
|
||||||
#endif
|
#endif
|
||||||
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80));
|
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80));
|
||||||
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(counter) / 2.0f + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET + 50.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255));
|
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(counter) / 2.0f + SCREEN_SCALE_FROM_RIGHT(TIMER_RIGHT_OFFSET + 50.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255));
|
||||||
@ -1206,7 +1206,7 @@ void CHud::DrawAfterFade()
|
|||||||
OddJob2On = 2;
|
OddJob2On = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fStep = min(40.0f, OddJob2XOffset / 6.0f);
|
fStep = Min(40.0f, OddJob2XOffset / 6.0f);
|
||||||
OddJob2XOffset = OddJob2XOffset - fStep;
|
OddJob2XOffset = OddJob2XOffset - fStep;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1217,7 +1217,7 @@ void CHud::DrawAfterFade()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
fStep = max(30.0f, OddJob2XOffset / 5.0f);
|
fStep = Max(30.0f, OddJob2XOffset / 5.0f);
|
||||||
|
|
||||||
OddJob2XOffset = OddJob2XOffset - fStep;
|
OddJob2XOffset = OddJob2XOffset - fStep;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void cParticleSystemMgr::LoadParticleData()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CFG_PARAM_INITIAL_COLOR_VARIATION:
|
case CFG_PARAM_INITIAL_COLOR_VARIATION:
|
||||||
entry->m_InitialColorVariation = min(atoi(value), 100);
|
entry->m_InitialColorVariation = Min(atoi(value), 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CFG_PARAM_FADE_DESTINATION_COLOR_R:
|
case CFG_PARAM_FADE_DESTINATION_COLOR_R:
|
||||||
|
@ -1,82 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class CParticle;
|
#include "ParticleType.h"
|
||||||
|
|
||||||
enum tParticleType
|
class CParticle;
|
||||||
{
|
|
||||||
PARTICLE_SPARK = 0,
|
|
||||||
PARTICLE_SPARK_SMALL,
|
|
||||||
PARTICLE_WHEEL_DIRT,
|
|
||||||
PARTICLE_WHEEL_WATER,
|
|
||||||
PARTICLE_BLOOD,
|
|
||||||
PARTICLE_BLOOD_SMALL,
|
|
||||||
PARTICLE_BLOOD_SPURT,
|
|
||||||
PARTICLE_DEBRIS,
|
|
||||||
PARTICLE_DEBRIS2,
|
|
||||||
PARTICLE_WATER,
|
|
||||||
PARTICLE_FLAME,
|
|
||||||
PARTICLE_FIREBALL,
|
|
||||||
PARTICLE_GUNFLASH,
|
|
||||||
PARTICLE_GUNFLASH_NOANIM,
|
|
||||||
PARTICLE_GUNSMOKE,
|
|
||||||
PARTICLE_GUNSMOKE2,
|
|
||||||
PARTICLE_SMOKE,
|
|
||||||
PARTICLE_SMOKE_SLOWMOTION,
|
|
||||||
PARTICLE_GARAGEPAINT_SPRAY,
|
|
||||||
PARTICLE_SHARD,
|
|
||||||
PARTICLE_SPLASH,
|
|
||||||
PARTICLE_CARFLAME,
|
|
||||||
PARTICLE_STEAM,
|
|
||||||
PARTICLE_STEAM2,
|
|
||||||
PARTICLE_STEAM_NY,
|
|
||||||
PARTICLE_STEAM_NY_SLOWMOTION,
|
|
||||||
PARTICLE_ENGINE_STEAM,
|
|
||||||
PARTICLE_RAINDROP,
|
|
||||||
PARTICLE_RAINDROP_SMALL,
|
|
||||||
PARTICLE_RAIN_SPLASH,
|
|
||||||
PARTICLE_RAIN_SPLASH_BIGGROW,
|
|
||||||
PARTICLE_RAIN_SPLASHUP,
|
|
||||||
PARTICLE_WATERSPRAY,
|
|
||||||
PARTICLE_EXPLOSION_MEDIUM,
|
|
||||||
PARTICLE_EXPLOSION_LARGE,
|
|
||||||
PARTICLE_EXPLOSION_MFAST,
|
|
||||||
PARTICLE_EXPLOSION_LFAST,
|
|
||||||
PARTICLE_CAR_SPLASH,
|
|
||||||
PARTICLE_BOAT_SPLASH,
|
|
||||||
PARTICLE_BOAT_THRUSTJET,
|
|
||||||
PARTICLE_BOAT_WAKE,
|
|
||||||
PARTICLE_WATER_HYDRANT,
|
|
||||||
PARTICLE_WATER_CANNON,
|
|
||||||
PARTICLE_EXTINGUISH_STEAM,
|
|
||||||
PARTICLE_PED_SPLASH,
|
|
||||||
PARTICLE_PEDFOOT_DUST,
|
|
||||||
PARTICLE_HELI_DUST,
|
|
||||||
PARTICLE_HELI_ATTACK,
|
|
||||||
PARTICLE_ENGINE_SMOKE,
|
|
||||||
PARTICLE_ENGINE_SMOKE2,
|
|
||||||
PARTICLE_CARFLAME_SMOKE,
|
|
||||||
PARTICLE_FIREBALL_SMOKE,
|
|
||||||
PARTICLE_PAINT_SMOKE,
|
|
||||||
PARTICLE_TREE_LEAVES,
|
|
||||||
PARTICLE_CARCOLLISION_DUST,
|
|
||||||
PARTICLE_CAR_DEBRIS,
|
|
||||||
PARTICLE_HELI_DEBRIS,
|
|
||||||
PARTICLE_EXHAUST_FUMES,
|
|
||||||
PARTICLE_RUBBER_SMOKE,
|
|
||||||
PARTICLE_BURNINGRUBBER_SMOKE,
|
|
||||||
PARTICLE_BULLETHIT_SMOKE,
|
|
||||||
PARTICLE_GUNSHELL_FIRST,
|
|
||||||
PARTICLE_GUNSHELL,
|
|
||||||
PARTICLE_GUNSHELL_BUMP1,
|
|
||||||
PARTICLE_GUNSHELL_BUMP2,
|
|
||||||
PARTICLE_TEST,
|
|
||||||
PARTICLE_BIRD_FRONT,
|
|
||||||
PARTICLE_RAINDROP_2D,
|
|
||||||
|
|
||||||
MAX_PARTICLES,
|
|
||||||
PARTICLE_FIRST = PARTICLE_SPARK,
|
|
||||||
PARTICLE_LAST = PARTICLE_RAINDROP_2D
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
77
src/render/ParticleType.h
Normal file
77
src/render/ParticleType.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum tParticleType
|
||||||
|
{
|
||||||
|
PARTICLE_SPARK = 0,
|
||||||
|
PARTICLE_SPARK_SMALL,
|
||||||
|
PARTICLE_WHEEL_DIRT,
|
||||||
|
PARTICLE_WHEEL_WATER,
|
||||||
|
PARTICLE_BLOOD,
|
||||||
|
PARTICLE_BLOOD_SMALL,
|
||||||
|
PARTICLE_BLOOD_SPURT,
|
||||||
|
PARTICLE_DEBRIS,
|
||||||
|
PARTICLE_DEBRIS2,
|
||||||
|
PARTICLE_WATER,
|
||||||
|
PARTICLE_FLAME,
|
||||||
|
PARTICLE_FIREBALL,
|
||||||
|
PARTICLE_GUNFLASH,
|
||||||
|
PARTICLE_GUNFLASH_NOANIM,
|
||||||
|
PARTICLE_GUNSMOKE,
|
||||||
|
PARTICLE_GUNSMOKE2,
|
||||||
|
PARTICLE_SMOKE,
|
||||||
|
PARTICLE_SMOKE_SLOWMOTION,
|
||||||
|
PARTICLE_GARAGEPAINT_SPRAY,
|
||||||
|
PARTICLE_SHARD,
|
||||||
|
PARTICLE_SPLASH,
|
||||||
|
PARTICLE_CARFLAME,
|
||||||
|
PARTICLE_STEAM,
|
||||||
|
PARTICLE_STEAM2,
|
||||||
|
PARTICLE_STEAM_NY,
|
||||||
|
PARTICLE_STEAM_NY_SLOWMOTION,
|
||||||
|
PARTICLE_ENGINE_STEAM,
|
||||||
|
PARTICLE_RAINDROP,
|
||||||
|
PARTICLE_RAINDROP_SMALL,
|
||||||
|
PARTICLE_RAIN_SPLASH,
|
||||||
|
PARTICLE_RAIN_SPLASH_BIGGROW,
|
||||||
|
PARTICLE_RAIN_SPLASHUP,
|
||||||
|
PARTICLE_WATERSPRAY,
|
||||||
|
PARTICLE_EXPLOSION_MEDIUM,
|
||||||
|
PARTICLE_EXPLOSION_LARGE,
|
||||||
|
PARTICLE_EXPLOSION_MFAST,
|
||||||
|
PARTICLE_EXPLOSION_LFAST,
|
||||||
|
PARTICLE_CAR_SPLASH,
|
||||||
|
PARTICLE_BOAT_SPLASH,
|
||||||
|
PARTICLE_BOAT_THRUSTJET,
|
||||||
|
PARTICLE_BOAT_WAKE,
|
||||||
|
PARTICLE_WATER_HYDRANT,
|
||||||
|
PARTICLE_WATER_CANNON,
|
||||||
|
PARTICLE_EXTINGUISH_STEAM,
|
||||||
|
PARTICLE_PED_SPLASH,
|
||||||
|
PARTICLE_PEDFOOT_DUST,
|
||||||
|
PARTICLE_HELI_DUST,
|
||||||
|
PARTICLE_HELI_ATTACK,
|
||||||
|
PARTICLE_ENGINE_SMOKE,
|
||||||
|
PARTICLE_ENGINE_SMOKE2,
|
||||||
|
PARTICLE_CARFLAME_SMOKE,
|
||||||
|
PARTICLE_FIREBALL_SMOKE,
|
||||||
|
PARTICLE_PAINT_SMOKE,
|
||||||
|
PARTICLE_TREE_LEAVES,
|
||||||
|
PARTICLE_CARCOLLISION_DUST,
|
||||||
|
PARTICLE_CAR_DEBRIS,
|
||||||
|
PARTICLE_HELI_DEBRIS,
|
||||||
|
PARTICLE_EXHAUST_FUMES,
|
||||||
|
PARTICLE_RUBBER_SMOKE,
|
||||||
|
PARTICLE_BURNINGRUBBER_SMOKE,
|
||||||
|
PARTICLE_BULLETHIT_SMOKE,
|
||||||
|
PARTICLE_GUNSHELL_FIRST,
|
||||||
|
PARTICLE_GUNSHELL,
|
||||||
|
PARTICLE_GUNSHELL_BUMP1,
|
||||||
|
PARTICLE_GUNSHELL_BUMP2,
|
||||||
|
PARTICLE_TEST,
|
||||||
|
PARTICLE_BIRD_FRONT,
|
||||||
|
PARTICLE_RAINDROP_2D,
|
||||||
|
|
||||||
|
MAX_PARTICLES,
|
||||||
|
PARTICLE_FIRST = PARTICLE_SPARK,
|
||||||
|
PARTICLE_LAST = PARTICLE_RAINDROP_2D
|
||||||
|
};
|
@ -98,7 +98,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
|
|||||||
|
|
||||||
if(aLights[i].type == LIGHT_DIRECTIONAL){
|
if(aLights[i].type == LIGHT_DIRECTIONAL){
|
||||||
float dot = -DotProduct(dir, aLights[i].dir);
|
float dot = -DotProduct(dir, aLights[i].dir);
|
||||||
intensity *= max((dot-0.5f)*2.0f, 0.0f);
|
intensity *= Max((dot-0.5f)*2.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(intensity > 0.0f)
|
if(intensity > 0.0f)
|
||||||
|
@ -217,9 +217,9 @@ CRubbish::Update(void)
|
|||||||
|
|
||||||
// FRAMETIME
|
// FRAMETIME
|
||||||
if(bRubbishInvisible)
|
if(bRubbishInvisible)
|
||||||
RubbishVisibility = max(RubbishVisibility-5, 0);
|
RubbishVisibility = Max(RubbishVisibility-5, 0);
|
||||||
else
|
else
|
||||||
RubbishVisibility = min(RubbishVisibility+5, 255);
|
RubbishVisibility = Min(RubbishVisibility+5, 255);
|
||||||
|
|
||||||
// Spawn a new sheet
|
// Spawn a new sheet
|
||||||
COneSheet *sheet = StartEmptyList.m_next;
|
COneSheet *sheet = StartEmptyList.m_next;
|
||||||
|
@ -719,10 +719,10 @@ CShadows::RenderStoredShadows(void)
|
|||||||
float fStartY = shadowPos.y - fHeight;
|
float fStartY = shadowPos.y - fHeight;
|
||||||
float fEndY = shadowPos.y + fHeight;
|
float fEndY = shadowPos.y + fHeight;
|
||||||
|
|
||||||
int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||||
int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||||
int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||||
int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||||
|
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
|
|
||||||
@ -865,10 +865,10 @@ CShadows::GeneratePolysForStaticShadow(int16 nStaticShadowID)
|
|||||||
float fStartY = shadowPos.y - fHeight;
|
float fStartY = shadowPos.y - fHeight;
|
||||||
float fEndY = shadowPos.y + fHeight;
|
float fEndY = shadowPos.y + fHeight;
|
||||||
|
|
||||||
int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
|
int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||||
int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
|
int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||||
int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X-1);
|
||||||
int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y-1);
|
||||||
|
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
|
|
||||||
@ -1008,11 +1008,11 @@ CShadows::CastShadowEntity(CEntity *pEntity, float fStartX, float fStartY, floa
|
|||||||
Points[3].x = (fLengthRight - fFrontRight) - fSideRight;
|
Points[3].x = (fLengthRight - fFrontRight) - fSideRight;
|
||||||
Points[3].y = (fLengthForward - fFrontForward) - fSideForward;
|
Points[3].y = (fLengthForward - fFrontForward) - fSideForward;
|
||||||
|
|
||||||
float MinX = min(min(Points[0].x, Points[1].x), min(Points[2].x, Points[3].x));
|
float MinX = Min(Min(Points[0].x, Points[1].x), Min(Points[2].x, Points[3].x));
|
||||||
float MaxX = max(max(Points[0].x, Points[1].x), max(Points[2].x, Points[3].x));
|
float MaxX = Max(Max(Points[0].x, Points[1].x), Max(Points[2].x, Points[3].x));
|
||||||
|
|
||||||
float MinY = min(min(Points[0].y, Points[1].y), min(Points[2].y, Points[3].y));
|
float MinY = Min(Min(Points[0].y, Points[1].y), Min(Points[2].y, Points[3].y));
|
||||||
float MaxY = max(max(Points[0].y, Points[1].y), max(Points[2].y, Points[3].y));
|
float MaxY = Max(Max(Points[0].y, Points[1].y), Max(Points[2].y, Points[3].y));
|
||||||
|
|
||||||
float MaxZ = pPosn->z - pEntity->GetPosition().z;
|
float MaxZ = pPosn->z - pEntity->GetPosition().z;
|
||||||
float MinZ = MaxZ - fZDistance;
|
float MinZ = MaxZ - fZDistance;
|
||||||
@ -1763,7 +1763,7 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur
|
|||||||
{
|
{
|
||||||
ASSERT(pPosn != NULL);
|
ASSERT(pPosn != NULL);
|
||||||
|
|
||||||
C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, max(fFrontX, -fSideY),
|
C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, Max(fFrontX, -fSideY),
|
||||||
0, 128, 255, 128,
|
0, 128, 255, 128,
|
||||||
2048, 0.2f, 0);
|
2048, 0.2f, 0);
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ CTimeCycle::Update(void)
|
|||||||
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
|
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL);
|
||||||
|
|
||||||
if(m_FogReduction != 0)
|
if(m_FogReduction != 0)
|
||||||
m_fCurrentFarClip = max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
|
m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);
|
||||||
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
|
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
|
||||||
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
|
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;
|
||||||
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
|
m_nCurrentFogColourBlue = (m_nCurrentSkyTopBlue + 2*m_nCurrentSkyBottomBlue) / 3;
|
||||||
@ -311,7 +311,7 @@ CTimeCycle::Update(void)
|
|||||||
|
|
||||||
if(TheCamera.GetForward().z < -0.9f ||
|
if(TheCamera.GetForward().z < -0.9f ||
|
||||||
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
|
!CWeather::bScriptsForceRain && (CCullZones::PlayerNoRain() || CCullZones::CamNoRain() || CCutsceneMgr::IsRunning()))
|
||||||
m_FogReduction = min(m_FogReduction+1, 64);
|
m_FogReduction = Min(m_FogReduction+1, 64);
|
||||||
else
|
else
|
||||||
m_FogReduction = max(m_FogReduction-1, 0);
|
m_FogReduction = Max(m_FogReduction-1, 0);
|
||||||
}
|
}
|
||||||
|
@ -195,14 +195,14 @@ void CWaterCannon::PushPeds(void)
|
|||||||
{
|
{
|
||||||
if ( m_abUsed[i] )
|
if ( m_abUsed[i] )
|
||||||
{
|
{
|
||||||
minx = min(minx, m_avecPos[i].x);
|
minx = Min(minx, m_avecPos[i].x);
|
||||||
maxx = max(maxx, m_avecPos[i].x);
|
maxx = Max(maxx, m_avecPos[i].x);
|
||||||
|
|
||||||
miny = min(miny, m_avecPos[i].y);
|
miny = Min(miny, m_avecPos[i].y);
|
||||||
maxy = max(maxy, m_avecPos[i].y);
|
maxy = Max(maxy, m_avecPos[i].y);
|
||||||
|
|
||||||
minz = min(minz, m_avecPos[i].z);
|
minz = Min(minz, m_avecPos[i].z);
|
||||||
maxz = max(maxz, m_avecPos[i].z);
|
maxz = Max(maxz, m_avecPos[i].z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +979,7 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
|
|||||||
SMALL_SECTOR_SIZE / 2,
|
SMALL_SECTOR_SIZE / 2,
|
||||||
apBoatList) )
|
apBoatList) )
|
||||||
{
|
{
|
||||||
float fWakeColor = fAdd1 - max(255.0f - float(color.blue + color.red + color.green) / 3, fAdd2);
|
float fWakeColor = fAdd1 - Max(255.0f - float(color.blue + color.red + color.green) / 3, fAdd2);
|
||||||
|
|
||||||
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
|
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
|
||||||
RpGeometry *geom = apGeomArray[nGeomUsed++];
|
RpGeometry *geom = apGeomArray[nGeomUsed++];
|
||||||
@ -1035,9 +1035,9 @@ CWaterLevel::RenderOneWavySector(float fX, float fY, float fZ, RwRGBA const &col
|
|||||||
|
|
||||||
RwRGBAAssign(&wakeColor, &color);
|
RwRGBAAssign(&wakeColor, &color);
|
||||||
|
|
||||||
wakeColor.red = min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
|
wakeColor.red = Min(color.red + int32(fWakeColor * fRedMult * fDistMult), 255);
|
||||||
wakeColor.green = min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
|
wakeColor.green = Min(color.green + int32(fWakeColor * fGreenMult * fDistMult), 255);
|
||||||
wakeColor.blue = min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
|
wakeColor.blue = Min(color.blue + int32(fWakeColor * fBlueMult * fDistMult), 255);
|
||||||
|
|
||||||
RwRGBAAssign(&geomPreLights[9*i+j], &wakeColor);
|
RwRGBAAssign(&geomPreLights[9*i+j], &wakeColor);
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ CWaterLevel::CalcDistanceToWater(float fX, float fY)
|
|||||||
fSectorY + SMALL_SECTOR_SIZE - fY
|
fSectorY + SMALL_SECTOR_SIZE - fY
|
||||||
);
|
);
|
||||||
|
|
||||||
fDistSqr = min(vecDist.MagnitudeSqr(), fDistSqr);
|
fDistSqr = Min(vecDist.MagnitudeSqr(), fDistSqr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ void CWeather::Update(void)
|
|||||||
else {
|
else {
|
||||||
// 0.125 probability
|
// 0.125 probability
|
||||||
LightningBurst = false;
|
LightningBurst = false;
|
||||||
LightningDuration = min(CTimer::GetFrameCounter() - LightningStart, 20);
|
LightningDuration = Min(CTimer::GetFrameCounter() - LightningStart, 20);
|
||||||
LightningFlash = false;
|
LightningFlash = false;
|
||||||
WhenToPlayLightningSound = CTimer::GetTimeInMilliseconds() + 150 * (20 - LightningDuration);
|
WhenToPlayLightningSound = CTimer::GetTimeInMilliseconds() + 150 * (20 - LightningDuration);
|
||||||
}
|
}
|
||||||
@ -219,9 +219,9 @@ void CWeather::Update(void)
|
|||||||
fNewRain = 0.0f;
|
fNewRain = 0.0f;
|
||||||
if (Rain != fNewRain) { // ok to use comparasion
|
if (Rain != fNewRain) { // ok to use comparasion
|
||||||
if (Rain < fNewRain)
|
if (Rain < fNewRain)
|
||||||
Rain = min(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
|
Rain = Min(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
|
||||||
else
|
else
|
||||||
Rain = max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
|
Rain = Max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clouds
|
// Clouds
|
||||||
|
@ -37,9 +37,9 @@ SetLightsWithTimeOfDayColour(RpWorld *)
|
|||||||
AmbientLightColourForFrame.green = 1.0f;
|
AmbientLightColourForFrame.green = 1.0f;
|
||||||
AmbientLightColourForFrame.blue = 1.0f;
|
AmbientLightColourForFrame.blue = 1.0f;
|
||||||
}
|
}
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = min(1.0f, AmbientLightColourForFrame.red*1.3f);
|
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame.red*1.3f);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = min(1.0f, AmbientLightColourForFrame.green*1.3f);
|
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame.green*1.3f);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = min(1.0f, AmbientLightColourForFrame.blue*1.3f);
|
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame.blue*1.3f);
|
||||||
RpLightSetColor(pAmbient, &AmbientLightColourForFrame);
|
RpLightSetColor(pAmbient, &AmbientLightColourForFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,20 +70,20 @@ SetLightsWithTimeOfDayColour(RpWorld *)
|
|||||||
float f1 = 2.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
float f1 = 2.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
||||||
float f2 = 3.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
float f2 = 3.0f * (CMenuManager::m_PrefsBrightness/256.0f - 1.0f) * 0.6f + 1.0f;
|
||||||
|
|
||||||
AmbientLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * f2);
|
AmbientLightColourForFrame.red = Min(1.0f, AmbientLightColourForFrame.red * f2);
|
||||||
AmbientLightColourForFrame.green = min(1.0f, AmbientLightColourForFrame.green * f2);
|
AmbientLightColourForFrame.green = Min(1.0f, AmbientLightColourForFrame.green * f2);
|
||||||
AmbientLightColourForFrame.blue = min(1.0f, AmbientLightColourForFrame.blue * f2);
|
AmbientLightColourForFrame.blue = Min(1.0f, AmbientLightColourForFrame.blue * f2);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.red = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.red * f1);
|
AmbientLightColourForFrame_PedsCarsAndObjects.red = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.red * f1);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.green = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.green * f1);
|
AmbientLightColourForFrame_PedsCarsAndObjects.green = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.green * f1);
|
||||||
AmbientLightColourForFrame_PedsCarsAndObjects.blue = min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.blue * f1);
|
AmbientLightColourForFrame_PedsCarsAndObjects.blue = Min(1.0f, AmbientLightColourForFrame_PedsCarsAndObjects.blue * f1);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
DirectionalLightColourForFrame.red = min(1.0f, DirectionalLightColourForFrame.red * f1);
|
DirectionalLightColourForFrame.red = Min(1.0f, DirectionalLightColourForFrame.red * f1);
|
||||||
DirectionalLightColourForFrame.green = min(1.0f, DirectionalLightColourForFrame.green * f1);
|
DirectionalLightColourForFrame.green = Min(1.0f, DirectionalLightColourForFrame.green * f1);
|
||||||
DirectionalLightColourForFrame.blue = min(1.0f, DirectionalLightColourForFrame.blue * f1);
|
DirectionalLightColourForFrame.blue = Min(1.0f, DirectionalLightColourForFrame.blue * f1);
|
||||||
#else
|
#else
|
||||||
DirectionalLightColourForFrame.red = min(1.0f, AmbientLightColourForFrame.red * f1);
|
DirectionalLightColourForFrame.red = Min(1.0f, AmbientLightColourForFrame.red * f1);
|
||||||
DirectionalLightColourForFrame.green = min(1.0f, AmbientLightColourForFrame.green * f1);
|
DirectionalLightColourForFrame.green = Min(1.0f, AmbientLightColourForFrame.green * f1);
|
||||||
DirectionalLightColourForFrame.blue = min(1.0f, AmbientLightColourForFrame.blue * f1);
|
DirectionalLightColourForFrame.blue = Min(1.0f, AmbientLightColourForFrame.blue * f1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ AddAnExtraDirectionalLight(RpWorld *world, float dirx, float diry, float dirz, f
|
|||||||
RwRGBAReal color;
|
RwRGBAReal color;
|
||||||
RwV3d *dir;
|
RwV3d *dir;
|
||||||
|
|
||||||
strength = max(max(red, green), blue);
|
strength = Max(Max(red, green), blue);
|
||||||
n = -1;
|
n = -1;
|
||||||
if(NumExtraDirLightsInWorld < NUMEXTRADIRECTIONALS)
|
if(NumExtraDirLightsInWorld < NUMEXTRADIRECTIONALS)
|
||||||
n = NumExtraDirLightsInWorld;
|
n = NumExtraDirLightsInWorld;
|
||||||
@ -221,7 +221,7 @@ AddAnExtraDirectionalLight(RpWorld *world, float dirx, float diry, float dirz, f
|
|||||||
RwFrameUpdateObjects(RpLightGetFrame(pExtraDirectionals[n]));
|
RwFrameUpdateObjects(RpLightGetFrame(pExtraDirectionals[n]));
|
||||||
RpLightSetFlags(pExtraDirectionals[n], rpLIGHTLIGHTATOMICS);
|
RpLightSetFlags(pExtraDirectionals[n], rpLIGHTLIGHTATOMICS);
|
||||||
LightStrengths[n] = strength;
|
LightStrengths[n] = strength;
|
||||||
NumExtraDirLightsInWorld = min(NumExtraDirLightsInWorld+1, NUMEXTRADIRECTIONALS);
|
NumExtraDirLightsInWorld = Min(NumExtraDirLightsInWorld+1, NUMEXTRADIRECTIONALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -692,7 +692,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
if(m_aSuspensionSpringRatio[i] < 1.0f)
|
if(m_aSuspensionSpringRatio[i] < 1.0f)
|
||||||
m_aWheelTimer[i] = 4.0f;
|
m_aWheelTimer[i] = 4.0f;
|
||||||
else
|
else
|
||||||
m_aWheelTimer[i] = max(m_aWheelTimer[i]-CTimer::GetTimeStep(), 0.0f);
|
m_aWheelTimer[i] = Max(m_aWheelTimer[i]-CTimer::GetTimeStep(), 0.0f);
|
||||||
|
|
||||||
if(m_aWheelTimer[i] > 0.0f){
|
if(m_aWheelTimer[i] > 0.0f){
|
||||||
m_nWheelsOnGround++;
|
m_nWheelsOnGround++;
|
||||||
@ -1010,7 +1010,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
|
|
||||||
if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){
|
if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){
|
||||||
if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
|
if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
|
||||||
m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.0005f, 0.0f);
|
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f);
|
||||||
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
|
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
|
||||||
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
|
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
|
||||||
FlyingControl(FLIGHT_MODEL_DODO);
|
FlyingControl(FLIGHT_MODEL_DODO);
|
||||||
@ -1018,7 +1018,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
FlyingControl(FLIGHT_MODEL_RCPLANE);
|
FlyingControl(FLIGHT_MODEL_RCPLANE);
|
||||||
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
|
}else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
|
||||||
if(CPad::GetPad(0)->GetCircleJustDown())
|
if(CPad::GetPad(0)->GetCircleJustDown())
|
||||||
m_aWheelSpeed[0] = max(m_aWheelSpeed[0]-0.03f, 0.0f);
|
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.03f, 0.0f);
|
||||||
if(m_aWheelSpeed[0] < 0.22f)
|
if(m_aWheelSpeed[0] < 0.22f)
|
||||||
m_aWheelSpeed[0] += 0.0001f;
|
m_aWheelSpeed[0] += 0.0001f;
|
||||||
if(m_aWheelSpeed[0] > 0.15f)
|
if(m_aWheelSpeed[0] > 0.15f)
|
||||||
@ -1130,10 +1130,10 @@ CAutomobile::ProcessControl(void)
|
|||||||
if(speed > sq(0.1f)){
|
if(speed > sq(0.1f)){
|
||||||
speed = Sqrt(speed);
|
speed = Sqrt(speed);
|
||||||
if(suspShake > 0.0f){
|
if(suspShake > 0.0f){
|
||||||
uint8 freq = min(200.0f*suspShake*speed*2000.0f/m_fMass + 100.0f, 250.0f);
|
uint8 freq = Min(200.0f*suspShake*speed*2000.0f/m_fMass + 100.0f, 250.0f);
|
||||||
CPad::GetPad(0)->StartShake(20000.0f*CTimer::GetTimeStep()/freq, freq);
|
CPad::GetPad(0)->StartShake(20000.0f*CTimer::GetTimeStep()/freq, freq);
|
||||||
}else{
|
}else{
|
||||||
uint8 freq = min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 145.0f);
|
uint8 freq = Min(200.0f*surfShake*speed*2000.0f/m_fMass + 40.0f, 145.0f);
|
||||||
CPad::GetPad(0)->StartShake(5000.0f*CTimer::GetTimeStep()/freq, freq);
|
CPad::GetPad(0)->StartShake(5000.0f*CTimer::GetTimeStep()/freq, freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2601,7 +2601,7 @@ CAutomobile::HydraulicControl(void)
|
|||||||
float minz = pos.z + extendedLowerLimit - wheelRadius;
|
float minz = pos.z + extendedLowerLimit - wheelRadius;
|
||||||
if(minz < specialColModel->boundingBox.min.z)
|
if(minz < specialColModel->boundingBox.min.z)
|
||||||
specialColModel->boundingBox.min.z = minz;
|
specialColModel->boundingBox.min.z = minz;
|
||||||
float radius = max(specialColModel->boundingBox.min.Magnitude(), specialColModel->boundingBox.max.Magnitude());
|
float radius = Max(specialColModel->boundingBox.min.Magnitude(), specialColModel->boundingBox.max.Magnitude());
|
||||||
if(specialColModel->boundingSphere.radius < radius)
|
if(specialColModel->boundingSphere.radius < radius)
|
||||||
specialColModel->boundingSphere.radius = radius;
|
specialColModel->boundingSphere.radius = radius;
|
||||||
|
|
||||||
@ -2700,10 +2700,10 @@ CAutomobile::HydraulicControl(void)
|
|||||||
float front = -rear;
|
float front = -rear;
|
||||||
float right = CPad::GetPad(0)->GetCarGunLeftRight()/128.0f;
|
float right = CPad::GetPad(0)->GetCarGunLeftRight()/128.0f;
|
||||||
float left = -right;
|
float left = -right;
|
||||||
suspChange[CARWHEEL_FRONT_LEFT] = max(front+left, 0.0f);
|
suspChange[CARWHEEL_FRONT_LEFT] = Max(front+left, 0.0f);
|
||||||
suspChange[CARWHEEL_REAR_LEFT] = max(rear+left, 0.0f);
|
suspChange[CARWHEEL_REAR_LEFT] = Max(rear+left, 0.0f);
|
||||||
suspChange[CARWHEEL_FRONT_RIGHT] = max(front+right, 0.0f);
|
suspChange[CARWHEEL_FRONT_RIGHT] = Max(front+right, 0.0f);
|
||||||
suspChange[CARWHEEL_REAR_RIGHT] = max(rear+right, 0.0f);
|
suspChange[CARWHEEL_REAR_RIGHT] = Max(rear+right, 0.0f);
|
||||||
|
|
||||||
if(m_hydraulicState < 100){
|
if(m_hydraulicState < 100){
|
||||||
// Lowered, move wheels up
|
// Lowered, move wheels up
|
||||||
@ -2819,7 +2819,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
ApplyTurnForce(impulse, point);
|
ApplyTurnForce(impulse, point);
|
||||||
|
|
||||||
CVector initialSpeed = m_vecMoveSpeed;
|
CVector initialSpeed = m_vecMoveSpeed;
|
||||||
float timeStep = max(CTimer::GetTimeStep(), 0.01f);
|
float timeStep = Max(CTimer::GetTimeStep(), 0.01f);
|
||||||
float impulseRatio = impulse.z / (GRAVITY * m_fMass * timeStep);
|
float impulseRatio = impulse.z / (GRAVITY * m_fMass * timeStep);
|
||||||
float waterResistance = Pow(1.0f - 0.05f*impulseRatio, CTimer::GetTimeStep());
|
float waterResistance = Pow(1.0f - 0.05f*impulseRatio, CTimer::GetTimeStep());
|
||||||
m_vecMoveSpeed *= waterResistance;
|
m_vecMoveSpeed *= waterResistance;
|
||||||
@ -2912,7 +2912,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
float fSpeed = vSpeed.MagnitudeSqr();
|
float fSpeed = vSpeed.MagnitudeSqr();
|
||||||
if(fSpeed > sq(0.05f)){
|
if(fSpeed > sq(0.05f)){
|
||||||
fSpeed = Sqrt(fSpeed);
|
fSpeed = Sqrt(fSpeed);
|
||||||
float size = min((fSpeed < 0.15f ? 0.25f : 0.75f)*fSpeed, 0.6f);
|
float size = Min((fSpeed < 0.15f ? 0.25f : 0.75f)*fSpeed, 0.6f);
|
||||||
CVector right = 0.2f*fSpeed*GetRight() + 0.2f*vSpeed;
|
CVector right = 0.2f*fSpeed*GetRight() + 0.2f*vSpeed;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_PED_SPLASH,
|
CParticle::AddParticle(PARTICLE_PED_SPLASH,
|
||||||
@ -2994,11 +2994,11 @@ CAutomobile::DoDriveByShootings(void)
|
|||||||
|
|
||||||
// TODO: what is this?
|
// TODO: what is this?
|
||||||
if(!lookingLeft && m_weaponDoorTimerLeft > 0.0f){
|
if(!lookingLeft && m_weaponDoorTimerLeft > 0.0f){
|
||||||
m_weaponDoorTimerLeft = max(m_weaponDoorTimerLeft - CTimer::GetTimeStep()*0.1f, 0.0f);
|
m_weaponDoorTimerLeft = Max(m_weaponDoorTimerLeft - CTimer::GetTimeStep()*0.1f, 0.0f);
|
||||||
ProcessOpenDoor(CAR_DOOR_LF, NUM_ANIMS, m_weaponDoorTimerLeft);
|
ProcessOpenDoor(CAR_DOOR_LF, NUM_ANIMS, m_weaponDoorTimerLeft);
|
||||||
}
|
}
|
||||||
if(!lookingRight && m_weaponDoorTimerRight > 0.0f){
|
if(!lookingRight && m_weaponDoorTimerRight > 0.0f){
|
||||||
m_weaponDoorTimerRight = max(m_weaponDoorTimerRight - CTimer::GetTimeStep()*0.1f, 0.0f);
|
m_weaponDoorTimerRight = Max(m_weaponDoorTimerRight - CTimer::GetTimeStep()*0.1f, 0.0f);
|
||||||
ProcessOpenDoor(CAR_DOOR_RF, NUM_ANIMS, m_weaponDoorTimerRight);
|
ProcessOpenDoor(CAR_DOOR_RF, NUM_ANIMS, m_weaponDoorTimerRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3146,7 +3146,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
|
|||||||
FindPlayerPed()->SetWantedLevelNoDrop(1);
|
FindPlayerPed()->SetWantedLevelNoDrop(1);
|
||||||
|
|
||||||
if(m_status == STATUS_PLAYER && impulse > 50.0f){
|
if(m_status == STATUS_PLAYER && impulse > 50.0f){
|
||||||
uint8 freq = min(0.4f*impulse*2000.0f/m_fMass + 100.0f, 250.0f);
|
uint8 freq = Min(0.4f*impulse*2000.0f/m_fMass + 100.0f, 250.0f);
|
||||||
CPad::GetPad(0)->StartShake(40000/freq, freq);
|
CPad::GetPad(0)->StartShake(40000/freq, freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3299,7 +3299,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
|
|||||||
|
|
||||||
if(m_pDamageEntity && m_pDamageEntity == FindPlayerVehicle() && impulse > 10.0f){
|
if(m_pDamageEntity && m_pDamageEntity == FindPlayerVehicle() && impulse > 10.0f){
|
||||||
int money = (doubleMoney ? 2 : 1) * impulse*pHandling->nMonetaryValue/1000000.0f;
|
int money = (doubleMoney ? 2 : 1) * impulse*pHandling->nMonetaryValue/1000000.0f;
|
||||||
money = min(money, 40);
|
money = Min(money, 40);
|
||||||
if(money > 2){
|
if(money > 2){
|
||||||
sprintf(gString, "$%d", money);
|
sprintf(gString, "$%d", money);
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += money;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += money;
|
||||||
@ -4004,7 +4004,7 @@ CAutomobile::SetupSuspensionLines(void)
|
|||||||
// adjust col model to include suspension lines
|
// adjust col model to include suspension lines
|
||||||
if(colModel->boundingBox.min.z > colModel->lines[0].p1.z)
|
if(colModel->boundingBox.min.z > colModel->lines[0].p1.z)
|
||||||
colModel->boundingBox.min.z = colModel->lines[0].p1.z;
|
colModel->boundingBox.min.z = colModel->lines[0].p1.z;
|
||||||
float radius = max(colModel->boundingBox.min.Magnitude(), colModel->boundingBox.max.Magnitude());
|
float radius = Max(colModel->boundingBox.min.Magnitude(), colModel->boundingBox.max.Magnitude());
|
||||||
if(colModel->boundingSphere.radius < radius)
|
if(colModel->boundingSphere.radius < radius)
|
||||||
colModel->boundingSphere.radius = radius;
|
colModel->boundingSphere.radius = radius;
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ CBoat::ProcessControl(void)
|
|||||||
impulse = m_vecMoveSpeed.MagnitudeSqr()*pHandling->fSuspensionForceLevel*buoyanceImpulse.z*CTimer::GetTimeStep()*0.5f*m_fGasPedal;
|
impulse = m_vecMoveSpeed.MagnitudeSqr()*pHandling->fSuspensionForceLevel*buoyanceImpulse.z*CTimer::GetTimeStep()*0.5f*m_fGasPedal;
|
||||||
else
|
else
|
||||||
impulse = 0.0f;
|
impulse = 0.0f;
|
||||||
impulse = min(impulse, GRAVITY*pHandling->fSuspensionDampingLevel*m_fMass*CTimer::GetTimeStep());
|
impulse = Min(impulse, GRAVITY*pHandling->fSuspensionDampingLevel*m_fMass*CTimer::GetTimeStep());
|
||||||
ApplyMoveForce(impulse*GetUp());
|
ApplyMoveForce(impulse*GetUp());
|
||||||
ApplyTurnForce(impulse*GetUp(), buoyancePoint - pHandling->fSuspensionBias*GetForward());
|
ApplyTurnForce(impulse*GetUp(), buoyancePoint - pHandling->fSuspensionBias*GetForward());
|
||||||
}
|
}
|
||||||
@ -375,10 +375,10 @@ CBoat::ProcessControl(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Slow down or push down boat as it approaches the world limits
|
// Slow down or push down boat as it approaches the world limits
|
||||||
m_vecMoveSpeed.x = min(m_vecMoveSpeed.x, -(GetPosition().x - 1900.0f)*0.01f); // east
|
m_vecMoveSpeed.x = Min(m_vecMoveSpeed.x, -(GetPosition().x - 1900.0f)*0.01f); // east
|
||||||
m_vecMoveSpeed.x = max(m_vecMoveSpeed.x, -(GetPosition().x - -1515.0f)*0.01f); // west
|
m_vecMoveSpeed.x = Max(m_vecMoveSpeed.x, -(GetPosition().x - -1515.0f)*0.01f); // west
|
||||||
m_vecMoveSpeed.y = min(m_vecMoveSpeed.y, -(GetPosition().y - 600.0f)*0.01f); // north
|
m_vecMoveSpeed.y = Min(m_vecMoveSpeed.y, -(GetPosition().y - 600.0f)*0.01f); // north
|
||||||
m_vecMoveSpeed.y = max(m_vecMoveSpeed.y, -(GetPosition().y - -1900.0f)*0.01f); // south
|
m_vecMoveSpeed.y = Max(m_vecMoveSpeed.y, -(GetPosition().y - -1900.0f)*0.01f); // south
|
||||||
|
|
||||||
if(!onLand && bBoatInWater)
|
if(!onLand && bBoatInWater)
|
||||||
ApplyWaterResistance();
|
ApplyWaterResistance();
|
||||||
@ -765,7 +765,7 @@ CBoat::IsVertexAffectedByWake(CVector vecVertex, CBoat *pBoat)
|
|||||||
float fDist = vecDist.MagnitudeSqr();
|
float fDist = vecDist.MagnitudeSqr();
|
||||||
|
|
||||||
if ( fDist < SQR(fMaxDist) )
|
if ( fDist < SQR(fMaxDist) )
|
||||||
return 1.0f - min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
|
return 1.0f - Min(fRangeMult * Sqrt(fDist / SQR(fMaxDist)) + (WAKE_LIFETIME - pBoat->m_afWakePointLifeTime[i]) * fTimeMult, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@ -837,7 +837,7 @@ CBoat::AddWakePoint(CVector point)
|
|||||||
int i;
|
int i;
|
||||||
if(m_afWakePointLifeTime[0] > 0.0f){
|
if(m_afWakePointLifeTime[0] > 0.0f){
|
||||||
if((CVector2D(GetPosition()) - m_avec2dWakePoints[0]).MagnitudeSqr() < SQR(1.0f)){
|
if((CVector2D(GetPosition()) - m_avec2dWakePoints[0]).MagnitudeSqr() < SQR(1.0f)){
|
||||||
for(i = min(m_nNumWakePoints, ARRAY_SIZE(m_afWakePointLifeTime)-1); i != 0; i--){
|
for(i = Min(m_nNumWakePoints, ARRAY_SIZE(m_afWakePointLifeTime)-1); i != 0; i--){
|
||||||
m_avec2dWakePoints[i] = m_avec2dWakePoints[i-1];
|
m_avec2dWakePoints[i] = m_avec2dWakePoints[i-1];
|
||||||
m_afWakePointLifeTime[i] = m_afWakePointLifeTime[i-1];
|
m_afWakePointLifeTime[i] = m_afWakePointLifeTime[i-1];
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void CCarGenerator::Setup(float x, float y, float z, float angle, int32 mi, int1
|
|||||||
m_bIsBlocking = false;
|
m_bIsBlocking = false;
|
||||||
m_vecInf = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.min;
|
m_vecInf = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.min;
|
||||||
m_vecSup = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.max;
|
m_vecSup = CModelInfo::GetModelInfo(m_nModelIndex)->GetColModel()->boundingBox.max;
|
||||||
m_fSize = max(m_vecInf.Magnitude(), m_vecSup.Magnitude());
|
m_fSize = Max(m_vecInf.Magnitude(), m_vecSup.Magnitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCarGenerator::CheckForBlockage()
|
bool CCarGenerator::CheckForBlockage()
|
||||||
|
@ -213,10 +213,10 @@ void CCrane::Update(void)
|
|||||||
CTimer::GetTimeInMilliseconds() > m_nTimeForNextCheck) {
|
CTimer::GetTimeInMilliseconds() > m_nTimeForNextCheck) {
|
||||||
CWorld::AdvanceCurrentScanCode();
|
CWorld::AdvanceCurrentScanCode();
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
int xstart = max(0, CWorld::GetSectorIndexX(m_fPickupX1));
|
int xstart = Max(0, CWorld::GetSectorIndexX(m_fPickupX1));
|
||||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(m_fPickupX2));
|
int xend = Min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(m_fPickupX2));
|
||||||
int ystart = max(0, CWorld::GetSectorIndexY(m_fPickupY1));
|
int ystart = Max(0, CWorld::GetSectorIndexY(m_fPickupY1));
|
||||||
int yend = min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(m_fPickupY2));
|
int yend = Min(NUMSECTORS_Y - 1, CWorld::GetSectorIndexY(m_fPickupY2));
|
||||||
#else
|
#else
|
||||||
int xstart = CWorld::GetSectorIndexX(m_fPickupX1);
|
int xstart = CWorld::GetSectorIndexX(m_fPickupX1);
|
||||||
int xend = CWorld::GetSectorIndexX(m_fPickupX2);
|
int xend = CWorld::GetSectorIndexX(m_fPickupX2);
|
||||||
|
@ -231,19 +231,19 @@ CHeli::ProcessControl(void)
|
|||||||
switch(m_heliStatus){
|
switch(m_heliStatus){
|
||||||
case HELI_STATUS_HOVER:
|
case HELI_STATUS_HOVER:
|
||||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 8.0f;
|
m_fTargetZ = Max(groundZ, m_fTargetZ) + 8.0f;
|
||||||
break;
|
break;
|
||||||
case HELI_STATUS_SHOT_DOWN:
|
case HELI_STATUS_SHOT_DOWN:
|
||||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
m_fTargetZ = Max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
||||||
break;
|
break;
|
||||||
case HELI_STATUS_HOVER2:
|
case HELI_STATUS_HOVER2:
|
||||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
m_fTargetZ = Max(groundZ, m_fTargetZ) + 8.0f + m_fTargetOffset;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
groundZ = CWorld::FindGroundZFor3DCoord(GetPosition().x, GetPosition().y, 1000.0f, nil);
|
||||||
m_fTargetZ = max(groundZ, m_fTargetZ) + 12.0f;
|
m_fTargetZ = Max(groundZ, m_fTargetZ) + 12.0f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,7 +1017,7 @@ CHeli::TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, i
|
|||||||
float distToHeli = (pHelis[i]->GetPosition() - *line0).Magnitude();
|
float distToHeli = (pHelis[i]->GetPosition() - *line0).Magnitude();
|
||||||
CVector line = (*line1 - *line0);
|
CVector line = (*line1 - *line0);
|
||||||
float lineLength = line.Magnitude();
|
float lineLength = line.Magnitude();
|
||||||
*bulletPos = *line0 + line*max(1.0f, distToHeli-5.0f);
|
*bulletPos = *line0 + line*Max(1.0f, distToHeli-5.0f);
|
||||||
|
|
||||||
pHelis[i]->m_nBulletDamage += damage;
|
pHelis[i]->m_nBulletDamage += damage;
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
|||||||
right = -contactSpeedRight/wheelsOnGround;
|
right = -contactSpeedRight/wheelsOnGround;
|
||||||
|
|
||||||
if(wheelStatus == WHEEL_STATUS_BURST){
|
if(wheelStatus == WHEEL_STATUS_BURST){
|
||||||
float fwdspeed = min(contactSpeedFwd, 0.3f);
|
float fwdspeed = Min(contactSpeedFwd, 0.3f);
|
||||||
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,7 +533,7 @@ CVehicle::DoFixedMachineGuns(void)
|
|||||||
void
|
void
|
||||||
CVehicle::ExtinguishCarFire(void)
|
CVehicle::ExtinguishCarFire(void)
|
||||||
{
|
{
|
||||||
m_fHealth = max(m_fHealth, 300.0f);
|
m_fHealth = Max(m_fHealth, 300.0f);
|
||||||
if(m_pCarFire)
|
if(m_pCarFire)
|
||||||
m_pCarFire->Extinguish();
|
m_pCarFire->Extinguish();
|
||||||
if(IsCar()){
|
if(IsCar()){
|
||||||
@ -874,13 +874,13 @@ CVehicle::SetDriver(CPed *driver)
|
|||||||
|
|
||||||
if(bFreebies && driver == FindPlayerPed()){
|
if(bFreebies && driver == FindPlayerPed()){
|
||||||
if(GetModelIndex() == MI_AMBULAN)
|
if(GetModelIndex() == MI_AMBULAN)
|
||||||
FindPlayerPed()->m_fHealth = min(FindPlayerPed()->m_fHealth + 20.0f, 100.0f);
|
FindPlayerPed()->m_fHealth = Min(FindPlayerPed()->m_fHealth + 20.0f, 100.0f);
|
||||||
else if(GetModelIndex() == MI_TAXI)
|
else if(GetModelIndex() == MI_TAXI)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
||||||
else if(GetModelIndex() == MI_POLICE)
|
else if(GetModelIndex() == MI_POLICE)
|
||||||
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
|
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
|
||||||
else if(GetModelIndex() == MI_ENFORCER)
|
else if(GetModelIndex() == MI_ENFORCER)
|
||||||
driver->m_fArmour = max(driver->m_fArmour, 100.0f);
|
driver->m_fArmour = Max(driver->m_fArmour, 100.0f);
|
||||||
else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE)
|
else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE)
|
||||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
|
||||||
bFreebies = false;
|
bFreebies = false;
|
||||||
|
@ -232,35 +232,35 @@ bool CBulletInfo::TestForSniperBullet(float x1, float x2, float y1, float y2, fl
|
|||||||
#else
|
#else
|
||||||
float minP = 0.0f;
|
float minP = 0.0f;
|
||||||
float maxP = 1.0f;
|
float maxP = 1.0f;
|
||||||
float minX = min(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
float minX = Min(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
||||||
float maxX = max(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
float maxX = Max(PlayerSniperBulletStart.x, PlayerSniperBulletEnd.x);
|
||||||
if (minX < x2 || maxX > x1) {
|
if (minX < x2 || maxX > x1) {
|
||||||
if (minX < x1)
|
if (minX < x1)
|
||||||
minP = min(minP, (x1 - minX) / (maxX - minX));
|
minP = Min(minP, (x1 - minX) / (maxX - minX));
|
||||||
if (maxX > x2)
|
if (maxX > x2)
|
||||||
maxP = max(maxP, (maxX - x2) / (maxX - minX));
|
maxP = Max(maxP, (maxX - x2) / (maxX - minX));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
float minY = min(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
float minY = Min(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
||||||
float maxY = max(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
float maxY = Max(PlayerSniperBulletStart.y, PlayerSniperBulletEnd.y);
|
||||||
if (minY < y2 || maxY > y1) {
|
if (minY < y2 || maxY > y1) {
|
||||||
if (minY < y1)
|
if (minY < y1)
|
||||||
minP = min(minP, (y1 - minY) / (maxY - minY));
|
minP = Min(minP, (y1 - minY) / (maxY - minY));
|
||||||
if (maxY > y2)
|
if (maxY > y2)
|
||||||
maxP = max(maxP, (maxY - y2) / (maxY - minY));
|
maxP = Max(maxP, (maxY - y2) / (maxY - minY));
|
||||||
}
|
}
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
float minZ = min(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
float minZ = Min(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
||||||
float maxZ = max(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
float maxZ = Max(PlayerSniperBulletStart.z, PlayerSniperBulletEnd.z);
|
||||||
if (minZ < z2 || maxZ > z1) {
|
if (minZ < z2 || maxZ > z1) {
|
||||||
if (minZ < z1)
|
if (minZ < z1)
|
||||||
minP = min(minP, (z1 - minZ) / (maxZ - minZ));
|
minP = Min(minP, (z1 - minZ) / (maxZ - minZ));
|
||||||
if (maxZ > z2)
|
if (maxZ > z2)
|
||||||
maxP = max(maxP, (maxZ - z2) / (maxZ - minZ));
|
maxP = Max(maxP, (maxZ - z2) / (maxZ - minZ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WeaponType.h"
|
||||||
|
|
||||||
class CEntity;
|
class CEntity;
|
||||||
enum eWeaponType;
|
|
||||||
|
|
||||||
class CBulletInfo
|
class CBulletInfo
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WeaponType.h"
|
||||||
|
|
||||||
class CEntity;
|
class CEntity;
|
||||||
class CObject;
|
class CObject;
|
||||||
class CProjectile;
|
class CProjectile;
|
||||||
enum eWeaponType;
|
|
||||||
|
|
||||||
class CProjectileInfo
|
class CProjectileInfo
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,7 @@ CShotInfo::Update()
|
|||||||
if (shot.m_sourceEntity) {
|
if (shot.m_sourceEntity) {
|
||||||
assert(shot.m_sourceEntity->IsPed());
|
assert(shot.m_sourceEntity->IsPed());
|
||||||
CPed *ped = (CPed*) shot.m_sourceEntity;
|
CPed *ped = (CPed*) shot.m_sourceEntity;
|
||||||
float radius = max(1.0f, shot.m_radius);
|
float radius = Max(1.0f, shot.m_radius);
|
||||||
|
|
||||||
for (int i = 0; i < ped->m_numNearPeds; ++i) {
|
for (int i = 0; i < ped->m_numNearPeds; ++i) {
|
||||||
CPed *nearPed = ped->m_nearPeds[i];
|
CPed *nearPed = ped->m_nearPeds[i];
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WeaponType.h"
|
||||||
|
|
||||||
class CEntity;
|
class CEntity;
|
||||||
enum eWeaponType;
|
|
||||||
|
|
||||||
class CShotInfo
|
class CShotInfo
|
||||||
{
|
{
|
||||||
|
@ -107,9 +107,11 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
|||||||
CVector fireOffset(0.0f, 0.0f, 0.6f);
|
CVector fireOffset(0.0f, 0.0f, 0.6f);
|
||||||
CVector *source = fireSource;
|
CVector *source = fireSource;
|
||||||
|
|
||||||
if ( !fireSource )
|
if (!fireSource) {
|
||||||
source = &(shooter->GetMatrix() * fireOffset);
|
static CVector tmp;
|
||||||
|
tmp = shooter->GetMatrix() * fireOffset;
|
||||||
|
source = &tmp;
|
||||||
|
}
|
||||||
if ( m_bAddRotOffset )
|
if ( m_bAddRotOffset )
|
||||||
{
|
{
|
||||||
float heading = RADTODEG(shooter->GetForward().Heading());
|
float heading = RADTODEG(shooter->GetForward().Heading());
|
||||||
@ -997,7 +999,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
|||||||
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
|
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
|
||||||
|
|
||||||
CVector dist = point->point - (*source);
|
CVector dist = point->point - (*source);
|
||||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 2.0f) * CVector(ahead.x, ahead.y, 0.0f);
|
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(ahead.x, ahead.y, 0.0f);
|
||||||
CVector smokePos = *source + offset;
|
CVector smokePos = *source + offset;
|
||||||
|
|
||||||
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
|
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
|
||||||
@ -1016,7 +1018,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
|
|||||||
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
|
CParticle::AddParticle(PARTICLE_SPARK, point->point, point->normal*0.05f);
|
||||||
|
|
||||||
CVector dist = point->point - (*source);
|
CVector dist = point->point - (*source);
|
||||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 0.5f) * CVector(ahead.x, ahead.y, 0.0f);
|
CVector offset = dist - Max(0.2f*dist.Magnitude(), 0.5f) * CVector(ahead.x, ahead.y, 0.0f);
|
||||||
CVector smokePos = *source + offset;
|
CVector smokePos = *source + offset;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
|
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
|
||||||
@ -1265,7 +1267,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
|
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
|
||||||
|
|
||||||
CVector dist = point.point - (*fireSource);
|
CVector dist = point.point - (*fireSource);
|
||||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
||||||
CVector smokePos = *fireSource + offset;
|
CVector smokePos = *fireSource + offset;
|
||||||
|
|
||||||
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
|
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, smokePos, CVector(0.0f, 0.0f, 0.0f));
|
||||||
@ -1280,7 +1282,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
|
CParticle::AddParticle(PARTICLE_SPARK, point.point, point.normal*0.05f);
|
||||||
|
|
||||||
CVector dist = point.point - (*fireSource);
|
CVector dist = point.point - (*fireSource);
|
||||||
CVector offset = dist - max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
CVector offset = dist - Max(0.2f*dist.Magnitude(), 2.0f) * CVector(shootRot.x, shootRot.y, 0.0f);
|
||||||
CVector smokePos = *fireSource + offset;
|
CVector smokePos = *fireSource + offset;
|
||||||
|
|
||||||
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
|
smokePos.x += CGeneral::GetRandomNumberInRange(-0.2f, 0.2f);
|
||||||
@ -1347,7 +1349,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CVector traceTarget = *fireSource;
|
CVector traceTarget = *fireSource;
|
||||||
traceTarget += (target - (*fireSource)) * min(info->m_fRange, 30.0f) / info->m_fRange;
|
traceTarget += (target - (*fireSource)) * Min(info->m_fRange, 30.0f) / info->m_fRange;
|
||||||
CBulletTraces::AddTrace(fireSource, &traceTarget);
|
CBulletTraces::AddTrace(fireSource, &traceTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1877,8 +1879,9 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV
|
|||||||
|
|
||||||
if ( 3.0f*distToVictimZ < distToVictim )
|
if ( 3.0f*distToVictimZ < distToVictim )
|
||||||
{
|
{
|
||||||
|
CVector tmp = CVector(victim->GetPosition().x, victim->GetPosition().y, 0.0f);
|
||||||
if ( CCollision::DistToLine(source, target,
|
if ( CCollision::DistToLine(source, target,
|
||||||
&CVector(victim->GetPosition().x, victim->GetPosition().y, 0.0f)) < victim->GetBoundRadius()*3.0f )
|
&tmp) < victim->GetBoundRadius()*3.0f )
|
||||||
{
|
{
|
||||||
float vehicleDist = Sqrt(SQR(distToVictim) + SQR(distToVictimZ));
|
float vehicleDist = Sqrt(SQR(distToVictim) + SQR(distToVictimZ));
|
||||||
if ( vehicleDist < closestEntityDist )
|
if ( vehicleDist < closestEntityDist )
|
||||||
@ -2145,12 +2148,12 @@ CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target
|
|||||||
ASSERT(source!=nil);
|
ASSERT(source!=nil);
|
||||||
ASSERT(target!=nil);
|
ASSERT(target!=nil);
|
||||||
|
|
||||||
float minx = min(source->x, target->x) - 2.0f;
|
float minx = Min(source->x, target->x) - 2.0f;
|
||||||
float maxx = max(source->x, target->x) + 2.0f;
|
float maxx = Max(source->x, target->x) + 2.0f;
|
||||||
float miny = min(source->y, target->y) - 2.0f;
|
float miny = Min(source->y, target->y) - 2.0f;
|
||||||
float maxy = max(source->y, target->y) + 2.0f;
|
float maxy = Max(source->y, target->y) + 2.0f;
|
||||||
float minz = min(source->z, target->z) - 2.0f;
|
float minz = Min(source->z, target->z) - 2.0f;
|
||||||
float maxz = max(source->z, target->z) + 2.0f;
|
float maxz = Max(source->z, target->z) + 2.0f;
|
||||||
|
|
||||||
for ( int32 i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--)
|
for ( int32 i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
@ -1,56 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "WeaponType.h"
|
||||||
|
|
||||||
#define DRIVEBYAUTOAIMING_MAXDIST (2.5f)
|
#define DRIVEBYAUTOAIMING_MAXDIST (2.5f)
|
||||||
#define DOOMAUTOAIMING_MAXDIST (9000.0f)
|
#define DOOMAUTOAIMING_MAXDIST (9000.0f)
|
||||||
|
|
||||||
enum eWeaponType
|
|
||||||
{
|
|
||||||
WEAPONTYPE_UNARMED,
|
|
||||||
WEAPONTYPE_BASEBALLBAT,
|
|
||||||
WEAPONTYPE_COLT45,
|
|
||||||
WEAPONTYPE_UZI,
|
|
||||||
WEAPONTYPE_SHOTGUN,
|
|
||||||
WEAPONTYPE_AK47,
|
|
||||||
WEAPONTYPE_M16,
|
|
||||||
WEAPONTYPE_SNIPERRIFLE,
|
|
||||||
WEAPONTYPE_ROCKETLAUNCHER,
|
|
||||||
WEAPONTYPE_FLAMETHROWER,
|
|
||||||
WEAPONTYPE_MOLOTOV,
|
|
||||||
WEAPONTYPE_GRENADE,
|
|
||||||
WEAPONTYPE_DETONATOR,
|
|
||||||
WEAPONTYPE_HELICANNON,
|
|
||||||
WEAPONTYPE_LAST_WEAPONTYPE,
|
|
||||||
WEAPONTYPE_ARMOUR,
|
|
||||||
WEAPONTYPE_RAMMEDBYCAR,
|
|
||||||
WEAPONTYPE_RUNOVERBYCAR,
|
|
||||||
WEAPONTYPE_EXPLOSION,
|
|
||||||
WEAPONTYPE_UZI_DRIVEBY,
|
|
||||||
WEAPONTYPE_DROWNING,
|
|
||||||
WEAPONTYPE_FALL,
|
|
||||||
WEAPONTYPE_UNIDENTIFIED,
|
|
||||||
|
|
||||||
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
|
|
||||||
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum eWeaponFire {
|
|
||||||
WEAPON_FIRE_MELEE,
|
|
||||||
WEAPON_FIRE_INSTANT_HIT,
|
|
||||||
WEAPON_FIRE_PROJECTILE,
|
|
||||||
WEAPON_FIRE_AREA_EFFECT,
|
|
||||||
WEAPON_FIRE_USE
|
|
||||||
};
|
|
||||||
|
|
||||||
// Taken from MTA SA, seems it's unchanged
|
|
||||||
enum eWeaponState
|
|
||||||
{
|
|
||||||
WEAPONSTATE_READY,
|
|
||||||
WEAPONSTATE_FIRING,
|
|
||||||
WEAPONSTATE_RELOADING,
|
|
||||||
WEAPONSTATE_OUT_OF_AMMO,
|
|
||||||
WEAPONSTATE_MELEE_MADECONTACT
|
|
||||||
};
|
|
||||||
|
|
||||||
class CEntity;
|
class CEntity;
|
||||||
class CPhysical;
|
class CPhysical;
|
||||||
class CAutomobile;
|
class CAutomobile;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum AnimationId;
|
#include "AnimationId.h"
|
||||||
enum eWeaponFire;
|
#include "WeaponType.h"
|
||||||
enum eWeaponType;
|
|
||||||
|
|
||||||
class CWeaponInfo {
|
class CWeaponInfo {
|
||||||
// static CWeaponInfo(&ms_apWeaponInfos)[14];
|
// static CWeaponInfo(&ms_apWeaponInfos)[14];
|
||||||
|
49
src/weapons/WeaponType.h
Normal file
49
src/weapons/WeaponType.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum eWeaponType
|
||||||
|
{
|
||||||
|
WEAPONTYPE_UNARMED,
|
||||||
|
WEAPONTYPE_BASEBALLBAT,
|
||||||
|
WEAPONTYPE_COLT45,
|
||||||
|
WEAPONTYPE_UZI,
|
||||||
|
WEAPONTYPE_SHOTGUN,
|
||||||
|
WEAPONTYPE_AK47,
|
||||||
|
WEAPONTYPE_M16,
|
||||||
|
WEAPONTYPE_SNIPERRIFLE,
|
||||||
|
WEAPONTYPE_ROCKETLAUNCHER,
|
||||||
|
WEAPONTYPE_FLAMETHROWER,
|
||||||
|
WEAPONTYPE_MOLOTOV,
|
||||||
|
WEAPONTYPE_GRENADE,
|
||||||
|
WEAPONTYPE_DETONATOR,
|
||||||
|
WEAPONTYPE_HELICANNON,
|
||||||
|
WEAPONTYPE_LAST_WEAPONTYPE,
|
||||||
|
WEAPONTYPE_ARMOUR,
|
||||||
|
WEAPONTYPE_RAMMEDBYCAR,
|
||||||
|
WEAPONTYPE_RUNOVERBYCAR,
|
||||||
|
WEAPONTYPE_EXPLOSION,
|
||||||
|
WEAPONTYPE_UZI_DRIVEBY,
|
||||||
|
WEAPONTYPE_DROWNING,
|
||||||
|
WEAPONTYPE_FALL,
|
||||||
|
WEAPONTYPE_UNIDENTIFIED,
|
||||||
|
|
||||||
|
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
|
||||||
|
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eWeaponFire {
|
||||||
|
WEAPON_FIRE_MELEE,
|
||||||
|
WEAPON_FIRE_INSTANT_HIT,
|
||||||
|
WEAPON_FIRE_PROJECTILE,
|
||||||
|
WEAPON_FIRE_AREA_EFFECT,
|
||||||
|
WEAPON_FIRE_USE
|
||||||
|
};
|
||||||
|
|
||||||
|
// Taken from MTA SA, seems it's unchanged
|
||||||
|
enum eWeaponState
|
||||||
|
{
|
||||||
|
WEAPONSTATE_READY,
|
||||||
|
WEAPONSTATE_FIRING,
|
||||||
|
WEAPONSTATE_RELOADING,
|
||||||
|
WEAPONSTATE_OUT_OF_AMMO,
|
||||||
|
WEAPONSTATE_MELEE_MADECONTACT
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user