merged master

This commit is contained in:
aap 2020-05-05 14:21:13 +02:00
commit b3b9be5e8c
29 changed files with 189 additions and 196 deletions

View File

@ -2987,7 +2987,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
if (ped->IsPlayer()) if (ped->IsPlayer())
return GetPlayerTalkSfx(sound); return GetPlayerTalkSfx(sound);
switch (ped->m_modelIndex) { switch (ped->GetModelIndex()) {
case MI_COP: case MI_COP:
return GetCopTalkSfx(sound); return GetCopTalkSfx(sound);
case MI_SWAT: case MI_SWAT:
@ -3035,13 +3035,13 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
case MI_SPECIAL02: case MI_SPECIAL02:
case MI_SPECIAL03: case MI_SPECIAL03:
case MI_SPECIAL04: case MI_SPECIAL04:
return GetSpecialCharacterTalkSfx(ped->m_modelIndex, sound); return GetSpecialCharacterTalkSfx(ped->GetModelIndex(), sound);
case MI_MALE02: case MI_MALE02:
return GetMaleNo2TalkSfx(sound); return GetMaleNo2TalkSfx(sound);
case MI_MALE03: case MI_MALE03:
case MI_P_MAN1: case MI_P_MAN1:
case MI_P_MAN2: case MI_P_MAN2:
return GetBlackProjectMaleTalkSfx(sound, ped->m_modelIndex); return GetBlackProjectMaleTalkSfx(sound, ped->GetModelIndex());
case MI_FATMALE01: case MI_FATMALE01:
return GetWhiteFatMaleTalkSfx(sound); return GetWhiteFatMaleTalkSfx(sound);
case MI_FATMALE02: case MI_FATMALE02:
@ -3094,12 +3094,12 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
return GetBlackWorkerMaleTalkSfx(sound); return GetBlackWorkerMaleTalkSfx(sound);
case MI_B_MAN1: case MI_B_MAN1:
case MI_B_MAN3: case MI_B_MAN3:
return GetBusinessMaleYoungTalkSfx(sound, ped->m_modelIndex); return GetBusinessMaleYoungTalkSfx(sound, ped->GetModelIndex());
case MI_B_MAN2: case MI_B_MAN2:
return GetBusinessMaleOldTalkSfx(sound); return GetBusinessMaleOldTalkSfx(sound);
case MI_B_WOM1: case MI_B_WOM1:
case MI_B_WOM2: case MI_B_WOM2:
return GetWhiteBusinessFemaleTalkSfx(sound, ped->m_modelIndex); return GetWhiteBusinessFemaleTalkSfx(sound, ped->GetModelIndex());
case MI_B_WOM3: case MI_B_WOM3:
return GetBlackBusinessFemaleTalkSfx(sound); return GetBlackBusinessFemaleTalkSfx(sound);
case MI_MOD_MAN: case MI_MOD_MAN:
@ -3112,7 +3112,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
return GetStewardFemaleTalkSfx(sound); return GetStewardFemaleTalkSfx(sound);
case MI_FAN_MAN1: case MI_FAN_MAN1:
case MI_FAN_MAN2: case MI_FAN_MAN2:
return GetFanMaleTalkSfx(sound, ped->m_modelIndex); return GetFanMaleTalkSfx(sound, ped->GetModelIndex());
case MI_FAN_WOM: case MI_FAN_WOM:
return GetFanFemaleTalkSfx(sound); return GetFanFemaleTalkSfx(sound);
case MI_HOS_MAN: case MI_HOS_MAN:
@ -3126,7 +3126,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound)
case MI_SHOPPER1: case MI_SHOPPER1:
case MI_SHOPPER2: case MI_SHOPPER2:
case MI_SHOPPER3: case MI_SHOPPER3:
return GetShopperFemaleTalkSfx(sound, ped->m_modelIndex); return GetShopperFemaleTalkSfx(sound, ped->GetModelIndex());
case MI_STUD_MAN: case MI_STUD_MAN:
return GetStudentMaleTalkSfx(sound); return GetStudentMaleTalkSfx(sound);
case MI_STUD_WOM: case MI_STUD_WOM:
@ -6264,7 +6264,7 @@ cAudioManager::ProcessPed(CPhysical *ped)
// params.m_bDistanceCalculated = false; // params.m_bDistanceCalculated = false;
params.m_pPed = (CPed *)ped; params.m_pPed = (CPed *)ped;
params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos); params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if (ped->m_modelIndex == MI_FATMALE02) if (ped->GetModelIndex() == MI_FATMALE02)
ProcessPedHeadphones(&params); ProcessPedHeadphones(&params);
ProcessPedOneShots(&params); ProcessPedOneShots(&params);
} }
@ -7090,7 +7090,7 @@ cAudioManager::ProcessPlane(cVehicleParams *params)
ProcessCesna(params); ProcessCesna(params);
break; break;
default: default:
debug("Plane Model Id is %d\n, ", params->m_pVehicle->m_modelIndex); debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex());
break; break;
} }
} }
@ -7991,7 +7991,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
if (handling) if (handling)
params.m_pTransmission = &handling->Transmission; params.m_pTransmission = &handling->Transmission;
params.m_nIndex = veh->m_modelIndex - 90; params.m_nIndex = veh->GetModelIndex() - 90;
if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE) if (params.m_pVehicle->GetStatus() == STATUS_SIMPLE)
velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f;
else else
@ -8272,7 +8272,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
if (params->m_fDistance < SQR(SOUND_INTENSITY)) { if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
automobile = (CAutomobile *)params->m_pVehicle; automobile = (CAutomobile *)params->m_pVehicle;
if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->m_modelIndex != MI_MRWHOOP) { if ((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->GetModelIndex() != MI_MRWHOOP) {
if (automobile->m_nCarHornTimer) { if (automobile->m_nCarHornTimer) {
if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) { if (params->m_pVehicle->GetStatus() != STATUS_PLAYER) {
automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer); automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer);

View File

@ -58,7 +58,7 @@ cMusicManager::PlayerInCar()
if (FindPlayerVehicle()->GetStatus() == STATUS_WRECKED) if (FindPlayerVehicle()->GetStatus() == STATUS_WRECKED)
return false; return false;
switch(FindPlayerVehicle()->m_modelIndex) { switch (FindPlayerVehicle()->GetModelIndex()) {
case MI_FIRETRUCK: case MI_FIRETRUCK:
case MI_AMBULAN: case MI_AMBULAN:
case MI_MRWHOOP: case MI_MRWHOOP:

View File

@ -538,7 +538,7 @@ cAudioManager::SetupSuspectLastSeenReport()
main_color = gCarColourTable[color1][1]; main_color = gCarColourTable[color1][1];
color_pre_modifier = gCarColourTable[color1][0]; color_pre_modifier = gCarColourTable[color1][0];
color_post_modifier = gCarColourTable[color1][2]; color_post_modifier = gCarColourTable[color1][2];
switch (veh->m_modelIndex) { switch (veh->GetModelIndex()) {
#ifdef FIX_BUGS #ifdef FIX_BUGS
case MI_COLUMB: case MI_COLUMB:
main_color = SFX_POLICE_RADIO_BLUE; main_color = SFX_POLICE_RADIO_BLUE;
@ -637,7 +637,7 @@ cAudioManager::SetupSuspectLastSeenReport()
break; break;
default: default:
debug("\n *** UNKNOWN CAR MODEL INDEX %d *** ", veh->m_modelIndex); debug("\n *** UNKNOWN CAR MODEL INDEX %d *** ", veh->GetModelIndex());
return; return;
} }
m_sPoliceRadioQueue.Add(m_anRandomTable[4] % 3 + SFX_POLICE_RADIO_MESSAGE_NOISE_1); m_sPoliceRadioQueue.Add(m_anRandomTable[4] % 3 + SFX_POLICE_RADIO_MESSAGE_NOISE_1);

View File

@ -661,8 +661,7 @@ CPathFind::CountFloodFillGroups(uint8 type)
if(type == PATH_CAR) if(type == PATH_CAR)
#ifndef MIAMI #ifndef MIAMI
printf("Single car node: %f %f %f (%d)\n", printf("Single car node: %f %f %f (%d)\n",
node->GetX(), node->GetY(), node->GetZ(), node->GetX(), node->GetY(), node->GetZ(), m_mapObjects[node->objectIndex]->GetModelIndex());
m_mapObjects[node->objectIndex]->m_modelIndex);
#else #else
printf("Single car node: %f %f %f\n", printf("Single car node: %f %f %f\n",
node->GetX(), node->GetY(), node->GetZ()); node->GetX(), node->GetY(), node->GetZ());
@ -737,7 +736,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
// Calculate internal nodes, store them and connect them to defining object // Calculate internal nodes, store them and connect them to defining object
for(i = 0; i < m_numMapObjects; i++){ for(i = 0; i < m_numMapObjects; i++){
tileStart = m_numPathNodes; tileStart = m_numPathNodes;
start = 12*m_mapObjects[i]->m_modelIndex; start = 12 * m_mapObjects[i]->GetModelIndex();
for(j = 0; j < 12; j++){ for(j = 0; j < 12; j++){
if(objectpathinfo[start + j].type == NodeTypeIntern){ if(objectpathinfo[start + j].type == NodeTypeIntern){
CalcNodeCoors( CalcNodeCoors(
@ -826,7 +825,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
TempListLength = 0; TempListLength = 0;
#ifndef MIAMI #ifndef MIAMI
for(i = 0; i < m_numMapObjects; i++){ for(i = 0; i < m_numMapObjects; i++){
start = 12*m_mapObjects[i]->m_modelIndex; start = 12 * m_mapObjects[i]->GetModelIndex();
for(j = 0; j < 12; j++){ for(j = 0; j < 12; j++){
if(objectpathinfo[start + j].type != NodeTypeExtern) if(objectpathinfo[start + j].type != NodeTypeExtern)
continue; continue;
@ -1056,7 +1055,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
iseg++; iseg++;
#ifndef MIAMI #ifndef MIAMI
istart = 12*m_mapObjects[m_pathNodes[i].objectIndex]->m_modelIndex; istart = 12 * m_mapObjects[m_pathNodes[i].objectIndex]->GetModelIndex();
#endif #endif
// 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++){
@ -1066,7 +1065,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
jseg = j-i + iseg; jseg = j-i + iseg;
#ifndef MIAMI #ifndef MIAMI
jstart = 12*m_mapObjects[m_pathNodes[j].objectIndex]->m_modelIndex; jstart = 12 * m_mapObjects[m_pathNodes[j].objectIndex]->GetModelIndex();
if(objectpathinfo[istart + iseg].next == jseg || if(objectpathinfo[istart + iseg].next == jseg ||
objectpathinfo[jstart + jseg].next == iseg){ objectpathinfo[jstart + jseg].next == iseg){
#else #else

View File

@ -298,7 +298,7 @@ CPhoneInfo::Initialise(void)
for (int i = pool->GetSize() - 1; i >= 0; i--) { for (int i = pool->GetSize() - 1; i >= 0; i--) {
CBuilding *building = pool->GetSlot(i); CBuilding *building = pool->GetSlot(i);
if (building) { if (building) {
if (building->m_modelIndex == MI_PHONEBOOTH1) { if (building->GetModelIndex() == MI_PHONEBOOTH1) {
CPhone *maxPhone = &m_aPhones[m_nMax]; CPhone *maxPhone = &m_aPhones[m_nMax];
maxPhone->m_nState = PHONE_STATE_FREE; maxPhone->m_nState = PHONE_STATE_FREE;
maxPhone->m_vecPos = building->GetPosition(); maxPhone->m_vecPos = building->GetPosition();

View File

@ -229,7 +229,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
if (m_eType == PICKUP_ON_STREET) { if (m_eType == PICKUP_ON_STREET) {
m_nTimer = CTimer::GetTimeInMilliseconds() + 30000; m_nTimer = CTimer::GetTimeInMilliseconds() + 30000;
} else if (m_eType == PICKUP_ON_STREET_SLOW) { } else if (m_eType == PICKUP_ON_STREET_SLOW) {
if (MI_PICKUP_BRIBE == m_pObject->m_modelIndex) if (MI_PICKUP_BRIBE == m_pObject->GetModelIndex())
m_nTimer = CTimer::GetTimeInMilliseconds() + 300000; m_nTimer = CTimer::GetTimeInMilliseconds() + 300000;
else else
m_nTimer = CTimer::GetTimeInMilliseconds() + 720000; m_nTimer = CTimer::GetTimeInMilliseconds() + 720000;

View File

@ -84,12 +84,11 @@ static int32 NextValidModelId(int32 mi, int32 step)
CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo; CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo;
if (!pInfo) if (!pInfo)
continue; continue;
if (pInfo->m_type == MITYPE_PED if (pInfo->GetModelType() == MITYPE_PED
#ifdef FIX_BUGS #ifdef FIX_BUGS
&& !(i >= MI_SPECIAL01 && i <= MI_SPECIAL04) && !(i >= MI_SPECIAL01 && i <= MI_SPECIAL04)
#endif #endif
|| || pInfo->GetModelType() == MITYPE_VEHICLE &&
pInfo->m_type == MITYPE_VEHICLE &&
#ifdef FIX_BUGS #ifdef FIX_BUGS
(pVehicleInfo->m_vehicleType == VEHICLE_TYPE_CAR || pVehicleInfo->m_vehicleType == VEHICLE_TYPE_BOAT)) (pVehicleInfo->m_vehicleType == VEHICLE_TYPE_CAR || pVehicleInfo->m_vehicleType == VEHICLE_TYPE_BOAT))
#else // && and || priority failure it seems, also crashes on special models #else // && and || priority failure it seems, also crashes on special models

View File

@ -8074,7 +8074,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
continue; continue;
// desperatly want to believe this was inlined :| // desperatly want to believe this was inlined :|
CBaseModelInfo* pInfo = CModelInfo::GetModelInfo(model); CBaseModelInfo* pInfo = CModelInfo::GetModelInfo(model);
assert(pInfo->m_type == MITYPE_VEHICLE); assert(pInfo->GetModelType() == MITYPE_VEHICLE);
CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo; CVehicleModelInfo* pVehicleInfo = (CVehicleModelInfo*)pInfo;
if (pVehicleInfo->m_vehicleType != VEHICLE_TYPE_CAR) { if (pVehicleInfo->m_vehicleType != VEHICLE_TYPE_CAR) {
switch (model) { switch (model) {

View File

@ -148,7 +148,7 @@ LastPedModelId(int modelId)
CBaseModelInfo *model; CBaseModelInfo *model;
for (int i = modelId; i >= 0; i--) { for (int i = modelId; i >= 0; i--) {
model = CModelInfo::GetModelInfo(i); model = CModelInfo::GetModelInfo(i);
if (model->m_type == MITYPE_PED) if (model->GetModelType() == MITYPE_PED)
return i; return i;
} }
return modelId; return modelId;
@ -160,7 +160,7 @@ LastVehicleModelId(int modelId)
CBaseModelInfo* model; CBaseModelInfo* model;
for (int i = modelId; i >= 0; i--) { for (int i = modelId; i >= 0; i--) {
model = CModelInfo::GetModelInfo(i); model = CModelInfo::GetModelInfo(i);
if (model->m_type == MITYPE_VEHICLE) if (model->GetModelType() == MITYPE_VEHICLE)
return i; return i;
} }
return modelId; return modelId;
@ -222,7 +222,7 @@ CAnimViewer::Update(void)
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId); CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId);
CEntity *newEntity = nil; CEntity *newEntity = nil;
if (modelInfo->m_type == MITYPE_PED) { if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup; int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
if (animId > ANIM_IDLE_STANCE) if (animId > ANIM_IDLE_STANCE)
@ -257,7 +257,7 @@ CAnimViewer::Update(void)
if (!pTarget) { if (!pTarget) {
if (modelInfo->m_type == MITYPE_VEHICLE) { if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo; CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo;
if (veh->m_vehicleType != VEHICLE_TYPE_CAR) { if (veh->m_vehicleType != VEHICLE_TYPE_CAR) {
@ -281,7 +281,7 @@ CAnimViewer::Update(void)
newEntity->SetStatus(STATUS_ABANDONED); newEntity->SetStatus(STATUS_ABANDONED);
} }
newEntity->bIsStuck = true; newEntity->bIsStuck = true;
} else if (modelInfo->m_type == MITYPE_PED) { } else if (modelInfo->GetModelType() == MITYPE_PED) {
pTarget = newEntity = new CPed(PEDTYPE_CIVMALE); pTarget = newEntity = new CPed(PEDTYPE_CIVMALE);
newEntity->SetModelIndex(modelId); newEntity->SetModelIndex(modelId);
} else { } else {
@ -301,9 +301,9 @@ CAnimViewer::Update(void)
} }
pTarget->GetMatrix().GetPosition().z = 0.0f; pTarget->GetMatrix().GetPosition().z = 0.0f;
if (modelInfo->m_type != MITYPE_PED) { if (modelInfo->GetModelType() != MITYPE_PED) {
if (modelInfo->m_type == MITYPE_VEHICLE) { if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) { if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
nextModelId = LastPedModelId(modelId); nextModelId = LastPedModelId(modelId);
@ -369,10 +369,11 @@ CAnimViewer::Update(void)
if (pad->NewState.Triangle) { if (pad->NewState.Triangle) {
#ifdef PED_SKIN #ifdef PED_SKIN
if(IsClumpSkinned(pTarget->GetClump())) if(IsClumpSkinned(pTarget->GetClump()))
((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->AnimatePedColModelSkinned(pTarget->GetClump()); ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
else else
#endif #endif
CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(pTarget->m_modelIndex))->GetHitColModel(), RpClumpGetFrame(pTarget->GetClump())); CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(),
RpClumpGetFrame(pTarget->GetClump()));
AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
CMessages::AddMessage(gUString, 100, 0); CMessages::AddMessage(gUString, 100, 0);
} }

View File

@ -4639,7 +4639,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
uint8 camSetArrPos = 0; uint8 camSetArrPos = 0;
// We may need those later // We may need those later
bool isPlane = car->m_modelIndex == MI_DODO; bool isPlane = car->GetModelIndex() == MI_DODO;
bool isHeli = false; bool isHeli = false;
bool isBike = false; bool isBike = false;
bool isCar = car->IsCar() && !isPlane && !isHeli && !isBike; bool isCar = car->IsCar() && !isPlane && !isHeli && !isBike;
@ -4650,9 +4650,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
uint8 nextDirectionIsForward = !(pad->GetLookBehindForCar() || pad->GetLookBehindForPed() || pad->GetLookLeft() || pad->GetLookRight()) && uint8 nextDirectionIsForward = !(pad->GetLookBehindForCar() || pad->GetLookBehindForPed() || pad->GetLookLeft() || pad->GetLookRight()) &&
DirectionWasLooking == LOOKING_FORWARD; DirectionWasLooking == LOOKING_FORWARD;
if (car->m_modelIndex == MI_FIRETRUCK) { if (car->GetModelIndex() == MI_FIRETRUCK) {
camSetArrPos = 7; camSetArrPos = 7;
} else if (car->m_modelIndex == MI_RCBANDIT) { } else if (car->GetModelIndex() == MI_RCBANDIT) {
camSetArrPos = 5; camSetArrPos = 5;
} else if (car->IsBoat()) { } else if (car->IsBoat()) {
camSetArrPos = 4; camSetArrPos = 4;
@ -4851,7 +4851,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// This is also original LCS and SA bug, or some attempt to fix lag. We'll never know // This is also original LCS and SA bug, or some attempt to fix lag. We'll never know
// if (car->m_vecMoveSpeed.MagnitudeSqr() < sq(0.2f)) // if (car->m_vecMoveSpeed.MagnitudeSqr() < sq(0.2f))
if (car->m_modelIndex != MI_FIRETRUCK) { if (car->GetModelIndex() != MI_FIRETRUCK) {
// if (!isBike || GetMysteriousWheelRelatedThingBike(car) > 3) // if (!isBike || GetMysteriousWheelRelatedThingBike(car) > 3)
// if (!isHeli && (!isPlane || car->GetWheelsOnGround())) { // if (!isHeli && (!isPlane || car->GetWheelsOnGround())) {
@ -4907,7 +4907,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
bool correctAlpha = true; bool correctAlpha = true;
// if (SA checks if we aren't in work car, why?) { // if (SA checks if we aren't in work car, why?) {
if (!isCar || car->m_modelIndex != MI_YARDIE) { if (!isCar || car->GetModelIndex() != MI_YARDIE) {
correctAlpha = false; correctAlpha = false;
} }
else { else {
@ -5186,13 +5186,13 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// gTargetCoordsForLookingBehind = TargetCoors; // gTargetCoordsForLookingBehind = TargetCoors;
// SA code from CAutomobile::TankControl/FireTruckControl. // SA code from CAutomobile::TankControl/FireTruckControl.
if (car->m_modelIndex == MI_RHINO || car->m_modelIndex == MI_FIRETRUCK) { if (car->GetModelIndex() == MI_RHINO || car->GetModelIndex() == MI_FIRETRUCK) {
float &carGunLR = ((CAutomobile*)car)->m_fCarGunLR; float &carGunLR = ((CAutomobile*)car)->m_fCarGunLR;
CVector hi = Multiply3x3(Front, car->GetMatrix()); CVector hi = Multiply3x3(Front, car->GetMatrix());
// III/VC's firetruck turret angle is reversed // III/VC's firetruck turret angle is reversed
float angleToFace = (car->m_modelIndex == MI_FIRETRUCK ? -hi.Heading() : hi.Heading()); float angleToFace = (car->GetModelIndex() == MI_FIRETRUCK ? -hi.Heading() : hi.Heading());
if (angleToFace <= carGunLR + PI) { if (angleToFace <= carGunLR + PI) {
if (angleToFace < carGunLR - PI) if (angleToFace < carGunLR - PI)
@ -5202,7 +5202,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
} }
float neededTurn = angleToFace - carGunLR; float neededTurn = angleToFace - carGunLR;
float turnPerFrame = CTimer::GetTimeStep() * (car->m_modelIndex == MI_FIRETRUCK ? 0.05f : 0.015f); float turnPerFrame = CTimer::GetTimeStep() * (car->GetModelIndex() == MI_FIRETRUCK ? 0.05f : 0.015f);
if (neededTurn <= turnPerFrame) { if (neededTurn <= turnPerFrame) {
if (neededTurn < -turnPerFrame) if (neededTurn < -turnPerFrame)
angleToFace = carGunLR - turnPerFrame; angleToFace = carGunLR - turnPerFrame;
@ -5210,7 +5210,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
angleToFace = turnPerFrame + carGunLR; angleToFace = turnPerFrame + carGunLR;
} }
if (car->m_modelIndex == MI_RHINO && carGunLR != angleToFace) { if (car->GetModelIndex() == MI_RHINO && carGunLR != angleToFace) {
DMAudio.PlayOneShot(car->m_audioEntityId, SOUND_CAR_TANK_TURRET_ROTATE, Abs(angleToFace - carGunLR)); DMAudio.PlayOneShot(car->m_audioEntityId, SOUND_CAR_TANK_TURRET_ROTATE, Abs(angleToFace - carGunLR));
} }
carGunLR = angleToFace; carGunLR = angleToFace;
@ -5222,7 +5222,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
} }
// Because firetruk turret also has Y movement // Because firetruk turret also has Y movement
if (car->m_modelIndex == MI_FIRETRUCK) { if (car->GetModelIndex() == MI_FIRETRUCK) {
float &carGunUD = ((CAutomobile*)car)->m_fCarGunUD; float &carGunUD = ((CAutomobile*)car)->m_fCarGunUD;
float alphaToFace = Atan2(hi.z, hi.Magnitude2D()) + DEGTORAD(15.0f); float alphaToFace = Atan2(hi.z, hi.Magnitude2D()) + DEGTORAD(15.0f);

View File

@ -235,7 +235,7 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
#ifndef MIAMI #ifndef MIAMI
if(mi->GetColModel()){ if(mi->GetColModel()){
#else #else
if(mi->GetColModel() && mi->m_bOwnsColModel){ if(mi->GetColModel() && mi->DoesOwnColModel()){
#endif #endif
LoadCollisionModel(work_buff+24, *mi->GetColModel(), modelname); LoadCollisionModel(work_buff+24, *mi->GetColModel(), modelname);
}else{ }else{
@ -506,7 +506,7 @@ CFileLoader::LoadClumpFile(RwStream *stream, uint32 id)
return false; return false;
mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(id); mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(id);
mi->SetClump(clump); mi->SetClump(clump);
if(mi->m_type == MITYPE_PED && id != 0 && RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){ if (mi->GetModelType() == MITYPE_PED && id != 0 && RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)) {
// Read LOD ped // Read LOD ped
clump = RpClumpStreamRead(stream); clump = RpClumpStreamRead(stream);
if(clump){ if(clump){
@ -1481,7 +1481,7 @@ CFileLoader::ReloadObject(const char *line)
#ifdef FIX_BUGS #ifdef FIX_BUGS
mi && mi &&
#endif #endif
mi->m_type == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) { mi->GetModelType() == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
mi->SetLodDistances(dist); mi->SetLodDistances(dist);
SetModelInfoFlags(mi, flags); SetModelInfoFlags(mi, flags);
} else { } else {

View File

@ -354,7 +354,7 @@ CPlayerInfo::Process(void)
bool startTaxiTimer = true; bool startTaxiTimer = true;
if (m_bUnusedTaxiThing && m_pPed->bInVehicle) { if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
CVehicle *veh = m_pPed->m_pMyVehicle; CVehicle *veh = m_pPed->m_pMyVehicle;
if ((veh->m_modelIndex == MI_TAXI || veh->m_modelIndex == MI_CABBIE || veh->m_modelIndex == MI_BORGNINE) if ((veh->GetModelIndex() == MI_TAXI || veh->GetModelIndex() == MI_CABBIE || veh->GetModelIndex() == MI_BORGNINE)
&& veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) { && veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) {
for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) { for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) {
timePassed -= 1000; timePassed -= 1000;
@ -407,7 +407,7 @@ CPlayerInfo::Process(void)
if (m_pPed->bInVehicle) { if (m_pPed->bInVehicle) {
if (!m_pRemoteVehicle) { if (!m_pRemoteVehicle) {
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity; CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->m_modelIndex)) { if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->GetModelIndex())) {
CVehicle *veh = m_pPed->m_pMyVehicle; CVehicle *veh = m_pPed->m_pMyVehicle;
if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) { if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {

View File

@ -223,21 +223,21 @@ INITSAVEBUF
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType); WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
WriteSaveBuf<int16>(buf, pVehicle->m_modelIndex); WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle)); WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle));
pVehicle->Save(buf); pVehicle->Save(buf);
} }
#else #else
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->m_modelIndex); WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle)); WriteSaveBuf(buf, GetVehicleRef(pVehicle));
memcpy(buf, pVehicle, sizeof(CAutomobile)); memcpy(buf, pVehicle, sizeof(CAutomobile));
SkipSaveBuf(buf, sizeof(CAutomobile)); SkipSaveBuf(buf, sizeof(CAutomobile));
} }
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->m_modelIndex); WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle)); WriteSaveBuf(buf, GetVehicleRef(pVehicle));
memcpy(buf, pVehicle, sizeof(CBoat)); memcpy(buf, pVehicle, sizeof(CBoat));
SkipSaveBuf(buf, sizeof(CBoat)); SkipSaveBuf(buf, sizeof(CBoat));
@ -279,7 +279,7 @@ INITSAVEBUF
bool bHasBeenDamaged = pObject->bHasBeenDamaged; bool bHasBeenDamaged = pObject->bHasBeenDamaged;
bool bUseVehicleColours = pObject->bUseVehicleColours; bool bUseVehicleColours = pObject->bUseVehicleColours;
CCompressedMatrixNotAligned tmp; CCompressedMatrixNotAligned tmp;
WriteSaveBuf(buf, pObject->m_modelIndex); WriteSaveBuf(buf, pObject->GetModelIndex());
WriteSaveBuf(buf, GetObjectRef(pObject)); WriteSaveBuf(buf, GetObjectRef(pObject));
tmp.CompressFromFullMatrix(pObject->GetMatrix()); tmp.CompressFromFullMatrix(pObject->GetMatrix());
WriteSaveBuf(buf, tmp); WriteSaveBuf(buf, tmp);
@ -397,7 +397,7 @@ INITSAVEBUF
continue; continue;
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) { if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
WriteSaveBuf(buf, pPed->m_nPedType); WriteSaveBuf(buf, pPed->m_nPedType);
WriteSaveBuf(buf, pPed->m_modelIndex); WriteSaveBuf(buf, pPed->GetModelIndex());
WriteSaveBuf(buf, GetPedRef(pPed)); WriteSaveBuf(buf, GetPedRef(pPed));
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
pPed->Save(buf); pPed->Save(buf);

View File

@ -553,7 +553,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
if(mi->IsSimple()){ if(mi->IsSimple()){
success = CFileLoader::LoadAtomicFile(stream, streamId); success = CFileLoader::LoadAtomicFile(stream, streamId);
}else if(mi->m_type == MITYPE_VEHICLE){ } else if (mi->GetModelType() == MITYPE_VEHICLE) {
// load vehicles in two parts // load vehicles in two parts
CModelInfo::GetModelInfo(streamId)->AddRef(); CModelInfo::GetModelInfo(streamId)->AddRef();
success = CFileLoader::StartLoadClumpFile(stream, streamId); success = CFileLoader::StartLoadClumpFile(stream, streamId);
@ -634,7 +634,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
if(streamId < STREAM_OFFSET_TXD){ if(streamId < STREAM_OFFSET_TXD){
// Model // Model
// Vehicles and Peds not in loaded list // Vehicles and Peds not in loaded list
if(mi->m_type != MITYPE_VEHICLE && mi->m_type != MITYPE_PED){ if (mi->GetModelType() != MITYPE_VEHICLE && mi->GetModelType() != MITYPE_PED) {
CSimpleModelInfo *smi = (CSimpleModelInfo*)mi; CSimpleModelInfo *smi = (CSimpleModelInfo*)mi;
// Set fading for some objects // Set fading for some objects
@ -1080,7 +1080,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex()); mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){ if(!e->bImBeingRendered){
e->DeleteRwObject(); e->DeleteRwObject();
if(mi->m_refCount == 0) if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
} }
} }
@ -1093,7 +1093,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex()); mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){ if(!e->bImBeingRendered){
e->DeleteRwObject(); e->DeleteRwObject();
if(mi->m_refCount == 0) if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
} }
} }
@ -1106,7 +1106,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex()); mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered && ((CObject*)e)->ObjectCreatedBy == GAME_OBJECT){ if(!e->bImBeingRendered && ((CObject*)e)->ObjectCreatedBy == GAME_OBJECT){
e->DeleteRwObject(); e->DeleteRwObject();
if(mi->m_refCount == 0) if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
} }
} }
@ -1119,7 +1119,7 @@ CStreaming::RemoveBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex()); mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){ if(!e->bImBeingRendered){
e->DeleteRwObject(); e->DeleteRwObject();
if(mi->m_refCount == 0) if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
} }
} }
@ -1211,7 +1211,7 @@ CStreaming::RemoveBigBuildings(eLevelName level)
mi = CModelInfo::GetModelInfo(e->GetModelIndex()); mi = CModelInfo::GetModelInfo(e->GetModelIndex());
if(!e->bImBeingRendered){ if(!e->bImBeingRendered){
e->DeleteRwObject(); e->DeleteRwObject();
if(mi->m_refCount == 0) if (mi->GetNumRefs() == 0)
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
} }
} }
@ -1229,8 +1229,7 @@ CStreaming::RemoveLoadedVehicle(void)
ms_lastVehicleDeleted = 0; ms_lastVehicleDeleted = 0;
id = ms_vehiclesLoaded[ms_lastVehicleDeleted]; id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 && if(id != -1 &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0 &&
CModelInfo::GetModelInfo(id)->m_refCount == 0 &&
ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED) ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED)
goto found; goto found;
} }
@ -1251,7 +1250,7 @@ CStreaming::RemoveLeastUsedModel(void)
for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; si = si->m_prev){ for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; si = si->m_prev){
streamId = si - ms_aInfoForModel; streamId = si - ms_aInfoForModel;
if(streamId < STREAM_OFFSET_TXD){ if(streamId < STREAM_OFFSET_TXD){
if(CModelInfo::GetModelInfo(streamId)->m_refCount == 0){ if (CModelInfo::GetModelInfo(streamId)->GetNumRefs() == 0) {
RemoveModel(streamId); RemoveModel(streamId);
return true; return true;
} }
@ -1277,7 +1276,7 @@ CStreaming::RemoveAllUnusedModels(void)
for(i = NUM_DEFAULT_MODELS; i < MODELINFOSIZE; i++){ for(i = NUM_DEFAULT_MODELS; i < MODELINFOSIZE; i++){
if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED && if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED &&
ms_aInfoForModel[i].m_flags & STREAMFLAGS_DONT_REMOVE && ms_aInfoForModel[i].m_flags & STREAMFLAGS_DONT_REMOVE &&
CModelInfo::GetModelInfo(i)->m_refCount == 0){ CModelInfo::GetModelInfo(i)->GetNumRefs() == 0) {
RemoveModel(i); RemoveModel(i);
ms_aInfoForModel[i].m_loadState = STREAMSTATE_NOTLOADED; ms_aInfoForModel[i].m_loadState = STREAMSTATE_NOTLOADED;
} }
@ -1368,8 +1367,7 @@ CStreaming::AddToLoadedVehiclesList(int32 modelId)
for(i = 0; i < MAXVEHICLESLOADED; i++){ for(i = 0; i < MAXVEHICLESLOADED; i++){
id = ms_vehiclesLoaded[ms_lastVehicleDeleted]; id = ms_vehiclesLoaded[ms_lastVehicleDeleted];
if(id != -1 && if(id != -1 &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 && CModelInfo::GetModelInfo(id)->GetNumRefs() == 0)
CModelInfo::GetModelInfo(id)->m_refCount == 0)
goto found; goto found;
ms_lastVehicleDeleted++; ms_lastVehicleDeleted++;
if(ms_lastVehicleDeleted == MAXVEHICLESLOADED) if(ms_lastVehicleDeleted == MAXVEHICLESLOADED)
@ -1443,7 +1441,7 @@ void
CStreaming::SetModelIsDeletable(int32 id) CStreaming::SetModelIsDeletable(int32 id)
{ {
ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_DONT_REMOVE; ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_DONT_REMOVE;
if((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->m_type != MITYPE_VEHICLE) && if ((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED) == 0){ (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED) == 0){
if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED) if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED)
RemoveModel(id); RemoveModel(id);
@ -1462,7 +1460,7 @@ void
CStreaming::SetMissionDoesntRequireModel(int32 id) CStreaming::SetMissionDoesntRequireModel(int32 id)
{ {
ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_SCRIPTOWNED; ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_SCRIPTOWNED;
if((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->m_type != MITYPE_VEHICLE) && if ((id >= STREAM_OFFSET_TXD || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) &&
(ms_aInfoForModel[id].m_flags & STREAMFLAGS_DONT_REMOVE) == 0){ (ms_aInfoForModel[id].m_flags & STREAMFLAGS_DONT_REMOVE) == 0){
if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED) if(ms_aInfoForModel[id].m_loadState != STREAMSTATE_LOADED)
RemoveModel(id); RemoveModel(id);
@ -1877,8 +1875,8 @@ CStreaming::RequestModelStream(int32 ch)
// Can't load certain combinations of files together // Can't load certain combinations of files together
if(streamId < STREAM_OFFSET_TXD){ if(streamId < STREAM_OFFSET_TXD){
if(havePed && CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_PED || if (havePed && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED ||
haveBigFile && CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_VEHICLE || haveBigFile && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE ||
!TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot())) !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()))
break; break;
}else{ }else{
@ -1897,9 +1895,9 @@ CStreaming::RequestModelStream(int32 ch)
break; break;
} }
if(streamId < STREAM_OFFSET_TXD){ if(streamId < STREAM_OFFSET_TXD){
if(CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_PED) if (CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED)
havePed = 1; havePed = 1;
if(CModelInfo::GetModelInfo(streamId)->m_type == MITYPE_VEHICLE) if (CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE)
haveBigFile = 1; haveBigFile = 1;
}else{ }else{
if(size > 200) if(size > 200)
@ -1957,8 +1955,7 @@ CStreaming::ProcessLoadingChannel(int32 ch)
continue; continue;
cdsize = ms_aInfoForModel[id].GetCdSize(); cdsize = ms_aInfoForModel[id].GetCdSize();
if(id < STREAM_OFFSET_TXD && if(id < STREAM_OFFSET_TXD && CModelInfo::GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
CModelInfo::GetModelInfo(id)->m_type == MITYPE_VEHICLE &&
ms_numVehiclesLoaded >= desiredNumVehiclesLoaded && ms_numVehiclesLoaded >= desiredNumVehiclesLoaded &&
!RemoveLoadedVehicle() && !RemoveLoadedVehicle() &&
((ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 || GetAvailableVehicleSlot() == -1)){ ((ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0 || GetAvailableVehicleSlot() == -1)){
@ -2231,7 +2228,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float
if(!e->bStreamingDontDelete && !e->bIsSubway && if(!e->bStreamingDontDelete && !e->bIsSubway &&
(!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){ (!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){
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->GetModelType() != 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());
@ -2263,7 +2260,7 @@ CStreaming::ProcessEntitiesInSectorList(CPtrList &list)
if(!e->bStreamingDontDelete && !e->bIsSubway && if(!e->bStreamingDontDelete && !e->bIsSubway &&
(!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){ (!e->IsObject() || ((CObject*)e)->ObjectCreatedBy != TEMP_OBJECT)){
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->GetModelType() != MITYPE_TIME || CClock::GetIsTimeInRange(mi->GetTimeOn(), mi->GetTimeOff()))
#ifdef GTA_ZONECULL #ifdef GTA_ZONECULL
if(CRenderer::IsEntityCullZoneVisible(e)) if(CRenderer::IsEntityCullZoneVisible(e))
#endif #endif
@ -2631,7 +2628,7 @@ CStreaming::DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem)
if(!e->bStreamingDontDelete && !e->bImBeingRendered && if(!e->bStreamingDontDelete && !e->bImBeingRendered &&
e->m_rwObject && ms_aInfoForModel[e->GetModelIndex()].m_next){ e->m_rwObject && ms_aInfoForModel[e->GetModelIndex()].m_next){
e->DeleteRwObject(); e->DeleteRwObject();
if(CModelInfo::GetModelInfo(e->GetModelIndex())->m_refCount == 0){ if (CModelInfo::GetModelInfo(e->GetModelIndex())->GetNumRefs() == 0) {
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
if(ms_memoryUsed < mem) if(ms_memoryUsed < mem)
return true; return true;
@ -2652,7 +2649,7 @@ CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem)
if(!e->bStreamingDontDelete && !e->bImBeingRendered && if(!e->bStreamingDontDelete && !e->bImBeingRendered &&
e->m_rwObject && !e->IsVisible() && ms_aInfoForModel[e->GetModelIndex()].m_next){ e->m_rwObject && !e->IsVisible() && ms_aInfoForModel[e->GetModelIndex()].m_next){
e->DeleteRwObject(); e->DeleteRwObject();
if(CModelInfo::GetModelInfo(e->GetModelIndex())->m_refCount == 0){ if (CModelInfo::GetModelInfo(e->GetModelIndex())->GetNumRefs() == 0) {
RemoveModel(e->GetModelIndex()); RemoveModel(e->GetModelIndex());
if(ms_memoryUsed < mem) if(ms_memoryUsed < mem)
return true; return true;

View File

@ -758,7 +758,7 @@ CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList &list, const
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
if(pEntity->m_scanCode != GetCurrentScanCode()) { if(pEntity->m_scanCode != GetCurrentScanCode()) {
pEntity->m_scanCode = GetCurrentScanCode(); pEntity->m_scanCode = GetCurrentScanCode();
if(modelId == pEntity->m_modelIndex) { if (modelId == pEntity->GetModelIndex()) {
float fMagnitude = 0.0f; float fMagnitude = 0.0f;
if(bCheck2DOnly) if(bCheck2DOnly)
fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D(); fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D();
@ -953,14 +953,13 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
float distance = diff.Magnitude(); float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) { if(e->GetBoundRadius() + radius > distance) {
CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel(); CColModel *eCol = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
int collidedSpheres = int collidedSpheres =
CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), *eCol, CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), *eCol,
gaTempSphereColPoints, nil, nil); gaTempSphereColPoints, nil, nil);
if(collidedSpheres != 0 || if(collidedSpheres != 0 ||
(e->IsVehicle() && ((CVehicle *)e)->m_vehType == VEHICLE_TYPE_CAR && (e->IsVehicle() && ((CVehicle *)e)->m_vehType == VEHICLE_TYPE_CAR && e->GetModelIndex() != MI_DODO &&
e->m_modelIndex != MI_DODO &&
radius + eCol->boundingBox.max.x > distance)) { radius + eCol->boundingBox.max.x > distance)) {
return e; return e;
} }
@ -1823,7 +1822,7 @@ CWorld::RepositionCertainDynamicObjects()
void void
CWorld::RepositionOneObject(CEntity *pEntity) CWorld::RepositionOneObject(CEntity *pEntity)
{ {
int16 modelId = pEntity->m_modelIndex; int16 modelId = pEntity->GetModelIndex();
if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
@ -2026,8 +2025,7 @@ CWorld::Process(void)
if(!movingEnt->bIsInSafePosition) { if(!movingEnt->bIsInSafePosition) {
movingEnt->bIsStuck = true; movingEnt->bIsStuck = true;
if(movingEnt->GetStatus() == STATUS_PLAYER) { if(movingEnt->GetStatus() == STATUS_PLAYER) {
printf("STUCK: Final Step: Player Entity %d Is Stuck\n", printf("STUCK: Final Step: Player Entity %d Is Stuck\n", movingEnt->GetModelIndex());
movingEnt->m_modelIndex);
movingEnt->m_vecMoveSpeed *= 0.3f; movingEnt->m_vecMoveSpeed *= 0.3f;
movingEnt->ApplyMoveSpeed(); movingEnt->ApplyMoveSpeed();
movingEnt->ApplyTurnSpeed(); movingEnt->ApplyTurnSpeed();
@ -2119,13 +2117,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) { if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
if(pEntity->bIsStatic) { if(pEntity->bIsStatic) {
if(pEntity->IsObject()) { if(pEntity->IsObject()) {
if(fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) { if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if(IsGlass(pObject->m_modelIndex)) { if (IsGlass(pObject->GetModelIndex())) {
CGlass::WindowRespondsToExplosion(pObject, position); CGlass::WindowRespondsToExplosion(pObject, position);
} else { } else {
pObject->bIsStatic = false; pObject->bIsStatic = false;
pObject->AddToMovingList(); pObject->AddToMovingList();
int16 modelId = pEntity->m_modelIndex; int16 modelId = pEntity->GetModelIndex();
if(modelId != MI_FIRE_HYDRANT || if(modelId != MI_FIRE_HYDRANT ||
pObject->bHasBeenDamaged) { pObject->bHasBeenDamaged) {
if(pEntity->IsObject() && if(pEntity->IsObject() &&

View File

@ -12,7 +12,7 @@ CBuilding::ReplaceWithNewModel(int32 id)
{ {
DeleteRwObject(); DeleteRwObject();
if(CModelInfo::GetModelInfo(m_modelIndex)->m_refCount == 0) if (CModelInfo::GetModelInfo(m_modelIndex)->GetNumRefs() == 0)
CStreaming::RemoveModel(m_modelIndex); CStreaming::RemoveModel(m_modelIndex);
m_modelIndex = id; m_modelIndex = id;

View File

@ -474,7 +474,7 @@ CEntity::PreRender(void)
break; break;
} }
if(CModelInfo::GetModelInfo(GetModelIndex())->m_num2dEffects != 0) if (CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects() != 0)
ProcessLightsForEntity(); ProcessLightsForEntity();
} }
@ -633,7 +633,7 @@ CEntity::AddSteamsFromGround(CVector *unused)
C2dEffect *effect; C2dEffect *effect;
CVector pos; CVector pos;
n = CModelInfo::GetModelInfo(GetModelIndex())->m_num2dEffects; n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects();
for(i = 0; i < n; i++){ for(i = 0; i < n; i++){
effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i);
if(effect->type != EFFECT_PARTICLE) if(effect->type != EFFECT_PARTICLE)
@ -676,7 +676,7 @@ CEntity::ProcessLightsForEntity(void)
flashTimer2 = 0; flashTimer2 = 0;
flashTimer3 = 0; flashTimer3 = 0;
n = CModelInfo::GetModelInfo(GetModelIndex())->m_num2dEffects; n = CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects();
for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){ for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){
effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i); effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i);

View File

@ -159,7 +159,7 @@ public:
bool GetIsOnScreenAndNotCulled(void); bool GetIsOnScreenAndNotCulled(void);
bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); } bool IsVisible(void) { return m_rwObject && bIsVisible && GetIsOnScreen(); }
bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); } bool IsVisibleComplex(void) { return m_rwObject && bIsVisible && GetIsOnScreenComplex(); }
int GetModelIndex(void) { return m_modelIndex; } int16 GetModelIndex(void) const { return m_modelIndex; }
void UpdateRwFrame(void); void UpdateRwFrame(void);
void SetupBigBuilding(void); void SetupBigBuilding(void);

View File

@ -22,18 +22,17 @@ class C2dEffect;
class CBaseModelInfo class CBaseModelInfo
{ {
protected: protected:
// TODO?: make more things protected
char m_name[MAX_MODEL_NAME]; char m_name[MAX_MODEL_NAME];
CColModel *m_colModel; CColModel *m_colModel;
C2dEffect *m_twodEffects; C2dEffect *m_twodEffects;
int16 m_objectId; int16 m_objectId;
public:
uint16 m_refCount; uint16 m_refCount;
int16 m_txdSlot; int16 m_txdSlot;
ModelInfoType m_type; ModelInfoType m_type;
uint8 m_num2dEffects; uint8 m_num2dEffects;
bool m_bOwnsColModel; bool m_bOwnsColModel;
public:
CBaseModelInfo(ModelInfoType type); CBaseModelInfo(ModelInfoType type);
virtual ~CBaseModelInfo() {} virtual ~CBaseModelInfo() {}
virtual void Shutdown(void); virtual void Shutdown(void);
@ -42,6 +41,8 @@ public:
virtual RwObject *CreateInstance(void) = 0; virtual RwObject *CreateInstance(void) = 0;
virtual RwObject *GetRwObject(void) = 0; virtual RwObject *GetRwObject(void) = 0;
// one day it becomes virtual
ModelInfoType GetModelType() const { return m_type; }
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; } bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; }
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE || bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE ||
m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck
@ -51,6 +52,7 @@ public:
void SetColModel(CColModel *col, bool owns = false){ void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; } m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; } CColModel *GetColModel(void) { return m_colModel; }
bool DoesOwnColModel(void) { return m_bOwnsColModel; }
void DeleteCollisionModel(void); void DeleteCollisionModel(void);
void ClearTexDictionary(void) { m_txdSlot = -1; } void ClearTexDictionary(void) { m_txdSlot = -1; }
short GetObjectID(void) { return m_objectId; } short GetObjectID(void) { return m_objectId; }
@ -64,6 +66,8 @@ public:
void Init2dEffects(void); void Init2dEffects(void);
void Add2dEffect(C2dEffect *fx); void Add2dEffect(C2dEffect *fx);
C2dEffect *Get2dEffect(int n); C2dEffect *Get2dEffect(int n);
uint8 GetNum2dEffects() const { return m_num2dEffects; }
uint16 GetNumRefs() const { return m_refCount; }
}; };
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");

View File

@ -217,14 +217,14 @@ CModelInfo::GetModelInfo(const char *name, int minIndex, int maxIndex)
bool bool
CModelInfo::IsBoatModel(int32 id) CModelInfo::IsBoatModel(int32 id)
{ {
return GetModelInfo(id)->m_type == MITYPE_VEHICLE && return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT; ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT;
} }
bool bool
CModelInfo::IsBikeModel(int32 id) CModelInfo::IsBikeModel(int32 id)
{ {
return GetModelInfo(id)->m_type == MITYPE_VEHICLE && return GetModelInfo(id)->GetModelType() == MITYPE_VEHICLE &&
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE; ((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE;
} }

View File

@ -22,7 +22,7 @@ CTimeModelInfo::FindOtherTimeModel(void)
for(i = 0; i < MODELINFOSIZE; i++){ for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i); CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
if(mi && mi->m_type == MITYPE_TIME && if (mi && mi->GetModelType() == MITYPE_TIME &&
strncmp(name, mi->GetName(), 24) == 0){ strncmp(name, mi->GetName(), 24) == 0){
m_otherTimeModelID = i; m_otherTimeModelID = i;
return (CTimeModelInfo*)mi; return (CTimeModelInfo*)mi;

View File

@ -131,7 +131,7 @@ CCutsceneHead::RenderLimb(int32 bone)
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(m_parentObject->GetClump()); RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(m_parentObject->GetClump());
int idx = RpHAnimIDGetIndex(hier, bone); int idx = RpHAnimIDGetIndex(hier, bone);
RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier); RwMatrix *mats = RpHAnimHierarchyGetMatrixArray(hier);
CPedModelInfo *mi = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); CPedModelInfo *mi = (CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex());
switch(bone){ switch(bone){
case BONE_Lhand: case BONE_Lhand:
atomic = mi->getLeftHand(); atomic = mi->getLeftHand();

View File

@ -100,7 +100,7 @@ void
CCutsceneObject::RenderLimb(int32 bone) CCutsceneObject::RenderLimb(int32 bone)
{ {
RpAtomic *atomic; RpAtomic *atomic;
CPedModelInfo *mi = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); CPedModelInfo *mi = (CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex());
switch(bone){ switch(bone){
case BONE_head: case BONE_head:
atomic = mi->getHead(); atomic = mi->getHead();

View File

@ -57,7 +57,7 @@ CObject::CObject(int32 mi, bool createRW)
CObject::CObject(CDummyObject *dummy) CObject::CObject(CDummyObject *dummy)
{ {
SetModelIndexNoCreate(dummy->m_modelIndex); SetModelIndexNoCreate(dummy->GetModelIndex());
if (dummy->m_rwObject) if (dummy->m_rwObject)
AttachToRwObject(dummy->m_rwObject); AttachToRwObject(dummy->m_rwObject);
@ -97,7 +97,7 @@ CObject::ProcessControl(void)
m_vecMoveSpeed *= fTimeStep; m_vecMoveSpeed *= fTimeStep;
m_vecTurnSpeed *= fTimeStep; m_vecTurnSpeed *= fTimeStep;
} }
if ((m_modelIndex == MI_EXPLODINGBARREL || m_modelIndex == MI_PETROLPUMP) && bHasBeenDamaged && bIsVisible if ((GetModelIndex() == MI_EXPLODINGBARREL || GetModelIndex() == MI_PETROLPUMP) && bHasBeenDamaged && bIsVisible
&& (CGeneral::GetRandomNumber() & 0x1F) == 10) { && (CGeneral::GetRandomNumber() & 0x1F) == 10) {
bExplosionProof = true; bExplosionProof = true;
bIsVisible = false; bIsVisible = false;
@ -125,7 +125,7 @@ CObject::Render(void)
if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){ if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nRefModelIndex); CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nRefModelIndex);
assert(mi->m_type == MITYPE_VEHICLE); assert(mi->GetModelType() == MITYPE_VEHICLE);
mi->SetVehicleColour(m_colour1, m_colour2); mi->SetVehicleColour(m_colour1, m_colour2);
} }
@ -159,7 +159,7 @@ CObject::ObjectDamage(float amount)
return; return;
static int8 nFrameGen = 0; static int8 nFrameGen = 0;
bool bBodyCastDamageEffect = false; bool bBodyCastDamageEffect = false;
if (m_modelIndex == MI_BODYCAST){ if (GetModelIndex() == MI_BODYCAST) {
if (amount > 50.0f) if (amount > 50.0f)
nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount); nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount);
if (nBodyCastHealth < 0) if (nBodyCastHealth < 0)
@ -310,7 +310,7 @@ void
CObject::Init(void) CObject::Init(void)
{ {
m_type = ENTITY_TYPE_OBJECT; m_type = ENTITY_TYPE_OBJECT;
CObjectData::SetObjectData(m_modelIndex, *this); CObjectData::SetObjectData(GetModelIndex(), *this);
m_nEndOfLifeTime = 0; m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT; ObjectCreatedBy = GAME_OBJECT;
bIsStatic = true; bIsStatic = true;
@ -333,9 +333,9 @@ CObject::Init(void)
m_pCurSurface = outEntity; m_pCurSurface = outEntity;
else else
m_pCurSurface = nil; m_pCurSurface = nil;
if (m_modelIndex == MI_BODYCAST) if (GetModelIndex() == MI_BODYCAST)
nBodyCastHealth = 1000; nBodyCastHealth = 1000;
else if (m_modelIndex == MI_BUOY) else if (GetModelIndex() == MI_BUOY)
bTouchingWater = true; bTouchingWater = true;
} }

View File

@ -1667,7 +1667,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
CVector vehDoorOffset; CVector vehDoorOffset;
float seatOffset; float seatOffset;
vehModel = (CVehicleModelInfo*) CModelInfo::GetModelInfo(veh->m_modelIndex); vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(veh->GetModelIndex());
if (veh->bIsVan && (component == CAR_DOOR_LR || component == CAR_DOOR_RR)) { if (veh->bIsVan && (component == CAR_DOOR_LR || component == CAR_DOOR_RR)) {
seatOffset = 0.0f; seatOffset = 0.0f;
vehDoorOffset = vecPedVanRearDoorAnimOffset; vehDoorOffset = vecPedVanRearDoorAnimOffset;
@ -2351,7 +2351,7 @@ CPed::SetModelIndex(uint32 mi)
CEntity::SetModelIndex(mi); CEntity::SetModelIndex(mi);
RpAnimBlendClumpInit(GetClump()); RpAnimBlendClumpInit(GetClump());
RpAnimBlendClumpFillFrameArray(GetClump(), m_pFrames); RpAnimBlendClumpFillFrameArray(GetClump(), m_pFrames);
CPedModelInfo *modelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); CPedModelInfo *modelInfo = (CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex());
SetPedStats(modelInfo->m_pedStatType); SetPedStats(modelInfo->m_pedStatType);
m_headingRate = m_pedStats->m_headingChangeRate; m_headingRate = m_pedStats->m_headingChangeRate;
m_animGroup = (AssocGroupId) modelInfo->m_animGroup; m_animGroup = (AssocGroupId) modelInfo->m_animGroup;
@ -4245,9 +4245,8 @@ CPed::SetGetUp(void)
CVehicle *veh = (CVehicle*)CPedPlacement::IsPositionClearOfCars(&GetPosition()); CVehicle *veh = (CVehicle*)CPedPlacement::IsPositionClearOfCars(&GetPosition());
if (veh && veh->m_vehType != VEHICLE_TYPE_BIKE || if (veh && veh->m_vehType != VEHICLE_TYPE_BIKE ||
collidingVeh && collidingVeh->IsVehicle() && collidingVeh->m_vehType != VEHICLE_TYPE_BIKE collidingVeh && collidingVeh->IsVehicle() && collidingVeh->m_vehType != VEHICLE_TYPE_BIKE
&& ((uint8)(CTimer::GetFrameCounter() + m_randomSeed + 5) % 8 && ((uint8)(CTimer::GetFrameCounter() + m_randomSeed + 5) % 8 ||
|| CCollision::ProcessColModels(GetMatrix(), *CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(), CCollision::ProcessColModels(GetMatrix(), *GetColModel(), collidingVeh->GetMatrix(), *collidingVeh->GetColModel(),
collidingVeh->GetMatrix(), *CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(),
aTempPedColPts, nil, nil) > 0)) { aTempPedColPts, nil, nil) > 0)) {
bGetUpAnimStarted = false; bGetUpAnimStarted = false;
@ -4640,9 +4639,9 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
animType = 1; animType = 1;
} }
} }
if (neededTurn <= DEGTORAD(90.0f) || veh->m_modelIndex == MI_RCBANDIT || vehPressedHorn || animType != 0) { if (neededTurn <= DEGTORAD(90.0f) || veh->GetModelIndex() == MI_RCBANDIT || vehPressedHorn || animType != 0) {
SetLookFlag(veh, true); SetLookFlag(veh, true);
if ((CGeneral::GetRandomNumber() & 1) && veh->m_modelIndex != MI_RCBANDIT && animType == 0) { if ((CGeneral::GetRandomNumber() & 1) && veh->GetModelIndex() != MI_RCBANDIT && animType == 0) {
stepAnim = ANIM_IDLE_TAXI; stepAnim = ANIM_IDLE_TAXI;
} else { } else {
@ -5149,7 +5148,7 @@ CPed::FightStrike(CVector &touchedNodePos)
#ifdef PED_SKIN #ifdef PED_SKIN
// Have to animate a skinned clump because the initial col model is useless // Have to animate a skinned clump because the initial col model is useless
if(IsClumpSkinned(GetClump())) if(IsClumpSkinned(GetClump()))
ourCol = ((CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->AnimatePedColModelSkinned(GetClump()); ourCol = ((CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex()))->AnimatePedColModelSkinned(GetClump());
else else
#endif #endif
if (nearPed->m_nPedState == PED_FALL if (nearPed->m_nPedState == PED_FALL
@ -5158,7 +5157,8 @@ CPed::FightStrike(CVector &touchedNodePos)
ourCol = &CTempColModels::ms_colModelPedGroundHit; ourCol = &CTempColModels::ms_colModelPedGroundHit;
} else { } else {
#ifdef ANIMATE_PED_COL_MODEL #ifdef ANIMATE_PED_COL_MODEL
ourCol = CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->GetHitColModel(), RpClumpGetFrame(GetClump())); ourCol = CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex()))->GetHitColModel(),
RpClumpGetFrame(GetClump()));
#else #else
ourCol = ((CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->GetHitColModel(); ourCol = ((CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->GetHitColModel();
#endif #endif
@ -5916,7 +5916,7 @@ CPed::CreateDeadPedMoney(void)
if (!CGame::nastyGame) if (!CGame::nastyGame)
return; return;
int skin = m_modelIndex; int skin = GetModelIndex();
if ((skin >= MI_COP && skin <= MI_FIREMAN) || CharCreatedBy == MISSION_CHAR || bInVehicle) if ((skin >= MI_COP && skin <= MI_FIREMAN) || CharCreatedBy == MISSION_CHAR || bInVehicle)
return; return;
@ -6397,7 +6397,7 @@ uint8
CPed::GetNearestTrainPedPosition(CVehicle *train, CVector &enterPos) CPed::GetNearestTrainPedPosition(CVehicle *train, CVector &enterPos)
{ {
CVector enterStepOffset; CVector enterStepOffset;
CVehicleModelInfo *trainModel = (CVehicleModelInfo*) CModelInfo::GetModelInfo(train->m_modelIndex); CVehicleModelInfo *trainModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(train->GetModelIndex());
CMatrix trainMat = CMatrix(train->GetMatrix()); CMatrix trainMat = CMatrix(train->GetMatrix());
CVector leftEntryPos, rightEntryPos, midEntryPos; CVector leftEntryPos, rightEntryPos, midEntryPos;
float distLeftEntry, distRightEntry, distMidEntry; float distLeftEntry, distRightEntry, distMidEntry;
@ -6472,7 +6472,7 @@ void
CPed::LineUpPedWithTrain(void) CPed::LineUpPedWithTrain(void)
{ {
CVector lineUpPos; CVector lineUpPos;
CVehicleModelInfo *trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_pMyVehicle->m_modelIndex); CVehicleModelInfo *trainModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(m_pMyVehicle->GetModelIndex());
CVector enterOffset(1.5f, 0.0f, -0.2f); CVector enterOffset(1.5f, 0.0f, -0.2f);
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
@ -6535,7 +6535,7 @@ CPed::ExitCar(void)
// Car is upside down // Car is upside down
if (m_pMyVehicle->GetUp().z > -0.8f) { if (m_pMyVehicle->GetUp().z > -0.8f) {
if (exitAnim != ANIM_CAR_CLOSE_RHS && exitAnim != ANIM_CAR_CLOSE_LHS && animTime <= 0.3f) if (exitAnim != ANIM_CAR_CLOSE_RHS && exitAnim != ANIM_CAR_CLOSE_LHS && animTime <= 0.3f)
LineUpPedWithCar((m_pMyVehicle->m_modelIndex == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START)); LineUpPedWithCar((m_pMyVehicle->GetModelIndex() == MI_DODO ? LINE_UP_TO_CAR_END : LINE_UP_TO_CAR_START));
else else
LineUpPedWithCar(LINE_UP_TO_CAR_END); LineUpPedWithCar(LINE_UP_TO_CAR_END);
} else { } else {
@ -7043,7 +7043,7 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
return; return;
CVector forward(0.15f * ped->GetForward() + ped->GetPosition()); CVector forward(0.15f * ped->GetForward() + ped->GetPosition());
forward.z += CModelInfo::GetModelInfo(ped->m_modelIndex)->GetColModel()->spheres->center.z + 0.25f; forward.z += CModelInfo::GetModelInfo(ped->GetModelIndex())->GetColModel()->spheres->center.z + 0.25f;
CEntity *obstacle = CWorld::TestSphereAgainstWorld(forward, 0.25f, nil, true, true, false, true, false, false); CEntity *obstacle = CWorld::TestSphereAgainstWorld(forward, 0.25f, nil, true, true, false, true, false, false);
if (!obstacle) { if (!obstacle) {
@ -7483,7 +7483,7 @@ CPed::Seek(void)
if (!obstacle->IsVehicle() || ((CVehicle*)obstacle)->m_vehType == VEHICLE_TYPE_CAR) { if (!obstacle->IsVehicle() || ((CVehicle*)obstacle)->m_vehType == VEHICLE_TYPE_CAR) {
distanceToCountItDone = 2.5f; distanceToCountItDone = 2.5f;
} else { } else {
CVehicleModelInfo *vehModel = (CVehicleModelInfo*) CModelInfo::GetModelInfo(obstacle->m_modelIndex); CVehicleModelInfo *vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(obstacle->GetModelIndex());
float yLength = vehModel->GetColModel()->boundingBox.max.y float yLength = vehModel->GetColModel()->boundingBox.max.y
- vehModel->GetColModel()->boundingBox.min.y; - vehModel->GetColModel()->boundingBox.min.y;
distanceToCountItDone = yLength * 0.55f; distanceToCountItDone = yLength * 0.55f;
@ -7940,9 +7940,9 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen)
CVector rfPos, lrPos, rrPos; CVector rfPos, lrPos, rrPos;
bool canEnter = false; bool canEnter = false;
CVehicleModelInfo *vehModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(veh->m_modelIndex); CVehicleModelInfo *vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(veh->GetModelIndex());
switch (veh->m_modelIndex) { switch (veh->GetModelIndex()) {
case MI_BUS: case MI_BUS:
m_vehEnterType = CAR_DOOR_RF; m_vehEnterType = CAR_DOOR_RF;
posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF); posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF);
@ -8599,7 +8599,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
CVector distVec = GetPosition() - car->GetPosition(); CVector distVec = GetPosition() - car->GetPosition();
if ((impulse > 12.0f || car->m_modelIndex == MI_TRAIN) && !IsPlayer()) { if ((impulse > 12.0f || car->GetModelIndex() == MI_TRAIN) && !IsPlayer()) {
nodeToDamage = PED_TORSO; nodeToDamage = PED_TORSO;
killMethod = WEAPONTYPE_RAMMEDBYCAR; killMethod = WEAPONTYPE_RAMMEDBYCAR;
uint8 randVal = CGeneral::GetRandomNumber() & 3; uint8 randVal = CGeneral::GetRandomNumber() & 3;
@ -8616,11 +8616,11 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
} }
bIsStanding = false; bIsStanding = false;
damageDir = CPed::GetLocalDirection(-m_vecMoveSpeed); damageDir = CPed::GetLocalDirection(-m_vecMoveSpeed);
vehModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(car->m_modelIndex); vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(car->GetModelIndex());
vehColModel = vehModel->GetColModel(); vehColModel = vehModel->GetColModel();
float carRightAndDistDotProd = DotProduct(distVec, car->GetRight()); float carRightAndDistDotProd = DotProduct(distVec, car->GetRight());
if (car->m_modelIndex == MI_TRAIN) { if (car->GetModelIndex() == MI_TRAIN) {
killMethod = WEAPONTYPE_RUNOVERBYCAR; killMethod = WEAPONTYPE_RUNOVERBYCAR;
nodeToDamage = PED_HEAD; nodeToDamage = PED_HEAD;
m_vecMoveSpeed = 0.9f * car->m_vecMoveSpeed; m_vecMoveSpeed = 0.9f * car->m_vecMoveSpeed;
@ -8780,7 +8780,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
bIsStanding = false; bIsStanding = false;
uint8 fallDirection = GetLocalDirection(-car->m_vecMoveSpeed); uint8 fallDirection = GetLocalDirection(-car->m_vecMoveSpeed);
float damage; float damage;
if (IsPlayer() && car->m_modelIndex == MI_TRAIN) if (IsPlayer() && car->GetModelIndex() == MI_TRAIN)
damage = 150.0f; damage = 150.0f;
else else
damage = 30.0f; damage = 30.0f;
@ -8789,14 +8789,14 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
CPed::SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true); CPed::SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true);
if ((m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD) if ((m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD)
&& !m_pCollidingEntity && !m_pCollidingEntity &&
&& (!IsPlayer() || bHasHitWall || car->m_modelIndex == MI_TRAIN || m_vecDamageNormal.z < -0.8f)) { (!IsPlayer() || bHasHitWall || car->GetModelIndex() == MI_TRAIN || m_vecDamageNormal.z < -0.8f)) {
m_pCollidingEntity = car; m_pCollidingEntity = car;
} }
bKnockedUpIntoAir = false; bKnockedUpIntoAir = false;
if (car->m_modelIndex != MI_TRAIN && !bHasHitWall) { if (car->GetModelIndex() != MI_TRAIN && !bHasHitWall) {
m_vecMoveSpeed = car->m_vecMoveSpeed * 0.75f; m_vecMoveSpeed = car->m_vecMoveSpeed * 0.75f;
} }
m_vecMoveSpeed.z = 0.0f; m_vecMoveSpeed.z = 0.0f;
@ -8870,8 +8870,8 @@ CPed::LookForInterestingNodes(void)
for (ptrNode = sector->m_lists[ENTITYLIST_VEHICLES].first; ptrNode && !found; ptrNode = ptrNode->next) { for (ptrNode = sector->m_lists[ENTITYLIST_VEHICLES].first; ptrNode && !found; ptrNode = ptrNode->next) {
CVehicle *veh = (CVehicle*)ptrNode->item; CVehicle *veh = (CVehicle*)ptrNode->item;
model = veh->GetModelInfo(); model = veh->GetModelInfo();
if (model->m_num2dEffects != 0) { if (model->GetNum2dEffects() != 0) {
for (int e = 0; e < model->m_num2dEffects; e++) { for (int e = 0; e < model->GetNum2dEffects(); e++) {
effect = model->Get2dEffect(e); effect = model->Get2dEffect(e);
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
objMat = &veh->GetMatrix(); objMat = &veh->GetMatrix();
@ -8887,9 +8887,9 @@ CPed::LookForInterestingNodes(void)
} }
for (ptrNode = sector->m_lists[ENTITYLIST_OBJECTS].first; ptrNode && !found; ptrNode = ptrNode->next) { for (ptrNode = sector->m_lists[ENTITYLIST_OBJECTS].first; ptrNode && !found; ptrNode = ptrNode->next) {
CObject *obj = (CObject*)ptrNode->item; CObject *obj = (CObject*)ptrNode->item;
model = CModelInfo::GetModelInfo(obj->m_modelIndex); model = CModelInfo::GetModelInfo(obj->GetModelIndex());
if (model->m_num2dEffects != 0) { if (model->GetNum2dEffects() != 0) {
for (int e = 0; e < model->m_num2dEffects; e++) { for (int e = 0; e < model->GetNum2dEffects(); e++) {
effect = model->Get2dEffect(e); effect = model->Get2dEffect(e);
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
objMat = &obj->GetMatrix(); objMat = &obj->GetMatrix();
@ -8905,9 +8905,9 @@ CPed::LookForInterestingNodes(void)
} }
for (ptrNode = sector->m_lists[ENTITYLIST_BUILDINGS].first; ptrNode && !found; ptrNode = ptrNode->next) { for (ptrNode = sector->m_lists[ENTITYLIST_BUILDINGS].first; ptrNode && !found; ptrNode = ptrNode->next) {
CBuilding *building = (CBuilding*)ptrNode->item; CBuilding *building = (CBuilding*)ptrNode->item;
model = CModelInfo::GetModelInfo(building->m_modelIndex); model = CModelInfo::GetModelInfo(building->GetModelIndex());
if (model->m_num2dEffects != 0) { if (model->GetNum2dEffects() != 0) {
for (int e = 0; e < model->m_num2dEffects; e++) { for (int e = 0; e < model->GetNum2dEffects(); e++) {
effect = model->Get2dEffect(e); effect = model->Get2dEffect(e);
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
objMat = &building->GetMatrix(); objMat = &building->GetMatrix();
@ -8923,9 +8923,9 @@ CPed::LookForInterestingNodes(void)
} }
for (ptrNode = sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first; ptrNode && !found; ptrNode = ptrNode->next) { for (ptrNode = sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first; ptrNode && !found; ptrNode = ptrNode->next) {
CBuilding *building = (CBuilding*)ptrNode->item; CBuilding *building = (CBuilding*)ptrNode->item;
model = CModelInfo::GetModelInfo(building->m_modelIndex); model = CModelInfo::GetModelInfo(building->GetModelIndex());
if (model->m_num2dEffects != 0) { if (model->GetNum2dEffects() != 0) {
for (int e = 0; e < model->m_num2dEffects; e++) { for (int e = 0; e < model->GetNum2dEffects(); e++) {
effect = model->Get2dEffect(e); effect = model->Get2dEffect(e);
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) { if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
objMat = &building->GetMatrix(); objMat = &building->GetMatrix();
@ -9153,7 +9153,7 @@ CPed::MoveHeadToLook(void)
if (animTime > 4.0f / 30.0f && animTime - fuckUAssoc->timeStep > 4.0f / 30.0f) { if (animTime > 4.0f / 30.0f && animTime - fuckUAssoc->timeStep > 4.0f / 30.0f) {
bool lookingToCop = false; bool lookingToCop = false;
if (m_pLookTarget->m_modelIndex == MI_POLICE if (m_pLookTarget->GetModelIndex() == MI_POLICE
|| m_pLookTarget->IsPed() && ((CPed*)m_pLookTarget)->m_nPedType == PEDTYPE_COP) { || m_pLookTarget->IsPed() && ((CPed*)m_pLookTarget)->m_nPedType == PEDTYPE_COP) {
lookingToCop = true; lookingToCop = true;
@ -9213,7 +9213,7 @@ CPed::MoveHeadToLook(void)
} else { } else {
animToPlay = ANIM_FUCKU; animToPlay = ANIM_FUCKU;
} }
} else if (m_pedStats->m_temper > 49 || m_pLookTarget->m_modelIndex == MI_POLICE) { } else if (m_pedStats->m_temper > 49 || m_pLookTarget->GetModelIndex() == MI_POLICE) {
animToPlay = ANIM_FUCKU; animToPlay = ANIM_FUCKU;
} }
} else if (notRocketLauncher && (CGeneral::GetRandomNumber() & 1)) { } else if (notRocketLauncher && (CGeneral::GetRandomNumber() & 1)) {
@ -9551,7 +9551,7 @@ CPed::ProcessControl(void)
case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_BUILDING:
case ENTITY_TYPE_OBJECT: case ENTITY_TYPE_OBJECT:
{ {
CBaseModelInfo *collidingModel = CModelInfo::GetModelInfo(collidingEnt->m_modelIndex); CBaseModelInfo *collidingModel = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex());
CColModel *collidingCol = collidingModel->GetColModel(); CColModel *collidingCol = collidingModel->GetColModel();
if (collidingEnt->IsObject() && ((CObject*)collidingEnt)->m_nSpecialCollisionResponseCases != COLLRESPONSE_CHANGE_THEN_SMASH if (collidingEnt->IsObject() && ((CObject*)collidingEnt)->m_nSpecialCollisionResponseCases != COLLRESPONSE_CHANGE_THEN_SMASH
|| collidingCol->boundingBox.max.x < 3.0f || collidingCol->boundingBox.max.x < 3.0f
@ -9980,7 +9980,7 @@ CPed::ProcessControl(void)
} else { } else {
DMAudio.PlayOneShot(collidingVeh->m_audioEntityId, SOUND_CAR_PED_COLLISION, m_fDamageImpulse); DMAudio.PlayOneShot(collidingVeh->m_audioEntityId, SOUND_CAR_PED_COLLISION, m_fDamageImpulse);
if (IsPlayer()) { if (IsPlayer()) {
CColModel *collidingCol = CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(); CColModel *collidingCol = CModelInfo::GetModelInfo(collidingVeh->GetModelIndex())->GetColModel();
CVector colMinVec = collidingCol->boundingBox.min; CVector colMinVec = collidingCol->boundingBox.min;
CVector colMaxVec = collidingCol->boundingBox.max; CVector colMaxVec = collidingCol->boundingBox.max;
@ -10042,7 +10042,7 @@ CPed::ProcessControl(void)
float damage; float damage;
if (driver && driver->IsPlayer()) { if (driver && driver->IsPlayer()) {
damage = vehRightVecAndSpeedDotProd * 1000.0f; damage = vehRightVecAndSpeedDotProd * 1000.0f;
} else if (collidingVeh->m_modelIndex == MI_TRAIN) { } else if (collidingVeh->GetModelIndex() == MI_TRAIN) {
damage = 50.0f; damage = 50.0f;
} else { } else {
damage = 20.0f; damage = 20.0f;
@ -11981,7 +11981,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker)
} }
if (attackerPed && attackerPed->IsPlayer() && (attackerPed->m_nPedState == PED_CARJACK || attackerPed->bInVehicle)) { if (attackerPed && attackerPed->IsPlayer() && (attackerPed->m_nPedState == PED_CARJACK || attackerPed->bInVehicle)) {
if (!attackerPed->m_pMyVehicle || attackerPed->m_pMyVehicle->m_modelIndex != MI_TOYZ) { if (!attackerPed->m_pMyVehicle || attackerPed->m_pMyVehicle->GetModelIndex() != MI_TOYZ) {
int16 lastVehicle; int16 lastVehicle;
CEntity *vehicles[8]; CEntity *vehicles[8];
CWorld::FindObjectsInRange(GetPosition(), 30.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); CWorld::FindObjectsInRange(GetPosition(), 30.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
@ -12708,7 +12708,7 @@ CPed::renderLimb(int node)
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump()); RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
int idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID); int idx = RpHAnimIDGetIndex(hier, m_pFrames[node]->nodeID);
RwMatrix *mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx]; RwMatrix *mat = &RpHAnimHierarchyGetMatrixArray(hier)[idx];
CPedModelInfo *mi = (CPedModelInfo*)CModelInfo::GetModelInfo(m_modelIndex); CPedModelInfo *mi = (CPedModelInfo *)CModelInfo::GetModelInfo(GetModelIndex());
RpAtomic *atomic; RpAtomic *atomic;
switch(node){ switch(node){
case PED_HEAD: case PED_HEAD:
@ -14100,7 +14100,7 @@ void
CPed::SetDirectionToWalkAroundObject(CEntity *obj) CPed::SetDirectionToWalkAroundObject(CEntity *obj)
{ {
float distLimitForTimer = 8.0f; float distLimitForTimer = 8.0f;
CColModel *objCol = CModelInfo::GetModelInfo(obj->m_modelIndex)->GetColModel(); CColModel *objCol = CModelInfo::GetModelInfo(obj->GetModelIndex())->GetColModel();
CVector objColMin = objCol->boundingBox.min; CVector objColMin = objCol->boundingBox.min;
CVector objColMax = objCol->boundingBox.max; CVector objColMax = objCol->boundingBox.max;
CVector objColCenter = (objColMin + objColMax) / 2.0f; CVector objColCenter = (objColMin + objColMax) / 2.0f;
@ -14119,7 +14119,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
#ifdef TOGGLEABLE_BETA_FEATURES #ifdef TOGGLEABLE_BETA_FEATURES
if (!bMakePedsRunToPhonesToReportCrimes) if (!bMakePedsRunToPhonesToReportCrimes)
#endif #endif
if (CharCreatedBy != MISSION_CHAR && obj->m_modelIndex == MI_PHONEBOOTH1) { if (CharCreatedBy != MISSION_CHAR && obj->GetModelIndex() == MI_PHONEBOOTH1) {
bool isRunning = m_nMoveState == PEDMOVE_RUN || m_nMoveState == PEDMOVE_SPRINT; bool isRunning = m_nMoveState == PEDMOVE_RUN || m_nMoveState == PEDMOVE_SPRINT;
SetFindPathAndFlee(obj, 5000, !isRunning); SetFindPathAndFlee(obj, 5000, !isRunning);
return; return;
@ -14135,7 +14135,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (objMat.GetUp().z < 0.0f) if (objMat.GetUp().z < 0.0f)
objUpsideDown = true; objUpsideDown = true;
if (obj->m_modelIndex != MI_TRAFFICLIGHTS && obj->m_modelIndex != MI_SINGLESTREETLIGHTS1 && obj->m_modelIndex != MI_SINGLESTREETLIGHTS2) { if (obj->GetModelIndex() != MI_TRAFFICLIGHTS && obj->GetModelIndex() != MI_SINGLESTREETLIGHTS1 && obj->GetModelIndex() != MI_SINGLESTREETLIGHTS2) {
objColCenter = obj->GetMatrix() * objColCenter; objColCenter = obj->GetMatrix() * objColCenter;
} else { } else {
checkIntervalInDist = 0.4f; checkIntervalInDist = 0.4f;
@ -14652,8 +14652,8 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
CColPoint intersectionPoint; CColPoint intersectionPoint;
CColLine ourLine; CColLine ourLine;
CColModel *ourCol = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel();
CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->m_modelIndex)->GetColModel(); CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex())->GetColModel();
if (!bUsesCollision) if (!bUsesCollision)
return false; return false;
@ -15108,7 +15108,7 @@ CPed::SetRadioStation(void)
if (IsPlayer() || !m_pMyVehicle || m_pMyVehicle->pDriver != this) if (IsPlayer() || !m_pMyVehicle || m_pMyVehicle->pDriver != this)
return; return;
uint8 category = GetPedRadioCategory(m_modelIndex); uint8 category = GetPedRadioCategory(GetModelIndex());
if (DMAudio.IsMP3RadioChannelAvailable()) { if (DMAudio.IsMP3RadioChannelAvailable()) {
if (CGeneral::GetRandomNumber() & 15) { if (CGeneral::GetRandomNumber() & 15) {
for (orderInCat = 0; orderInCat < 4; orderInCat++) { for (orderInCat = 0; orderInCat < 4; orderInCat++) {
@ -15198,7 +15198,7 @@ CPed::PreRender(void)
if (CWeather::Rain > 0.3f && TheCamera.SoundDistUp > 15.0f) { if (CWeather::Rain > 0.3f && TheCamera.SoundDistUp > 15.0f) {
if ((TheCamera.GetPosition() - GetPosition()).Magnitude() < 25.0f) { if ((TheCamera.GetPosition() - GetPosition()).Magnitude() < 25.0f) {
bool doSplashUp = true; bool doSplashUp = true;
CColModel *ourCol = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel();
CVector speed = FindPlayerSpeed(); CVector speed = FindPlayerSpeed();
if (Abs(speed.x) <= 0.05f && Abs(speed.y) <= 0.05f) { if (Abs(speed.x) <= 0.05f && Abs(speed.y) <= 0.05f) {
@ -15675,7 +15675,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
} else { } else {
if (veh->GetUp().z > -0.8f) { if (veh->GetUp().z > -0.8f) {
bool addDoorSmoke = false; bool addDoorSmoke = false;
if (veh->m_modelIndex == MI_YARDIE) if (veh->GetModelIndex() == MI_YARDIE)
addDoorSmoke = true; addDoorSmoke = true;
switch (m_vehEnterType) { switch (m_vehEnterType) {
@ -15917,7 +15917,7 @@ CPed::ScanForInterestingStuff(void)
for (int i = 0; i < lastVehicle; i++) { for (int i = 0; i < lastVehicle; i++) {
CVehicle* veh = (CVehicle*)vehicles[i]; CVehicle* veh = (CVehicle*)vehicles[i];
if (veh->m_modelIndex == MI_MRWHOOP) { if (veh->GetModelIndex() == MI_MRWHOOP) {
if (veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED) { if (veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED) {
if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f) { if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f) {
SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh); SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh);
@ -16134,7 +16134,7 @@ CPed::SeekCar(void)
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
return; return;
} }
if (vehToSeek->m_modelIndex == MI_COACH) { if (vehToSeek->GetModelIndex() == MI_COACH) {
GetNearestDoor(vehToSeek, dest); GetNearestDoor(vehToSeek, dest);
} else { } else {
if (vehToSeek->IsTrain()) { if (vehToSeek->IsTrain()) {
@ -16272,7 +16272,7 @@ void
CPed::ServiceTalking(void) CPed::ServiceTalking(void)
{ {
if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) { if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
if (CGeneral::faststricmp(CModelInfo::GetModelInfo(m_modelIndex)->GetName(), "bomber")) { if (CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber")) {
if (m_nPedState == PED_ON_FIRE) if (m_nPedState == PED_ON_FIRE)
m_queuedSound = SOUND_PED_BURNING; m_queuedSound = SOUND_PED_BURNING;
} else { } else {
@ -16808,7 +16808,7 @@ CPed::SetPedPositionInCar(void)
return; return;
} }
} }
CVehicleModelInfo *vehModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_pMyVehicle->m_modelIndex); CVehicleModelInfo *vehModel = (CVehicleModelInfo *)CModelInfo::GetModelInfo(m_pMyVehicle->GetModelIndex());
CMatrix newMat(m_pMyVehicle->GetMatrix()); CMatrix newMat(m_pMyVehicle->GetMatrix());
CVector seatPos; CVector seatPos;
if (m_pMyVehicle->pDriver == this) { if (m_pMyVehicle->pDriver == this) {
@ -16926,7 +16926,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction)
default: default:
break; break;
} }
obj->RefModelInfo(m_modelIndex); obj->RefModelInfo(GetModelIndex());
obj->AttachToRwObject((RwObject*)clump); obj->AttachToRwObject((RwObject*)clump);
obj->m_fMass = 15.0f; obj->m_fMass = 15.0f;
obj->m_fTurnMass = 5.0f; obj->m_fTurnMass = 5.0f;
@ -17604,7 +17604,7 @@ CPed::SetCarJack(CVehicle* car)
pedInSeat = car->pDriver; pedInSeat = car->pDriver;
if (m_fHealth > 0.0f && (IsPlayer() || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS || if (m_fHealth > 0.0f && (IsPlayer() || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS ||
(car->VehicleCreatedBy != MISSION_VEHICLE && car->m_modelIndex != MI_DODO))) (car->VehicleCreatedBy != MISSION_VEHICLE && car->GetModelIndex() != MI_DODO)))
if (pedInSeat && !pedInSeat->IsPedDoingDriveByShooting() && pedInSeat->m_nPedState == PED_DRIVING) if (pedInSeat && !pedInSeat->IsPedDoingDriveByShooting() && pedInSeat->m_nPedState == PED_DRIVING)
if (m_nPedState != PED_CARJACK && !m_pVehicleAnim) if (m_nPedState != PED_CARJACK && !m_pVehicleAnim)
if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door))) if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door)))
@ -17660,7 +17660,7 @@ CPed::SetExitBoat(CVehicle *boat)
m_nPedState = PED_IDLE; m_nPedState = PED_IDLE;
CVector firstPos = GetPosition(); CVector firstPos = GetPosition();
CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f);
if (boat->m_modelIndex == MI_SPEEDER && boat->IsUpsideDown()) { if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) {
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f);
m_pVehicleAnim->SetFinishCallback(CPed::PedSetOutCarCB, this); m_pVehicleAnim->SetFinishCallback(CPed::PedSetOutCarCB, this);
m_vehEnterType = CAR_DOOR_RF; m_vehEnterType = CAR_DOOR_RF;

View File

@ -755,7 +755,7 @@ CPopulation::AddPedInCar(CVehicle* car)
int preferredModel; int preferredModel;
CTheZones::GetZoneInfoForTimeOfDay(&coors, &zoneInfo); CTheZones::GetZoneInfoForTimeOfDay(&coors, &zoneInfo);
switch (car->m_modelIndex) { switch (car->GetModelIndex()) {
case MI_FIRETRUCK: case MI_FIRETRUCK:
preferredModel = 0; preferredModel = 0;
pedType = PEDTYPE_FIREMAN; pedType = PEDTYPE_FIREMAN;
@ -796,14 +796,14 @@ CPopulation::AddPedInCar(CVehicle* car)
int gangOfPed = 0; int gangOfPed = 0;
imSureThatModelIsLoaded = false; imSureThatModelIsLoaded = false;
while (gangOfPed < NUM_GANGS && CGangs::GetGangInfo(gangOfPed)->m_nVehicleMI != car->m_modelIndex) while (gangOfPed < NUM_GANGS && CGangs::GetGangInfo(gangOfPed)->m_nVehicleMI != car->GetModelIndex())
gangOfPed++; gangOfPed++;
if (gangOfPed < NUM_GANGS) { if (gangOfPed < NUM_GANGS) {
pedType = gangOfPed + PEDTYPE_GANG1; pedType = gangOfPed + PEDTYPE_GANG1;
preferredModel = ChooseGangOccupation(gangOfPed); preferredModel = ChooseGangOccupation(gangOfPed);
} else if (gangOfPed == NUM_GANGS) { } else if (gangOfPed == NUM_GANGS) {
CVehicleModelInfo *carModelInfo = ((CVehicleModelInfo*)CModelInfo::GetModelInfo(car->m_modelIndex)); CVehicleModelInfo *carModelInfo = ((CVehicleModelInfo *)CModelInfo::GetModelInfo(car->GetModelIndex()));
int i = 15; int i = 15;
for(; i >= 0; i--) { for(; i >= 0; i--) {
// Should return random model each time // Should return random model each time
@ -972,7 +972,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
CWorld::Remove(dummy); CWorld::Remove(dummy);
delete dummy; delete dummy;
CWorld::Add(obj); CWorld::Add(obj);
int16 mi = obj->m_modelIndex; int16 mi = obj->GetModelIndex();
if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
makeInvisible = true; makeInvisible = true;
@ -981,7 +981,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (makeInvisible) { if (makeInvisible) {
obj->bIsVisible = false; obj->bIsVisible = false;
} else if (obj->m_modelIndex == MI_BUOY) { } else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false; obj->bIsStatic = false;
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f); obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
obj->bTouchingWater = true; obj->bTouchingWater = true;
@ -999,7 +999,7 @@ CPopulation::ConvertToDummyObject(CObject *obj)
dummy->UpdateRwFrame(); dummy->UpdateRwFrame();
bool makeInvisible; bool makeInvisible;
int16 mi = obj->m_modelIndex; int16 mi = obj->GetModelIndex();
if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 || if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8) mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
makeInvisible = true; makeInvisible = true;
@ -1019,8 +1019,7 @@ bool
CPopulation::TestRoomForDummyObject(CObject *obj) CPopulation::TestRoomForDummyObject(CObject *obj)
{ {
int16 collidingObjs; int16 collidingObjs;
CWorld::FindObjectsKindaColliding(obj->m_objectMatrix.GetPosition(), CWorld::FindObjectsKindaColliding(obj->m_objectMatrix.GetPosition(), CModelInfo::GetModelInfo(obj->GetModelIndex())->GetColModel()->boundingSphere.radius,
CModelInfo::GetModelInfo(obj->m_modelIndex)->GetColModel()->boundingSphere.radius,
false, &collidingObjs, 2, nil, false, true, true, false, false); false, &collidingObjs, 2, nil, false, true, true, false, false);
return collidingObjs == 0; return collidingObjs == 0;

View File

@ -91,9 +91,7 @@ CRenderer::RenderOneRoad(CEntity *e)
if(gbDontRenderBuildings) if(gbDontRenderBuildings)
return; return;
if(gbShowCollisionPolys) if(gbShowCollisionPolys)
CCollision::DrawColModel_Coloured(e->GetMatrix(), CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex());
*CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel(),
e->m_modelIndex);
else else
e->Render(); e->Render();
} }
@ -109,9 +107,7 @@ CRenderer::RenderOneNonRoad(CEntity *e)
#ifndef MASTER #ifndef MASTER
if(gbShowCollisionPolys){ if(gbShowCollisionPolys){
if(!e->IsVehicle()){ if(!e->IsVehicle()){
CCollision::DrawColModel_Coloured(e->GetMatrix(), CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex());
*CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel(),
e->m_modelIndex);
return; return;
} }
}else if(e->IsBuilding()){ }else if(e->IsBuilding()){
@ -339,7 +335,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
float dist; float dist;
bool request = true; bool request = true;
if(mi->m_type == MITYPE_TIME){ if (mi->GetModelType() == MITYPE_TIME) {
ti = (CTimeModelInfo*)mi; ti = (CTimeModelInfo*)mi;
other = ti->GetOtherTimeModel(); other = ti->GetOtherTimeModel();
if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){ if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){
@ -355,7 +351,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
request = false; request = false;
} }
}else{ }else{
if(mi->m_type != MITYPE_SIMPLE){ if (mi->GetModelType() != MITYPE_SIMPLE) {
if(FindPlayerVehicle() == ent && if(FindPlayerVehicle() == ent &&
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){
// Player's vehicle in first person mode // Player's vehicle in first person mode
@ -485,7 +481,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
float dist; float dist;
bool request = true; bool request = true;
if(mi->m_type == MITYPE_TIME){ if(mi->GetModelType() == MITYPE_TIME){
ti = (CTimeModelInfo*)mi; ti = (CTimeModelInfo*)mi;
other = ti->GetOtherTimeModel(); other = ti->GetOtherTimeModel();
if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){ if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){
@ -502,7 +498,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
} }
}else{ }else{
// TODO(MIAMI): weapon // TODO(MIAMI): weapon
if(mi->m_type != MITYPE_SIMPLE){ if(mi->GetModelType() != MITYPE_SIMPLE){
if(FindPlayerVehicle() == ent && if(FindPlayerVehicle() == ent &&
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){
// Player's vehicle in first person mode // Player's vehicle in first person mode
@ -636,11 +632,11 @@ int32
CRenderer::SetupBigBuildingVisibility(CEntity *ent) CRenderer::SetupBigBuildingVisibility(CEntity *ent)
{ {
#ifndef MIAMI #ifndef MIAMI
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->m_modelIndex); CSimpleModelInfo *mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(ent->GetModelIndex());
CTimeModelInfo *ti; CTimeModelInfo *ti;
int32 other; int32 other;
if(mi->m_type == MITYPE_TIME){ if (mi->GetModelType() == MITYPE_TIME) {
ti = (CTimeModelInfo*)mi; ti = (CTimeModelInfo*)mi;
other = ti->GetOtherTimeModel(); other = ti->GetOtherTimeModel();
// Hide objects not in time range if possible // Hide objects not in time range if possible
@ -648,7 +644,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
if(!CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())) if(!CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff()))
return VIS_INVISIBLE; return VIS_INVISIBLE;
// Draw like normal // Draw like normal
}else if(mi->m_type == MITYPE_VEHICLE) } else if (mi->GetModelType() == MITYPE_VEHICLE)
return ent->IsVisible() ? VIS_VISIBLE : VIS_INVISIBLE; return ent->IsVisible() ? VIS_VISIBLE : VIS_INVISIBLE;
float dist = (ms_vecCameraPosition-ent->GetPosition()).Magnitude(); float dist = (ms_vecCameraPosition-ent->GetPosition()).Magnitude();
@ -665,7 +661,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
// But if it is a time object, we'd rather draw the wrong // But if it is a time object, we'd rather draw the wrong
// non-LOD than the right LOD. // non-LOD than the right LOD.
if(nonLOD->m_type == MITYPE_TIME){ if (nonLOD->GetModelType() == MITYPE_TIME) {
ti = (CTimeModelInfo*)nonLOD; ti = (CTimeModelInfo*)nonLOD;
other = ti->GetOtherTimeModel(); other = ti->GetOtherTimeModel();
if(other != -1 && CModelInfo::GetModelInfo(other)->GetRwObject()) if(other != -1 && CModelInfo::GetModelInfo(other)->GetRwObject())
@ -725,7 +721,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
// TODO(MIAMI): area // TODO(MIAMI): area
bool request = true; bool request = true;
if(mi->m_type == MITYPE_TIME){ if(mi->GetModelType() == MITYPE_TIME){
ti = (CTimeModelInfo*)mi; ti = (CTimeModelInfo*)mi;
other = ti->GetOtherTimeModel(); other = ti->GetOtherTimeModel();
if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){ if(CClock::GetIsTimeInRange(ti->GetTimeOn(), ti->GetTimeOff())){
@ -742,7 +738,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
// it since what we really want is the other one. // it since what we really want is the other one.
request = false; request = false;
} }
}else if(mi->m_type == MITYPE_VEHICLE) }else if(mi->GetModelType() == MITYPE_VEHICLE)
return ent->IsVisible() ? VIS_VISIBLE : VIS_INVISIBLE; return ent->IsVisible() ? VIS_VISIBLE : VIS_INVISIBLE;
float dist = (ms_vecCameraPosition-ent->GetPosition()).Magnitude(); float dist = (ms_vecCameraPosition-ent->GetPosition()).Magnitude();
@ -759,7 +755,7 @@ CRenderer::SetupBigBuildingVisibility(CEntity *ent)
// But if it is a time object, we'd rather draw the wrong // But if it is a time object, we'd rather draw the wrong
// non-LOD than the right LOD. // non-LOD than the right LOD.
if(nonLOD->m_type == MITYPE_TIME){ if(nonLOD->GetModelType() == MITYPE_TIME){
ti = (CTimeModelInfo*)nonLOD; ti = (CTimeModelInfo*)nonLOD;
other = ti->GetOtherTimeModel(); other = ti->GetOtherTimeModel();
if(other != -1 && CModelInfo::GetModelInfo(other)->GetRwObject()) if(other != -1 && CModelInfo::GetModelInfo(other)->GetRwObject())
@ -1447,7 +1443,7 @@ CRenderer::SortBIGBuildingsForSectorList(CPtrList *list)
bool bool
CRenderer::ShouldModelBeStreamed(CEntity *ent) CRenderer::ShouldModelBeStreamed(CEntity *ent)
{ {
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(ent->m_modelIndex); CSimpleModelInfo *mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(ent->GetModelIndex());
float dist = (ent->GetPosition() - ms_vecCameraPosition).Magnitude(); float dist = (ent->GetPosition() - ms_vecCameraPosition).Magnitude();
if(mi->m_noFade) if(mi->m_noFade)
return dist - STREAM_DISTANCE < mi->GetLargestLodDistance(); return dist - STREAM_DISTANCE < mi->GetLargestLodDistance();

View File

@ -146,7 +146,7 @@ CVisibilityPlugins::RenderFadingEntities(void)
CEntity *e = node->item.entity; CEntity *e = node->item.entity;
if(e->m_rwObject == nil) if(e->m_rwObject == nil)
continue; continue;
mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(e->m_modelIndex); mi = (CSimpleModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex());
if(mi->m_noZwrite) if(mi->m_noZwrite)
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
@ -718,7 +718,7 @@ CVisibilityPlugins::SetAtomicModelInfo(RpAtomic *atomic,
{ {
AtomicExt *ext = ATOMICEXT(atomic); AtomicExt *ext = ATOMICEXT(atomic);
ext->modelInfo = modelInfo; ext->modelInfo = modelInfo;
switch(modelInfo->m_type) switch (modelInfo->GetModelType())
case MITYPE_SIMPLE: case MITYPE_SIMPLE:
case MITYPE_TIME: case MITYPE_TIME:
if(modelInfo->m_normalCull) if(modelInfo->m_normalCull)
@ -828,7 +828,7 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo
SetFrameHierarchyId(RpClumpGetFrame(clump), (int32)modelInfo); SetFrameHierarchyId(RpClumpGetFrame(clump), (int32)modelInfo);
// Unused // Unused
switch(modelInfo->m_type){ switch (modelInfo->GetModelType()) {
// ignore MLO // ignore MLO
case MITYPE_VEHICLE: case MITYPE_VEHICLE:
vmi = (CVehicleModelInfo*)modelInfo; vmi = (CVehicleModelInfo*)modelInfo;

View File

@ -292,7 +292,7 @@ CBoat::ProcessControl(void)
AddWakePoint(GetPosition()); AddWakePoint(GetPosition());
float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward()); float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward());
if(m_modelIndex == MI_GHOST) if (GetModelIndex() == MI_GHOST)
steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f; steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f;
if(steerFactor < 0.0f) steerFactor = 0.0f; if(steerFactor < 0.0f) steerFactor = 0.0f;