Merge branch 'master' of git://github.com/GTAmodding/re3 into eray

This commit is contained in:
eray orçunus 2019-06-20 21:29:34 +03:00
commit 4a3138f384
11 changed files with 466 additions and 57 deletions

View File

@ -1,6 +1,5 @@
#pragma once
#define MAX_CDIMAGES 8
#define CDSTREAM_SECTOR_SIZE 2048
#define _GET_INDEX(a) (a >> 24)

View File

@ -10,12 +10,6 @@
#include "Pools.h"
#include "Script.h"
//WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
//WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha) { EAXJMP(0x4A5D10); }
//WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in) { EAXJMP(0x4A50D0); }
//WRAPPER void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha) { EAXJMP(0x4A5EF0); }
//WRAPPER void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { EAXJMP(0x4A59C0); }
//WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); }
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
@ -73,6 +67,9 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
WeaponSprite
};
#if 0
WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
#else
void CRadar::DrawMap()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -94,7 +91,11 @@ void CRadar::DrawMap()
CRadar::DrawRadarMap();
}
}
#endif
#if 0
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
#else
void CRadar::DrawBlips()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -208,6 +209,7 @@ void CRadar::DrawBlips()
}
}
}
#endif
bool CRadar::DisplayThisBlip(int16 spriteid)
{
@ -316,6 +318,9 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in)
out->y = (SCREEN_SCALE_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (SCREEN_SCALE_Y(123.0f)) - in->y * (SCREEN_SCALE_Y(76.0f)) * 0.5f;
}
#if 0
WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in) { EAXJMP(0x4A50D0); }
#else
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in)
{
if (TheCamera.Cams->Mode != CCam::CamMode::MODE_TOPDOWN1 && TheCamera.Cams->Mode != CCam::CamMode::MODE_TOPDOWNPED) {
@ -348,7 +353,11 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in)
out->x = cachedSin * y + cachedCos * x;
out->y = cachedCos * y - cachedSin * x;
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha) { EAXJMP(0x4A5EF0); }
#else
void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha)
{
float w = SCREEN_SCALE_X(8.0f);
@ -356,7 +365,11 @@ void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha)
RadarSprites[sprite]->Draw(CRect(x - w, y - h, x + w, y + h), CRGBA(255, 255, 255, alpha));
}
#endif
#if 0
WRAPPER void CRadar::ShowRadarMarker(CVector pos, CRGBA color, float radius) { EAXJMP(0x4A59C0); }
#else
void CRadar::ShowRadarMarker(CVector pos, CRGBA color, float radius) {
float z2 = pos.z + (0.5f * color.color32) * TheCamera.m_matrix.m_matrix.at.z;
float y2 = (0.5f * color.color32) * TheCamera.m_matrix.m_matrix.at.y + pos.y;
@ -390,7 +403,11 @@ void CRadar::ShowRadarMarker(CVector pos, CRGBA color, float radius) {
x1 = pos.x - (1.4f * color.color32) * TheCamera.m_matrix.m_matrix.right.x;
CTheScripts::ScriptDebugLine3D(x1, y1, z1, x2, y2, z2, color.color32, color.color32);
}
#endif
#if 0
WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha) { EAXJMP(0x4A5D10); }
#else
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha)
{
CVector curPosn[4];
@ -417,6 +434,7 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
}
#endif
STARTPATCHES
InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);

View File

