Skip to content
Permalink
Browse files
Only VC cop cars/models are streamed now
Some Empire stuff wrapped with macroes for easier update releasing
Futher code refactoring

git-svn-id: svn://localhost/vcspc/trunk@27 9f344024-d43e-4b27-bde7-3d027e20192d
  • Loading branch information
silent committed Dec 14, 2013
1 parent 82794df commit f84691458c158d40c836805c5dc9146498819ff7
@@ -259,7 +259,7 @@ void CFont::SetTextSlanted(float fAngle)
}
}

void CFont::func_7194E0(float fUnk)
void CFont::SetCentreSize(float fUnk)
{
DWORD dwFunc = (DWORD)0x7194E0;
_asm
@@ -94,7 +94,7 @@ class CFont
static void SetTextOutline(unsigned char bOutline);
static void ResetSlantedTextPos(float fOne, float fTwo);
static void SetTextSlanted(float fAngle);
static void func_7194E0(float fUnk);
static void SetCentreSize(float fUnk);
static void SetTextWrapX(float fWrap);
static void SetTextJustify(bool bJustify);
static void func_71A210();
@@ -9,7 +9,7 @@ void CGarages::PrintMessages()
CFont::SetTextLetterSize(_width(0.6f), _height(1.1f));
CFont::SetTextUseProportionalValues(true);
CFont::SetTextBackground(0, 0);
CFont::func_7194E0(_width(230.0f));
CFont::SetCentreSize(_width(500.0f));
CFont::SetTextAlignment(ALIGN_Center);
CFont::SetFontStyle(FONT_Eurostile);
CFont::SetTextColour(CRGBA(BaseColors[3]));
@@ -20,17 +20,17 @@ void CGarages::PrintMessages()
if ( garages->MessageNumber2 < 0 )
{
if ( garages->MessageNumber1 < 0 )
CFont::PrintString(RsGlobal.MaximumWidth / 2, _y(275.0), gxt->GetText(garages->MessageIDString));
CFont::PrintString(static_cast<float>(RsGlobal.MaximumWidth / 2), _y(275.0f), gxt->GetText(garages->MessageIDString));
else
{
gxt->TextNumberFormat(gxt->GetText(garages->MessageIDString), garages->MessageNumber1, -1, -1, -1, -1, -1, tmpString);
CFont::PrintString(RsGlobal.MaximumWidth / 2, _y(275.0), tmpString);
CFont::PrintString(static_cast<float>(RsGlobal.MaximumWidth / 2), _y(275.0f), tmpString);
}
}
else
{
gxt->TextNumberFormat(gxt->GetText(garages->MessageIDString), garages->MessageNumber1, garages->MessageNumber2, -1, -1, -1, -1, tmpString);
CFont::PrintString(RsGlobal.MaximumWidth / 2, _y(275.0), tmpString);
CFont::PrintString(static_cast<float>(RsGlobal.MaximumWidth / 2), _y(275.0f), tmpString);
}
}
}
@@ -1,8 +1,6 @@
#ifndef __CSHADOWS
#define __CSHADOWS

#define WIN32_LEAN_AND_MEAN

class CShadows
{
public:
@@ -1,6 +1,7 @@
#include "StdAfx.h"

CdImage CStreaming::ms_cdImages[NUM_IMG_FILES];
bool CStreaming::ms_bCopBikeAllowed;

WRAPPER int CdStreamAddImage(const char* pName, bool bStandardIMG) { WRAPARG(pName); WRAPARG(bStandardIMG); EAXJMP(0x407610); }
WRAPPER void InitModelIndices() { EAXJMP(0x5B57C0); }
@@ -20,7 +21,7 @@ void CStreaming::RequestModel(DWORD index, int a2)
}
}

void CStreaming::ReleaseModel(DWORD index)
void CStreaming::SetModelIsDeletable(DWORD index)
{
DWORD dwFunc = (DWORD)FUNC_CStreaming__ReleaseModel;
_asm
@@ -126,8 +127,46 @@ void CStreaming::LoadCdDirectory(const char* pArchiveName, long nArchiveIndex, C
}
}

void CStreaming::StreamCopModels(int nTownID)
{
UNREFERENCED_PARAMETER(nTownID);

if ( *activeInterior )
return;

// TODO: Concern SCM flag to ignore bikes
CWanted* pWanted = FindPlayerWanted(-1);
ms_bCopBikeAllowed = pWanted ? pWanted->GetWantedLevel() < 3 : false;

if ( _loadedObjectInfo[281].bLoaded != true || _loadedObjectInfo[VT_POLICEM].bLoaded != true )
{
CStreaming::RequestModel(281, 2);
CStreaming::RequestModel(VT_POLICEM, 2);
}

if ( ms_bCopBikeAllowed && (_loadedObjectInfo[284].bLoaded != true || _loadedObjectInfo[VT_ELECTRAP].bLoaded != true) )
{
CStreaming::RequestModel(284, 2);
CStreaming::RequestModel(VT_ELECTRAP, 2);
}
}

int CStreaming::ChooseCopModel()
{
return _loadedObjectInfo[281].bLoaded == true ? 281 : -1;
}

