diff options
Diffstat (limited to 'src/core')
33 files changed, 1142 insertions, 649 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 562b9c15..e3e19cd2 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -81,7 +81,7 @@ CAnimViewer::Initialise(void) { CCollision::Init(); CWorld::Initialise(); mod_HandlingManager.Initialise(); - CTempColModels::Initialise(); + gpTempColModels->Initialise(); CAnimManager::Initialise(); CModelInfo::Initialise(); CParticle::Initialise(); @@ -92,7 +92,7 @@ CAnimViewer::Initialise(void) { CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); CFileLoader::LoadLevel("DATA\\ANIMVIEWER.DAT"); CStreaming::Init(); - for(int i = 0; i < MODELINFOSIZE; i++) + for(int i = 0; i < CModelInfo::GetNumModelInfos(); i++) if(CModelInfo::GetModelInfo(i)) CModelInfo::GetModelInfo(i)->ConvertAnimFileIndex(); CStreaming::LoadInitialPeds(); @@ -166,7 +166,7 @@ LastPedModelId(int modelId) { CBaseModelInfo *model; for(;;){ - assert(modelId < MODELINFOSIZE); + assert(modelId < CModelInfo::GetNumModelInfos()); model = CModelInfo::GetModelInfo(modelId); if (model && model->GetModelType() == MITYPE_PED) break; @@ -180,7 +180,7 @@ FirstCarModelId(int modelId) { CBaseModelInfo *model; for(;;){ - assert(modelId < MODELINFOSIZE); + assert(modelId < CModelInfo::GetNumModelInfos()); model = CModelInfo::GetModelInfo(modelId); if (model && model->GetModelType() == MITYPE_VEHICLE) break; @@ -200,7 +200,7 @@ NextModelId(int modelId, int wantedChange) while(tryCount != 0) { modelId += wantedChange; - if (modelId < 0 || modelId >= MODELINFOSIZE) { + if (modelId < 0 || modelId >= CModelInfo::GetNumModelInfos()) { tryCount--; wantedChange = -wantedChange; } else if (modelId != 5 && modelId != 6 && modelId != 405) { diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index cd6e38f4..c02f6dab 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -121,6 +121,7 @@ CCam::Process(void) else TargetOrientation = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().x, CamTargetEntity->GetForward().y); +/* LCS: removed CVector Fwd(0.0f, 0.0f, 0.0f); Fwd.x = CamTargetEntity->GetForward().x; Fwd.y = CamTargetEntity->GetForward().y; @@ -138,6 +139,9 @@ CCam::Process(void) else TargetSpeedVar = -Min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/1.8f, 0.5f); SpeedVar = 0.895f*SpeedVar + 0.105*TargetSpeedVar; +*/ + SpeedVar = 0.0f; + TargetSpeedVar = 0.0f; }else{ if(CamTargetEntity == FindPlayerPed()){ // Some fancy smoothing of player position and speed @@ -5059,6 +5063,11 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA float stickX = -(pad->GetCarGunLeftRight()); float stickY = -pad->GetCarGunUpDown(); + // HACK to disable rotation on tank for now + if(car->GetModelIndex() == MI_RHINO){ + stickX = 0.0f; + stickY = 0.0f; + } // In SA this checks for m_bUseMouse3rdPerson so num2 / num8 do not move camera // when Keyboard & Mouse controls are used. To make it work better with III/VC, check for actual pad state instead @@ -5353,70 +5362,5 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // SA // gTargetCoordsForLookingBehind = TargetCoors; - // SA code from CAutomobile::TankControl/FireTruckControl. - if (car->GetModelIndex() == MI_RHINO || car->GetModelIndex() == MI_FIRETRUCK) { - - float &carGunLR = ((CAutomobile*)car)->m_fCarGunLR; - CVector hi = Multiply3x3(Front, car->GetMatrix()); - - // III/VC's firetruck turret angle is reversed - float angleToFace = (car->GetModelIndex() == MI_FIRETRUCK ? -hi.Heading() : hi.Heading()); - - if (angleToFace <= carGunLR + PI) { - if (angleToFace < carGunLR - PI) - angleToFace = angleToFace + TWOPI; - } else { - angleToFace = angleToFace - TWOPI; - } - - float neededTurn = angleToFace - carGunLR; - float turnPerFrame = CTimer::GetTimeStep() * (car->GetModelIndex() == MI_FIRETRUCK ? 0.05f : 0.015f); - if (neededTurn <= turnPerFrame) { - if (neededTurn < -turnPerFrame) - angleToFace = carGunLR - turnPerFrame; - } else { - angleToFace = turnPerFrame + carGunLR; - } - - if (car->GetModelIndex() == MI_RHINO && carGunLR != angleToFace) { - DMAudio.PlayOneShot(car->m_audioEntityId, SOUND_CAR_TANK_TURRET_ROTATE, Abs(angleToFace - carGunLR)); - } - carGunLR = angleToFace; - - if (carGunLR < -PI) { - carGunLR += TWOPI; - } else if (carGunLR > PI) { - carGunLR -= TWOPI; - } - - // Because firetruk turret also has Y movement - if (car->GetModelIndex() == MI_FIRETRUCK) { - float &carGunUD = ((CAutomobile*)car)->m_fCarGunUD; - - float alphaToFace = Atan2(hi.z, hi.Magnitude2D()) + DEGTORAD(15.0f); - float neededAlphaTurn = alphaToFace - carGunUD; - float alphaTurnPerFrame = CTimer::GetTimeStepInSeconds(); - - if (neededAlphaTurn > alphaTurnPerFrame) { - neededTurn = alphaTurnPerFrame; - carGunUD = neededTurn + carGunUD; - } else { - if (neededAlphaTurn >= -alphaTurnPerFrame) { - carGunUD = alphaToFace; - } else { - carGunUD = carGunUD - alphaTurnPerFrame; - } - } - - float turretMinY = -DEGTORAD(20.0f); - float turretMaxY = DEGTORAD(20.0f); - if (turretMinY <= carGunUD) { - if (carGunUD > turretMaxY) - carGunUD = turretMaxY; - } else { - carGunUD = turretMinY; - } - } - } } #endif diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index e7cd65a0..6e632c7c 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -114,6 +114,7 @@ CCamera::Init(void) m_1rstPersonRunCloseToAWall = false; m_fPositionAlongSpline = 0.0f; m_bCameraJustRestored = false; + m_bFreezePedZoomSwitch = false; Cams[0].Init(); Cams[1].Init(); Cams[2].Init(); @@ -985,7 +986,7 @@ CCamera::CamControl(void) // Change user selected mode if(CPad::GetPad(0)->CycleCameraModeUpJustDown() && !CReplay::IsPlayingBack() && (m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) && - !m_WideScreenOn && !m_bFailedCullZoneTestPreviously && !m_bFirstPersonBeingUsed){ + !m_WideScreenOn && !m_bFailedCullZoneTestPreviously && !m_bFirstPersonBeingUsed && !m_bFreezePedZoomSwitch){ if(FrontEndMenuManager.m_ControlMethod == CONTROL_STANDARD){ if(PedZoomIndicator == CAM_ZOOM_3) PedZoomIndicator = CAM_ZOOM_1; @@ -3863,7 +3864,7 @@ CCamera::GetScreenFadeStatus(void) } - +//--LCS: TODO void CCamera::RenderMotionBlur(void) { @@ -3872,7 +3873,8 @@ CCamera::RenderMotionBlur(void) CMBlur::MotionBlurRender(m_pRwCamera, m_BlurRed, m_BlurGreen, m_BlurBlue, - m_motionBlur, m_BlurType, m_imotionBlurAddAlpha); +// m_motionBlur, m_BlurType, m_imotionBlurAddAlpha); + m_motionBlur, m_BlurType, 32); // hack hack } void diff --git a/src/core/Camera.h b/src/core/Camera.h index 39ecb760..66a89f21 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -368,6 +368,7 @@ public: bool m_bVehicleSuspenHigh; bool m_bEnable1rstPersonCamCntrlsScript; bool m_bAllow1rstPersonWeaponsCamera; + bool m_bFreezePedZoomSwitch; bool m_bFailedCullZoneTestPreviously; bool m_FadeTargetIsSplashScreen; diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp index a3298343..0aa841ae 100644 --- a/src/core/Clock.cpp +++ b/src/core/Clock.cpp @@ -18,6 +18,7 @@ uint16 CClock::ms_Stored_nGameClockSeconds; uint32 CClock::ms_nMillisecondsPerGameMinute; uint32 CClock::ms_nLastClockTick; bool CClock::ms_bClockHasBeenStored; +float CClock::ms_EnvMapTimeMultiplicator; #ifndef MASTER bool gbFreezeTime; @@ -33,6 +34,7 @@ CClock::Initialise(uint32 scale) ms_nMillisecondsPerGameMinute = scale; ms_nLastClockTick = CTimer::GetTimeInMilliseconds(); ms_bClockHasBeenStored = false; + ms_EnvMapTimeMultiplicator = 1.0f; debug("CClock ready\n"); #ifndef MASTER VarConsole.Add("Time (hour of day)", &ms_nGameClockHours, 1, 0, 23, true); @@ -134,3 +136,10 @@ CClock::RestoreClock(void) ms_nGameClockMinutes = ms_Stored_nGameClockMinutes; ms_nGameClockSeconds = ms_Stored_nGameClockSeconds; } + +void +CClock::CalcEnvMapTimeMultiplicator(void) +{ + float nightness = Abs(ms_nGameClockHours/24.0f - 0.5f); + ms_EnvMapTimeMultiplicator = SQR(1.0f - nightness);; +} diff --git a/src/core/Clock.h b/src/core/Clock.h index a611cd50..808e61f4 100644 --- a/src/core/Clock.h +++ b/src/core/Clock.h @@ -12,6 +12,7 @@ public: static uint32 ms_nMillisecondsPerGameMinute; static uint32 ms_nLastClockTick; static bool ms_bClockHasBeenStored; + static float ms_EnvMapTimeMultiplicator; static void Initialise(uint32 scale); static void Update(void); @@ -21,6 +22,8 @@ public: static void StoreClock(void); static void RestoreClock(void); + static void CalcEnvMapTimeMultiplicator(void); + static uint8 GetHours(void) { return ms_nGameClockHours; } static uint8 GetMinutes(void) { return ms_nGameClockMinutes; } static int16 GetSeconds(void) { return ms_nGameClockSeconds; } diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index dbf2cad9..e2b66286 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -291,7 +291,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname) { int i; - model.boundingSphere.radius = *(float*)(buf); + model.boundingSphere.radius = Max(*(float*)(buf), 0.1f); model.boundingSphere.center.x = *(float*)(buf+4); model.boundingSphere.center.y = *(float*)(buf+8); model.boundingSphere.center.z = *(float*)(buf+12); @@ -304,10 +304,13 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname) model.numSpheres = *(int16*)(buf+40); buf += 44; if(model.numSpheres > 0){ - model.spheres = (CColSphere*)RwMalloc(model.numSpheres*sizeof(CColSphere)); + model.spheres = new CColSphere[model.numSpheres]; REGISTER_MEMPTR(&model.spheres); for(i = 0; i < model.numSpheres; i++){ - model.spheres[i].Set(*(float*)buf, *(CVector*)(buf+4), buf[16], buf[17]); + float radius = *(float*)buf; + if(radius > model.boundingSphere.radius) + model.boundingSphere.radius = radius + 0.01f; + model.spheres[i].Set(radius, *(CVector*)(buf+4), buf[16], buf[17]); buf += 20; } }else @@ -316,7 +319,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname) model.numLines = *(int16*)buf; buf += 4; if(model.numLines > 0){ - //model.lines = (CColLine*)RwMalloc(model.numLines*sizeof(CColLine)); + //model.lines = new CColLine[model.numLines];; REGISTER_MEMPTR(&model.lines); for(i = 0; i < model.numLines; i++){ //model.lines[i].Set(*(CVector*)buf, *(CVector*)(buf+12)); @@ -330,7 +333,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname) model.numBoxes = *(int16*)buf; buf += 4; if(model.numBoxes > 0){ - model.boxes = (CColBox*)RwMalloc(model.numBoxes*sizeof(CColBox)); + model.boxes = new CColBox[model.numBoxes]; REGISTER_MEMPTR(&model.boxes); for(i = 0; i < model.numBoxes; i++){ model.boxes[i].Set(*(CVector*)buf, *(CVector*)(buf+12), buf[24], buf[25]); @@ -342,7 +345,7 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname) int32 numVertices = *(int16*)buf; buf += 4; if(numVertices > 0){ - model.vertices = (CompressedVector*)RwMalloc(numVertices*sizeof(CompressedVector)); + model.vertices = new CompressedVector[numVertices]; REGISTER_MEMPTR(&model.vertices); for(i = 0; i < numVertices; i++){ model.vertices[i].Set(*(float*)buf, *(float*)(buf+4), *(float*)(buf+8)); @@ -360,14 +363,64 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname) model.numTriangles = *(int16*)buf; buf += 4; if(model.numTriangles > 0){ - model.triangles = (CColTriangle*)RwMalloc(model.numTriangles*sizeof(CColTriangle)); + model.triangles = new CColTriangle[model.numTriangles]; REGISTER_MEMPTR(&model.triangles); for(i = 0; i < model.numTriangles; i++){ model.triangles[i].Set(*(int32*)buf, *(int32*)(buf+4), *(int32*)(buf+8), buf[12]); buf += 16; + + // skip small triangles + CVector vA = model.vertices[model.triangles[i].a].Get(); + CVector vB = model.vertices[model.triangles[i].b].Get(); + CVector vC = model.vertices[model.triangles[i].c].Get(); + float area = CrossProduct(vA - vB, vA - vC).Magnitude(); + if(area < 0.001f || vA == vB || vA == vC || vB == vC){ + i--; + model.numTriangles--; + } } }else model.triangles = nil; + + SplitColTrianglesIntoSections(model); +} + +void +CFileLoader::SplitColTrianglesIntoSections(CColModel &model) +{ + if(model.triangles == nil || model.numTriangles == 0) + return; + + model.numTriBBoxes = 1; + model.triBBoxes = new CColTriBBox[1]; + model.triBBoxes[0].first = 0; + model.triBBoxes[0].last = model.numTriangles-1; + CVector v = model.vertices[model.triangles[0].a].Get(); + model.triBBoxes[0].Set(v, v); + + for(int i = 0; i < model.numTriangles; i++){ + CVector vA = model.vertices[model.triangles[i].a].Get(); + CVector vB = model.vertices[model.triangles[i].b].Get(); + CVector vC = model.vertices[model.triangles[i].c].Get(); + model.triBBoxes[0].min.x = Min(vA.x, model.triBBoxes[0].min.x); + model.triBBoxes[0].min.y = Min(vA.y, model.triBBoxes[0].min.y); + model.triBBoxes[0].min.z = Min(vA.z, model.triBBoxes[0].min.z); + model.triBBoxes[0].min.x = Min(vB.x, model.triBBoxes[0].min.x); + model.triBBoxes[0].min.y = Min(vB.y, model.triBBoxes[0].min.y); + model.triBBoxes[0].min.z = Min(vB.z, model.triBBoxes[0].min.z); + model.triBBoxes[0].min.x = Min(vC.x, model.triBBoxes[0].min.x); + model.triBBoxes[0].min.y = Min(vC.y, model.triBBoxes[0].min.y); + model.triBBoxes[0].min.z = Min(vC.z, model.triBBoxes[0].min.z); + model.triBBoxes[0].max.x = Max(vA.x, model.triBBoxes[0].max.x); + model.triBBoxes[0].max.y = Max(vA.y, model.triBBoxes[0].max.y); + model.triBBoxes[0].max.z = Max(vA.z, model.triBBoxes[0].max.z); + model.triBBoxes[0].max.x = Max(vB.x, model.triBBoxes[0].max.x); + model.triBBoxes[0].max.y = Max(vB.y, model.triBBoxes[0].max.y); + model.triBBoxes[0].max.z = Max(vB.z, model.triBBoxes[0].max.z); + model.triBBoxes[0].max.x = Max(vC.x, model.triBBoxes[0].max.x); + model.triBBoxes[0].max.y = Max(vC.y, model.triBBoxes[0].max.y); + model.triBBoxes[0].max.z = Max(vC.z, model.triBBoxes[0].max.z); + } } static void @@ -608,11 +661,14 @@ CFileLoader::LoadObjectTypes(const char *filename) int section; int pathIndex; int id, pathType; - int minID, maxID; + //int minID, maxID; + + for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++) + m_sTempIdeData[i].id = -1; section = NONE; - minID = INT32_MAX; - maxID = -1; + //minID = INT32_MAX; + //maxID = -1; pathIndex = -1; debug("Loading object types from %s...\n", filename); @@ -636,13 +692,13 @@ CFileLoader::LoadObjectTypes(const char *filename) }else switch(section){ case OBJS: id = LoadObject(line); - if(id > maxID) maxID = id; - if(id < minID) minID = id; + //if(id > maxID) maxID = id; + //if(id < minID) minID = id; break; case TOBJ: id = LoadTimeObject(line); - if(id > maxID) maxID = id; - if(id < minID) minID = id; + //if(id > maxID) maxID = id; + //if(id < minID) minID = id; break; case WEAP: LoadWeaponObject(line); @@ -679,10 +735,10 @@ CFileLoader::LoadObjectTypes(const char *filename) } CFileMgr::CloseFile(fd); - for(id = minID; id <= maxID; id++){ + for(id = 0; id < MODELINFOSIZE; id++){ CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id); if(mi && mi->IsBuilding()) - mi->SetupBigBuilding(minID, maxID); + mi->SetupBigBuilding(); } } @@ -715,6 +771,13 @@ CFileLoader::LoadObject(const char *line) if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4) return 0; // game returns return value + for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++) + if(m_sTempIdeData[i].id == -1){ + m_sTempIdeData[i].id = id; + strcpy(m_sTempIdeData[i].name, model); + break; + } + switch(numObjs){ case 1: sscanf(line, "%d %s %s %d %f %d", @@ -763,6 +826,13 @@ CFileLoader::LoadTimeObject(const char *line) if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4) return 0; // game returns return value + for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++) + if(m_sTempIdeData[i].id < 0){ + m_sTempIdeData[i].id = id; + strcpy(m_sTempIdeData[i].name, model); + break; + } + switch(numObjs){ case 1: sscanf(line, "%d %s %s %d %f %d %d %d", @@ -793,7 +863,7 @@ CFileLoader::LoadTimeObject(const char *line) mi->m_firstDamaged = damaged; mi->SetTimes(timeOn, timeOff); mi->SetTexDictionary(txd); - other = mi->FindOtherTimeModel(); + other = mi->FindOtherTimeModel(model); if(other) other->SetOtherTimeModel(id); MatchModelString(model, id); @@ -817,7 +887,7 @@ CFileLoader::LoadWeaponObject(const char *line) mi->m_lodDistances[0] = dist; mi->SetTexDictionary(txd); mi->SetAnimFile(animFile); - mi->SetColModel(&CTempColModels::ms_colModelWeapon); + mi->SetColModel(&gpTempColModels->ms_colModelWeapon); MatchModelString(model, id); return id; } @@ -833,7 +903,7 @@ CFileLoader::LoadClumpObject(const char *line) mi = CModelInfo::AddClumpModel(id); mi->SetModelName(model); mi->SetTexDictionary(txd); - mi->SetColModel(&CTempColModels::ms_colModelBBox); + mi->SetColModel(&gpTempColModels->ms_colModelBBox); } } @@ -845,14 +915,15 @@ CFileLoader::LoadVehicleObject(const char *line) char type[8], handlingId[16], gamename[32], animFile[16], vehclass[12]; uint32 frequency, comprules; int32 level, misc; - float wheelScale; + float wheelScale, normalSplay; CVehicleModelInfo *mi; char *p; - sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f", + sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f %f", &id, model, txd, type, handlingId, gamename, animFile, vehclass, - &frequency, &level, &comprules, &misc, &wheelScale); + &frequency, &level, &comprules, &misc, &wheelScale, + &normalSplay); mi = CModelInfo::AddVehicleModel(id); mi->SetModelName(model); @@ -872,6 +943,8 @@ CFileLoader::LoadVehicleObject(const char *line) mi->m_vehicleType = VEHICLE_TYPE_BOAT; }else if(strcmp(type, "train") == 0){ mi->m_vehicleType = VEHICLE_TYPE_TRAIN; + }else if(strcmp(type, "ferry") == 0){ + mi->m_vehicleType = VEHICLE_TYPE_FERRY; }else if(strcmp(type, "heli") == 0){ mi->m_vehicleType = VEHICLE_TYPE_HELI; }else if(strcmp(type, "plane") == 0){ @@ -937,7 +1010,7 @@ CFileLoader::LoadPedObject(const char *line) mi->SetModelName(model); mi->SetTexDictionary(txd); mi->SetAnimFile(animFile); - mi->SetColModel(&CTempColModels::ms_colModelPed1); + mi->SetColModel(&gpTempColModels->ms_colModelPed1); mi->m_pedType = CPedType::FindPedType(pedType); mi->m_pedStatType = CPedStats::GetPedStatType(pedStats); for(animGroupId = 0; animGroupId < NUM_ANIM_ASSOC_GROUPS; animGroupId++) diff --git a/src/core/FileLoader.h b/src/core/FileLoader.h index 077e7bdd..3a7d43a7 100644 --- a/src/core/FileLoader.h +++ b/src/core/FileLoader.h @@ -11,6 +11,7 @@ public: static bool LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot); static bool LoadCollisionFile(uint8 *buffer, uint32 size, uint8 colSlot); static void LoadCollisionModel(uint8 *buf, struct CColModel &model, char *name); + static void SplitColTrianglesIntoSections(CColModel &model); static void LoadModelFile(const char *filename); static RpAtomic *FindRelatedModelInfoCB(RpAtomic *atomic, void *data); static void LoadClumpFile(const char *filename); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 875bb76b..b9eb193a 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -36,15 +36,16 @@ #include "User.h" #include "sampman.h" +// --LCS: changed a bit to have lcs feel, needs more work // Similar story to Hud.cpp: // Game has colors inlined in code. // For easier modification we collect them here: -const CRGBA LABEL_COLOR(255, 150, 225, 255); +const CRGBA LABEL_COLOR(115, 173, 216, 255); const CRGBA SELECTIONBORDER_COLOR(25, 130, 70, 255); const CRGBA MENUOPTION_COLOR = LABEL_COLOR; -const CRGBA SELECTEDMENUOPTION_COLOR = LABEL_COLOR; -const CRGBA HEADER_COLOR = LABEL_COLOR; -const CRGBA DARKMENUOPTION_COLOR(195, 90, 165, 255); +const CRGBA SELECTEDMENUOPTION_COLOR(255, 255, 255, 255); +const CRGBA HEADER_COLOR(197, 0, 0, 255); +const CRGBA DARKMENUOPTION_COLOR(115/2, 173/2, 216 / 2, 255); const CRGBA SLIDERON_COLOR(97, 194, 247, 255); const CRGBA SLIDEROFF_COLOR(27, 89, 130, 255); const CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 130); @@ -53,6 +54,19 @@ const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR; const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100); const CRGBA SCROLLBAR_COLOR = LABEL_COLOR; +#if 0 +// Mobile +#define DEFAULT_BRIGHTNESS 0x150 +#define MIN_BRIGHTNESS 180 +#define MAX_BRIGHTNESS 700 +#else +// PS2, also PSP probably +// 8 bars (32 step) +#define DEFAULT_BRIGHTNESS 0x120 +#define MIN_BRIGHTNESS 0x80 +#define MAX_BRIGHTNESS 0x180 +#endif + #define MAP_MIN_SIZE 162.f #define MAP_SIZE_TO_ALLOW_X_MOVE 297.f @@ -187,7 +201,7 @@ wchar* CMenuManager::m_pDialogText = nil; #endif #define SET_FONT_FOR_MENU_HEADER \ - CFont::SetRightJustifyOn(); \ + CFont::SetRightJustifyOff(); \ CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); \ CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \ CFont::SetDropShadowPosition(0); @@ -472,7 +486,7 @@ CMenuManager::CMenuManager() m_PrefsMusicVolume = 49; m_PrefsRadioStation = 0; m_PrefsStereoMono = 1; - m_PrefsBrightness = 256; + m_PrefsBrightness = DEFAULT_BRIGHTNESS; m_PrefsLOD = CRenderer::ms_lodDistScale; m_KeyPressedCode = -1; m_bFrontEnd_ReloadObrTxtGxt = false; @@ -719,12 +733,8 @@ CMenuManager::CheckSliderMovement(int value) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_BRIGHTNESS: -#ifdef FIX_BUGS - m_PrefsBrightness += value * (384 / MENUSLIDER_LOGICAL_BARS); -#else - m_PrefsBrightness += value * 24.19f; -#endif - m_PrefsBrightness = Clamp(m_PrefsBrightness, 0, 384); + m_PrefsBrightness += value * (float)(MAX_BRIGHTNESS - MIN_BRIGHTNESS) / MENUSLIDER_LOGICAL_BARS; + m_PrefsBrightness = Clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS); break; case MENUACTION_DRAWDIST: if(value > 0) @@ -960,14 +970,14 @@ CMenuManager::DrawStandardMenus(bool activeScreen) #endif switch (m_nCurrScreen) { - case MENUPAGE_CHOOSE_LOAD_SLOT: + /*case MENUPAGE_CHOOSE_LOAD_SLOT: case MENUPAGE_CHOOSE_DELETE_SLOT: case MENUPAGE_CHOOSE_SAVE_SLOT: CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(38.0f), MENU_Y(85.0f), MENU_X_LEFT_ALIGNED(615.0f), MENU_Y(75.0f), MENU_X_LEFT_ALIGNED(30.0f), MENU_Y(320.0f), MENU_X_LEFT_ALIGNED(605.0f), MENU_Y(330.0f), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a))); - break; + break;*/ case MENUPAGE_SOUND_SETTINGS: PrintRadioSelector(); break; @@ -983,11 +993,11 @@ CMenuManager::DrawStandardMenus(bool activeScreen) if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') { SET_FONT_FOR_MENU_HEADER - CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + //CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); + //CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); } // Label @@ -1063,18 +1073,21 @@ CMenuManager::DrawStandardMenus(bool activeScreen) #endif wchar* rightText = nil; wchar* leftText; - if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) { + /*if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) { CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE)); CFont::SetDropShadowPosition(0); - } else { - CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + } else {*/ + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); - CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255))); - } + if (i == m_nCurrOption && itemsAreSelectable) + CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255))); + else + CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255))); + //} if (aScreens[m_nCurrScreen].m_aEntries[i].m_Align == MENUALIGN_LEFT) { CFont::SetCentreOff(); CFont::SetRightJustifyOff(); @@ -1434,7 +1447,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen) // Actually bottomRight and bottomLeft should be exchanged here(although this is original code). // So this shows us either R* didn't use same struct for menu BG and highlight, or they just kept fields as x1,y1 etc. Yikes. - if (m_nOptionHighlightTransitionBlend == 0) { + /*if (m_nOptionHighlightTransitionBlend == 0) { if (m_firstStartCounter == 255 && m_nMenuFadeAlpha == 255 && !bMenuChangeOngoing) { CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(menuOptionHighlight.topLeft_x), MENU_Y(menuOptionHighlight.topLeft_y), MENU_X_LEFT_ALIGNED(menuOptionHighlight.topRight_x), MENU_Y(menuOptionHighlight.topRight_y), @@ -1470,7 +1483,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen) MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomRight_x), MENU_Y(menuOptionHighlight.bottomRight_y), MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomLeft_x), MENU_Y(menuOptionHighlight.bottomLeft_y), SELECTIONBORDER_COLOR); } - } + }*/ static uint32 lastBlendChange = 0; if (m_nOptionHighlightTransitionBlend <= 255) { @@ -1502,7 +1515,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen) CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE)); } else { - CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); } CFont::PrintString(MENU_X_LEFT_ALIGNED(DEFAULT_SCREEN_WIDTH - RIGHT_ALIGNED_TEXT_RIGHT_MARGIN(xMargin)), MENU_Y(aScreens[m_nCurrScreen].m_aEntries[i].m_Y MINUS_SCROLL_OFFSET), rightText); @@ -1558,7 +1571,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen) int lastActiveBarX; switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { case MENUACTION_BRIGHTNESS: - ProcessSlider(m_PrefsBrightness / 384.0f, SLIDER_Y(70.0f), HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true); + ProcessSlider((float)(m_PrefsBrightness - MIN_BRIGHTNESS) / (MAX_BRIGHTNESS - MIN_BRIGHTNESS), SLIDER_Y(70.0f), HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true); break; case MENUACTION_DRAWDIST: ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, SLIDER_Y(99.0f), HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true); @@ -2096,18 +2109,18 @@ CMenuManager::DrawControllerSetupScreen() // Shadow CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); - if (m_ControlMethod == CONTROL_STANDARD) - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_STI")); - else if (m_ControlMethod == CONTROL_CLASSIC) - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_CTI")); + //if (m_ControlMethod == CONTROL_STANDARD) + // CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_STI")); + //else if (m_ControlMethod == CONTROL_CLASSIC) + // CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_CTI")); // Real header CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); if (m_ControlMethod == CONTROL_STANDARD) - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_STI")); + CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_STI")); else if (m_ControlMethod == CONTROL_CLASSIC) - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_CTI")); + CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_CTI")); wchar *actionTexts[33]; actionTexts[0] = TheText.Get("FEC_FIR"); @@ -2260,7 +2273,7 @@ CMenuManager::DrawControllerSetupScreen() } // Back button and it's shadow - CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); CFont::SetRightJustifyOn(); CFont::SetDropShadowPosition(2); @@ -2319,7 +2332,7 @@ CMenuManager::DrawBackground(bool transitionCall) PrintMap(); // Left border - CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT, + /*CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255)); // Top border @@ -2332,7 +2345,7 @@ CMenuManager::DrawBackground(bool transitionCall) // Right border CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y), - SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255)); + SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));*/ } else { m_nMenuFadeAlpha = 255; m_firstStartCounter = 255; @@ -2341,7 +2354,7 @@ CMenuManager::DrawBackground(bool transitionCall) PrintMap(); // Left border - CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT, + /*CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255)); // Top border @@ -2354,7 +2367,7 @@ CMenuManager::DrawBackground(bool transitionCall) // Right border CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y), - SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255)); + SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));*/ } } else { menuBg.SaveCurrentCoors(); @@ -2444,9 +2457,9 @@ CMenuManager::DrawBackground(bool transitionCall) if (CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 30 || forceFadeInCounter > 30 ) { - m_nMenuFadeAlpha += 20; + m_nMenuFadeAlpha += 50; if (m_firstStartCounter < 255) { - m_firstStartCounter = Min(m_firstStartCounter + 20, 255); + m_firstStartCounter = Min(m_firstStartCounter + 50, 255); } LastFade = CTimer::GetTimeInMillisecondsPauseMode(); #ifdef FIX_BUGS @@ -2505,12 +2518,12 @@ CMenuManager::DrawBackground(bool transitionCall) CFont::DrawFonts(); SetFrontEndRenderStates(); - if (m_nCurrScreen != MENUPAGE_OUTRO) - if (m_firstStartCounter == 255) { - m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255)); - } else { - m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255))); - } + //if (m_nCurrScreen != MENUPAGE_OUTRO) + // if (m_firstStartCounter == 255) { + // m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255)); + // } else { + // m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255))); + // } if (m_ShowEmptyBindingError) { static uint32 lastBindingError = CTimer::GetTimeInMillisecondsPauseMode(); @@ -2629,11 +2642,11 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen) MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a))); SET_FONT_FOR_MENU_HEADER - CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_PS")); + //CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); + //CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_PS")); CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); - CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_PS")); + CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_PS")); // Header (Skin - Date) if (m_nCurrExLayer == HOVEROPTION_LIST) { @@ -2813,7 +2826,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen) // Big apply button if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0) { - CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); switch (m_PrefsLanguage) { case LANGUAGE_FRENCH: CFont::SetScale(MENU_X(1.1f), MENU_Y(1.9f)); @@ -2833,7 +2846,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen) CFont::SetRightJustifyOff(); CFont::PrintString(MENU_X_LEFT_ALIGNED(24.0f), MENU_Y(220.0f), TheText.Get("FET_APP")); } - CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); @@ -2905,7 +2918,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen) m_nHoverOption = HOVEROPTION_NOT_HOVERING; } } - CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); CFont::SetRightJustifyOn(); CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255))); @@ -3341,7 +3354,7 @@ CMenuManager::SmallMessageScreen(const char* text) void CMenuManager::PrintBriefs() { - CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); + CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255))); CFont::SetRightJustifyOff(); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE)); @@ -3497,9 +3510,9 @@ CMenuManager::Process(void) #ifdef XBOX_MESSAGE_SCREEN ProcessDialogTimer(); #endif - - if (TheCamera.GetScreenFadeStatus() != FADE_0) - return; + // tmp hack to get saving to work + //if (TheCamera.GetScreenFadeStatus() != FADE_0) + // return; InitialiseChangedLanguageSettings(); @@ -4836,7 +4849,8 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u break; case MENUACTION_CANCELGAME: DMAudio.Service(); - SwitchToNewScreen(MENUPAGE_OUTRO); + RsEventHandler(rsQUITAPP, nil); + //SwitchToNewScreen(MENUPAGE_OUTRO); break; case MENUACTION_RESUME: #ifdef LEGACY_MENU_OPTIONS @@ -4908,7 +4922,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE); SaveSettings(); } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { - m_PrefsBrightness = 256; + m_PrefsBrightness = DEFAULT_BRIGHTNESS; m_PrefsLOD = 1.2f; #ifdef LEGACY_MENU_OPTIONS m_PrefsVsync = true; @@ -5779,7 +5793,7 @@ CMenuManager::DrawQuitGameScreen(void) static CSprite2d *splash = nil; if (splash == nil) - splash = LoadSplash("OUTRO"); + splash = LoadSplash("sceelee"); m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(28.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255 - alpha)); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 77c8965f..a1ae4625 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -22,6 +22,7 @@ #include "Darkel.h" #include "Debug.h" #include "EventList.h" +#include "Ferry.h" #include "FileLoader.h" #include "FileMgr.h" #include "Fire.h" @@ -322,7 +323,7 @@ bool CGame::InitialiseOnceAfterRW(void) { TheText.Load(); CTimer::Initialise(); - CTempColModels::Initialise(); + gpTempColModels->Initialise(); mod_HandlingManager.Initialise(); CSurfaceTable::Initialise("DATA\\SURFACE.DAT"); CPedStats::Initialise(); @@ -374,6 +375,9 @@ bool CGame::Initialise(const char* datFile) CPools::Initialise(); + if(gMakeResources) + CVehicleModelInfo::Load(nil); + #ifndef GTA_PS2 #ifdef PED_CAR_DENSITY_SLIDERS // Load density values from gta3.ini only if our reVC.ini have them 0.6f @@ -384,7 +388,7 @@ bool CGame::Initialise(const char* datFile) #ifdef USE_TEXTURE_POOL _TexturePoolsUnknown(false); #endif - currLevel = LEVEL_BEACH; + currLevel = LEVEL_INDUSTRIAL; currArea = AREA_MAIN_MAP; PUSH_MEMID(MEMID_TEXTURES); @@ -455,7 +459,7 @@ bool CGame::Initialise(const char* datFile) CdStreamAddImage("MODELS\\GTA3.IMG"); - CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); +// CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); CFileLoader::LoadLevel(datFile); LoadingScreen("Loading the Game", "Add Particles", nil); @@ -550,6 +554,7 @@ bool CGame::Initialise(const char* datFile) LoadingScreen("Loading the Game", "Position dynamic objects", nil); LoadingScreen("Loading the Game", "Initialise vehicle paths", nil); + CFerry::InitFerrys(); CTrain::InitTrains(); CPlane::InitPlanes(); CCredits::Init(); @@ -598,7 +603,7 @@ bool CGame::ShutDown(void) CPlane::Shutdown(); CTrain::Shutdown(); CScriptPaths::Shutdown(); - CWaterCreatures::RemoveAll(); + //CWaterCreatures::RemoveAll(); CSpecialFX::Shutdown(); CGarages::Shutdown(); CMovingThings::Shutdown(); @@ -649,7 +654,7 @@ bool CGame::ShutDown(void) return true; } -void CGame::ReInitGameObjectVariables(void) +bool CGame::ReInitGameObjectVariables(bool load) { CGameLogic::InitAtStartOfGame(); #ifdef PS2_MENU @@ -672,8 +677,9 @@ void CGame::ReInitGameObjectVariables(void) CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; CStreaming::RequestBigBuildings(LEVEL_GENERIC); - CStreaming::RemoveIslandsNotUsed(LEVEL_BEACH); - CStreaming::RemoveIslandsNotUsed(LEVEL_MAINLAND); + CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); CStreaming::LoadAllRequestedModels(false); currArea = AREA_MAIN_MAP; CPed::Initialise(); @@ -693,7 +699,7 @@ void CGame::ReInitGameObjectVariables(void) gPhoneInfo.Initialise(); PUSH_MEMID(MEMID_SCRIPT); - CTheScripts::Init(); + bool res = CTheScripts::Init(load); CGangs::Initialise(); POP_MEMID(); @@ -706,12 +712,14 @@ void CGame::ReInitGameObjectVariables(void) CStats::Init(); CPickups::Init(); CPacManPickups::Init(); - CGarages::Init(); + if (!load) + CGarages::Init(); CSpecialFX::Init(); CRopes::Init(); CWaterCannons::Init(); CScriptPaths::Init(); CParticle::ReloadConfig(); + CParticle::SetPixelData(); #ifdef PS2_MENU if ( !TheMemoryCard.m_bWantToLoad ) @@ -723,12 +731,15 @@ void CGame::ReInitGameObjectVariables(void) CTheScripts::StartTestScript(); CTheScripts::Process(); TheCamera.Process(); + CFerry::InitFerrys(); CTrain::InitTrains(); CPlane::InitPlanes(); } for (int32 i = 0; i < MAX_PADS; i++) CPad::GetPad(i)->Clear(true); + + return res; } void CGame::ReloadIPLs(void) @@ -759,7 +770,7 @@ void CGame::ShutDownForRestart(void) CRadar::RemoveRadarSections(); FrontEndMenuManager.UnloadTextures(); CParticleObject::RemoveAllExpireableParticleObjects(); - CWaterCreatures::RemoveAll(); + //CWaterCreatures::RemoveAll(); CSetPieces::Init(); CPedType::Shutdown(); CSpecialFX::Shutdown(); @@ -799,15 +810,15 @@ void CGame::InitialiseWhenRestarting(void) RestoreForStartLoad(); } - ReInitGameObjectVariables(); + bool bLoadSuccessful = ReInitGameObjectVariables(FrontEndMenuManager.m_bWantToLoad); if ( FrontEndMenuManager.m_bWantToLoad == true ) { - FrontEndMenuManager.m_bWantToLoad = false; InitRadioStationPositionList(); - if ( GenericLoad() == true ) + if ( bLoadSuccessful == true ) { DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds()); + CFerry::InitFerrys(); CTrain::InitTrains(); CPlane::InitPlanes(); } @@ -823,8 +834,8 @@ void CGame::InitialiseWhenRestarting(void) ShutDownForRestart(); CTimer::Stop(); CTimer::Initialise(); - FrontEndMenuManager.m_bWantToLoad = false; - ReInitGameObjectVariables(); + //FrontEndMenuManager.m_bWantToLoad = false; + ReInitGameObjectVariables(false); currLevel = LEVEL_GENERIC; CCollision::SortOutCollisionAfterLoad(); } @@ -833,6 +844,7 @@ void CGame::InitialiseWhenRestarting(void) #endif } + FrontEndMenuManager.m_bWantToLoad = true; CTimer::Update(); DMAudio.ChangeMusicMode(MUSICMODE_GAME); @@ -843,6 +855,20 @@ void CGame::InitialiseWhenRestarting(void) void CGame::Process(void) { + if (FrontEndMenuManager.m_bWantToLoad) { + CTheScripts::StartTestScript(); + CTheScripts::Process(); + TheCamera.Process(); + CStreaming::LoadScene(TheCamera.GetPosition()); + //CGame::GenerateTempPedAtStartOfNetworkGame(); + if (!CStreaming::HasModelLoaded(MI_PLAYER)){ + CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DEPENDENCY | STREAMFLAGS_DONT_REMOVE); + CStreaming::LoadAllRequestedModels(false); + } + TheCamera.Process(); + CStreaming::LoadScene(TheCamera.GetPosition()); + FrontEndMenuManager.m_bWantToLoad = false; + } CPad::UpdatePads(); #ifdef USE_CUSTOM_ALLOCATOR ProcessTidyUpMemory(); @@ -864,9 +890,9 @@ void CGame::Process(void) gameProcessPirateCheck = 2; } #endif - uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); + //uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); CStreaming::Update(); - uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; + //uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; CWindModifiers::Number = 0; if (!CTimer::GetIsPaused()) { @@ -891,6 +917,7 @@ void CGame::Process(void) CCollision::Update(); CScriptPaths::Update(); + CFerry::UpdateFerrys(); CTrain::UpdateTrains(); CPlane::UpdatePlanes(); CHeli::UpdateHelis(); @@ -905,26 +932,20 @@ void CGame::Process(void) CEventList::Update(); CParticle::Update(); gFireManager.Update(); - - // Otherwise even on 30 fps most probably you won't see any peds around Ocean View Hospital -#if defined FIX_BUGS && !defined SQUEEZE_PERFORMANCE - if (processTime > 2) { -#else - if (processTime >= 2) { -#endif - CPopulation::Update(false); - } else { - uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); + //if (processTime >= 2) { + // CPopulation::Update(false); + //} else { + // uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); CPopulation::Update(true); - processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; - } + // processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; + //} CWeapon::UpdateWeapons(); if (!CCutsceneMgr::IsRunning()) CTheCarGenerators::Process(); if (!CReplay::IsPlayingBack()) CCranes::UpdateCranes(); CClouds::Update(); - CMovingThings::Update(); + //CMovingThings::Update(); // TODO CWaterCannons::Update(); CUserDisplay::Process(); CReplay::Update(); @@ -955,7 +976,7 @@ void CGame::Process(void) if (!CReplay::IsPlayingBack()) { PUSH_MEMID(MEMID_CARS); - if (processTime < 2) + //if (processTime < 2) CCarCtrl::GenerateRandomCars(); CRoadBlocks::GenerateRoadBlocks(); CCarCtrl::RemoveDistantCars(); diff --git a/src/core/Game.h b/src/core/Game.h index 4052eb00..e6016888 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -3,8 +3,10 @@ enum eLevelName { LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel LEVEL_GENERIC = 0, - LEVEL_BEACH, - LEVEL_MAINLAND, + LEVEL_INDUSTRIAL, + LEVEL_COMMERCIAL, + LEVEL_SUBURBAN, + LEVEL_UNDERGROUND, NUM_LEVELS }; @@ -60,7 +62,7 @@ public: static void FinalShutdown(void); static bool Initialise(const char *datFile); static bool ShutDown(void); - static void ReInitGameObjectVariables(void); + static bool ReInitGameObjectVariables(bool); static void ReloadIPLs(void); static void ShutDownForRestart(void); static void InitialiseWhenRestarting(void); @@ -78,4 +80,4 @@ public: static void ProcessTidyUpMemory(void); }; -inline bool IsAreaVisible(int area) { return area == CGame::currArea || area == AREA_EVERYWHERE; } +inline bool IsAreaVisible(int area) { return true; } diff --git a/src/core/General.h b/src/core/General.h index c17d916d..62613445 100644 --- a/src/core/General.h +++ b/src/core/General.h @@ -6,36 +6,10 @@ class CGeneral { public: static float GetATanOfXY(float x, float y){ - if(x == 0.0f && y == 0.0f) - return 0.0f; - float xabs = Abs(x); - float yabs = Abs(y); - - if(xabs < yabs){ - if(y > 0.0f){ - if(x > 0.0f) - return 0.5f*PI - Atan2(x / y, 1.0f); - else - return 0.5f*PI + Atan2(-x / y, 1.0f); - }else{ - if(x > 0.0f) - return 1.5f*PI + Atan2(x / -y, 1.0f); - else - return 1.5f*PI - Atan2(-x / -y, 1.0f); - } - }else{ - if(y > 0.0f){ - if(x > 0.0f) - return Atan2(y / x, 1.0f); - else - return PI - Atan2(y / -x, 1.0f); - }else{ - if(x > 0.0f) - return 2.0f*PI - Atan2(-y / x, 1.0f); - else - return PI + Atan2(-y / -x, 1.0f); - } - } + float arc = atan2f(y, x); + if(arc < 0.0f) + arc += TWOPI; + return arc; } static float LimitAngle(float angle) diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp index 5d343ec9..cf7a7f0c 100644 --- a/src/core/IniFile.cpp +++ b/src/core/IniFile.cpp @@ -8,7 +8,12 @@ #include "Population.h" float CIniFile::PedNumberMultiplier = 0.6f; -float CIniFile::CarNumberMultiplier = 0.6f; +float CIniFile::CarNumberMultiplier = +#ifdef GTA_PSP + 0.7f; +#else + 0.8f; +#endif void CIniFile::LoadIniFile() { diff --git a/src/core/IniFile.h b/src/core/IniFile.h index dcaed980..f23f94b6 100644 --- a/src/core/IniFile.h +++ b/src/core/IniFile.h @@ -2,7 +2,7 @@ #define DEFAULT_MAX_NUMBER_OF_PEDS 25.0f #define DEFAULT_MAX_NUMBER_OF_PEDS_INTERIOR 40.0f -#define DEFAULT_MAX_NUMBER_OF_CARS 12.0f +#define DEFAULT_MAX_NUMBER_OF_CARS 30.0f class CIniFile { diff --git a/src/core/KeyGen.cpp b/src/core/KeyGen.cpp new file mode 100644 index 00000000..c95ab4b1 --- /dev/null +++ b/src/core/KeyGen.cpp @@ -0,0 +1,106 @@ +#include "common.h" +#include "KeyGen.h" +#include <ctype.h> + +uint32 CKeyGen::keyTable[256] = +{ + 0, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +}; + +uint32 +CKeyGen::GetKey(const char *str, int size) +{ + uint32 key = 0xffffffff; + for (int i = 0; i < size; i++) + key = keyTable[(key ^ str[i]) & 0xFF] ^ (key >> 8); + return key; +} + +uint32 +CKeyGen::GetKey(const char *str) +{ + uint32 key = 0xffffffff; + while(*str != '\0') + key = keyTable[(key ^ *(str++)) & 0xFF] ^ (key >> 8); + return key; +} + +uint32 +CKeyGen::GetUppercaseKey(const char *str) +{ + uint32 key = 0xffffffff; + while (*str != '\0') + key = keyTable[(key ^ toupper(*(str++))) & 0xFF] ^ (key >> 8); + return key; +} + +uint32 +CKeyGen::AppendStringToKey(uint32 key, const char *str) +{ + while (*str != '\0') + key = keyTable[(key ^ *(str++)) & 0xFF] ^ (key >> 8); + return key; +}
\ No newline at end of file diff --git a/src/core/KeyGen.h b/src/core/KeyGen.h new file mode 100644 index 00000000..129859ce --- /dev/null +++ b/src/core/KeyGen.h @@ -0,0 +1,11 @@ +#pragma once + +class CKeyGen +{ + static uint32 keyTable[256]; +public: + static uint32 GetKey(const char *str, int size); + static uint32 GetKey(const char *str); + static uint32 GetUppercaseKey(const char *str); + static uint32 AppendStringToKey(uint32 key, const char *str); +};
\ No newline at end of file diff --git a/src/core/Leeds.cpp b/src/core/Leeds.cpp new file mode 100644 index 00000000..cda50605 --- /dev/null +++ b/src/core/Leeds.cpp @@ -0,0 +1,14 @@ +#include "common.h" +#include "Leeds.h" + +void LoadResource(RpAtomic *atomic) {} +void LoadResource(RpClump *clump) {} + + +void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer) {} +void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer) {} +void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer) {} +void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer) {} +void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer) {} +void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer) {} +void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer) {} diff --git a/src/core/Leeds.h b/src/core/Leeds.h new file mode 100644 index 00000000..bf71d7e0 --- /dev/null +++ b/src/core/Leeds.h @@ -0,0 +1,36 @@ +#pragma once + +/* +PatchElementModelInfo(RslElement *,void *) +ChunkName(char const*) +DestroyAndFreeResourceImage(void) +WriteOrder(char const*) +UnpatchTextures(void) +IsChunked(int) +SaveResourceImage(void) +LoadResourceImage(void) +SaveResource(RslNode *,base::cRelocatableChunkWriter &) +SaveResource(RslTAnimTree *,base::cRelocatableChunkWriter &) +SaveResource(RslSkin *,base::cRelocatableChunkWriter &) +SaveResource(CAnimBlendTree *,base::cRelocatableChunkWriter &) +PatchElementTextures(RslElement *) +PatchElementGroupTextures(RslElementGroup *) +*/ + +void LoadResource(RpAtomic *atomic); +void LoadResource(RpClump *clump); + +/* +cRelocatableChunkWriterGTA::Save(char const*,uint,uint,bool) +cRelocatableChunkGTA::cRelocatableChunkGTA(char const*,uint,uint,bool) +SaveAnimBlock(int) +SaveModel(int,bool) +*/ + +void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer); +void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer); +void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer); +void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer); +void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer); +void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer); +void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer); diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index e75510e5..86c218fa 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -88,6 +88,7 @@ extern bool gbFastTime; extern bool gGravityCheat; #endif +/* LCS: removed void SpecialCarCheats() { if ( !CVehicle::bCheat9 ) @@ -136,6 +137,7 @@ void SpecialCarCheats() CPad::bHasPlayerCheated = true; } } +*/ void PickUpChicksCheat() { @@ -361,7 +363,7 @@ void ChangePlayerCheat() do { do { - modelId = CGeneral::GetRandomNumberInRange(0, MI_PGA); + modelId = CGeneral::GetRandomNumberInRange(0, MI_GANG18); anotherModelId = modelId+1; } while (!CModelInfo::GetModelInfo(anotherModelId)); } while (anotherModelId >= MI_SPECIAL01 && anotherModelId <= MI_SPECIAL04 || modelId == MI_TAXI_D); @@ -580,16 +582,18 @@ void SuicideCheat(void) { } void DoChicksWithGunsCheat(void) { +/* // broken in LCS CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CStreaming::SetModelIsDeletable(CGangs::GetGangPedModel1(GANG_PLAYER)); CStreaming::SetModelIsDeletable(CGangs::GetGangPedModel2(GANG_PLAYER)); CStreaming::SetModelTxdIsDeletable(CGangs::GetGangPedModel1(GANG_PLAYER)); CStreaming::SetModelTxdIsDeletable(CGangs::GetGangPedModel2(GANG_PLAYER)); CStreaming::RemoveCurrentZonesModels(); - CGangs::SetGangPedModels(GANG_PLAYER, MI_HFYBE, MI_WFYBE); + CGangs::SetGangPedModels(GANG_PLAYER, MI_CAS_WOM, MI_HOS_WOM); CGangs::SetGangWeapons(GANG_PLAYER, WEAPONTYPE_M4, WEAPONTYPE_M4); CStats::CheatedCount += 1000; CPad::bHasPlayerCheated = true; +*/ } ////////////////////////////////////////////////////////////////////////// @@ -1411,6 +1415,8 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; BlackCarsCheat(); } +/* + // LCS: removed for now // "TRAVELINSTYLE" else if (!Cheat_strncmp(KeyBoardCheatString, "HQ`U`iLSFaNZ[")) { KeyBoardCheatString[0] = ' '; @@ -1506,6 +1512,7 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; ChangePlayerModel("igdiaz"); } +*/ // DEEPFRIEDMARSBARS else if (!Cheat_strncmp(KeyBoardCheatString, "VWHC`mDTEPVZMpRK")) { KeyBoardCheatString[0] = ' '; @@ -1521,11 +1528,13 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; BackToTheFuture(); } +/* LCS: removed // LOADSOFLITTLETHINGS else if (!Cheat_strncmp(KeyBoardCheatString, "VLUJUoHSU_VTMo`J]bV")) { KeyBoardCheatString[0] = ' '; SpecialCarCheats(); } +*/ // HOPINGIRL else if (!Cheat_strncmp(KeyBoardCheatString, "OWPH[dSVI")) { KeyBoardCheatString[0] = ' '; diff --git a/src/core/Pad.h b/src/core/Pad.h index f141ed6c..cc0fa9d1 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -140,7 +140,7 @@ class CPad public: enum { - HORNHISTORY_SIZE = 5, + HORNHISTORY_SIZE = 8, DRUNK_STEERING_BUFFER_SIZE = 10, }; CControllerState NewState; @@ -164,6 +164,8 @@ public: int32 LastTimeTouched; int32 AverageWeapon; int32 AverageEntries; + float unk_B4; + float unk_B8; #ifdef DETECT_PAD_INPUT_SWITCH static bool IsAffectedByController; @@ -275,6 +277,16 @@ public: uint32 InputHowLongAgo(void); void SetDrunkInputDelay(int32 delay) { DrunkDrivingBufferUsed = delay; } + // TODO(LCS): properly, this is just to get some estimation for script + int16 GetOddJobTrigger() { return GetRightShockJustDown(); } + int16 GuiLeft() { return GetAnaloguePadLeft() || GetDPadLeftJustDown(); } + int16 GuiRight() { return GetAnaloguePadRight() || GetDPadRightJustDown(); } + int16 GuiUp() { return GetAnaloguePadUp() || GetDPadUpJustDown(); } + int16 GuiDown() { return GetAnaloguePadDown() || GetDPadDownJustDown(); } + int16 GuiSelect() { return GetCrossJustDown(); } + int16 GuiBack() { return GetTriangleJustDown(); } + int16 GetSkipCutscene() { return GetCrossJustDown(); } + #ifdef XINPUT static int XInputJoy1; static int XInputJoy2; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 36d05b82..2e3372f1 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -418,8 +418,10 @@ CPlayerInfo::Process(void) CTimer::Update(); } m_bInRemoteMode = false; - CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true; - CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil; + if (CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle) { + CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true; + CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil; + } if (FindPlayerVehicle()) { FindPlayerVehicle()->SetStatus(STATUS_PLAYER); } diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 4e15559d..b93b7d02 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -57,7 +57,7 @@ CSprite2d CRadar::SpraySprite; CSprite2d CRadar::TShirtSprite; CSprite2d CRadar::TommySprite; CSprite2d CRadar::PhoneSprite; -CSprite2d CRadar::RadioWildstyleSprite; +/*CSprite2d CRadar::RadioWildstyleSprite; CSprite2d CRadar::RadioFlashSprite; CSprite2d CRadar::RadioKChatSprite; CSprite2d CRadar::RadioFeverSprite; @@ -65,10 +65,39 @@ CSprite2d CRadar::RadioVRockSprite; CSprite2d CRadar::RadioVCPRSprite; CSprite2d CRadar::RadioEspantosoSprite; CSprite2d CRadar::RadioEmotionSprite; -CSprite2d CRadar::RadioWaveSprite; -#ifdef MAP_ENHANCEMENTS -CSprite2d CRadar::WaypointSprite; -#endif +CSprite2d CRadar::RadioWaveSprite;*/ +CSprite2d CRadar::EightBallSprite; +CSprite2d CRadar::BurnerSprite; +CSprite2d CRadar::CiprianiSprite; +CSprite2d CRadar::DonaldSprite; +CSprite2d CRadar::JosephSprite; +CSprite2d CRadar::LeoneSprite; +CSprite2d CRadar::MariaSprite; +CSprite2d CRadar::McraySprite; +CSprite2d CRadar::ToshikoSprite; +CSprite2d CRadar::VincenzoSprite; +CSprite2d CRadar::BombSprite; +CSprite2d CRadar::ClothesShopSprite; +CSprite2d CRadar::PropertyRedSprite; +CSprite2d CRadar::PhilCassidySprite; +CSprite2d CRadar::PowerupSprite; +CSprite2d CRadar::MPBase; +CSprite2d CRadar::MPCheckPoint; +CSprite2d CRadar::MPPlayer; +CSprite2d CRadar::MPObjective; +CSprite2d CRadar::MPCar; +CSprite2d CRadar::MPTank; +CSprite2d CRadar::MPCarLockup; +CSprite2d CRadar::MPTargetPlayer; +CSprite2d CRadar::MapHereSprite0; +CSprite2d CRadar::MapHereSprite1; +CSprite2d CRadar::MapHereSprite2; +CSprite2d CRadar::MapHereSprite3; +CSprite2d CRadar::MapHereSprite4; +CSprite2d CRadar::MapHereSprite5; +CSprite2d CRadar::MapHereSprite6; +CSprite2d CRadar::MapHereSprite7; +CSprite2d CRadar::MapWayPoint; CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { nil, @@ -102,18 +131,38 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { &TShirtSprite, &TommySprite, &PhoneSprite, - &RadioWildstyleSprite, - &RadioFlashSprite, - &RadioKChatSprite, - &RadioFeverSprite, - &RadioVRockSprite, - &RadioVCPRSprite, - &RadioEspantosoSprite, - &RadioEmotionSprite, - &RadioWaveSprite, -#ifdef MAP_ENHANCEMENTS - &WaypointSprite, -#endif + &EightBallSprite, + &BurnerSprite, + &CiprianiSprite, + &DonaldSprite, + &JosephSprite, + &LeoneSprite, + &MariaSprite, + &McraySprite, + &ToshikoSprite, + &VincenzoSprite, + &BombSprite, + &ClothesShopSprite, + &PropertyRedSprite, + &PhilCassidySprite, + &PowerupSprite, + &MPBase, + &MPCheckPoint, + &MPPlayer, + &MPObjective, + &MPCar, + &MPTank, + &MPCarLockup, + &MPTargetPlayer, + &MapHereSprite0, + &MapHereSprite1, + &MapHereSprite2, + &MapHereSprite3, + &MapHereSprite4, + &MapHereSprite5, + &MapHereSprite6, + &MapHereSprite7, + &MapWayPoint, }; // Why this doesn't coincide with world coordinates i don't know @@ -825,9 +874,6 @@ void CRadar::DrawRadarSection(int32 x, int32 y) void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha) { -#ifdef MAP_ENHANCEMENTS - if(sprite == RADAR_SPRITE_WAYPOINT) alpha = 255; -#endif RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha)); if (FrontEndMenuManager.m_bMenuMapActive) { @@ -945,9 +991,6 @@ const char* gRadarTexNames[] = { void CRadar::Initialise() { -#ifdef MAP_ENHANCEMENTS - TargetMarkerId = -1; -#endif for (int i = 0; i < NUMRADARBLIPS; i++) { ms_RadarTrace[i].m_BlipIndex = 1; SetRadarMarkerState(i, false); @@ -1087,7 +1130,7 @@ CRadar::LoadTextures() TShirtSprite.SetTexture("tshirt"); TommySprite.SetTexture("tommy"); PhoneSprite.SetTexture("phone"); - RadioWildstyleSprite.SetTexture("RWildstyle"); + /*RadioWildstyleSprite.SetTexture("RWildstyle"); RadioFlashSprite.SetTexture("RFlash"); RadioKChatSprite.SetTexture("RKchat"); RadioFeverSprite.SetTexture("RFever"); @@ -1095,44 +1138,39 @@ CRadar::LoadTextures() RadioVCPRSprite.SetTexture("RVCPR"); RadioEspantosoSprite.SetTexture("REspantoso"); RadioEmotionSprite.SetTexture("REmotion"); - RadioWaveSprite.SetTexture("RWave"); -#ifdef MAP_ENHANCEMENTS - WaypointSprite.SetTexture("radar_waypoint"); - if(!WaypointSprite.m_pTexture) { - // create the texture if it's missing in TXD -#define WAYPOINT_R (255) -#define WAYPOINT_G (72) -#define WAYPOINT_B (77) - - RwRaster *raster = RwRasterCreate(16, 16, 0, rwRASTERTYPETEXTURE | rwRASTERFORMAT8888); - - RwUInt32 *pixels = (RwUInt32 *)RwRasterLock(raster, 0, rwRASTERLOCKWRITE); - for(int x = 0; x < 16; x++) - for(int y = 0; y < 16; y++) - { - int x2 = x < 8 ? x : 7 - (x & 7); - int y2 = y < 8 ? y : 7 - (y & 7); - if ((y2 >= 4 && x2 >= 4) // square in the center is transparent - || (x2 < 2 && y2 == 0) // two pixels on each side of first/last line are transparent - || (x2 < 1 && y2 == 1)) // one pixel on each side of second to first/last line is transparent - pixels[x + y * 16] = 0; - else if((x2 == 2 && y2 >= 2)|| (y2 == 2 && x2 >= 2) )// colored square inside -#ifdef RW_GL3 - pixels[x + y * 16] = WAYPOINT_R | (WAYPOINT_G << 8) | (WAYPOINT_B << 16) | (255 << 24); -#else - pixels[x + y * 16] = WAYPOINT_B | (WAYPOINT_G << 8) | (WAYPOINT_R << 16) | (255 << 24); -#endif - else - pixels[x + y * 16] = 0xFF000000; // black - } - RwRasterUnlock(raster); - WaypointSprite.m_pTexture = RwTextureCreate(raster); - RwTextureSetFilterMode(WaypointSprite.m_pTexture, rwFILTERLINEAR); -#undef WAYPOINT_R -#undef WAYPOINT_G -#undef WAYPOINT_B - } -#endif + RadioWaveSprite.SetTexture("RWave");*/ + EightBallSprite.SetTexture("radar_8Ball"); + BurnerSprite.SetTexture("radar_Burner"); + CiprianiSprite.SetTexture("radar_Cipriani"); + DonaldSprite.SetTexture("radar_Donald"); + JosephSprite.SetTexture("radar_Joseph"); + LeoneSprite.SetTexture("radar_Leone"); + MariaSprite.SetTexture("radar_Maria"); + McraySprite.SetTexture("radar_McRay"); + ToshikoSprite.SetTexture("radar_Toshiko"); + VincenzoSprite.SetTexture("radar_Vincenzo"); + BombSprite.SetTexture("radar_Bomb"); + ClothesShopSprite.SetTexture("radar_cShop"); + PropertyRedSprite.SetTexture("radar_propertyR"); + PhilCassidySprite.SetTexture("radar_flag"); + PowerupSprite.SetTexture("radar_powerup"); + MPBase.SetTexture("mp_base"); + MPCheckPoint.SetTexture("radar_mp_checkpoint"); + MPPlayer.SetTexture("mp_player"); + MPObjective.SetTexture("mp_objective"); + MPCar.SetTexture("mp_car"); + MPTank.SetTexture("mp_tank"); + MPCarLockup.SetTexture("mp_carlockup"); + MPTargetPlayer.SetTexture("mp_targetplayer"); + MapHereSprite0.SetTexture("radar_arrow"); + MapHereSprite1.SetTexture("radar_arrow_01"); + MapHereSprite2.SetTexture("radar_arrow_02"); + MapHereSprite3.SetTexture("radar_arrow_03"); + MapHereSprite4.SetTexture("radar_arrow_04"); + MapHereSprite5.SetTexture("radar_arrow_05"); + MapHereSprite6.SetTexture("radar_arrow_06"); + MapHereSprite7.SetTexture("radar_arrow_07"); + MapWayPoint.SetTexture("radar_player_target"); CTxdStore::PopCurrentTxd(); } @@ -1232,6 +1270,7 @@ void CRadar::SetRadarMarkerState(int32 counter, bool flag) } void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { + /* float f1 = radius * 1.4f; float f2 = radius * 0.5f; CVector p1, p2; @@ -1251,6 +1290,7 @@ void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { p1 = pos - TheCamera.GetRight()*f1; p2 = pos - TheCamera.GetRight()*f2; CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color); + */ } void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha) @@ -1318,7 +1358,39 @@ void CRadar::Shutdown() TShirtSprite.Delete(); TommySprite.Delete(); PhoneSprite.Delete(); - RadioWildstyleSprite.Delete(); + EightBallSprite.Delete(); + BurnerSprite.Delete(); + CiprianiSprite.Delete(); + DonaldSprite.Delete(); + JosephSprite.Delete(); + LeoneSprite.Delete(); + MariaSprite.Delete(); + McraySprite.Delete(); + ToshikoSprite.Delete(); + VincenzoSprite.Delete(); + BombSprite.Delete(); + ClothesShopSprite.Delete(); + PropertyRedSprite.Delete(); + PhilCassidySprite.Delete(); + PowerupSprite.Delete(); + MPBase.Delete(); + MPCheckPoint.Delete(); + MPPlayer.Delete(); + MPObjective.Delete(); + MPCar.Delete(); + MPTank.Delete(); + MPCarLockup.Delete(); + MPTargetPlayer.Delete(); + MapHereSprite0.Delete(); + MapHereSprite1.Delete(); + MapHereSprite2.Delete(); + MapHereSprite3.Delete(); + MapHereSprite4.Delete(); + MapHereSprite5.Delete(); + MapHereSprite6.Delete(); + MapHereSprite7.Delete(); + MapWayPoint.Delete(); + /*RadioWildstyleSprite.Delete(); RadioFlashSprite.Delete(); RadioKChatSprite.Delete(); RadioFeverSprite.Delete(); @@ -1326,10 +1398,7 @@ void CRadar::Shutdown() RadioVCPRSprite.Delete(); RadioEspantosoSprite.Delete(); RadioEmotionSprite.Delete(); - RadioWaveSprite.Delete(); -#ifdef MAP_ENHANCEMENTS - WaypointSprite.Delete(); -#endif + RadioWaveSprite.Delete();*/ RemoveRadarSections(); } @@ -1511,7 +1580,7 @@ CRadar::ToggleTargetMarker(float x, float y) ms_RadarTrace[nextBlip].m_nEntityHandle = 0; ms_RadarTrace[nextBlip].m_wScale = 5; ms_RadarTrace[nextBlip].m_eBlipDisplay = BLIP_DISPLAY_BLIP_ONLY; - ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_WAYPOINT; + ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE; TargetMarkerId = CRadar::GetNewUniqueBlipIndex(nextBlip); } else { ClearBlip(TargetMarkerId); @@ -1772,7 +1841,7 @@ CRadar::DrawLegend(int32 x, int32 y, int32 sprite) case RADAR_SPRITE_PHONE: text = TheText.Get("LG_25"); break; - case RADAR_SPRITE_RADIO_WILDSTYLE: + /*case RADAR_SPRITE_RADIO_WILDSTYLE: text = TheText.Get("LG_26"); break; case RADAR_SPRITE_RADIO_FLASH: @@ -1798,13 +1867,9 @@ CRadar::DrawLegend(int32 x, int32 y, int32 sprite) break; case RADAR_SPRITE_RADIO_WAVE: text = TheText.Get("LG_34"); - break; -#ifdef MAP_ENHANCEMENTS - case RADAR_SPRITE_WAYPOINT: - text = TheText.Get("LG_38"); - break; -#endif + break;*/ default: + text = TheText.Get("LG_34"); // tmp hack break; } CFont::PrintString(SCREEN_SCALE_X(20.f) + x, SCREEN_SCALE_Y(3.0f) + y, text); diff --git a/src/core/Radar.h b/src/core/Radar.h index afb37fe4..dbfcfd0d 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -17,9 +17,9 @@ #define OBJECTBLIP_MARKER_COLOR_B 242 #define OBJECTBLIP_MARKER_COLOR_A 255 -#define COORDBLIP_MARKER_COLOR_R 252 -#define COORDBLIP_MARKER_COLOR_G 138 -#define COORDBLIP_MARKER_COLOR_B 242 +#define COORDBLIP_MARKER_COLOR_R 255 +#define COORDBLIP_MARKER_COLOR_G 255 +#define COORDBLIP_MARKER_COLOR_B 128 #define COORDBLIP_MARKER_COLOR_A 228 #define NUM_MAP_LEGENDS 75 @@ -84,18 +84,38 @@ enum eRadarSprite RADAR_SPRITE_TSHIRT, RADAR_SPRITE_TOMMY, RADAR_SPRITE_PHONE, - RADAR_SPRITE_RADIO_WILDSTYLE, - RADAR_SPRITE_RADIO_FLASH, - RADAR_SPRITE_RADIO_KCHAT, - RADAR_SPRITE_RADIO_FEVER, - RADAR_SPRITE_RADIO_VROCK, - RADAR_SPRITE_RADIO_VCPR, - RADAR_SPRITE_RADIO_ESPANTOSO, - RADAR_SPRITE_RADIO_EMOTION, - RADAR_SPRITE_RADIO_WAVE, -#ifdef MAP_ENHANCEMENTS - RADAR_SPRITE_WAYPOINT, -#endif + RADAR_SPRITE_EIGHTBALL, + RADAR_SPRITE_BURNER, + RADAR_SPRITE_CIPRIANI, + RADAR_SPRITE_DONALD, + RADAR_SPRITE_JOSEPH, + RADAR_SPRITE_LEONE, + RADAR_SPRITE_MARIA, + RADAR_SPRITE_MCRAY, + RADAR_SPRITE_TOSHIKO, + RADAR_SPRITE_VINCENZO, // tmp + RADAR_SPRITE_BOMB, + RADAR_SPRITE_CLOTHES, + RADAR_SPRITE_PROPERTY_RED, + RADAR_SPRITE_PHIL_CASSIDY, + RADAR_SPRITE_POWERUP, + RADAR_SPRITE_MPBASE, + RADAR_SPRITE_MPCHECKPOINT, + RADAR_SPRITE_MPPLAYER, + RADAR_SPRITE_MPOBJECTIVE, + RADAR_SPRITE_MPCAR, + RADAR_SPRITE_MPTANK, + RADAR_SPRITE_MPCARLOCKUP, + RADAR_SPRITE_MPTARGETPLAYER, + RADAR_SPRITE_MAPHERE0, + RADAR_SPRITE_MAPHERE1, + RADAR_SPRITE_MAPHERE2, + RADAR_SPRITE_MAPHERE3, + RADAR_SPRITE_MAPHERE4, + RADAR_SPRITE_MAPHERE5, + RADAR_SPRITE_MAPHERE6, + RADAR_SPRITE_MAPHERE7, + RADAR_SPRITE_MAPWAYPOINT, RADAR_SPRITE_COUNT }; @@ -218,7 +238,7 @@ public: static CSprite2d TShirtSprite; static CSprite2d TommySprite; static CSprite2d PhoneSprite; - static CSprite2d RadioWildstyleSprite; +/* static CSprite2d RadioWildstyleSprite; static CSprite2d RadioFlashSprite; static CSprite2d RadioKChatSprite; static CSprite2d RadioFeverSprite; @@ -226,7 +246,39 @@ public: static CSprite2d RadioVCPRSprite; static CSprite2d RadioEspantosoSprite; static CSprite2d RadioEmotionSprite; - static CSprite2d RadioWaveSprite; + static CSprite2d RadioWaveSprite;*/ + static CSprite2d EightBallSprite; + static CSprite2d BurnerSprite; + static CSprite2d CiprianiSprite; + static CSprite2d DonaldSprite; + static CSprite2d JosephSprite; + static CSprite2d LeoneSprite; + static CSprite2d MariaSprite; + static CSprite2d McraySprite; + static CSprite2d ToshikoSprite; + static CSprite2d VincenzoSprite; + static CSprite2d BombSprite; + static CSprite2d ClothesShopSprite; + static CSprite2d PropertyRedSprite; + static CSprite2d PhilCassidySprite; + static CSprite2d PowerupSprite; + static CSprite2d MPBase; + static CSprite2d MPCheckPoint; + static CSprite2d MPPlayer; + static CSprite2d MPObjective; + static CSprite2d MPCar; + static CSprite2d MPTank; + static CSprite2d MPCarLockup; + static CSprite2d MPTargetPlayer; + static CSprite2d MapHereSprite0; + static CSprite2d MapHereSprite1; + static CSprite2d MapHereSprite2; + static CSprite2d MapHereSprite3; + static CSprite2d MapHereSprite4; + static CSprite2d MapHereSprite5; + static CSprite2d MapHereSprite6; + static CSprite2d MapHereSprite7; + static CSprite2d MapWayPoint; static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT]; static float cachedCos; static float cachedSin; @@ -236,7 +288,6 @@ public: static int16 MapLegendCounter; #ifdef MAP_ENHANCEMENTS - static CSprite2d WaypointSprite; static int TargetMarkerId; static CVector TargetMarkerPos; #endif diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 6d980e18..f62ff179 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -37,6 +37,7 @@ #include "Font.h" #include "Frontend.h" #include "VarConsole.h" +#include "KeyGen.h" bool CStreaming::ms_disableStreaming; bool CStreaming::ms_bLoadingBigModel; @@ -76,10 +77,16 @@ size_t CStreaming::ms_memoryAvailable; int32 desiredNumVehiclesLoaded = 12; -CEntity *pIslandLODmainlandEntity; -CEntity *pIslandLODbeachEntity; -int32 islandLODmainland; -int32 islandLODbeach; +CEntity *pIslandLODindustEntity; +CEntity *pIslandLODcomIndEntity; +CEntity *pIslandLODcomSubEntity; +CEntity *pIslandLODsubIndEntity; +CEntity *pIslandLODsubComEntity; +int32 islandLODindust; +int32 islandLODcomInd; +int32 islandLODcomSub; +int32 islandLODsubInd; +int32 islandLODsubCom; #ifndef MASTER bool gbPrintStats; @@ -173,7 +180,7 @@ CStreaming::Init2(void) // init stream info, mark things that are already loaded - for(i = 0; i < MODELINFOSIZE; i++){ + for(i = 0; i < CModelInfo::GetNumModelInfos(); i++){ CBaseModelInfo *mi = CModelInfo::GetModelInfo(i); if(mi && mi->GetRwObject()){ ms_aInfoForModel[i].m_loadState = STREAMSTATE_LOADED; @@ -242,12 +249,21 @@ CStreaming::Init2(void) // find island LODs - pIslandLODmainlandEntity = nil; - pIslandLODbeachEntity = nil; - islandLODmainland = -1; - islandLODbeach = -1; - CModelInfo::GetModelInfo("IslandLODmainland", &islandLODmainland); - CModelInfo::GetModelInfo("IslandLODbeach", &islandLODbeach); + 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); #ifndef MASTER VarConsole.Add("Streaming Debug", &gbPrintStats, true); @@ -919,65 +935,61 @@ CStreaming::RequestIslands(eLevelName level) { ISLAND_LOADING_ISNT(HIGH) switch(level){ - case LEVEL_MAINLAND: - if(islandLODbeach != -1) - RequestModel(islandLODbeach, BIGBUILDINGFLAGS); + case LEVEL_INDUSTRIAL: + RequestModel(islandLODcomInd, BIGBUILDINGFLAGS); + RequestModel(islandLODsubInd, BIGBUILDINGFLAGS); break; - case LEVEL_BEACH: - if(islandLODmainland != -1) - RequestModel(islandLODmainland, BIGBUILDINGFLAGS); + case LEVEL_COMMERCIAL: + RequestModel(islandLODindust, BIGBUILDINGFLAGS); + RequestModel(islandLODsubCom, BIGBUILDINGFLAGS); + break; + case LEVEL_SUBURBAN: + RequestModel(islandLODindust, BIGBUILDINGFLAGS); + RequestModel(islandLODcomSub, BIGBUILDINGFLAGS); break; default: break; } } -static char *IGnames[] = { - "player", - "player2", - "player3", - "player4", - "player5", - "player6", - "player7", - "player8", - "player9", - "play10", - "play11", - "igken", - "igcandy", - "igsonny", - "igbuddy", - "igjezz", - "ighlary", - "igphil", - "igmerc", - "igdick", - "igdiaz", +const char *csPlayerNames[] = +{ + "csplr", + "csplr2", + "csplr3", + "csplr4", + "csplr5", + "csplr6", + "csplr7", + "csplr8", + "csplr9", + "csplr10", + "csplr11", + "csplr12", + "csplr13", + "csplr14", + "csplr15", + "csplr16", "" }; -static char *CSnames[] = { - "csplay", - "csplay2", - "csplay3", - "csplay4", - "csplay5", - "csplay6", - "csplay7", - "csplay8", - "csplay9", - "csplay10", - "csplay11", - "csken", - "cscandy", - "cssonny", - "csbuddy", - "csjezz", - "cshlary", - "csphil", - "csmerc", - "csdick", - "csdiaz", +const char* playerNames[] = +{ + "plr", + "plr2", + "plr3", + "plr4", + "plr5", + "plr6", + "plr7", + "plr8", + "plr9", + "plr10", + "plr11", + "plr12", + "plr13", + "plr14", + "plr15", + "plr16", "" }; @@ -991,15 +1003,17 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag int i, n; mi = CModelInfo::GetModelInfo(modelId); - if(strncasecmp("CSPlay", modelName, 6) == 0){ - char *curname = CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName(); - for(int i = 0; CSnames[i][0]; i++){ - if(strcasecmp(curname, IGnames[i]) == 0){ - modelName = CSnames[i]; + if (CKeyGen::GetUppercaseKey(modelName) == CKeyGen::GetUppercaseKey("cstoni_a")) { + i = 0; + while (csPlayerNames[i][0] != '\0') { + if (CModelInfo::GetModelInfo(0)->GetNameHashKey() == CKeyGen::GetUppercaseKey(playerNames[i])) { + modelName = csPlayerNames[i]; break; } + i++; } } + if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){ // Already have the correct name, just request it RequestModel(modelId, flags); @@ -1134,10 +1148,9 @@ CStreaming::RemoveModel(int32 id) void CStreaming::RemoveUnusedBuildings(eLevelName level) { - if(level != LEVEL_BEACH) - RemoveBuildings(LEVEL_BEACH); - if(level != LEVEL_MAINLAND) - RemoveBuildings(LEVEL_MAINLAND); + for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++) + if(level != i) + RemoveBuildings((eLevelName)i); } void @@ -1260,10 +1273,9 @@ CStreaming::RemoveUnusedBigBuildings(eLevelName level) { ISLAND_LOADING_IS(LOW) { - if(level != LEVEL_BEACH) - RemoveBigBuildings(LEVEL_BEACH); - if(level != LEVEL_MAINLAND) - RemoveBigBuildings(LEVEL_MAINLAND); + for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++) + if(level != i) + RemoveBuildings((eLevelName)i); } RemoveIslandsNotUsed(level); } @@ -1285,29 +1297,53 @@ void CStreaming::RemoveIslandsNotUsed(eLevelName level) { int i; - if(pIslandLODmainlandEntity == nil) + if(pIslandLODindustEntity == nil) for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){ CBuilding *building = CPools::GetBuildingPool()->GetSlot(i); if(building == nil) continue; - if(building->GetModelIndex() == islandLODmainland) - pIslandLODmainlandEntity = building; - if(building->GetModelIndex() == islandLODbeach) - pIslandLODbeachEntity = building; + if(building->GetModelIndex() == islandLODindust) + pIslandLODindustEntity = building; + else if(building->GetModelIndex() == islandLODcomInd) + pIslandLODcomIndEntity = building; + else if(building->GetModelIndex() == islandLODcomSub) + pIslandLODcomSubEntity = building; + else if(building->GetModelIndex() == islandLODsubInd) + pIslandLODsubIndEntity = building; + else if(building->GetModelIndex() == islandLODsubCom) + pIslandLODsubComEntity = building; } #ifdef NO_ISLAND_LOADING if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { - DeleteIsland(pIslandLODmainlandEntity); - DeleteIsland(pIslandLODbeachEntity); + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); } else #endif switch(level){ - case LEVEL_MAINLAND: - DeleteIsland(pIslandLODmainlandEntity); + case LEVEL_INDUSTRIAL: + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubComEntity); break; - case LEVEL_BEACH: - DeleteIsland(pIslandLODbeachEntity); - + case LEVEL_COMMERCIAL: + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + break; + case LEVEL_SUBURBAN: + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); + DeleteIsland(pIslandLODcomIndEntity); + break; + default: + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); break; } } @@ -1569,6 +1605,7 @@ CStreaming::IsObjectInCdImage(int32 id) void CStreaming::SetModelIsDeletable(int32 id) { + assert(id >= 0); // guard against fake IDs ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_DONT_REMOVE; if ((id >= STREAM_OFFSET_TXD && id < STREAM_OFFSET_COL || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) && (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED) == 0){ @@ -1647,11 +1684,11 @@ CStreaming::StreamVehiclesAndPeds(void) } if(FindPlayerPed()->m_pWanted->AreFbiRequired()){ - RequestModel(MI_FBIRANCH, STREAMFLAGS_DONT_REMOVE); + RequestModel(MI_FBICAR, STREAMFLAGS_DONT_REMOVE); RequestModel(MI_FBI, STREAMFLAGS_DONT_REMOVE); }else{ - SetModelIsDeletable(MI_FBIRANCH); - if(!HasModelLoaded(MI_FBIRANCH)) + SetModelIsDeletable(MI_FBICAR); + if(!HasModelLoaded(MI_FBICAR)) SetModelIsDeletable(MI_FBI); } @@ -1671,6 +1708,7 @@ CStreaming::StreamVehiclesAndPeds(void) else SetModelIsDeletable(MI_CHOPPER); +/* LCS: removed if (FindPlayerPed()->m_pWanted->AreMiamiViceRequired()) { SetModelIsDeletable(MI_VICE1); SetModelIsDeletable(MI_VICE2); @@ -1712,6 +1750,7 @@ CStreaming::StreamVehiclesAndPeds(void) SetModelIsDeletable(MI_VICE7); SetModelIsDeletable(MI_VICE8); } +*/ if(timeBeforeNextLoad >= 0) timeBeforeNextLoad--; @@ -3146,6 +3185,46 @@ CStreaming::LoadSceneCollision(const CVector &pos) CStreaming::LoadAllRequestedModels(false); } +//--LCS: TODO PSP and PS2 +// some things commented out that might be Rsl3D dependent +void CStreaming::RegisterPointer(void *ptr, int, bool) {} +RpAtomic *CStreaming::RegisterAtomic(RpAtomic *atomic, void *) +{ + return atomic; +} +void CStreaming::RegisterClump(RpClump *clump) +{ + RpClumpForAllAtomics(clump, RegisterAtomic, nil); +} +RpAtomic *CStreaming::RegisterInstance(RpAtomic *atomic, void *) +{ +// RegisterPointer(&atomic->geometry, 2, true); + return atomic; +} +void CStreaming::RegisterInstance(RpClump *clump) +{ + RpClumpForAllAtomics(clump, RegisterInstance, nil); +} + +void CStreaming::UnregisterPointer(void *ptr, int) {} +RpAtomic *CStreaming::UnregisterAtomic(RpAtomic *atomic, void *) +{ + return atomic; +} +void CStreaming::UnregisterClump(RpClump *clump) +{ + RpClumpForAllAtomics(clump, UnregisterAtomic, nil); +} +RpAtomic *CStreaming::UnregisterInstance(RpAtomic *atomic, void *) +{ +// UnregisterPointer(&atomic->geometry, 2); + return atomic; +} +void CStreaming::UnregisterInstance(RpClump *clump) +{ + RpClumpForAllAtomics(clump, UnregisterInstance, nil); +} + void CStreaming::MemoryCardSave(uint8 *buf, uint32 *size) { diff --git a/src/core/Streaming.h b/src/core/Streaming.h index 4ddf0b3b..b4a634fa 100644 --- a/src/core/Streaming.h +++ b/src/core/Streaming.h @@ -17,9 +17,11 @@ enum StreamFlags STREAMFLAGS_PRIORITY = 0x08, STREAMFLAGS_NOFADE = 0x10, STREAMFLAGS_20 = 0x20, // TODO(MIAMI): what's this + STREAMFLAGS_40 = 0x40, // TODO(LCS): what's this + STREAMFLAGS_AMBIENT_SCRIPT_OWNED = 0x80, - STREAMFLAGS_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED, - STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY, + STREAMFLAGS_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_AMBIENT_SCRIPT_OWNED, + STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY |STREAMFLAGS_AMBIENT_SCRIPT_OWNED, }; enum StreamLoadState @@ -127,6 +129,7 @@ public: static bool HasColLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_COL); } static bool HasAnimLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_ANIM); } static bool CanRemoveModel(int32 id) { return (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0; } + static bool IsScriptOwnedModel(int32 id) { return (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED); } static bool CanRemoveTxd(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_TXD); } static bool CanRemoveCol(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_COL); } static bool CanRemoveAnim(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_ANIM); } @@ -210,6 +213,17 @@ public: static void LoadScene(const CVector &pos); static void LoadSceneCollision(const CVector &pos); + static void RegisterPointer(void *ptr, int, bool); + static RpAtomic *RegisterAtomic(RpAtomic *atomic, void *); + static void RegisterClump(RpClump *clump); + static RpAtomic *RegisterInstance(RpAtomic *atomic, void *); + static void RegisterInstance(RpClump *clump); + static void UnregisterPointer(void *ptr, int); + static RpAtomic *UnregisterAtomic(RpAtomic *atomic, void *); + static void UnregisterClump(RpClump *clump); + static RpAtomic *UnregisterInstance(RpAtomic *atomic, void *); + static void UnregisterInstance(RpClump *clump); + static void MemoryCardSave(uint8 *buffer, uint32 *length); static void MemoryCardLoad(uint8 *buffer, uint32 length); @@ -217,3 +231,10 @@ public: static void PrintStreamingBufferState(); }; + +// LCS(TODO): put them into CStreaming::mspInst +extern int32 islandLODindust; +extern int32 islandLODcomInd; +extern int32 islandLODcomSub; +extern int32 islandLODsubInd; +extern int32 islandLODsubCom; diff --git a/src/core/World.cpp b/src/core/World.cpp index 549c2cc0..2de36383 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1788,56 +1788,35 @@ void CWorld::RepositionOneObject(CEntity *pEntity) { int16 modelId = pEntity->GetModelIndex(); - if (modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || - modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || - modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || - modelId == MI_PHONESIGN || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || - modelId == MI_PARKTABLE || modelId == MI_PARKINGMETER2 || modelId == MI_TELPOLE02 || - modelId == MI_PARKBENCH || modelId == MI_BARRIER1 || IsTreeModel(modelId) - ) { + if (IsLightThatNeedsRepositioning(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || + modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || + modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || + modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || + modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 || + modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 || + modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT || + modelId == MI_PARKTABLE) { CVector& position = pEntity->GetMatrix().GetPosition(); - CColModel* pColModel = pEntity->GetColModel(); - float fBoundingBoxMinZ = pColModel->boundingBox.min.z; - float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; - if (fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z; + float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; position.z = FindGroundZFor3DCoord(position.x, position.y, - position.z + fHeight, nil) - - fBoundingBoxMinZ; + position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - + fBoundingBoxMinZ; pEntity->GetMatrix().UpdateRW(); pEntity->UpdateRwFrame(); - } else if(IsLightThatNeedsRepositioning(modelId)) { - CVector position = pEntity->GetMatrix().GetPosition(); - CColModel* pColModel = pEntity->GetColModel(); - float fBoundingBoxMinZ = pColModel->boundingBox.min.z; - float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; - if (fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z; - if (pColModel->numBoxes == 1) - position = pEntity->GetMatrix() * CVector( - (pColModel->boxes[0].min.x + pColModel->boxes[0].max.x) / 2, - (pColModel->boxes[0].min.y + pColModel->boxes[0].max.y) / 2, - pColModel->boxes[0].min.z); - else if (pColModel->numSpheres > 0) { - position.z = 1000.0f; - for (int i = 0; i < pColModel->numSpheres; i++) { - if (pColModel->spheres[i].center.z < position.z) - position = pColModel->spheres[i].center; - } - if (position.z < 1000.0f) - position = pEntity->GetMatrix() * position; - } - pEntity->GetMatrix().GetPosition().z = FindGroundZFor3DCoord(position.x, position.y, pEntity->GetMatrix().GetPosition().z + fHeight, nil) - fBoundingBoxMinZ; - pEntity->GetMatrix().UpdateRW(); - pEntity->UpdateRwFrame(); - - } - if(modelId == MI_BUOY) { + } else if(modelId == MI_BUOY) { + float fWaterLevel = 0.0f; bool bFound = true; const CVector &position = pEntity->GetPosition(); float fGroundZ = FindGroundZFor3DCoord(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); - CColModel *pColModel = pEntity->GetColModel(); - float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; - pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + 6.0f - 0.5f * fHeight; + if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, + &fWaterLevel)) { + if(!bFound || fWaterLevel > fGroundZ) { + CColModel *pColModel = pEntity->GetColModel(); + float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; + pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight; + } + } } } @@ -1927,16 +1906,7 @@ CWorld::Process(void) for(int i = 0; i < NUMCUTSCENEOBJECTS; i++) { CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i); if(csObj && csObj->m_entryInfoList.first) { - if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP && - RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) { - if (csObj->IsObject()) - RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepNonClippedInSeconds()); - else { - if (!csObj->bOffscreen) - csObj->bOffscreen = !csObj->GetIsOnScreen(); - RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepInSeconds(), !csObj->bOffscreen); - } - } + csObj->UpdateAnim(); csObj->ProcessControl(); csObj->ProcessCollision(); csObj->GetMatrix().UpdateRW(); @@ -1948,26 +1918,42 @@ CWorld::Process(void) } else { for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CEntity *movingEnt = (CEntity *)node->item; - if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && - RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { - if (movingEnt->IsObject()) - RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepNonClippedInSeconds()); - else { - if (!movingEnt->bOffscreen) - movingEnt->bOffscreen = !movingEnt->GetIsOnScreen(); - RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepInSeconds(), !movingEnt->bOffscreen); - } - } + if(!movingEnt->bRemoveFromWorld) + movingEnt->UpdateAnim(); } for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CPhysical *movingEnt = (CPhysical *)node->item; if(movingEnt->bRemoveFromWorld) { RemoveEntityInsteadOfProcessingIt(movingEnt); } else { - movingEnt->ProcessControl(); + if(!CCutsceneMgr::IsCutsceneProcessing() || movingEnt->UpdatesInCutscene()) + movingEnt->ProcessControl(); if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); } } } +#ifdef VIS_DISTANCE_ALPHA + for(int y = 0; y < NUMSECTORS_Y; y++) + for(int x = 0; x < NUMSECTORS_X; x++){ + CPtrNode *node; + CSector *sect = CWorld::GetSector(x, y); + for(node = sect->m_lists[ENTITYLIST_PEDS].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_PEDS_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + for(node = sect->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first; node; node = node->next) + ((CEntity*)node->item)->UpdateDistanceFade(); + } +#endif bForceProcessControl = true; for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) { CPhysical *movingEnt = (CPhysical *)node->item; @@ -2154,8 +2140,8 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa } else { CVector pos = pEntity->GetPosition(); pos.z -= 0.5f; - CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, - pos, true); + CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, pos, true); + CParticleObject::AddObject(POBJECT_FIRE_HYDRANT_STEAM, pos, true); pObject->bHasBeenDamaged = true; } } @@ -2310,3 +2296,17 @@ CWorld::IsWanderPathClear(CVector const& point1, CVector const& point2, float di } return true; } + +void +CWorld::CheckObjectsEffectedByFire(float x, float y, float z, float radius, CEntity* reason) +{ + int32 i = CPools::GetObjectPool()->GetSize(); + while (i--) { + CObject* pObject = CPools::GetObjectPool()->GetSlot(i); + if (pObject) { + if (Abs(pObject->GetPosition().z - z) < 5.0f && Abs(pObject->GetPosition().x - x) < radius && + Abs(pObject->GetPosition().y - y) < radius) + pObject->m_nLastWeaponToDamage = WEAPONTYPE_FLAMETHROWER; + } + } +} diff --git a/src/core/World.h b/src/core/World.h index 81eb5d4c..cecbf71d 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -5,19 +5,19 @@ #include "PlayerInfo.h" #include "Collision.h" -/* Sectors span from -2400 to 1600 in x and -2000 to 2000 y. - * With 80x80 sectors, each is 50x50 units. */ +/* Sectors span from -2000 to 2000 in x and y. + * With 100x100 sectors, each is 40x40 units. */ -#define SECTOR_SIZE_X (50.0f) -#define SECTOR_SIZE_Y (50.0f) +#define SECTOR_SIZE_X (40.0f) +#define SECTOR_SIZE_Y (40.0f) -#define NUMSECTORS_X (80) -#define NUMSECTORS_Y (80) +#define NUMSECTORS_X (100) +#define NUMSECTORS_Y (100) #define WORLD_SIZE_X (NUMSECTORS_X * SECTOR_SIZE_X) #define WORLD_SIZE_Y (NUMSECTORS_Y * SECTOR_SIZE_Y) -#define WORLD_MIN_X (-2400.0f) +#define WORLD_MIN_X (-2000.0f) #define WORLD_MIN_Y (-2000.0f) #define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X) @@ -29,6 +29,7 @@ enum { ENTITYLIST_BUILDINGS, ENTITYLIST_BUILDINGS_OVERLAP, + ENTITYLIST_MULTIPLAYER, ENTITYLIST_OBJECTS, ENTITYLIST_OBJECTS_OVERLAP, ENTITYLIST_VEHICLES, @@ -154,6 +155,7 @@ public: static void TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer); static void TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer); static void UseDetonator(CEntity *pEntity); + static void CheckObjectsEffectedByFire(float, float, float, float, CEntity*); // NB: following functions are unused (TODO?) static void CastShadow(float, float, float, float); diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 93eca199..5a53ee29 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -87,20 +87,20 @@ CTheZones::Init(void) TotalNumberOfInfoZones = 1; strcpy(InfoZoneArray[0].name, "CITYINF"); - InfoZoneArray[0].minx = -2400.0f; + InfoZoneArray[0].minx = -2000.0f; InfoZoneArray[0].miny = -2000.0f; InfoZoneArray[0].minz = -500.0f; - InfoZoneArray[0].maxx = 1600.0f; + InfoZoneArray[0].maxx = 2000.0f; InfoZoneArray[0].maxy = 2000.0f; InfoZoneArray[0].maxz = 500.0f; InfoZoneArray[0].level = LEVEL_GENERIC; InfoZoneArray[0].type = ZONE_INFO; strcpy(NavigationZoneArray[0].name, "VICE_C"); - NavigationZoneArray[0].minx = -2400.0f; + NavigationZoneArray[0].minx = -2000.0f; NavigationZoneArray[0].miny = -2000.0f; NavigationZoneArray[0].minz = -500.0f; - NavigationZoneArray[0].maxx = 1600.0f; + NavigationZoneArray[0].maxx = 2000.0f; NavigationZoneArray[0].maxy = 2000.0f; NavigationZoneArray[0].maxz = 500.0f; NavigationZoneArray[0].level = LEVEL_GENERIC; @@ -114,10 +114,10 @@ CTheZones::Init(void) } TotalNumberOfMapZones = 1; strcpy(MapZoneArray[0].name, "THEMAP"); - MapZoneArray[0].minx = -2400.0f; + MapZoneArray[0].minx = -2000.0f; MapZoneArray[0].miny = -2000.0f; MapZoneArray[0].minz = -500.0f; - MapZoneArray[0].maxx = 1600.0f; + MapZoneArray[0].maxx = 2000.0f; MapZoneArray[0].maxy = 2000.0f; MapZoneArray[0].maxz = 500.0f; MapZoneArray[0].level = LEVEL_GENERIC; diff --git a/src/core/common.h b/src/core/common.h index 12c80b71..361e8515 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -120,6 +120,8 @@ typedef ptrdiff_t ssize_t; #endif #include "config.h" +#include "memoryManager.h" +#include "relocatableChunk.h" #include <rphanim.h> #include <rpskin.h> @@ -217,6 +219,18 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x) #endif +// these are temp marcos while we don't implement all PSP UI coordinates +#define PSP_DEFAULT_SCREEN_WIDTH (480) +#define PSP_DEFAULT_SCREEN_HEIGHT (272) + +#define PSP_SCALE_TO_PS2_X(a) ((float)a * ((float)DEFAULT_SCREEN_WIDTH / (float)PSP_DEFAULT_SCREEN_WIDTH)) +#define PSP_SCALE_TO_PS2_Y(a) ((float)a * ((float)DEFAULT_SCREEN_HEIGHT / (float)PSP_DEFAULT_SCREEN_HEIGHT)) + +#define PSP_SCREEN_SCALE_X(a) ((a) * (float) SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH) +#define PSP_SCREEN_SCALE_Y(a) ((a) * (float) SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH) +#define PSP_SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - PSP_SCREEN_SCALE_X(a)) +#define PSP_SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - PSP_SCREEN_SCALE_Y(a)) + #include "maths.h" #include "Vector.h" #ifdef GTA_PS2 diff --git a/src/core/config.h b/src/core/config.h index 8943223b..27148483 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -12,15 +12,15 @@ enum Config { MAX_CDIMAGES = 8, // additional cdimages MAX_CDCHANNELS = 5, - MODELINFOSIZE = 6500, // 4900 on PS2 - TXDSTORESIZE = 1385, - COLSTORESIZE = 31, + MODELINFOSIZE = 4900, + TXDSTORESIZE = 1200, + COLSTORESIZE = 15, EXTRADIRSIZE = 256, CUTSCENEDIRSIZE = 512, SIMPLEMODELSIZE = 3885, TIMEMODELSIZE = 385, - CLUMPMODELSIZE = 5, + CLUMPMODELSIZE = 10, WEAPONMODELSIZE = 37, PEDMODELSIZE = 130, VEHICLEMODELSIZE = 110, @@ -31,19 +31,19 @@ enum Config { NUMOBJECTINFO = 210, // Pool sizes - NUMPTRNODES = 50000, - NUMENTRYINFOS = 3200, - NUMPEDS = 140, - NUMVEHICLES = 110, - NUMBUILDINGS = 7000, - NUMTREADABLES = 1, - NUMOBJECTS = 460, - NUMDUMMIES = 2340, + NUMPTRNODES = 50000, // only 30100 + NUMENTRYINFOS = 4000, + NUMPEDS = 140, // only 70 + NUMVEHICLES = 110, // only 70 + NUMBUILDINGS = 7000, // only 6757 + NUMTREADABLES = 1300, + NUMOBJECTS = 475, + NUMDUMMIES = 3000, NUMAUDIOSCRIPTOBJECTS = 192, NUMCOLMODELS = 4400, NUMCUTSCENEOBJECTS = 50, // not a pool in VC - NUMANIMBLOCKS = 35, + NUMANIMBLOCKS = 60, NUMANIMATIONS = 450, NUMTEMPOBJECTS = 40, @@ -63,20 +63,20 @@ enum Config { NUMREFERENCES = 800, // Zones - NUMAUDIOZONES = 14, + NUMAUDIOZONES = 36, NUMINFOZONES = 169, - NUMMAPZONES = 39, - NUMNAVIGZONES = 20, + NUMMAPZONES = 110, + NUMNAVIGZONES = 70, // Cull zones - NUMATTRIBZONES = 704, + NUMATTRIBZONES = 900, NUMOCCLUSIONVOLUMES = 350, NUMACTIVEOCCLUDERS = 48, PATHNODESIZE = 4500, - NUMWEATHERS = 7, + NUMWEATHERS = 8, NUMHOURS = 24, NUMEXTRADIRECTIONALS = 4, @@ -102,7 +102,7 @@ enum Config { NUMPACMANPICKUPS = 256, NUMEVENTS = 64, - NUM_CARGENS = 185, + NUM_CARGENS = 195, // 500 on mobile NUM_PATH_NODES_IN_AUTOPILOT = 8, @@ -116,7 +116,7 @@ enum Config { NUM_WATERCANNONS = 3, NUMPEDROUTES = 200, - NUMPHONES = 50, + NUMPHONES = 60, NUMPEDGROUPS = 67, NUMMODELSPERPEDGROUP = 16, MAXZONEPEDSLOADED = 8, @@ -138,14 +138,16 @@ enum Config { NUM_GARAGE_STORED_CARS = 4, - NUM_CRANES = 8, + NUM_CRANES = 11, NUM_ESCALATORS = 22, NUM_WATER_CREATURES = 8, NUM_EXPLOSIONS = 48, NUM_SETPIECES = 96, - NUM_SHORTCUT_START_POINTS = 16 + NUM_SHORTCUT_START_POINTS = 16, + + NUM_FERRY_PATHS = 1 }; // We don't expect to compile for PS2 or Xbox @@ -154,6 +156,9 @@ enum Config { //#define GTA_PS2 //#define GTA_XBOX +#define GTA_TRAIN +#define GTA_BRIDGE + // Version defines #define GTAVC_PS2 400 #define GTAVC_PC_10 410 @@ -184,7 +189,7 @@ enum Config { # ifndef GTA_HANDHELD # define PC_PLAYER_CONTROLS // mouse player/cam mode # endif -# define GTA_REPLAY +//# define GTA_REPLAY # define GTA_SCENE_EDIT # define PC_MENU # define PC_WATER @@ -254,6 +259,11 @@ enum Config { # define PS2_MATFX #endif +// Mobile only. +// Looks like they tried to fix fading but it still sucks +// do not use this +//#define VIS_DISTANCE_ALPHA + #ifdef VU_COLLISION #define COMPRESSED_COL_VECTORS // currently need compressed vectors in this code #endif @@ -278,9 +288,9 @@ enum Config { #endif #define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds. -#define MORE_LANGUAGES // Add more translations to the game +//#define MORE_LANGUAGES // Add more translations to the game #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms -#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES +//#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES #define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS #define NO_MOVIES // add option to disable intro videos @@ -311,7 +321,7 @@ enum Config { #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number -#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time +//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time #define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync #define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering //#define USE_TEXTURE_POOL @@ -331,6 +341,7 @@ enum Config { // Water & Particle #undef PC_WATER #define WATER_CHEATS +//#define PSP_WATERCANNON //#define USE_CUTSCENE_SHADOW_FOR_PED // requires COMPATIBLE_SAVES //#define DISABLE_CUTSCENE_SHADOWS @@ -373,7 +384,7 @@ enum Config { # ifdef CUSTOM_FRONTEND_OPTIONS # define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable -# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU +//# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU # define CUTSCENE_BORDERS_SWITCH # define MULTISAMPLING // adds MSAA option # define INVERT_LOOK_FOR_PAD // enable the hidden option @@ -387,18 +398,18 @@ enum Config { #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #define SUPPORT_JAPANESE_SCRIPT //#define SUPPORT_XBOX_SCRIPT -#define SUPPORT_MOBILE_SCRIPT -#define SUPPORT_GINPUT_SCRIPT +//#define SUPPORT_MOBILE_SCRIPT +//#define SUPPORT_GINPUT_SCRIPT #if (defined SUPPORT_XBOX_SCRIPT && defined SUPPORT_MOBILE_SCRIPT) static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually exclusive"); #endif #ifdef PC_MENU -#define MISSION_REPLAY // mobile feature +//#define MISSION_REPLAY // mobile feature //#define SIMPLER_MISSIONS // apply simplifications from mobile -#define USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT +//#define USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT #endif #define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT -#define SCRIPT_LOG_FILE_LEVEL 0 // 0 == no log, 1 == overwrite every frame, 2 == full log +#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log #if SCRIPT_LOG_FILE_LEVEL == 0 #undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT @@ -442,9 +453,9 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #define AUDIO_REFLECTIONS // Enable audio reflections. This is enabled in all vanilla versions #define AUDIO_REVERB // Enable audio reverb. It was disabled in PS2 and mobile versions #define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS -#define AUDIO_CACHE // cache sound lengths to speed up the cold boot -#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally) -#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) +//#define AUDIO_CACHE // cache sound lengths to speed up the cold boot +#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 41 (PSP and mobile have 21 originally) +//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder #define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files #define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused diff --git a/src/core/main.cpp b/src/core/main.cpp index e84c6eeb..d0f59f54 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -81,12 +81,22 @@ GlobalScene Scene; -uint8 work_buff[55000]; +uint8 work_buff[102400]; char gString[256]; char gString2[512]; wchar gUString[256]; wchar gUString2[256]; +// leeds +bool gMakeResources = true; +bool gUseChunkFiles = false; +bool gSecondExportPass; +bool gUseModelResources; +bool gUseResources; +bool gNASTY_NASTY_MEM_SHUTDOWN_HACK; // rather unused +bool gbPreviewCity; // don't do worldstream-style rendering but traditional method +bool gMultiplayerSuperBrakeOnPause = true; + float FramesPerSecond = 30.0f; bool gbPrintShite = false; @@ -98,7 +108,7 @@ bool gbShowTimebars; bool gbDrawVersionText; // Our addition, we think it was always enabled on !MASTER builds #endif #ifdef NO_MOVIES -bool gbNoMovies; +bool gbNoMovies = true; #endif volatile int32 frameCount; @@ -108,7 +118,7 @@ RwRGBA gColourTop; bool gameAlreadyInitialised; float NumberOfChunksLoaded; -#define TOTALNUMCHUNKS 95.0f +#define TOTALNUMCHUNKS 52.0f bool g_SlowMode = false; char version_name[64]; @@ -135,7 +145,7 @@ bool gbPrintMemoryUsage; #endif #ifdef NEW_RENDERER -bool gbNewRenderer; +bool gbNewRenderer = true; #endif #ifdef FIX_BUGS // need to clear stencil for mblur fx. no idea why it works in the original game @@ -606,11 +616,11 @@ GetRandomSplashScreen(void) static char splashName[128]; static int splashIndex[12] = { 1, 2, - 3, 4, - 5, 11, - 6, 8, - 9, 10, - 7, 12 + 3, 0, + 1, 2, + 3, 0, + 1, 2, + 3, 0 }; index = splashIndex[2*index2 + CGeneral::GetRandomNumberInRange(0, 2)]; @@ -624,11 +634,12 @@ GetRandomSplashScreen(void) Const char* GetLevelSplashScreen(int level) { - static Const char *splashScreens[4] = { + static Const char *splashScreens[5] = { nil, "splash1", "splash2", "splash3", + "loadsc0", }; return splashScreens[level]; @@ -640,6 +651,7 @@ ResetLoadingScreenBar() NumberOfChunksLoaded = 0.0f; } +//--LCS: not the real thing void LoadingScreen(const char *str1, const char *str2, const char *splashscreen) { @@ -651,7 +663,7 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) #endif #ifndef RANDOMSPLASH - splashscreen = "LOADSC0"; + splashscreen = "SCEELEE"; #endif splash = LoadSplash(splashscreen); @@ -673,24 +685,27 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) NumberOfChunksLoaded += 1; #ifndef RANDOMSPLASH + // this looks nice float hpos = SCREEN_SCALE_X(40); float length = SCREEN_WIDTH - SCREEN_SCALE_X(80); - float top = SCREEN_HEIGHT - SCREEN_SCALE_Y(14); - float bottom = top + SCREEN_SCALE_Y(5); + float top = SCREEN_HEIGHT - SCREEN_SCALE_Y(30); + float bottom = top + SCREEN_SCALE_Y(8); #else - float hpos = SCREEN_STRETCH_X(40); - float length = SCREEN_STRETCH_X(440); - // this is rather weird - float top = SCREEN_STRETCH_Y(407.4f - 7.0f/3.0f); - float bottom = SCREEN_STRETCH_Y(407.4f + 7.0f/3.0f); + // should correspond to PS2 position + float hpos = SCREEN_STRETCH_X(44); + float length = SCREEN_STRETCH_X(176); + float top = SCREEN_STRETCH_Y(420); + float bottom = top + SCREEN_STRETCH_Y(8); #endif - CSprite2d::DrawRect(CRect(hpos-1.0f, top-1.0f, hpos+length+1.0f, bottom+1.0f), CRGBA(40, 53, 68, 255)); + CSprite2d::DrawRect(CRect(hpos+4.0f, top+6.0f, hpos+length+4.0f, bottom+6.0f), CRGBA(0, 0, 0, 200)); - CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(155, 50, 125, 255)); + CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(0, 0, 0, 255)); + + CSprite2d::DrawRect(CRect(hpos+1.0f, top+1.0f, hpos+length-1.0f, bottom-1.0f), CRGBA(99, 99, 99, 255)); length *= NumberOfChunksLoaded/TOTALNUMCHUNKS; - CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(255, 150, 225, 255)); + CSprite2d::DrawRect(CRect(hpos+1.0f, top+1.0f, hpos+length-1.0f, bottom-1.0f), CRGBA(126, 15, 0, 255)); // this is done by the game but is unused CFont::SetBackgroundOff(); @@ -705,7 +720,7 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) // my attempt static wchar tmpstr[80]; float yscale = SCREEN_SCALE_Y(0.9f); - top -= 45*yscale; + top = bottom+5*yscale; CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale); CFont::SetPropOn(); CFont::SetRightJustifyOff(); @@ -726,12 +741,13 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) } } +//--LCS: slightly fixed void LoadingIslandScreen(const char *levelName) { CSprite2d *splash; - splash = LoadSplash(nil); + splash = LoadSplash(GetLevelSplashScreen(CGame::currLevel)); if(!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)) return; @@ -1214,7 +1230,6 @@ DisplayGameDebugText() #ifdef NEW_RENDERER bool gbRenderRoads = true; bool gbRenderEverythingBarRoads = true; -bool gbRenderFadingInUnderwaterEntities = true; bool gbRenderFadingInEntities = true; bool gbRenderWater = true; bool gbRenderBoats = true; @@ -1230,10 +1245,11 @@ MattRenderScene(void) /// CWorld::AdvanceCurrentScanCode(); // CMattRenderer::ResetRenderStates /// CRenderer::ClearForFrame(); // before ConstructRenderList - // CClock::CalcEnvMapTimeMultiplicator + CClock::CalcEnvMapTimeMultiplicator(); RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE); - CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater - // CClock::ms_EnvMapTimeMultiplicator = 1.0f; +if(gbRenderWater) + CRenderer::RenderWater(); // actually CMattRenderer::RenderWater + CClock::ms_EnvMapTimeMultiplicator = 1.0f; // cWorldStream::ClearDynamics /// CRenderer::ConstructRenderList(); // before PreRender if(gbRenderWorld0) @@ -1246,22 +1262,14 @@ if(gbRenderWorld1) if(gbRenderRoads) CRenderer::RenderRoads(); - CRenderer::RenderPeds(); - - // not sure where to put these since LCS has no underwater entities -if(gbRenderBoats) - CRenderer::RenderBoats(); -if(gbRenderFadingInUnderwaterEntities) - CRenderer::RenderFadingInUnderwaterEntities(); RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE); -if(gbRenderWater) - CRenderer::RenderTransparentWater(); if(gbRenderEverythingBarRoads) CRenderer::RenderEverythingBarRoads(); - // seam fixer - // moved this: - // CRenderer::RenderFadingInEntities(); + // TODO: seam fixer + // these aren't very transparent. just objects +if(gbRenderFadingInEntities) + CRenderer::RenderFadingInEntities(); } void @@ -1274,7 +1282,8 @@ RenderScene_new(void) MattRenderScene(); DefinedState(); // CMattRenderer::ResetRenderStates - // moved CRenderer::RenderBoats to before transparent water +if(gbRenderBoats) + CRenderer::RenderBoats(); POP_RENDERGROUP(); } @@ -1284,13 +1293,12 @@ void RenderEffects_new(void) { PUSH_RENDERGROUP("RenderEffects_new"); -/* // stupid to do this before the whole world is drawn! - CShadows::RenderStaticShadows(); - // CRenderer::GenerateEnvironmentMap - CShadows::RenderStoredShadows(); - CSkidmarks::Render(); - CRubbish::Render(); -*/ + // stupid to do this before the whole world is drawn! +// CShadows::RenderStaticShadows(); + CRenderer::GenerateEnvironmentMap(); +// CShadows::RenderStoredShadows(); +// CSkidmarks::Render(); +// CRubbish::Render(); // these aren't really effects DefinedState(); @@ -1308,9 +1316,6 @@ if(gbRenderWorld2) if(gbRenderVehicles) CRenderer::RenderVehicles(); } - // better render these after transparent world -if(gbRenderFadingInEntities) - CRenderer::RenderFadingInEntities(); // actual effects here @@ -1373,7 +1378,7 @@ void RenderDebugShit(void) { PUSH_RENDERGROUP("RenderDebugShit"); - CTheScripts::RenderTheScriptDebugLines(); + //CTheScripts::RenderTheScriptDebugLines(); #ifndef FINAL if(gbShowCollisionLines) CRenderer::RenderCollisionLines(); @@ -1577,12 +1582,8 @@ Idle(void *arg) #ifdef PC_WATER CWaterLevel::PreCalcWaterGeometry(); #endif -#ifdef NEW_RENDERER - if(gbNewRenderer){ - CWorld::AdvanceCurrentScanCode(); // don't think this is even necessary - CRenderer::ClearForFrame(); - } -#endif + CWorld::AdvanceCurrentScanCode(); + CRenderer::ClearForFrame(); CRenderer::ConstructRenderList(); tbEndTimer("CnstrRenderList"); diff --git a/src/core/main.h b/src/core/main.h index 803afb14..0c43d7f4 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -18,7 +18,7 @@ struct GlobalScene }; extern GlobalScene Scene; -extern uint8 work_buff[55000]; +extern uint8 work_buff[102400]; extern char gString[256]; extern char gString2[512]; extern wchar gUString[256]; @@ -35,6 +35,16 @@ extern bool gbShowTimebars; extern bool gbPrintMemoryUsage; #endif +// leeds +extern bool gMakeResources; +extern bool gUseChunkFiles; +extern bool gSecondExportPass; +extern bool gUseModelResources; +extern bool gUseResources; +extern bool gNASTY_NASTY_MEM_SHUTDOWN_HACK; +extern bool gbPreviewCity; +extern bool gMultiplayerSuperBrakeOnPause; + class CSprite2d; bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index b9cfc34d..4c2b9388 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -134,20 +134,20 @@ CustomFrontendOptionsPopulate(void) int fd; // These work only if we have neo folder, so they're dynamically added #ifdef EXTENDED_PIPELINES - const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" }; + const char *pipelineNames[] = { "FED_PSP", "FED_PS2","FED_MOB" }; const char *off_on[] = { "FEM_OFF", "FEM_ON" }; fd = CFileMgr::OpenFile("neo/neo.txd","r"); if (fd) { #ifdef GRAPHICS_MENU_OPTIONS FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false); - FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline"); - FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "Graphics", "NeoRimLight"); + FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline"); + FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "Graphics", "WorldPipeline"); FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps"); FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss"); #else FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false); - FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline"); - FrontendOptionAddSelect("FED_PRM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "Graphics", "NeoRimLight"); + FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline"); + FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "Graphics", "WorldPipeline"); FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps"); FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss"); #endif @@ -194,7 +194,7 @@ CustomFrontendOptionsPopulate(void) #define MINI_CASE_SENSITIVE #include "ini.h" -mINI::INIFile ini("reVC.ini"); +mINI::INIFile ini("reLCS.ini"); mINI::INIStructure cfg; bool ReadIniIfExists(const char *cat, const char *key, uint32 *out) @@ -643,9 +643,6 @@ void SaveINISettings() StoreIni("CustomPipesValues", "GlossMult", CustomPipes::GlossMult); #endif StoreIni("Rendering", "BackfaceCulling", gBackfaceCulling); -#ifdef NEW_RENDERER - StoreIni("Rendering", "NewRenderer", gbNewRenderer); -#endif #ifdef PROPER_SCALING StoreIni("Draw", "ProperScaling", CDraw::ms_bProperScaling); @@ -709,7 +706,6 @@ void FastWeatherCheat(); void OnlyRenderWheelsCheat(); void ChittyChittyBangBangCheat(); void StrongGripCheat(); -void SpecialCarCheats(); void PickUpChicksCheat(); DebugMenuEntry *carCol1; @@ -830,17 +826,15 @@ SwitchToMission(void) #endif static const char *carnames[] = { - "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "rio", "firetruk", "trash", "stretch", "manana", - "infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing", - "bobcat", "mrwhoop", "bfinject", "hunter", "police", "enforcer", "securica", "banshee", "predator", "bus", - "rhino", "barracks", "cuban", "chopper", "angel", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "romero", - "packer", "sentxs", "admiral", "squalo", "seaspar", "pizzaboy", "gangbur", "airtrain", "deaddodo", "speeder", - "reefer", "tropic", "flatbed", "yankee", "caddy", "zebra", "topfun", "skimmer", "pcj600", "faggio", "freeway", - "rcbaron", "rcraider", "glendale", "oceanic", "sanchez", "sparrow", "patriot", "lovefist", "coastg", "dinghy", - "hermes", "sabre", "sabretur", "pheonix", "walton", "regina", "comet", "deluxo", "burrito", "spand", "marquis", - "baggage", "kaufman", "maverick", "vcnmav", "rancher", "fbiranch", "virgo", "greenwoo", "jetmax", "hotring", - "sandking", "blistac", "polmav", "boxville", "benson", "mesa", "rcgoblin", "hotrina", "hotrinb", - "bloodra", "bloodrb", "vicechee" + "spider", "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", + "manana", "infernus", "blista", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", + "kuruma", "bobcat", "mrwhoop", "bfinject", "hearse", "police", "enforcer", "securica", "banshee", "bus", "rhino", + "barracks", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "bellyup", "mrwongs", "mafia", "yardie", + "yakuza", "diablos", "columb", "hoods", "panlant", "flatbed", "yankee", "borgnine", "toyz", "campvan", "ballot", + "shelby", "pontiac", "esprit", "ammotruk", "hotrod", "Sindacco_Car", "Forelli_Car", "ferry", "ghost", "speeder", + "reefer", "predator", "train", "escape", "chopper", "airtrain", "deaddodo", "angel", "pizzaboy", "noodleboy", + "pcj600", "faggio", "freeway", "angel2", "sanchez2", "sanchez", "rcgoblin", "rcraider", "hunter", "maverick", + "polmav", "vcnmav" }; static CTweakVar** TweakVarsList; @@ -970,11 +964,10 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Only render wheels", OnlyRenderWheelsCheat); DebugMenuAddCmd("Cheats", "Chitty chitty bang bang", ChittyChittyBangBangCheat); DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat); - DebugMenuAddCmd("Cheats", "Special car", SpecialCarCheats); DebugMenuAddCmd("Cheats", "Pickup chicks", PickUpChicksCheat); static int spawnCarId = MI_LANDSTAL; - e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_VICECHEE, carnames); + e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_SPIDER, MI_VCNMAV, carnames); DebugMenuEntrySetWrap(e, true); DebugMenuAddCmd("Spawn", "Spawn Car", [](){ if(spawnCarId == MI_CHOPPER || @@ -989,22 +982,19 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); }); DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); }); DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); }); - DebugMenuAddCmd("Spawn", "Spawn Phoenix", [](){ SpawnCar(MI_PHEONIX); }); + DebugMenuAddCmd("Spawn", "Spawn Esprit", [](){ SpawnCar(MI_ESPRIT); }); DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); }); DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); }); DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); }); - DebugMenuAddCmd("Spawn", "Spawn Admiral", [](){ SpawnCar(MI_ADMIRAL); }); - DebugMenuAddCmd("Spawn", "Spawn Washington", [](){ SpawnCar(MI_WASHING); }); + DebugMenuAddCmd("Spawn", "Spawn Mafia", [](){ SpawnCar(MI_MAFIA); }); + DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); }); DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); }); DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); }); DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); }); - DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); }); - DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); }); + DebugMenuAddCmd("Spawn", "Spawn Diablo", [](){ SpawnCar(MI_DIABLOS); }); + DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); }); DebugMenuAddCmd("Spawn", "Spawn BF injection", [](){ SpawnCar(MI_BFINJECT); }); DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); }); - DebugMenuAddCmd("Spawn", "Spawn VCN Maverick", [](){ SpawnCar(MI_VCNMAV); }); - DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); }); - DebugMenuAddCmd("Spawn", "Spawn Sea Sparrow", [](){ SpawnCar(MI_SEASPAR); }); DebugMenuAddCmd("Spawn", "Spawn Hunter", [](){ SpawnCar(MI_HUNTER); }); DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); }); DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); }); @@ -1012,10 +1002,9 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Spawn", "Spawn PCJ 600", [](){ SpawnCar(MI_PCJ600); }); DebugMenuAddCmd("Spawn", "Spawn Faggio", [](){ SpawnCar(MI_FAGGIO); }); DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); }); - DebugMenuAddCmd("Spawn", "Spawn Squalo", [](){ SpawnCar(MI_SQUALO); }); - DebugMenuAddCmd("Spawn", "Spawn Skimmer", [](){ SpawnCar(MI_SKIMMER); }); DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil); + DebugMenuAddVar("Render", "Brightness", &FrontEndMenuManager.m_PrefsBrightness, nil, 16, 0, 700, nil); #ifdef PROPER_SCALING DebugMenuAddVarBool8("Render", "Proper Scaling", &CDraw::ms_bProperScaling, nil); #endif @@ -1031,10 +1020,8 @@ DebugMenuPopulate(void) DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil); DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil); #ifdef NEW_RENDERER - DebugMenuAddVarBool8("Render", "New Renderer", &gbNewRenderer, nil); extern bool gbRenderRoads; extern bool gbRenderEverythingBarRoads; -extern bool gbRenderFadingInUnderwaterEntities; extern bool gbRenderFadingInEntities; extern bool gbRenderWater; extern bool gbRenderBoats; @@ -1044,7 +1031,6 @@ extern bool gbRenderWorld1; extern bool gbRenderWorld2; DebugMenuAddVarBool8("Debug Render", "gbRenderRoads", &gbRenderRoads, nil); DebugMenuAddVarBool8("Debug Render", "gbRenderEverythingBarRoads", &gbRenderEverythingBarRoads, nil); - DebugMenuAddVarBool8("Debug Render", "gbRenderFadingInUnderwaterEntities", &gbRenderFadingInUnderwaterEntities, nil); DebugMenuAddVarBool8("Debug Render", "gbRenderFadingInEntities", &gbRenderFadingInEntities, nil); DebugMenuAddVarBool8("Debug Render", "gbRenderWater", &gbRenderWater, nil); DebugMenuAddVarBool8("Debug Render", "gbRenderBoats", &gbRenderBoats, nil); @@ -1052,11 +1038,12 @@ extern bool gbRenderWorld2; DebugMenuAddVarBool8("Debug Render", "gbRenderWorld0", &gbRenderWorld0, nil); DebugMenuAddVarBool8("Debug Render", "gbRenderWorld1", &gbRenderWorld1, nil); DebugMenuAddVarBool8("Debug Render", "gbRenderWorld2", &gbRenderWorld2, nil); + DebugMenuAddVarBool8("Debug Render", "gbPreviewCity", &gbPreviewCity, nil); #endif #ifdef EXTENDED_COLOURFILTER - static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" }; - e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames); + static const char *filternames[] = { "None", "PSP", "PS2" }; + e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_PS2, filternames); DebugMenuEntrySetWrap(e, true); DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f); DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil); @@ -1072,18 +1059,25 @@ extern bool gbRenderWorld2; DebugMenuAddVarBool32("Render", "MatFX env map use matcolor", &rw::MatFX::envMapUseMatColor, nil); #endif #ifdef EXTENDED_PIPELINES - static const char *vehpipenames[] = { "MatFX", "Neo" }; + static const char *worldpipenames[] = { "PSP", "PS2", "Mobile" }; + e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil, + 1, CustomPipes::WORLDPIPE_PSP, CustomPipes::WORLDPIPE_MOBILE, worldpipenames); + DebugMenuEntrySetWrap(e, true); + static const char *vehpipenames[] = { "PSP", "PS2", "Mobile" }; e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil, - 1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames); + 1, CustomPipes::VEHICLEPIPE_PSP, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames); DebugMenuEntrySetWrap(e, true); - DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f); - DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f); + DebugMenuAddVarBool8("Render", "Glass Cars cheat", &CustomPipes::gGlassCarsCheat, nil); +extern bool gbRenderDebugEnvMap; + DebugMenuAddVarBool8("Render", "Show Env map", &gbRenderDebugEnvMap, nil); +// DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f); +// DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f); DebugMenuAddVarBool8("Render", "Neo Ped Rim light enable", &CustomPipes::RimlightEnable, nil); DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f); - DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil); - DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f); - DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil); - DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f); +// DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil); +// DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f); +// DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil); +// DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f); #endif DebugMenuAddVarBool8("Debug Render", "Show Ped Paths", &gbShowPedPaths, nil); DebugMenuAddVarBool8("Debug Render", "Show Car Paths", &gbShowCarPaths, nil); @@ -1137,24 +1131,30 @@ extern bool gbRenderWorld2; #ifdef MISSION_SWITCHER DebugMenuEntry *missionEntry; static const char* missions[] = { - "Initial", "Intro", "An Old Friend", "The Party", "Back Alley Brawl", "Jury Fury", "Riot", - "Treacherous Swine", "Mall Shootout", "Guardian Angels", "Sir, Yes Sir!", "All Hands On Deck!", - "The Chase", "Phnom Penh '86", "The Fastest Boat", "Supply & Demand", "Rub Out", "Death Row", - "Four Iron", "Demolition Man", "Two Bit Hit", "No Escape?", "The Shootist", "The Driver", - "The Job", "Gun Runner", "Boomshine Saigon", "Recruitment Drive", "Dildo Dodo", "Martha's Mug Shot", - "G-spotlight", "Shakedown", "Bar Brawl", "Cop Land", "Spilling the Beans", "Hit the Courier", - "Printworks Buy", "Sunshine Autos", "Interglobal Films Buy", "Cherry Popper Icecreams Buy", - "Kaufman Cabs Buy", "Malibu Club Buy", "The Boatyard Buy", "Pole Position Club Buy", "El Swanko Casa Buy", - "Links View Apartment Buy", "Hyman Condo Buy", "Ocean Heighs Aprt. Buy", "1102 Washington Street Buy", - "Vice Point Buy", "Skumole Shack Buy", "Cap the Collector", "Keep your Friends Close...", - "Alloy Wheels of Steel", "Messing with the Man", "Hog Tied", "Stunt Boat Challenge", "Cannon Fodder", - "Naval Engagement", "Trojan Voodoo", "Juju Scramble", "Bombs Away!", "Dirty Lickin's", "Love Juice", - "Psycho Killer", "Publicity Tour", "Weapon Range", "Road Kill", "Waste the Wife", "Autocide", - "Check Out at the Check In", "Loose Ends", "V.I.P.", "Friendly Rivalry", "Cabmaggedon", "TAXI DRIVER", - "PARAMEDIC", "FIREFIGHTER", "VIGILANTE", "HOTRING", "BLOODRING", "DIRTRING", "Sunshine Autos Races", - "Distribution", "Downtown Chopper Checkpoint", "Ocean Beach Chopper Checkpoint", "Vice Point Chopper Checkpoint", - "Little Haiti Chopper Checkpoint", "Trial by Dirt", "Test Track", "PCJ Playground", "Cone Crazy", - "PIZZA BOY", "RC Raider Pickup", "RC Bandit Race", "RC Baron Race", "Checkpoint Charlie" + "initial: objects", "initial: hidden packages", "initial: car generators", "initial: pickups", "initial: unique stunt jumps", + "initial: player", "initial: general info", "initial: lods", "initial: weapons", "Home Sweet Home", "Taxi-Driver Sub-Mission", + "Paramedic Sub-Mission", "Vigilante Sub-Mission", "Karmageddon", "Firefighter Sub-Mission", "Trash Dash", "RC Triad Take-Down", + "Thrashin' RC", "Ragin' RC", "Chasin' RC", "GO GO Faggio", "Noodleboy", "Pizzaboy", "Wong Side Of The Tracks", "Bumps and Grinds: Course 1", + "Bumps and Grinds: Course 2", "Bumps and Grinds: Course 3", "Bumps and Grinds: Course 4", "Bumps and Grinds: Course 5", "Bumps and Grinds: Course 6", + "Bumps and Grinds: Course 7", "Bumps and Grinds: Course 8", "Bumps and Grinds: Course 9", "Bumps and Grinds: Course 10", "Car Salesman", "Bike Salesman", + "RACE: Low-Rider Rumble", "RACE: Deimos Dash", "RACE: Wi-Cheetah Run", "RACE: Red Light Racing", "RACE: Torrington TT", "RACE: Gangsta GP", + "Scooter Shooter", "AWOL Angel", "9mm Mayhem", "Scrapyard Challenge", "See the Sight Before your Flight", "SlashTV", "Slacker (Vincenzo)", + "Dealing Revenge (Vincenzo)", "Snuff (Vincenzo)", "Smash and Grab (Vincenzo)", "Hot Wheels (Vincenzo)", "The Portland Chainsaw Masquerade (Vincenzo)", + "The Offer (Salvatore)", "Ho Selecta! (Salvatore)", "Frighteners (Salvatore)", "Rollercoaster Ride (Salvatore)", "Contra-Banned (Salvatore)", + "Sindacco Sabotage (Salvatore)", "The Trouble with Triads (Salvatore)", "Driving Mr Leone (Salvatore)", "conversation (JD)", "Bone Voyeur! (JD)", + "Don in 60 Seconds (JD)", "A Volatile Situation (JD)", "Blow up 'Dolls' (JD)", "Salvatore's Salvation (JD)", "The Guns of Leone (JD)", + "Calm before the Storm (JD)", "The Made Man (JD)", "Snappy Dresser (Ma Cipriani)", "Big Rumble in Little China (Ma Cipriani)", "Grease Sucho (Ma Cipriani)", + "Dead Meat (Ma Cipriani)", "No Son of Mine (Ma Cipriani)", "Shop 'til you Strop (Maria)", "Taken for a Ride (Maria)", "Booby Prize (Maria)", + "Biker Heat (Maria)", "Overdose of Trouble (Maria)", "Making Toni (Salvatore)", "A Walk In The Park (Salvatore)", "Caught In The Act (Salvatore)", + "Search And Rescue (Salvatore)", "Taking The Peace (Salvatore)", "Shoot The Messenger (Salvatore)", "Sayonara Sindaccos (Leon McAffrey)", + "The Whole 9 Yardies (Leon McAffrey)", "Crazy '69' (Leon McAffrey)", "Night Of The Livid Dreads (Leon McAffrey)", "Munitions Dump (Leon McAffrey)", + "The Morgue Party Candidate (Donald Love)", "Steering The Vote (Donald Love)", "Cam-Pain (Donald Love)", "Friggin' The Riggin' (Donald Love)", + "Love & Bullets (Donald Love)", "Counterfeit Count (Donald Love)", "Love On The Rocks (Donald Love)", "L.C. Confidential (Church Confessional)", + "The Passion Of The Heist (Church Confessional)", "Karmageddon (Church Confessional)", "False Idols (Church Confessional)", "Rough Justice (Salvatore)", + "Dead Reckoning (Salvatore)", "Shogun Showdown (Salvatore)", "The Shoreside Redemption (Salvatore)", "The Sicilian Gambit (Salvatore)", + "Panlantic Land Grab (Donald Love)", "Stop the Press (Donald Love)", "Morgue Party Resurrection (Donald Love)", "No Money, Mo' Problems (Donald Love)", + "Bringing the House Down (Donald Love)", "Love on the Run (Donald Love)", "More Deadly than the Male (Toshiko Kasen)", "Cash Clash (Toshiko Kasen)", + "A Date with Death (Toshiko Kasen)", "Cash in Kazuki's Chips (Toshiko Kasen)" }; missionEntry = DebugMenuAddVar("Game", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions); @@ -1212,7 +1212,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con strcat_s(re3_buff, re3_buffsize, "(Press Retry to debug the application)"); - nCode = ::MessageBoxA(nil, re3_buff, "REVC Assertion Failed!", + nCode = ::MessageBoxA(nil, re3_buff, "RELCS Assertion Failed!", MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); if (nCode == IDABORT) @@ -1233,7 +1233,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con abort(); #else // TODO - printf("\nREVC ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr); + printf("\nRELCS ASSERT FAILED\n\tFile: %s\n\tLine: %d\n\tFunction: %s\n\tExpression: %s\n",filename,lineno,func,expr); assert(false); #endif } @@ -1287,14 +1287,14 @@ void re3_usererror(const char *format, ...) vsprintf_s(re3_buff, re3_buffsize, format, va); va_end(va); - ::MessageBoxA(nil, re3_buff, "REVC Error!", + ::MessageBoxA(nil, re3_buff, "RELCS Error!", MB_OK|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); raise(SIGABRT); _exit(3); #else vsprintf(re3_buff, format, va); - printf("\nREVC Error!\n\t%s\n",re3_buff); + printf("\nRELCS Error!\n\t%s\n",re3_buff); assert(false); #endif } |