@ -1,16 +1,284 @@
#include "common.h"
#include "patcher.h"
#include "ModelInfo.h"
#include "TxdStore.h"
#include "Pools.h"
#include "Directory.h"
#include "RwHelper.h"
#include "Entity.h"
#include "FileMgr.h"
#include "CdStream.h"
#include "Streaming.h"
/*
CStreaming::ms_channelError 0x880DB8
CStreaming::ms_lastVehicleDeleted 0x95CBF8
*/
bool &CStreaming::ms_disableStreaming = *(bool*)0x95CD6E;
bool &CStreaming::ms_bLoadingBigModel = *(bool*)0x95CDB0;
int32 &CStreaming::ms_numModelsRequested = *(int32*)0x8E2C10;
CStreamingInfo *CStreaming::ms_aInfoForModel = (CStreamingInfo*)0x6C7088;
CStreamingInfo &CStreaming::ms_startLoadedList = *(CStreamingInfo*)0x942F60;
CStreamingInfo &CStreaming::ms_endLoadedList = *(CStreamingInfo*)0x8F1AC0;
CStreamingInfo &CStreaming::ms_startRequestedList = *(CStreamingInfo*)0x8F1B3C;
CStreamingInfo &CStreaming::ms_endRequestedList = *(CStreamingInfo*)0x940738;
int32 &CStreaming::ms_oldSectorX = *(int32*)0x8F2C84;
int32 &CStreaming::ms_oldSectorY = *(int32*)0x8F2C88;
uint32 &CStreaming::ms_streamingBufferSize = *(uint32*)0x942FB0;
uint8 **CStreaming::ms_pStreamingBuffer = (uint8**)0x87F818;
int32 &CStreaming::ms_memoryUsed = *(int32*)0x940568;
CStreamingChannel *CStreaming::ms_channel = (CStreamingChannel*)0x727EE0;
int32 &CStreaming::ms_numVehiclesLoaded = *(int32*)0x8F2C80;
int32 *CStreaming::ms_vehiclesLoaded = (int32*)0x773560;
CDirectory *&CStreaming::ms_pExtraObjectsDir = *(CDirectory**)0x95CB90;
int32 &CStreaming::ms_numPriorityRequests = *(int32*)0x8F31C4;
bool &CStreaming::ms_hasLoadedLODs = *(bool*)0x95CD47;
int32 &CStreaming::ms_currentPedGrp = *(int32*)0x8F2BBC;
int32 CStreaming::ms_currentPedLoading;
int32 CStreaming::ms_lastCullZone;
uint16 &CStreaming::ms_loadedGangs = *(uint16*)0x95CC60;
int32 *CStreaming::ms_imageOffsets = (int32*)0x6E60A0;
int32 &CStreaming::ms_lastImageRead = *(int32*)0x880E2C;
int32 &CStreaming::ms_imageSize = *(int32*)0x8F1A34;
int32 &CStreaming::ms_memoryAvailable = *(int32*)0x880F8C;
int32 &desiredNumVehiclesLoaded = *(int32*)0x5EC194;
CEntity *&pIslandLODindustEntity = *(CEntity**)0x6212DC;
CEntity *&pIslandLODcomIndEntity = *(CEntity**)0x6212E0;
CEntity *&pIslandLODcomSubEntity = *(CEntity**)0x6212E4;
CEntity *&pIslandLODsubIndEntity = *(CEntity**)0x6212E8;
CEntity *&pIslandLODsubComEntity = *(CEntity**)0x6212EC;
int32 &islandLODindust = *(int32*)0x6212C8;
int32 &islandLODcomInd = *(int32*)0x6212CC;
int32 &islandLODcomSub = *(int32*)0x6212D0;
int32 &islandLODsubInd = *(int32*)0x6212D4;
int32 &islandLODsubCom = *(int32*)0x6212D8;
WRAPPER void CStreaming::RemoveModel(int32 id) { EAXJMP(0x408830); }
WRAPPER void CStreaming::RequestModel(int32 model, int32 flags) { EAXJMP(0x407EA0); }
WRAPPER void CStreaming::MakeSpaceFor(int32 size) { EAXJMP(0x409B70); }
void
CStreaming::Init(void)
{
int i;
for(i = 0; i < NUMSTREAMINFO; i++){
ms_aInfoForModel[i].m_loadState = STREAMSTATE_NOTLOADED;
ms_aInfoForModel[i].m_next = nil;
ms_aInfoForModel[i].m_prev = nil;
ms_aInfoForModel[i].m_nextID = -1;
ms_aInfoForModel[i].m_size = 0;
ms_aInfoForModel[i].m_position = 0;
}
// init lists
ms_startLoadedList.m_next = &ms_endLoadedList;
ms_startLoadedList.m_prev = nil;
ms_endLoadedList.m_prev = &ms_startLoadedList;
ms_endLoadedList.m_next = nil;
ms_startRequestedList.m_next = &ms_endRequestedList;
ms_startRequestedList.m_prev = nil;
ms_endRequestedList.m_prev = &ms_startRequestedList;
ms_endRequestedList.m_next = nil;
// init misc
ms_oldSectorX = 0;
ms_oldSectorY = 0;
ms_streamingBufferSize = 0;
ms_disableStreaming = false;
ms_memoryUsed = 0;
ms_bLoadingBigModel = false;
// init channels
ms_channel[0].state = CHANNELSTATE_0;
ms_channel[1].state = CHANNELSTATE_0;
for(i = 0; i < 4; i++){
ms_channel[0].modelIds[i] = -1;
ms_channel[0].offsets[i] = -1;
ms_channel[1].modelIds[i] = -1;
ms_channel[1].offsets[i] = -1;
}
// init stream info, mark things that are already loaded
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
if(mi && mi->GetRwObject()){
ms_aInfoForModel[i + STREAM_OFFSET_MODEL].m_loadState = STREAMSTATE_LOADED;
ms_aInfoForModel[i + STREAM_OFFSET_MODEL].m_flags = STREAMFLAGS_DONT_REMOVE;
if(mi->IsSimple())
((CSimpleModelInfo*)mi)->m_alpha = 255;
}
}
for(i = 0; i < TXDSTORESIZE; i++)
if(CTxdStore::GetSlot(i) && CTxdStore::GetSlot(i)->texDict)
ms_aInfoForModel[i + STREAM_OFFSET_TXD].m_loadState = STREAMSTATE_LOADED;
for(i = 0; i < MAXVEHICLESLOADED; i++)
ms_vehiclesLoaded[i] = -1;
ms_numVehiclesLoaded = 0;
ms_pExtraObjectsDir = new CDirectory(EXTRADIRSIZE);
ms_numPriorityRequests = 0;
ms_hasLoadedLODs = true;
ms_currentPedGrp = -1;
ms_lastCullZone = -1; // unused because RemoveModelsNotVisibleFromCullzone is gone
ms_loadedGangs = 0;
ms_currentPedLoading = 8; // unused, whatever it is
LoadCdDirectory();
// allocate streaming buffers
if(ms_streamingBufferSize & 1) ms_streamingBufferSize++;
ms_pStreamingBuffer[0] = (uint8*)RwMallocAlign(ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE, CDSTREAM_SECTOR_SIZE);
ms_streamingBufferSize /= 2;
ms_pStreamingBuffer[1] = ms_pStreamingBuffer[0] + ms_streamingBufferSize*CDSTREAM_SECTOR_SIZE;
debug("Streaming buffer size is %d sectors", ms_streamingBufferSize);
// PC only, figure out how much memory we got
#define MB (1024*1024)
extern DWORD &_dwMemAvailPhys;
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
if(ms_memoryAvailable < 50*MB)
ms_memoryAvailable = 50*MB;
desiredNumVehiclesLoaded = (ms_memoryAvailable/MB - 50)/3 + 12;
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
debug("Memory allocated to Streaming is %dMB", ms_memoryAvailable/MB);
#undef MB
// find island LODs
pIslandLODindustEntity = nil;
pIslandLODcomIndEntity = nil;
pIslandLODcomSubEntity = nil;
pIslandLODsubIndEntity = nil;
pIslandLODsubComEntity = nil;
islandLODindust = -1;
islandLODcomInd = -1;
islandLODcomSub = -1;
islandLODsubInd = -1;
islandLODsubCom = -1;
CModelInfo::GetModelInfo("IslandLODInd", &islandLODindust);
CModelInfo::GetModelInfo("IslandLODcomIND", &islandLODcomInd);
CModelInfo::GetModelInfo("IslandLODcomSUB", &islandLODcomSub);
CModelInfo::GetModelInfo("IslandLODsubIND", &islandLODsubInd);
CModelInfo::GetModelInfo("IslandLODsubCOM", &islandLODsubCom);
for(i = 0; i < CPools::GetBuildingPool()->GetSize(); i++){
CBuilding *building = CPools::GetBuildingPool()->GetSlot(i);
if(building == nil)
continue;
if(building->GetModelIndex() == islandLODindust) pIslandLODindustEntity = building;
if(building->GetModelIndex() == islandLODcomInd) pIslandLODcomIndEntity = building;
if(building->GetModelIndex() == islandLODcomSub) pIslandLODcomSubEntity = building;
if(building->GetModelIndex() == islandLODsubInd) pIslandLODsubIndEntity = building;
if(building->GetModelIndex() == islandLODsubCom) pIslandLODsubComEntity = building;
}
}
void
CStreaming::Shutdown(void)
{
RwFreeAlign(ms_pStreamingBuffer[0]);
ms_streamingBufferSize = 0;
if(ms_pExtraObjectsDir)
delete ms_pExtraObjectsDir;
}
void
CStreaming::LoadCdDirectory(void)
{
char dirname[132];
int i;
// PC specific stuff
ms_imageOffsets[0] = 0;
for(i = 1; i < NUMCDIMAGES; i++)
ms_imageOffsets[i] = -1;
ms_imageSize = GetGTA3ImgSize();
i = CdStreamGetNumImages();
while(i-- >= 1){
strcpy(dirname, CdStreamGetImageName(i));
strncpy(strrchr(dirname, '.') + 1, "DIR", 3);
LoadCdDirectory(dirname, i);
}
ms_lastImageRead = 0;
ms_imageSize /= CDSTREAM_SECTOR_SIZE;
}
void
CStreaming::LoadCdDirectory(const char *dirname, int n)
{
int fd, lastID, imgSelector;
int modelId, txdId;
uint32 posn, size;
CDirectory::DirectoryInfo direntry;
char *dot;
lastID = -1;
fd = CFileMgr::OpenFile(dirname, "rb");
assert(fd > 0);
imgSelector = n<<24;
assert(sizeof(direntry) == 32);
while(CFileMgr::Read(fd, (char*)&direntry, sizeof(direntry))){
dot = strchr(direntry.name, '.');
if(dot) *dot = '\0';
if(direntry.size > ms_streamingBufferSize)
ms_streamingBufferSize = direntry.size;
if(strcmp(dot+1, "DFF") == 0 || strcmp(dot+1, "dff") == 0){
if(CModelInfo::GetModelInfo(direntry.name, &modelId)){
if(ms_aInfoForModel[modelId + STREAM_OFFSET_MODEL].GetCdPosnAndSize(posn, size)){
debug("%s appears more than once in %s\n", direntry.name, dirname);
lastID = -1;
}else{
direntry.offset |= imgSelector;
ms_aInfoForModel[modelId + STREAM_OFFSET_MODEL].SetCdPosnAndSize(direntry.offset, direntry.size);
if(lastID != -1)
ms_aInfoForModel[lastID].m_nextID = modelId + STREAM_OFFSET_MODEL;
lastID = modelId + STREAM_OFFSET_MODEL;
}
}else{
// BUG: doesn't remember which cdimage this was in
ms_pExtraObjectsDir->AddItem(direntry);
lastID = -1;
}
}else if(strcmp(dot+1, "TXD") == 0 || strcmp(dot+1, "txd") == 0){
txdId = CTxdStore::FindTxdSlot(direntry.name);
if(txdId == -1)
txdId = CTxdStore::AddTxdSlot(direntry.name);
if(ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].GetCdPosnAndSize(posn, size)){
debug("%s appears more than once in %s\n", direntry.name, dirname);
lastID = -1;
}else{
direntry.offset |= imgSelector;
ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].SetCdPosnAndSize(direntry.offset, direntry.size);
if(lastID != -1)
ms_aInfoForModel[lastID].m_nextID = txdId + STREAM_OFFSET_TXD;
lastID = txdId + STREAM_OFFSET_TXD;
}
}else
lastID = -1;
}
CFileMgr::CloseFile(fd);
}
void
CStreaming::ImGonnaUseStreamingMemory(void)
{
@ -26,3 +294,54 @@ void
CStreaming::UpdateMemoryUsed(void)
{
}
bool
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
{
if(m_size == 0)
return false;
posn = m_position;
size = m_size;
return true;
}
void
CStreamingInfo::SetCdPosnAndSize(uint32 posn, uint32 size)
{
m_position = posn;
m_size = size;
}
void
CStreamingInfo::AddToList(CStreamingInfo *link)
{
// Insert this after link
m_next = link->m_next;
m_prev = link;
link->m_next = this;
m_next->m_prev = this;
}
void
CStreamingInfo::RemoveFromList(void)
{
m_next->m_prev = m_prev;
m_prev->m_next = m_next;
m_next = nil;
m_prev = nil;
}
STARTPATCHES
InjectHook(0x406430, CStreaming::Init, PATCH_JUMP);
InjectHook(0x406C80, CStreaming::Shutdown, PATCH_JUMP);
InjectHook(0x406CC0, (void (*)(void))CStreaming::LoadCdDirectory, PATCH_JUMP);
InjectHook(0x406DA0, (void (*)(const char*, int))CStreaming::LoadCdDirectory, PATCH_JUMP);
InjectHook(0x4063E0, &CStreamingInfo::GetCdPosnAndSize, PATCH_JUMP);
InjectHook(0x406410, &CStreamingInfo::SetCdPosnAndSize, PATCH_JUMP);
InjectHook(0x4063D0, &CStreamingInfo::GetCdSize, PATCH_JUMP);
InjectHook(0x406380, &CStreamingInfo::AddToList, PATCH_JUMP);
InjectHook(0x4063A0, &CStreamingInfo::RemoveFromList, PATCH_JUMP);
ENDPATCHES

View File

@ -8,20 +8,25 @@ enum {
enum StreamFlags
{
STREAM_DONT_REMOVE = 0x01,
STREAM_SCRIPTOWNED = 0x02,
STREAM_DEPENDENCY = 0x04,
STREAM_PRIORITY = 0x08,
STREAM_NOFADE = 0x10,
STREAMFLAGS_DONT_REMOVE = 0x01,
STREAMFLAGS_SCRIPTOWNED = 0x02,
STREAMFLAGS_DEPENDENCY = 0x04,
STREAMFLAGS_PRIORITY = 0x08,
STREAMFLAGS_NOFADE = 0x10,
};
enum StreamLoadState
{
STREAM_NOTLOADED = 0,
STREAM_LOADED = 1,
STREAM_INQUEUE = 2,
STREAM_READING = 3, // what is this?
STREAM_BIGFILE = 4,
STREAMSTATE_NOTLOADED = 0,
STREAMSTATE_LOADED = 1,
STREAMSTATE_INQUEUE = 2,
STREAMSTATE_READING = 3, // what is this?
STREAMSTATE_BIGFILE = 4,
};
enum ChannelState
{
CHANNELSTATE_0 = 0,
};
class CStreamingInfo
@ -36,18 +41,62 @@ public:
uint32 m_position;
uint32 m_size;
// bool GetCdPosnAndSize(uint32 *pos, uint32 *size);
// void SetCdPosnAndSize(uint32 pos, uint32 size);
// void AddToList(CStreamingInfo *link);
// void RemoveFromList(void);
bool GetCdPosnAndSize(uint32 &posn, uint32 &size);
void SetCdPosnAndSize(uint32 posn, uint32 size);
void AddToList(CStreamingInfo *link);
void RemoveFromList(void);
uint32 GetCdSize(void) { return m_size; }
};
struct CStreamingChannel
{
int32 modelIds[4];
int32 offsets[4];
int32 state;
int32 field24;
int32 position;
int32 size;
int32 field30;
int32 status; // from CdStream
};
class CDirectory;
class CStreaming
{
public:
static bool &ms_disableStreaming;
static bool &ms_bLoadingBigModel;
static int32 &ms_numModelsRequested;
static CStreamingInfo *ms_aInfoForModel; //[NUMSTREAMINFO]
static CStreamingInfo &ms_startLoadedList;
static CStreamingInfo &ms_endLoadedList;
static CStreamingInfo &ms_startRequestedList;
static CStreamingInfo &ms_endRequestedList;
static int32 &ms_oldSectorX;
static int32 &ms_oldSectorY;
static uint32 &ms_streamingBufferSize;
static uint8 **ms_pStreamingBuffer; //[2]
static int32 &ms_memoryUsed;
static CStreamingChannel *ms_channel; //[2]
static int32 &ms_numVehiclesLoaded;
static int32 *ms_vehiclesLoaded; //[MAXVEHICLESLOADED]
static CDirectory *&ms_pExtraObjectsDir;
static int32 &ms_numPriorityRequests;
static bool &ms_hasLoadedLODs;
static int32 &ms_currentPedGrp;
static int32 ms_lastCullZone;
static uint16 &ms_loadedGangs;
static int32 ms_currentPedLoading;
static int32 *ms_imageOffsets; //[NUMCDIMAGES]
static int32 &ms_lastImageRead;
static int32 &ms_imageSize;
static int32 &ms_memoryAvailable;
static void Init(void);
static void Shutdown(void);
static void LoadCdDirectory(void);
static void LoadCdDirectory(const char *dirname, int n);
static void RemoveModel(int32 id);
static void RequestModel(int32 model, int32 flags);

View File

@ -16,8 +16,6 @@ int32 &gNumRetunePresses = *(int32*)0x650B80;
wchar *pCurrentStation = (wchar*)0x650B9C;
uint8 &cDisplay = *(uint8*)0x650BA1;
//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
bool cMusicManager::PlayerInCar()
{
if (!FindPlayerVehicle())
@ -44,6 +42,9 @@ bool cMusicManager::PlayerInCar()
}
}
#if 0
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
#else
void cMusicManager::DisplayRadioStationName()
{
int8 pRetune;
@ -170,3 +171,4 @@ void cMusicManager::DisplayRadioStationName()
CFont::DrawFonts();
}
}
#endif

