Bring more changes from DC port

This commit is contained in:
Shinovon 2026-05-02 15:22:39 +05:00
parent f6a5685de8
commit 7dae1b0268
10 changed files with 401 additions and 119 deletions

View file

@ -30,7 +30,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode; int16 DebugCamMode;
#ifdef FREE_CAM #ifdef FREE_CAM
bool CCamera::bFreeCam = false; bool CCamera::bFreeCam = true;
int nPreviousMode = -1; int nPreviousMode = -1;
#endif #endif

View file

@ -219,7 +219,7 @@ CFileLoader::LoadCollisionFile(const char *filename)
mi = CModelInfo::GetModelInfo(modelname, nil); mi = CModelInfo::GetModelInfo(modelname, nil);
if(mi){ if(mi){
if(mi->GetColModel()){ if(mi->GetColModel() && mi->DoesOwnColModel()){
LoadCollisionModel(work_buff+24, *mi->GetColModel(), modelname); LoadCollisionModel(work_buff+24, *mi->GetColModel(), modelname);
}else{ }else{
CColModel *model = new CColModel; CColModel *model = new CColModel;
@ -671,118 +671,383 @@ char *DoubleSidedNames[] = {
"sbwy_tunl_cstm2", "sbwy_tunl_cstm2",
"sbwy_tunl_cstm1", "sbwy_tunl_cstm1",
"tenmnt6ad", "tenmnt6ad",
"LUIGICLUBout",
"redlightbuild03",
"dinerind",
"dinerind02",
"franksclb02",
"glassfx1",
"lswank_inside",
"luigiineerclub",
"swank_inside",
"train_rust",
"glassfx2",
"glassfx3",
"glassfx4",
"glassfx55",
"glassfx_composh",
"glassfxsub1",
"glassfxsub2",
"" ""
}; };
char *TreeNames[] = { char *TreeNames[] = {
"coast_treepatch", "Dam_pod1",
"comparknewtrees", "building_fucked",
"comtreepatchprk", "ch_roof_kb",
"condotree01", "chtwn_fmrkt",
"condotree1", "hghwysgn01",
"indatree03", "hghwysgn02",
"indtreepatch5", "hghwysgn_sub",
"indtreepatch06f", "ind_land037",
"new_carprktrees", "ind_land125ind",
"new_carprktrees4", "indbilbridge1",
"newcoasttrees1", "industpatch05",
"newcoasttrees2", "iten_club01",
"newcoasttrees3", "iten_details7",
"newtreepatch_sub", "iten_washline02",
"newtrees1_sub", "iten_washline03",
"newunitrepatch", "mak_Watertank",
"pinetree_narrow", "mak_Watertank2",
"pinetree_wide", "mak_Watertank3",
"treencom2", "pharmas",
"treepatch", "rd_Road1A5",
"treepatch01_sub", "rdsign02bk",
"treepatch02_sub", "rdsign06",
"treepatch2", "rdsign14",
"treepatch2b", "rdsign15",
"treepatch03", "rdsign17",
"treepatch03_sub", "rdsign18bk",
"treepatch04_sub", "rdsign19",
"treepatch05_sub", "rdsign19",
"treepatch06_sub", "wire_shed",
"treepatch07_sub", "Dam_pod2",
"treepatch08_sub", "Dineradam",
"treepatch09_sub", "Gdyn_barrier17",
"treepatch10_sub", "LODky_skyscrp6",
"treepatch11_sub", "LODt_skyscrp1",
"treepatch12_sub", "LODy_skyscrp23",
"treepatch13_sub", "LODy_skyscrp26b",
"treepatch14_sub", "Pumpfirescape",
"treepatch15_sub", "Pumphouse",
"treepatch16_sub", "airtower1",
"treepatch17_sub", "airtower2",
"treepatch18_sub", "bar_barrier10",
"treepatch19_sub", "bar_barrier10b",
"treepatch20_sub", "bar_barrier12",
"treepatch21_sub", "bar_barrier16",
"treepatch22_sub", "bar_barriergate1",
"treepatch23_sub", "barrierturn",
"treepatch24_sub", "billboard01",
"treepatch25_sub", "billboard02",
"treepatch26_sub", "billboard03",
"treepatch27_sub", "carlift01",
"treepatch28_sub", "carlift02",
"treepatch29_sub", "carparkfence",
"treepatch30_sub", "casino_garden",
"treepatch31_sub", "chinabanner1",
"treepatch32_sub", "chinabanner2",
"treepatch33_sub", "chinabanner3",
"treepatch34_sub", "chinabanner4",
"treepatch35_sub", "coast_treepatch",
"treepatch69", "comparknewtrees",
"treepatch152_sub", "comtreepatchprk",
"treepatch153_sub", "condo_ivy",
"treepatch171_sub", "condotree01",
"treepatch172_sub", "condotree1",
"treepatch173_sub", "cons_buid02",
"treepatch212_sub", "cranebasea",
"treepatch213_sub", "cranebaseb",
"treepatch214_sub", "cranesmalltop",
"treepatcha", "cranetopa",
"treepatchb", "cranetopb",
"treepatchcomtop1", "csky_skyscrp23",
"treepatchd", "csky_skyscrp26b",
"treepatche", "damfence01",
"treepatchh", "damfence02",
"treepatchindaa2", "damfence03",
"treepatchindnew", "damfence04",
"treepatchindnew2", "damfence05",
"treepatchk", "damfence06",
"treepatchkb4", "damfence07",
"treepatchkb5", "damfence08",
"treepatchkb6", "damfencing",
"treepatchkb7", "dinerind",
"treepatchkb9", "dinerind02",
"treepatchl", "dinersign",
"treepatchm", "doc_crane_cab",
"treepatchnew_sub", "doc_crane_leggs",
"treepatchttwrs", "doc_shedbig1",
"treesuni1", "doc_shedbig12",
"trepatchindaa1", "doc_shedbig13",
"veg_bush2", "doc_shedbig2",
"veg_bush14", "doc_shedbig3",
"veg_tree1", "doc_shedbig31",
"veg_tree3", "doc_shedbig4",
"veg_treea1", "fencesmallb",
"veg_treea3", "firescapa1",
"veg_treeb1", "firescapb1",
"veg_treenew01", "foundation",
"veg_treenew03", "glassfx1",
"veg_treenew05", "glassfx2",
"veg_treenew06", "glassfx3",
"veg_treenew08", "glassfx4",
"veg_treenew09", "glassfx55",
"veg_treenew10", "glassfx_composh",
"veg_treenew16", "glassfxsub1",
"veg_treenew17", "glassfxsub2",
"vegclubtree01", "helix_barrier",
"vegclubtree02", "ind_customroad001",
"vegclubtree03", "ind_customroad002",
"vegpathtree", "ind_customroad003",
"ind_customroad004",
"ind_customroad005",
"ind_customroad006",
"ind_customroad008",
"ind_customroad009",
"ind_customroad010",
"ind_customroad011",
"ind_customroad012",
"ind_customroad013",
"ind_customroad014",
"ind_customroad015",
"ind_customroad016",
"ind_customroad017",
"ind_customroad018",
"ind_customroad019",
"ind_customroad020",
"ind_customroad021",
"ind_customroad022",
"ind_customroad023",
"ind_customroad024",
"ind_customroad025",
"ind_customroad026",
"ind_customroad028",
"ind_customroad029",
"ind_customroad033",
"ind_customroad034",
"ind_customroad035",
"ind_customroad036",
"ind_customroad037",
"ind_customroad038",
"ind_customroad039",
"ind_customroad040",
"ind_customroad041",
"ind_customroad042",
"ind_customroad043",
"ind_customroad044",
"ind_customroad045",
"ind_customroad046",
"ind_customroad047",
"ind_customroad048",
"ind_customroad049",
"ind_customroad050",
"ind_customroad051",
"ind_customroad052",
"ind_customroad053",
"ind_customroad054",
"ind_customroad055",
"ind_customroad056",
"ind_customroad057",
"ind_customroad058",
"ind_customroad059",
"ind_customroad060",
"ind_customroad061",
"ind_customroad062",
"ind_customroad063",
"ind_customroad064",
"ind_customroad065",
"ind_customroad066",
"ind_customroad067",
"ind_customroad068",
"ind_customroad069",
"ind_customroad070",
"ind_customroad071",
"ind_customroad072",
"ind_customroad073",
"ind_customroad074",
"ind_customroad075",
"ind_customroad076",
"ind_customroad077",
"ind_customroad078",
"ind_customroad079",
"ind_customroad080",
"ind_customroad081",
"ind_customroad082",
"ind_customroad083",
"ind_customroad084",
"ind_customroad085",
"ind_customroad086",
"ind_customroad087",
"ind_customroad088",
"ind_customroad089",
"ind_customroad090",
"ind_customroad091",
"ind_customroad093",
"ind_customroad094",
"ind_customroad095",
"ind_customroad096",
"ind_customroad097",
"ind_customroad098",
"ind_customroad099",
"ind_customroad0bb",
"indatree03",
"indhelix_barrier",
"indjunk",
"indtreepatch06f",
"indtreepatch5",
"iten_washline01",
"kmricndo01",
"kmricndo02",
"lhouse_barrier1",
"lhouse_barrier2",
"lhouse_barrier3",
"mak_billboard",
"mak_billboardsrvc",
"mscp_barrier",
"mscp_barrier01",
"mscp_barriersup",
"nbbridgerda",
"nbbridgerdb",
"new_carprktrees",
"new_carprktrees4",
"newairportwall1",
"newairportwall2",
"newairportwall3",
"newairportwall4",
"newairportwall5",
"newairportwall6",
"newcoasttrees1",
"newcoasttrees2",
"newcoasttrees3",
"newtreepatch_sub",
"newtrees1_sub",
"newunitrepatch",
"nrailsteps",
"nrailstepswest",
"overpassind",
"pinetree_narrow",
"pinetree_wide",
"plnt_chimgrad",
"plnt_pipepart01",
"plnt_pipjoin4way04",
"plnt_pylon01",
"rd_Road1A10",
"salvsdetail",
"salvstrans",
"skyscrapenew",
"skyscrpunbuilt2",
"sub_billboard1",
"sub_tripbboard",
"subfraightback02",
"subfraightback03",
"subfraightback04",
"subsign1",
"tall_fence",
"tcsky_skyscrp6",
"telepole",
"telepole01",
"telepole02",
"telepole03",
"telepole04",
"tenkb_builds01",
"tenkb_builds03",
"tenkb_builds04",
"tenkb_builds05",
"tenkb_builds06",
"tenkb_builds11",
"trainstairst",
"treencom2",
"treepatch",
"treepatch01_sub",
"treepatch02_sub",
"treepatch03",
"treepatch03_sub",
"treepatch04_sub",
"treepatch05_sub",
"treepatch06_sub",
"treepatch07_sub",
"treepatch08_sub",
"treepatch09_sub",
"treepatch10_sub",
"treepatch11_sub",
"treepatch12_sub",
"treepatch13_sub",
"treepatch14_sub",
"treepatch152_sub",
"treepatch153_sub",
"treepatch15_sub",
"treepatch16_sub",
"treepatch171_sub",
"treepatch172_sub",
"treepatch173_sub",
"treepatch17_sub",
"treepatch18_sub",
"treepatch19_sub",
"treepatch2",
"treepatch20_sub",
"treepatch212_sub",
"treepatch213_sub",
"treepatch214_sub",
"treepatch21_sub",
"treepatch22_sub",
"treepatch23_sub",
"treepatch24_sub",
"treepatch25_sub",
"treepatch26_sub",
"treepatch27_sub",
"treepatch28_sub",
"treepatch29_sub",
"treepatch2b",
"treepatch30_sub",
"treepatch31_sub",
"treepatch32_sub",
"treepatch33_sub",
"treepatch34_sub",
"treepatch35_sub",
"treepatch69",
"treepatcha",
"treepatchb",
"treepatchcomtop1",
"treepatchd",
"treepatche",
"treepatchh",
"treepatchindaa2",
"treepatchindnew",
"treepatchindnew2",
"treepatchk",
"treepatchkb4",
"treepatchkb5",
"treepatchkb6",
"treepatchkb7",
"treepatchkb9",
"treepatchl",
"treepatchm",
"treepatchnew_sub",
"treepatchttwrs",
"treesuni1",
"trepatchindaa1",
"veg_bush14",
"veg_bush2",
"veg_tree1",
"veg_tree3",
"veg_treea1",
"veg_treea3",
"veg_treeb1",
"veg_treenew01",
"veg_treenew03",
"veg_treenew05",
"veg_treenew06",
"veg_treenew08",
"veg_treenew09",
"veg_treenew10",
"veg_treenew16",
"veg_treenew17",
"vegclubtree01",
"vegclubtree02",
"vegclubtree03",
"vegpathtree",
"wlst_skyscrp1",
"" ""
}; };
char *OptimizedNames[] = { char *OptimizedNames[] = {

View file

@ -155,7 +155,7 @@ void RestoreDefDisplay(int8 action) {
CMenuManager::m_PrefsCutsceneBorders = true; CMenuManager::m_PrefsCutsceneBorders = true;
#endif #endif
#ifdef FREE_CAM #ifdef FREE_CAM
TheCamera.bFreeCam = false; TheCamera.bFreeCam = true;
#endif #endif
#ifdef PED_CAR_DENSITY_SLIDERS #ifdef PED_CAR_DENSITY_SLIDERS
CIniFile::PedNumberMultiplier = 0.6f; CIniFile::PedNumberMultiplier = 0.6f;

View file

@ -1214,8 +1214,9 @@ CStreaming::RemoveReferencedTxds(size_t mem)
CStreamingInfo *si; CStreamingInfo *si;
int streamId; int streamId;
for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; si = si->m_prev){ for(si = ms_endLoadedList.m_prev; si != &ms_startLoadedList; ){
streamId = si - ms_aInfoForModel; streamId = si - ms_aInfoForModel;
si = si->m_prev;
if(streamId >= STREAM_OFFSET_TXD && if(streamId >= STREAM_OFFSET_TXD &&
CTxdStore::GetNumRefs(streamId-STREAM_OFFSET_TXD) == 0){ CTxdStore::GetNumRefs(streamId-STREAM_OFFSET_TXD) == 0){
RemoveModel(streamId); RemoveModel(streamId);

View file

@ -370,7 +370,7 @@ enum Config {
# ifdef CUSTOM_FRONTEND_OPTIONS # ifdef CUSTOM_FRONTEND_OPTIONS
# define MENU_MAP // VC-like menu map. Won't appear if you don't have our menu.txd # define MENU_MAP // VC-like menu map. Won't appear if you don't have our menu.txd
# define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable # 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 CUTSCENE_BORDERS_SWITCH
# define MULTISAMPLING // adds MSAA option # define MULTISAMPLING // adds MSAA option
# define INVERT_LOOK_FOR_PAD // add bInvertLook4Pad from VC # define INVERT_LOOK_FOR_PAD // add bInvertLook4Pad from VC

View file

@ -38,6 +38,14 @@ CBaseModelInfo::DeleteCollisionModel(void)
} }
} }
void CBaseModelInfo::SetColModel(CColModel *col, bool owns) {
if (m_bOwnsColModel) {
delete m_colModel;
}
m_colModel = col;
m_bOwnsColModel = owns;
}
void void
CBaseModelInfo::AddRef(void) CBaseModelInfo::AddRef(void)
{ {

View file

@ -56,8 +56,7 @@ public:
} }
char *GetModelName(void) { return m_name; } char *GetModelName(void) { return m_name; }
void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); } void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
void SetColModel(CColModel *col, bool owns = false){ void SetColModel(CColModel *col, bool owns = false);
m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; } CColModel *GetColModel(void) { return m_colModel; }
bool DoesOwnColModel(void) { return m_bOwnsColModel; } bool DoesOwnColModel(void) { return m_bOwnsColModel; }
void DeleteCollisionModel(void); void DeleteCollisionModel(void);

View file

@ -94,7 +94,9 @@ CCutsceneHead::ProcessControl(void)
// PS2 only plays anims in cutscene, PC always plays anims // PS2 only plays anims in cutscene, PC always plays anims
if(!lastLoadedSKA || CCutsceneMgr::IsRunning()) if(!lastLoadedSKA || CCutsceneMgr::IsRunning())
#endif #endif
RpHAnimHierarchyAddAnimTime(hier, CTimer::GetTimeStepNonClippedInSeconds()); if (hier) {
RpHAnimHierarchyAddAnimTime(hier, CTimer::GetTimeStepNonClippedInSeconds());
}
} }
void void
@ -195,6 +197,10 @@ CCutsceneHead::PlayAnimation(const char *animName)
RwStreamSkip(stream, offset*2048); RwStreamSkip(stream, offset*2048);
if(RwStreamFindChunk(stream, rwID_HANIMANIMATION, nil, nil)){ if(RwStreamFindChunk(stream, rwID_HANIMANIMATION, nil, nil)){
anim = RpHAnimAnimationStreamRead(stream); anim = RpHAnimAnimationStreamRead(stream);
if (hier->interpolator->currentAnim) {
RpHAnimAnimationDestroy(hier->interpolator->currentAnim);
hier->interpolator->currentAnim = nil;
}
RpHAnimHierarchySetCurrentAnim(hier, anim); RpHAnimHierarchySetCurrentAnim(hier, anim);
} }

View file

@ -218,7 +218,7 @@ CAutomobile::SetModelIndex(uint32 id)
CVector vecDAMAGE_ENGINE_POS_SMALL(-0.1f, -0.1f, 0.0f); CVector vecDAMAGE_ENGINE_POS_SMALL(-0.1f, -0.1f, 0.0f);
CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f); CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f);
#pragma optimize("", off) // that's what R* did //#pragma optimize("", off) // that's what R* did
void void
CAutomobile::ProcessControl(void) CAutomobile::ProcessControl(void)
@ -1222,7 +1222,7 @@ CAutomobile::ProcessControl(void)
} }
} }
#pragma optimize("", on) //#pragma optimize("", on)
void void
CAutomobile::Teleport(CVector pos) CAutomobile::Teleport(CVector pos)

View file

@ -134,7 +134,10 @@ HAnimHierarchy::getIndex(Frame *f)
HAnimHierarchy* HAnimHierarchy*
HAnimHierarchy::get(Frame *f) HAnimHierarchy::get(Frame *f)
{ {
return HAnimData::get(f)->hierarchy; if (f)
return HAnimData::get(f)->hierarchy;
else
return nil;
} }
HAnimHierarchy* HAnimHierarchy*