int CStreaming::ChooseCopCarModel(BOOL bIgnoreBikes)
{
if ( bIgnoreBikes || (rand() % 100) > 50 || _loadedObjectInfo[284].bLoaded != true || _loadedObjectInfo[VT_ELECTRAP].bLoaded != true || !ms_bCopBikeAllowed )
return _loadedObjectInfo[281].bLoaded == true && _loadedObjectInfo[VT_POLICEM].bLoaded == true ? VT_POLICEM : -1;

return VT_ELECTRAP;
}

void CStreaming::RequestSpecialDriverModel(WORD carModel)
{
// TODO: Enum
switch ( carModel )
{
case 481:
@@ -165,36 +204,36 @@ void CStreaming::ReleaseSpecialDriverModel(WORD carModel)
switch ( carModel )
{
case 481:
ReleaseModel(23);
SetModelIsDeletable(23);
ReleaseTexture(23);
return;
case 448:
ReleaseModel(155);
SetModelIsDeletable(155);
ReleaseTexture(155);
return;
case 420:
case 438:
case 604:
taxiDriverModel = RandomizeTaxiDriverIDByTown();
ReleaseModel(taxiDriverModel);
SetModelIsDeletable(taxiDriverModel);
ReleaseTexture(taxiDriverModel);
return;
case 463:
ReleaseModel(247);
SetModelIsDeletable(247);
ReleaseTexture(247);
ReleaseModel(248);
SetModelIsDeletable(248);
ReleaseTexture(248);
return;
case 409:
ReleaseModel(255);
SetModelIsDeletable(255);
ReleaseTexture(255);
return;
case 423:
ReleaseModel(264);
SetModelIsDeletable(264);
ReleaseTexture(264);
return;
case 428:
ReleaseModel(71);
SetModelIsDeletable(71);
ReleaseTexture(71);
return;
default:
@@ -16,8 +16,6 @@
#define NUM_STREAMS (NUM_IMG_FILES+24)
#define MAX_DRAW_DISTANCE 450.0

#pragma message ("TODO: _reloadCopModels is temporary, needs to be reworked.")

struct LoadedObjectInfo
{
WORD nextIndex;
@@ -27,7 +25,7 @@ struct LoadedObjectInfo
BYTE field_7;
DWORD field_8;
DWORD field_C;
BYTE bLoaded;
bool bLoaded;
BYTE field_11[3];
};

@@ -46,10 +44,11 @@ class CStreaming
{
public:
static CdImage ms_cdImages[NUM_IMG_FILES];
static bool ms_bCopBikeAllowed;

public:
static void RequestModel(DWORD index, int a2);
static void ReleaseModel(DWORD index);
static void SetModelIsDeletable(DWORD index);
static void ReleaseTexture(DWORD index);
static void RequestSpecialModel(int index, const char* pName, int unk);
static void LoadRequestedModels(int unk);
@@ -58,7 +57,9 @@ class CStreaming
static bool RemoveLeastUsedModel(BYTE unkFlag);
static void DeleteRwObjectsBehindCamera(int memoryUsed);


static void StreamCopModels(int nTownID);
static int ChooseCopModel();
static int ChooseCopCarModel(BOOL bIgnoreBikes);
static void RequestSpecialDriverModel(WORD carModel);
static void ReleaseSpecialDriverModel(WORD carModel);
static int GetSpecialDriverModelID(WORD carModel);

This file was deleted.

This file was deleted.

@@ -1,22 +1,6 @@
#include "StdAfx.h"

BOOL CWanted::ShouldSendViceSquad()
bool CWanted::ShouldSendViceSquad()
{
return m_nWantedLevel >= 3; //|| this->flags & m_viceSquadRequired;
}

CWanted* CWanted::GetPlayerCWanted(int playerID)
{
DWORD dwFunc = 0x56E230;
CWanted* dwReturn;

_asm
{
mov eax, playerID
push eax
call dwFunc
add esp, 4
mov dwReturn, eax
}
return dwReturn;
return m_WantedLevel >= 3; //|| this->flags & m_viceSquadRequired;
}
@@ -4,21 +4,35 @@
class CWanted
{
private:
DWORD m_nWantedLevel;
BYTE __pad1[26];
int m_nWantedLevel;
int m_nWantedLevelBeforeParole;
int m_LastTimeWantedDecreased;
int m_LastTimeWantedLevelChanged;
int m_TimeOfParole;
float m_fMultiplier;
unsigned char m_nCopsInPursuit;
unsigned char m_nMaxCopsInPursuit;
unsigned char m_nMaxCopCarsInPursuit;
bool m_nCopsBeatingSuspect;
unsigned short m_nChanceOnRoadBlock;
bool m_PoliceBackOff : 1;
bool m_PoliceBackOffGarage : 1;
bool m_EverybodyBackOff : 1;
bool m_swatRequired : 1;
bool m_fbiRequired : 1;
bool m_armyRequired : 1;
bool m_viceSquadRequired : 1;
BYTE __pad2[636];
int current_chase_time;
int current_chase_time_counter;
bool m_bTimeCounting;
int m_WantedLevel;
int m_WantedLevelBeforeParole;
BYTE __pad2[616];

public:
static CWanted* GetPlayerCWanted(int playerID);
inline int GetWantedLevel() { return m_WantedLevel; }

BOOL ShouldSendViceSquad();
bool ShouldSendViceSquad();
};

static_assert(sizeof(CWanted) == CWanted_ARRAYSIZE, "CWanted class has wrong size!");

0 comments on commit f846914

Please sign in to comment.