View File

@ -1,7 +1,8 @@
#pragma once
enum Config {
NUMCDIMAGES = 50, // was 12
NUMCDIMAGES = 12, // gta3.img duplicates (not used on PC)
MAX_CDIMAGES = 8, // additional cdimages
MODELINFOSIZE = 5500,
TXDSTORESIZE = 850,
@ -14,6 +15,8 @@ enum Config {
VEHICLEMODELSIZE = 120,
TWODFXSIZE = 2000,
MAXVEHICLESLOADED = 50, // 70 on mobile
NUMOBJECTINFO = 168, // object.dat
// Pool sizes

View File

@ -8,5 +8,5 @@ bool CDarkel::Status = *(bool*)0x95CCB4;
bool CDarkel::FrenzyOnGoing()
{
return Status;
return Status == 1;
}

View File

@ -8,8 +8,6 @@
#include "Messages.h"
#include "Text.h"
//WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34;
bool &CGarages::BombsAreFree = *(bool *)0x95CD7A;
bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D;
@ -65,6 +63,9 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_CRUSHERLID;
}
#if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
#else
void CGarages::PrintMessages()
{
if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) {
@ -105,3 +106,4 @@ void CGarages::PrintMessages()
}
}
}
#endif

View File

@ -18,7 +18,7 @@ CBuilding::ReplaceWithNewModel(int32 id)
if(bIsBIGBuilding)
if(m_level == LEVEL_NONE || m_level == CGame::currLevel)
CStreaming::RequestModel(id, STREAM_DONT_REMOVE);
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
}
STARTPATCHES

