implemented extra model flags for backface culling and alpha test from mobile

This commit is contained in:
aap 2020-10-29 19:11:47 +01:00
parent 81e462b677
commit e97366c023
8 changed files with 418 additions and 3 deletions

View file

@ -1,6 +1,7 @@
#include "common.h"
#include "main.h"
#include "General.h"
#include "Quaternion.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
@ -449,6 +450,334 @@ CFileLoader::LoadAtomicFile(RwStream *stream, uint32 id)
return true;
}
#ifdef HARDCODED_MODEL_FLAGS
char *DoubleSidedNames[] = {
"chnabankdoor",
"Security_Hut",
"Hospital_Sub",
"phonebooth1",
"trafficlight1",
"sub_roadbarrier",
"redlightbuild09",
"doublestreetlght1",
"doc_shedbig31",
"com_land_128",
"garage7",
"proj_garage01",
"buildingground2",
"buildingground3",
"ch_roof_kb",
"overpassind",
"casino",
"ind_land100",
"fuckedup_skewlbus",
"Police_Station_ind",
"flagsitaly",
"sidebarrier_gaz1",
"bar_barrier12",
"bar_barrier10b",
"sidebarrier_gaz2",
"doc_shedbig3",
"doc_shedbig4",
"verticalift_bridge",
"verticalift_bridg2",
"usdcrdlrbuild01",
"apairporthanger",
"apairporthangerA",
"porthangerclosed",
"redlightbuild13",
"doc_rave",
"const_woodfence",
"const_woodfence2",
"const_woodfence3",
"subfraightback01",
"subfraightback02",
"subfraightback03",
"subfraightback04",
"subind_build03",
"chinabanner1",
"chinabanner2",
"chinabanner3",
"chinabanner4",
"Pumpfirescape",
"Pumphouse",
"amcounder",
"barrel1",
"barrel2",
"barrel3",
"barrel4",
"com_1way50",
"com_1way20",
"overpasscom01",
"overpasscom02",
"overpasscom03",
"overpasscom04",
"overpass_comse",
"newdockbuilding",
"newdockbuilding2",
"newdockbuilding",
"policeballhall",
"fuzballdoor",
"ind_land106",
"PoliceBallSigns",
"amcoudet",
"rustship_structure",
"impexpgrgesub",
"ind_land128",
"fshfctry_dstryd",
"railtrax_bentl",
"railtrax_lo4b",
"railtrax_straight",
"railtrax_bentrb",
"railtrax_skew",
"newtrackaaa",
"railtrax_skew5",
// these they forgot:
"railtrax_skewp",
"railtrax_ske2b",
"railtrax_strtshort",
"railtrax_2b",
"railtrax_straightss",
"railtrax_bentr",
""
};
char *TreeNames[] = {
"coast_treepatch",
"comparknewtrees",
"comtreepatchprk",
"condotree01",
"condotree1",
"indatree03",
"indtreepatch5",
"indtreepatch06f",
"new_carprktrees",
"new_carprktrees4",
"newcoasttrees1",
"newcoasttrees2",
"newcoasttrees3",
"newtreepatch_sub",
"newtrees1_sub",
"newunitrepatch",
"pinetree_narrow",
"pinetree_wide",
"treencom2",
"treepatch",
"treepatch01_sub",
"treepatch02_sub",
"treepatch2",
"treepatch2b",
"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",
"treepatch15_sub",
"treepatch16_sub",
"treepatch17_sub",
"treepatch18_sub",
"treepatch19_sub",
"treepatch20_sub",
"treepatch21_sub",
"treepatch22_sub",
"treepatch23_sub",
"treepatch24_sub",
"treepatch25_sub",
"treepatch26_sub",
"treepatch27_sub",
"treepatch28_sub",
"treepatch29_sub",
"treepatch30_sub",
"treepatch31_sub",
"treepatch32_sub",
"treepatch33_sub",
"treepatch34_sub",
"treepatch35_sub",
"treepatch69",
"treepatch152_sub",
"treepatch153_sub",
"treepatch171_sub",
"treepatch172_sub",
"treepatch173_sub",
"treepatch212_sub",
"treepatch213_sub",
"treepatch214_sub",
"treepatcha",
"treepatchb",
"treepatchcomtop1",
"treepatchd",
"treepatche",
"treepatchh",
"treepatchindaa2",
"treepatchindnew",
"treepatchindnew2",
"treepatchk",
"treepatchkb4",
"treepatchkb5",
"treepatchkb6",
"treepatchkb7",
"treepatchkb9",
"treepatchl",
"treepatchm",
"treepatchnew_sub",
"treepatchttwrs",
"treesuni1",
"trepatchindaa1",
"veg_bush2",
"veg_bush14",
"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",
""
};
char *OptimizedNames[] = {
"coast_treepatch",
"comparknewtrees",
"comtreepatchprk",
"indtreepatch5",
"indtreepatch06f",
"new_carprktrees",
"new_carprktrees4",
"newcoasttrees1",
"newcoasttrees2",
"newcoasttrees3",
"newtreepatch_sub",
"newtrees1_sub",
"newunitrepatch",
"treepatch",
"treepatch01_sub",
"treepatch02_sub",
"treepatch2",
"treepatch2b",
"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",
"treepatch15_sub",
"treepatch16_sub",
"treepatch17_sub",
"treepatch18_sub",
"treepatch19_sub",
"treepatch20_sub",
"treepatch21_sub",
"treepatch22_sub",
"treepatch23_sub",
"treepatch24_sub",
"treepatch25_sub",
"treepatch26_sub",
"treepatch27_sub",
"treepatch28_sub",
"treepatch29_sub",
"treepatch30_sub",
"treepatch31_sub",
"treepatch32_sub",
"treepatch33_sub",
"treepatch34_sub",
"treepatch35_sub",
"treepatch69",
"treepatch152_sub",
"treepatch153_sub",
"treepatch171_sub",
"treepatch172_sub",
"treepatch173_sub",
"treepatch212_sub",
"treepatch213_sub",
"treepatch214_sub",
"treepatcha",
"treepatchb",
"treepatchcomtop1",
"treepatchd",
"treepatche",
"treepatchh",
"treepatchindaa2",
"treepatchindnew",
"treepatchindnew2",
"treepatchk",
"treepatchkb4",
"treepatchkb5",
"treepatchkb6",
"treepatchkb7",
"treepatchkb9",
"treepatchl",
"treepatchm",
"treepatchnew_sub",
"treepatchttwrs",
"treesuni1",
"trepatchindaa1",
"combtm_treeshad01",
"combtm_treeshad02",
"combtm_treeshad03",
"combtm_treeshad04",
"combtm_treeshad05",
"combtm_treeshad06",
"comtop_tshad",
"comtop_tshad2",
"comtop_tshad3",
"comtop_tshad4",
"comtop_tshad5",
"comtop_tshad6",
"se_treeshad01",
"se_treeshad02",
"se_treeshad03",
"se_treeshad04",
"se_treeshad05",
"se_treeshad06",
"treeshads01",
"treeshads02",
"treeshads03",
"treeshads04",
"treeshads05",
""
};
// not from mobile
static bool
MatchModelName(char *name, char **list)
{
int i;
char *s;
for(i = 0; *list[i] != '\0'; i++)
if(strncmp(name, "LOD", 3) == 0){
if(!CGeneral::faststricmp(name+3, list[i]+3))
return true;
}else{
if(!CGeneral::faststricmp(name, list[i]))
return true;
}
return false;
}
#endif
RpAtomic*
CFileLoader::SetRelatedModelInfoCB(RpAtomic *atomic, void *data)
{
@ -600,6 +929,21 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
mi->m_isSubway = !!(flags & 0x10);
mi->m_ignoreLight = !!(flags & 0x20);
mi->m_noZwrite = !!(flags & 0x40);
#ifdef EXTRA_MODEL_FLAGS
// same flag values as SA
mi->m_bIsTree = !!(flags & 0x2000);
mi->m_bIsDoubleSided = !!(flags & 0x200000);
// new value otherwise unused
mi->m_bCanBeIgnored = !!(flags & 0x10000);
#ifdef HARDCODED_MODEL_FLAGS
// mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
if(MatchModelName(mi->GetName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
if(MatchModelName(mi->GetName(), TreeNames)) mi->m_bIsTree = true;
if(MatchModelName(mi->GetName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
#endif
#endif
}
void

View file

@ -201,6 +201,9 @@ enum Config {
#define LOAD_INI_SETTINGS
// Rendering/display
#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
// NB: keep this enabled unless your map IDEs have these flags baked in
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img