From f12e76fa135db3ca0a98c441cc3f5c0a4a14549d Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 8 May 2020 20:58:40 +0200 Subject: more small fixes --- src/core/Streaming.cpp | 23 +++++++++++++++-------- src/core/config.h | 3 +++ 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 5aa419b1..f24192ef 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1493,12 +1493,14 @@ CStreaming::GetCdImageOffset(int32 lastPosn) } inline bool -TxdAvailable(int32 txdId) +ModelNotLoaded(int32 modelId) { - CStreamingInfo *si = &CStreaming::ms_aInfoForModel[txdId + STREAM_OFFSET_TXD]; - return si->m_loadState == STREAMSTATE_LOADED || si->m_loadState == STREAMSTATE_READING; + CStreamingInfo *si = &CStreaming::ms_aInfoForModel[modelId]; + return si->m_loadState != STREAMSTATE_LOADED && si->m_loadState != STREAMSTATE_READING; } +inline bool TxdNotLoaded(int32 txdId) { return ModelNotLoaded(txdId + STREAM_OFFSET_TXD); } + // Find stream id of next requested file in cdimage int32 CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority) @@ -1523,10 +1525,15 @@ CStreaming::GetNextFileOnCd(int32 lastPosn, bool priority) continue; // request Txd if necessary - if(streamId < STREAM_OFFSET_TXD && - !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot())){ - ReRequestTxd(CModelInfo::GetModelInfo(streamId)->GetTxdSlot()); - }else if(ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)){ + if(streamId < STREAM_OFFSET_TXD){ + int txdId = CModelInfo::GetModelInfo(streamId)->GetTxdSlot(); + if(TxdNotLoaded(txdId)){ + ReRequestTxd(txdId); + continue; + } + } + + if(ms_aInfoForModel[streamId].GetCdPosnAndSize(posn, size)){ if(posn < posnFirst){ // find first requested file in image streamIdFirst = streamId; @@ -1624,7 +1631,7 @@ CStreaming::RequestModelStream(int32 ch) if(streamId < STREAM_OFFSET_TXD){ if (havePed && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_PED || haveBigFile && CModelInfo::GetModelInfo(streamId)->GetModelType() == MITYPE_VEHICLE || - !TxdAvailable(CModelInfo::GetModelInfo(streamId)->GetTxdSlot())) + TxdNotLoaded(CModelInfo::GetModelInfo(streamId)->GetTxdSlot())) break; }else{ if(haveBigFile && size > 200) diff --git a/src/core/config.h b/src/core/config.h index 7c1fab5b..79d9ab86 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -38,6 +38,9 @@ enum Config { NUMAUDIOSCRIPTOBJECTS = 256, NUMCUTSCENEOBJECTS = 50, + NUMANIMBLOCKS = 2, + NUMANIMATIONS = 250, + NUMTEMPOBJECTS = 30, // Path data -- cgit v1.2.3 From e917cd1f46471cc9be8da606ac03aa9ac3885b87 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 9 May 2020 02:50:48 +0300 Subject: Fix corona scaling --- src/core/Cam.cpp | 2 -- src/core/Camera.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 76d8d22b..3b11ec5f 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -25,8 +25,6 @@ #include "Camera.h" #include "DMAudio.h" -const float DefaultFOV = 70.0f; // beta: 80.0f - bool PrintDebugCode = false; int16 DebugCamMode; diff --git a/src/core/Camera.h b/src/core/Camera.h index 02122dfe..51138f99 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -40,6 +40,8 @@ enum #define DEFAULT_CAR_ZOOM_VALUE_2 (1.9f) #define DEFAULT_CAR_ZOOM_VALUE_3 (3.9f) +const float DefaultFOV = 70.0f; // beta: 80.0f + class CCam { public: -- cgit v1.2.3 From b80c4bae6be24ff7f261238a36e4c0c5519bef5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 9 May 2020 13:43:08 +0300 Subject: Menu map fixes and resizable window on GLFW --- src/core/Frontend.cpp | 37 ++++++++++++++++++++++++++++++++----- src/core/MenuScreens.h | 2 ++ src/core/Radar.cpp | 4 ++-- 3 files changed, 36 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index e2c2a453..06b9a151 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -901,6 +901,25 @@ CMenuManager::Draw() bool foundTheHoveringItem = false; wchar unicodeTemp[64]; +#ifdef MENU_MAP + if (m_nCurrScreen == MENUPAGE_MAP) { + // Back button + wchar *backTx = TheText.Get("FEDS_TB"); + CFont::SetDropShadowPosition(1); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(MENU_X(60.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), backTx); + CFont::SetDropShadowPosition(0); + if (!CheckHover(MENU_X(30.0f), MENU_X(30.0f) + CFont::GetStringWidth(backTx), SCREEN_SCALE_FROM_BOTTOM(125.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f))) { + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + m_nCurrOption = m_nPrevOption = 0; + } else { + m_nHoverOption = HOVEROPTION_RANDOM_ITEM; + m_nCurrOption = m_nPrevOption = 1; + } + return; + } +#endif + for (int i = 0; i < NUM_MENUROWS; ++i) { if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') { wchar *rightText = nil; @@ -5381,13 +5400,13 @@ CMenuManager::PrintController(void) #define ZOOM(x, y, in) \ do { \ - if(fMapSize > SCREEN_WIDTH * 2 && in) \ + if(fMapSize > SCREEN_HEIGHT * 3.0f && in) \ break; \ float z2 = in? 1.1f : 1.f/1.1f; \ fMapCenterX += (x - fMapCenterX) * (1.0f - z2); \ fMapCenterY += (y - fMapCenterY) * (1.0f - z2); \ \ - if (fMapSize < SCREEN_WIDTH / 3 && !in) \ + if (fMapSize < SCREEN_HEIGHT / 2 && !in) \ break; \ \ fMapSize *= z2; \ @@ -5400,10 +5419,18 @@ CMenuManager::PrintMap(void) bMenuMapActive = true; CRadar::InitFrontEndMap(); + // Just entered to map if (!bMapLoaded) { - fMapCenterX = SCREEN_WIDTH / 2; - fMapCenterY = SCREEN_HEIGHT / 3; - fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio(); + fMapSize = SCREEN_HEIGHT * 2.0f; + fMapCenterX = 0.0f; + fMapCenterY = 0.0f; + CVector2D radarSpacePlayer; + CVector2D screenSpacePlayer; + CRadar::TransformRealWorldPointToRadarSpace(radarSpacePlayer, CVector2D(FindPlayerCoors())); + CRadar::TransformRadarPointToScreenSpace(screenSpacePlayer, radarSpacePlayer); + + fMapCenterX = (-screenSpacePlayer.x) + SCREEN_WIDTH / 2; + fMapCenterY = (-screenSpacePlayer.y) + SCREEN_HEIGHT / 2; bMapMouseShownOnce = false; bMapLoaded = true; diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h index 339479b8..6c2ebdb8 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.h @@ -459,6 +459,8 @@ const CMenuScreen aScreens[] = { #ifdef MENU_MAP // MENUPAGE_MAP = 59 { "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, + MENUACTION_UNK110, "", SAVESLOT_NONE, MENUPAGE_NONE, // to prevent cross/enter to go back + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, #endif }; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 7e3d0083..9406f1bd 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1435,9 +1435,9 @@ CRadar::DrawYouAreHereSprite(float x, float y) if (show) { float left = x - SCREEN_SCALE_X(12.0f); - float top = y - SCREEN_SCALE_Y(2.0f); + float top = y; float right = SCREEN_SCALE_X(12.0) + x; - float bottom = y - SCREEN_SCALE_Y(26.0f); + float bottom = y - SCREEN_SCALE_Y(24.0f); CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255)); } MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE; -- cgit v1.2.3 From 989ded6052f6bd1c5d518e65768cce85a92fc20b Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 May 2020 13:00:39 +0200 Subject: removed cutscene heads --- src/core/Pools.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/Pools.h b/src/core/Pools.h index b0ba6598..2f0537ff 100644 --- a/src/core/Pools.h +++ b/src/core/Pools.h @@ -4,7 +4,7 @@ #include "Lists.h" #include "Treadable.h" #include "Object.h" -#include "CutsceneHead.h" +#include "CutsceneObject.h" #include "PlayerPed.h" #include "Automobile.h" #include "DummyPed.h" @@ -16,7 +16,7 @@ typedef CPool CPedPool; typedef CPool CVehiclePool; typedef CPool CBuildingPool; typedef CPool CTreadablePool; -typedef CPool CObjectPool; +typedef CPool CObjectPool; typedef CPool CDummyPool; typedef CPool CAudioScriptObjectPool; -- cgit v1.2.3 From 97d5698e0c669fd98911991b2ce3042fce376f06 Mon Sep 17 00:00:00 2001 From: aap Date: Sat, 9 May 2020 17:05:26 +0200 Subject: peds starting to work --- src/core/EventList.cpp | 2 -- src/core/FileLoader.cpp | 9 +++++---- src/core/Pad.cpp | 4 ++-- src/core/config.h | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/core') diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp index 675040ea..c3508a51 100644 --- a/src/core/EventList.cpp +++ b/src/core/EventList.cpp @@ -67,8 +67,6 @@ CEventList::RegisterEvent(eEventType type, eEventEntity entityType, CEntity *ent switch(entityType){ case EVENT_ENTITY_PED: ref = CPools::GetPedRef((CPed*)ent); - if(ent->GetModelIndex() >= MI_GANG01 && ent->GetModelIndex() <= MI_CRIMINAL02) - copsDontCare = true; break; case EVENT_ENTITY_VEHICLE: ref = CPools::GetVehicleRef((CVehicle*)ent); diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 07e2eee7..6a434bdd 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -861,15 +861,16 @@ CFileLoader::LoadPedObject(const char *line) { int id; char model[24], txd[24]; - char pedType[24], pedStats[24], animGroup[24]; + char pedType[24], pedStats[24], animGroup[24], animFile[16]; int carsCanDrive; CPedModelInfo *mi; int animGroupId; + int radio1, radio2; - if(sscanf(line, "%d %s %s %s %s %s %x", + sscanf(line, "%d %s %s %s %s %s %x %s %d %d", &id, model, txd, - pedType, pedStats, animGroup, &carsCanDrive) != 7) - return; + pedType, pedStats, animGroup, &carsCanDrive, + animFile, &radio1, &radio2); mi = CModelInfo::AddPedModel(id); mi->SetName(model); diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index da86d15e..b996dc28 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -140,9 +140,9 @@ void ChangePlayerCheat() do { do - modelId = CGeneral::GetRandomNumberInRange(0, MI_CAS_WOM+1); + modelId = CGeneral::GetRandomNumberInRange(0, MI_WFYG2+1); while (!CModelInfo::GetModelInfo(modelId)); - } while (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL04 || modelId == MI_TAXI_D); + } while (modelId == MI_TAXI_D); uint8 flags = CStreaming::ms_aInfoForModel[modelId].m_flags; ped->DeleteRwObject(); diff --git a/src/core/config.h b/src/core/config.h index 29a73f33..2ded57bf 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -108,8 +108,8 @@ enum Config { NUMPEDROUTES = 200, NUMPHONES = 50, - NUMPEDGROUPS = 31, - NUMMODELSPERPEDGROUP = 8, // TODO(MIAMI): 16 once we have peds + NUMPEDGROUPS = 67, + NUMMODELSPERPEDGROUP = 16, NUMSHOTINFOS = 100, NUMROADBLOCKS = 300, -- cgit v1.2.3