View File

@ -20,9 +20,6 @@
#include "User.h"
#include "World.h"
//WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
//WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
//WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); }
WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); }
WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); }
@ -178,6 +175,9 @@ void CHud::SetZoneName(wchar *name)
m_ZoneName = name;
}
#if 0
WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
#else
void CHud::Draw()
{
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
@ -973,7 +973,7 @@ void CHud::Draw()
*/
// MissionCompleteFailedText
if (CHud::m_BigMessage[0][0]) {
if (BigMessageInUse[0] == 0.0f) {
if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
@ -981,15 +981,19 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetColor(CRGBA(255, 255, 0, 255));
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= (SCREENW - 20)) {
BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageInUse[0] >= 120.0f) {
BigMessageInUse[0] = 120.0;
BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
}
if (BigMessageAlpha[0] <= 0.0f) {
BigMessageAlpha[0] = 0.0f;
BigMessageInUse[0] = 1.0f;
m_BigMessage[0][0] = 0;
BigMessageAlpha[0] = 0.0;
}
}
else {
@ -1017,9 +1021,9 @@ void CHud::Draw()
}
// WastedBustedText
if (CHud::m_BigMessage[2][0]) {
if (BigMessageInUse[2] == 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.4f;
if (m_BigMessage[2][0]) {
if (BigMessageInUse[2] != 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 255.0f);
if (BigMessageAlpha[2] > 255.0f)
BigMessageAlpha[2] = 255.0;
@ -1034,12 +1038,12 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]);
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
}
else {
BigMessageAlpha[2] = 0.0;
@ -1052,7 +1056,11 @@ void CHud::Draw()
}
}
}
#endif
#if 0
WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
#else
void CHud::DrawAfterFade()
{
if (CTimer::GetIsUserPaused() || CReplay::Mode == 1)
@ -1136,14 +1144,12 @@ void CHud::DrawAfterFade()
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CRGBA BackColor = { 0, 0, 0, (uint8)(0.9f * fAlpha) };
CFont::SetBackgroundColor(BackColor);
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha));
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f);
@ -1224,8 +1230,9 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f + 2.0f), m_BigMessage[5]);
CFont::SetColor(CRGBA(156, 91, 40, 255));
@ -1236,7 +1243,7 @@ void CHud::DrawAfterFade()
DrawMissionTitle
*/
if (m_BigMessage[1][0]) {
if (BigMessageInUse[1] == 0.0f) {
if (BigMessageInUse[1] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
@ -1250,11 +1257,15 @@ void CHud::DrawAfterFade()
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[1] >= (SCREENW - 20)) {
BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageAlpha[1] <= 0.0f) {
BigMessageAlpha[1] = 0.0f;
BigMessageInUse[1] = 1.0f;
if (BigMessageInUse[1] >= 120.0f) {
BigMessageInUse[1] = 120.0;
BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
}
if (BigMessageAlpha[1] <= 0) {
m_BigMessage[1][0] = 0;
BigMessageAlpha[1] = 0.0;
}
}
else {
@ -1264,6 +1275,7 @@ void CHud::DrawAfterFade()
if (BigMessageAlpha[1] >= 255.0f)
BigMessageAlpha[1] = 255.0f;
}
CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
@ -1271,16 +1283,20 @@ void CHud::DrawAfterFade()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
}
else {
BigMessageAlpha[1] = 0.0f;
BigMessageX[1] = -60.0f;
BigMessageInUse[1] = 1.0f;
BigMessageAlpha[1] = 0.0;
BigMessageX[1] = -60.0;
BigMessageInUse[1] = 1.0;
}
}
else {
BigMessageInUse[1] = 0.0f;
BigMessageInUse[1] = 0.0;
}
}
#endif
#if 1
WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
#else
void CHud::ReInitialise() {
m_Wants_To_Draw_Hud = true;
m_ZoneState = 0;
@ -1329,6 +1345,7 @@ void CHud::ReInitialise() {
PagerXOffset = 150.0f;
OddJob2XOffset = 0.0f;
}
#endif
STARTPATCHES
InjectHook(0x48BC9A, &CHud::Initialise, PATCH_CALL);

View File

@ -1009,7 +1009,7 @@ CRenderer::ScanSectorList_Priority(CPtrList *lists)
case VIS_STREAMME:
if(!CStreaming::ms_disableStreaming){
CStreaming::RequestModel(ent->GetModelIndex(), 0);
if(CStreaming::ms_aInfoForModel[ent->GetModelIndex()].m_loadState != STREAM_LOADED)
if(CStreaming::ms_aInfoForModel[ent->GetModelIndex()].m_loadState != STREAMSTATE_LOADED)
m_loadingPriority = true;
}
break;