diff options
Diffstat (limited to 'src/modelinfo')
-rw-r--r-- | src/modelinfo/BaseModelInfo.cpp | 13 | ||||
-rw-r--r-- | src/modelinfo/BaseModelInfo.h | 13 | ||||
-rw-r--r-- | src/modelinfo/ModelIndices.h | 379 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.cpp | 7 | ||||
-rw-r--r-- | src/modelinfo/SimpleModelInfo.cpp | 2 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.cpp | 8 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.h | 7 |
7 files changed, 257 insertions, 172 deletions
diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp index d0f868fa..fd13dfb5 100644 --- a/src/modelinfo/BaseModelInfo.cpp +++ b/src/modelinfo/BaseModelInfo.cpp @@ -1,11 +1,12 @@ #include "common.h" #include "templates.h" +#include "main.h" #include "TxdStore.h" #include "2dEffect.h" #include "BaseModelInfo.h" #include "ModelInfo.h" -#include "ColModel.h" +#include "KeyGen.h" CBaseModelInfo::CBaseModelInfo(ModelInfoType type) { @@ -17,6 +18,7 @@ CBaseModelInfo::CBaseModelInfo(ModelInfoType type) m_type = type; m_num2dEffects = 0; m_bOwnsColModel = false; + m_name = new char[MAX_MODEL_NAME]; } void @@ -100,3 +102,12 @@ CBaseModelInfo::Get2dEffect(int n) else return nil; } + + +void +CBaseModelInfo::SetModelName(const char *name) +{ + m_nameKey = CKeyGen::GetUppercaseKey(name); + if (!gUseChunkFiles) + strcpy(m_name, name); +}
\ No newline at end of file diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index 2d1dc8ac..f3fddf20 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -23,11 +23,15 @@ class C2dEffect; class CBaseModelInfo { protected: - char m_name[MAX_MODEL_NAME]; + char *m_name; + uint32 m_nameKey; + RwObject *m_object; uint8 m_type; uint8 m_num2dEffects; bool m_bOwnsColModel; +public: // need this in colstore CColModel *m_colModel; +protected: int16 m_2dEffectsID; int16 m_objectId; uint16 m_refCount; @@ -35,7 +39,11 @@ protected: public: CBaseModelInfo(ModelInfoType type); +#ifdef FIX_BUGS + virtual ~CBaseModelInfo() { delete []m_name; } +#else virtual ~CBaseModelInfo() {} +#endif virtual void Shutdown(void); virtual void DeleteRwObject(void) = 0; virtual RwObject *CreateInstance(void) = 0; @@ -51,7 +59,8 @@ public: bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME || m_type == MITYPE_WEAPON; } bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; } char *GetModelName(void) { return m_name; } - void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); } + void SetModelName(const char *name); + uint32 GetNameHashKey() { return m_nameKey; } void SetColModel(CColModel *col, bool owns = false){ m_colModel = col; m_bOwnsColModel = owns; } CColModel *GetColModel(void) { return m_colModel; } diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 836c4092..476a2273 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -138,7 +138,50 @@ X("blimp_night", MI_BLIMP_NIGHT) \ X("blimp_day", MI_BLIMP_DAY) \ X("yt_main_body", MI_YT_MAIN_BODY) \ - X("yt_main_body2", MI_YT_MAIN_BODY2) + X("yt_main_body2", MI_YT_MAIN_BODY2) \ + X("oddjgaragdoor", MI_LCS_GARAGEDOOR01) \ + X("bombdoor", MI_LCS_GARAGEDOOR02) \ + X("door_bombshop", MI_LCS_GARAGEDOOR03) \ + X("vheistlocdoor", MI_LCS_GARAGEDOOR04) \ + X("door2_garage", MI_LCS_GARAGEDOOR05) \ + X("ind_slidedoor", MI_LCS_GARAGEDOOR06) \ + X("bankjobdoor", MI_LCS_GARAGEDOOR07) \ + X("door_jmsgrage", MI_LCS_GARAGEDOOR08) \ + X("ind_safeh_gdoor", MI_LCS_GARAGEDOOR09) \ + X("door_sfehousegrge", MI_LCS_GARAGEDOOR10) \ + X("shedgaragedoor", MI_LCS_GARAGEDOOR11) \ + X("door4_garage", MI_LCS_GARAGEDOOR12) \ + X("door_col_compnd_01", MI_LCS_GARAGEDOOR13) \ + X("door_col_compnd_02", MI_LCS_GARAGEDOOR14) \ + X("door_col_compnd_03", MI_LCS_GARAGEDOOR15) \ + X("door_col_compnd_04", MI_LCS_GARAGEDOOR16) \ + X("door_col_compnd_05", MI_LCS_GARAGEDOOR17) \ + X("impex_door", MI_LCS_GARAGEDOOR18) \ + X("SalvGarage", MI_LCS_GARAGEDOOR19) \ + X("door3_garage", MI_LCS_GARAGEDOOR20) \ + X("leveldoor2", MI_LCS_GARAGEDOOR21) \ + X("double_garage_dr", MI_LCS_GARAGEDOOR22) \ + X("amcogaragedoor", MI_LCS_GARAGEDOOR23) \ + X("towergaragedoor1", MI_LCS_GARAGEDOOR24) \ + X("towergaragedoor2", MI_LCS_GARAGEDOOR25) \ + X("towergaragedoor3", MI_LCS_GARAGEDOOR26) \ + X("plysve_gragedoor", MI_LCS_GARAGEDOOR27) \ + X("impexpsubgrgdoor", MI_LCS_GARAGEDOOR28) \ + X("Sub_sprayshopdoor", MI_LCS_GARAGEDOOR29) \ + X("ind_plyrwoor", MI_LCS_GARAGEDOOR30) \ + X("8ballsuburbandoor", MI_LCS_GARAGEDOOR31) \ + X("door_nthgrage", MI_LCS_GARAGEDOOR32) \ + X("hangardoor1", MI_LCS_GARAGEDOOR33) \ + X("hangardoor2", MI_LCS_GARAGEDOOR34) \ + X("neds_door", MI_LCS_GARAGEDOOR35) \ + X("fs_wrhsedoor", MI_LCS_GARAGEDOOR36) \ + X("jm_ContraGarage", MI_LCS_GARAGEDOOR37) \ + X("jm_imp_SalvGarage", MI_LCS_GARAGEDOOR38) \ + X("crushercrush", MI_LCS_GARAGEDOOR39) \ + X("crushertop", MI_LCS_GARAGEDOOR40) \ + X("crusher_crane", MI_LCS_CRANE01) \ + +// NB: MI_LCS_ <- temporary stuff so that garages started somewhat working #define X(name, var) extern int16 var; MODELINDICES @@ -157,96 +200,85 @@ enum MI_FIREMAN, MI_MALE01, - MI_HFYST = 9, - MI_HFOST, - MI_HMYST, - MI_HMOST, - MI_HFYRI, - MI_HFORI, - MI_HMYRI, - MI_HMORI, - MI_HFYBE, - MI_HFOBE, - MI_HMYBE, - MI_HMOBE, - MI_HFYBU, - MI_HFYMD, - MI_HFYCG, - MI_HFYPR, - MI_HFOTR, - MI_HMOTR, - MI_HMYAP, - MI_HMOCA, - MI_TAXI_D = MI_HMOCA, - MI_BMODK, - MI_BMYKR, - MI_BFYST, - MI_BFOST, - MI_BMYST, - MI_BMOST, - MI_BFYRI, - MI_BFORI, - MI_BMYRI, - MI_BFYBE, - MI_BMYBE, - MI_BFOBE, - MI_BMOBE, - MI_BMYBU, - MI_BFYPR, - MI_BFOTR, - MI_BMOTR, - MI_BMYPI, - MI_BMYBB, - MI_WMYCR, - MI_WFYST, - MI_WFOST, - MI_WMYST, - MI_WMOST, - MI_WFYRI, - MI_WFORI, - MI_WMYRI, - MI_WMORI, - MI_WFYBE, - MI_WMYBE, - MI_WFOBE, - MI_WMOBE, - MI_WMYCW, - MI_WMYGO, - MI_WFOGO, - MI_WMOGO, - MI_WFYLG, - MI_WMYLG, - MI_WFYBU, - MI_WMYBU, - MI_WMOBU, - MI_WFYPR, - MI_WFOTR, - MI_WMOTR, - MI_WMYPI, - MI_WMOCA, - MI_WFYJG, - MI_WMYJG, - MI_WFYSK, - MI_WMYSK, - MI_WFYSH, - MI_WFOSH, - MI_JFOTO, - MI_JMOTO, - - MI_CBA,// = 83, - MI_CBB, - MI_HNA, - MI_HNB, - MI_SGA, - MI_SGB, - MI_CLA, - MI_CLB, - MI_GDA, - MI_GDB, - MI_BKA, - MI_BKB, - MI_PGA, - MI_PGB, + MI_TAXI_D = 9, + MI_PIMP, + MI_CRIMINAL01, + MI_CRIMINAL02, + MI_MALE02, + MI_MALE03, + MI_FATMALE01, + MI_FATMALE02, + MI_FEMALE01, + MI_FEMALE02, + MI_FEMALE03, + MI_FATFEMALE01, + MI_FATFEMALE02, + MI_PROSTITUTE, + MI_PROSTITUTE2, + MI_P_MAN1, + MI_P_MAN2, + MI_P_WOM1, + MI_P_WOM2, + MI_CT_MAN1, + MI_CT_MAN2, + MI_CT_WOM1, + MI_CT_WOM2, + MI_LI_MAN1, + MI_LI_MAN2, + MI_LI_WOM1, + MI_LI_WOM2, + MI_DOCKER1, + MI_DOCKER2, + MI_SCUM_MAN, + MI_SCUM_WOM, + MI_WORKER1, + MI_WORKER2, + MI_B_MAN1, + MI_B_MAN2, + MI_B_MAN3, + MI_B_WOM1, + MI_B_WOM2, + MI_B_WOM3, + MI_MOD_MAN, + MI_MOD_WOM, + MI_ST_MAN, + MI_ST_WOM, + MI_FAN_MAN1, + MI_FAN_MAN2, + MI_FAN_WOM, + MI_HOS_MAN, + MI_HOS_WOM, + MI_CONST1, + MI_CONST2, + MI_SHOPPER1, + MI_SHOPPER2, + MI_SHOPPER3, + MI_STUD_MAN, + MI_STUD_WOM, + MI_CAS_MAN, + MI_CAS_WOM, + MI_CAMP_MAN, + MI_CAMP_WOM, + MI_HITMAN, + + MI_GANG01 = 79, + MI_GANG02, + MI_GANG03, + MI_GANG04, + MI_GANG05, + MI_GANG06, + MI_GANG07, + MI_GANG08, + MI_GANG09, + MI_GANG10, + MI_GANG11, + MI_GANG12, + MI_GANG13, + MI_GANG14, + MI_GANG15, + MI_GANG16, + MI_GANG17, + MI_GANG18, MI_VICE1, MI_VICE2, MI_VICE3, @@ -283,19 +315,20 @@ enum MI_LAST_PED = MI_SPECIAL21, MI_FIRST_VEHICLE, - MI_LANDSTAL = MI_FIRST_VEHICLE, + MI_SPIDER = MI_FIRST_VEHICLE, + MI_LANDSTAL, MI_IDAHO, MI_STINGER, MI_LINERUN, MI_PEREN, MI_SENTINEL, - MI_RIO, + MI_PATRIOT, MI_FIRETRUCK, MI_TRASH, MI_STRETCH, MI_MANANA, MI_INFERNUS, - MI_VOODOO, + MI_BLISTA, MI_PONY, MI_MULE, MI_CHEETAH, @@ -304,100 +337,120 @@ enum MI_MOONBEAM, MI_ESPERANT, MI_TAXI, - MI_WASHING, + MI_KURUMA, MI_BOBCAT, MI_MRWHOOP, MI_BFINJECT, - MI_HUNTER, + MI_HEARSE, MI_POLICE, MI_ENFORCER, MI_SECURICA, MI_BANSHEE, - MI_PREDATOR, MI_BUS, MI_RHINO, MI_BARRACKS, - MI_CUBAN, - MI_CHOPPER, - MI_ANGEL, + MI_DODO, MI_COACH, MI_CABBIE, MI_STALLION, MI_RUMPO, MI_RCBANDIT, - MI_ROMERO, - MI_PACKER, - MI_SENTXS, - MI_ADMIRAL, - MI_SQUALO, - MI_SEASPAR, - MI_PIZZABOY, - MI_GANGBUR, - MI_AIRTRAIN, - MI_DEADDODO, - MI_SPEEDER, - MI_REEFER, - MI_TROPIC, + MI_BELLYUP, + MI_MRWONGS, + MI_MAFIA, + MI_YARDIE, + MI_YAKUZA, + MI_DIABLOS, + MI_COLUMB, + MI_HOODS, + MI_PANLANT, MI_FLATBED, MI_YANKEE, - MI_CADDY, - MI_ZEBRA, - MI_TOPFUN, - MI_SKIMMER, + MI_BORGNINE, + MI_TOYZ, + MI_CAMPVAN, + MI_BALLOT, + MI_SHELBY, + MI_PONTIAC, + MI_ESPRIT, + MI_AMMOTRUK, + MI_HOTROD, + MI_SINDACCO_CAR, + MI_FORELLI_CAR, + MI_FERRY, + MI_GHOST, + MI_SPEEDER, + MI_REEFER, + MI_PREDATOR, + MI_TRAIN, + MI_ESCAPE, + MI_CHOPPER, + MI_AIRTRAIN, + MI_DEADDODO, + MI_ANGEL, + MI_PIZZABOY, + MI_NOODLEBOY, MI_PCJ600, MI_FAGGIO, MI_FREEWAY, - MI_RCBARON, - MI_RCRAIDER, - MI_GLENDALE, - MI_OCEANIC, + MI_ANGEL2, + MI_SANCHEZ2, MI_SANCHEZ, + MI_RCGOBLIN, + MI_RCRAIDER, + MI_HUNTER, + MI_MAVERICK, + MI_POLMAV, + MI_VCNMAV, + + MI_LAST_VEHICLE = MI_VCNMAV, + + // HACK HACK, hopefully temporary + MI_SEASPAR = -1000, MI_SPARROW, - MI_PATRIOT, - MI_LOVEFIST, + MI_RCBARON, + MI_TOPFUN, + MI_CADDY, + MI_BAGGAGE, + MI_FBIRANCH, + MI_VICECHEE, + MI_RIO, + MI_SQUALO, + MI_JETMAX, MI_COASTG, MI_DINGHY, - MI_HERMES, - MI_SABRE, - MI_SABRETUR, + MI_MARQUIS, + MI_SKIMMER, + MI_TROPIC, + MI_SANDKING, + MI_VOODOO, + MI_CUBAN, MI_PHEONIX, - MI_WALTON, - MI_REGINA, MI_COMET, + MI_SABRE, + MI_VIRGO, + MI_RANCHER, + MI_BLISTAC, + MI_WASHING, + MI_ADMIRAL, + MI_SABRETUR, MI_DELUXO, + MI_HOTRING, + MI_REGINA, + MI_SENTXS, + MI_GLENDALE, + MI_OCEANIC, + MI_HERMES, + MI_GREENWOO, + MI_LOVEFIST, + MI_GANGBUR, MI_BURRITO, MI_SPAND, - MI_MARQUIS, - MI_BAGGAGE, - MI_KAUFMAN, - MI_MAVERICK, - MI_VCNMAV, - MI_RANCHER, - MI_FBIRANCH, - MI_VIRGO, - MI_GREENWOO, - MI_JETMAX, - MI_HOTRING, - MI_SANDKING, - MI_BLISTAC, - MI_POLMAV, - MI_BOXVILLE, - MI_BENSON, - MI_MESA, - MI_RCGOBLIN, - MI_HOTRINA, - MI_HOTRINB, - MI_BLOODRA, - MI_BLOODRB, - MI_VICECHEE, - - // HACK - MI_TRAIN = -1, - MI_DODO = -2, - - MI_LAST_VEHICLE = MI_VICECHEE, + MI_PACKER, + MI_WALTON, + MI_ROMERO, - MI_WHEEL_RIM, + MI_WHEEL_RIM = 237, MI_WHEEL_OFFROAD, MI_WHEEL_TRUCK, @@ -458,14 +511,18 @@ enum MI_FINGERS, MI_MINIGUN2, - MI_CUTOBJ01,// = 295, + MI_CUTOBJ01 = 120, MI_CUTOBJ02, MI_CUTOBJ03, MI_CUTOBJ04, MI_CUTOBJ05, + MI_CUTOBJ06, + MI_CUTOBJ07, + MI_CUTOBJ08, + MI_CUTOBJ09, + MI_CUTOBJ10, - - NUM_DEFAULT_MODELS,// = 300 + NUM_DEFAULT_MODELS = 300 }; enum{ diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index 41515e20..47f4e309 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -4,6 +4,7 @@ #include "TempColModels.h" #include "ModelIndices.h" #include "ModelInfo.h" +#include "KeyGen.h" CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE]; @@ -184,10 +185,11 @@ CModelInfo::AddVehicleModel(int id) CBaseModelInfo* CModelInfo::GetModelInfo(const char *name, int *id) { + uint32 hashKey = CKeyGen::GetUppercaseKey(name); CBaseModelInfo *modelinfo; for(int i = 0; i < MODELINFOSIZE; i++){ modelinfo = CModelInfo::ms_modelInfoPtrs[i]; - if(modelinfo && !CGeneral::faststricmp(modelinfo->GetModelName(), name)){ + if(modelinfo && hashKey == modelinfo->GetNameHashKey()){ if(id) *id = i; return modelinfo; @@ -199,13 +201,14 @@ CModelInfo::GetModelInfo(const char *name, int *id) CBaseModelInfo* CModelInfo::GetModelInfo(const char *name, int minIndex, int maxIndex) { + uint32 hashKey = CKeyGen::GetUppercaseKey(name); if (minIndex > maxIndex) return 0; CBaseModelInfo *modelinfo; for(int i = minIndex; i <= maxIndex; i++){ modelinfo = CModelInfo::ms_modelInfoPtrs[i]; - if(modelinfo && !CGeneral::faststricmp(modelinfo->GetModelName(), name)) + if(modelinfo && hashKey == modelinfo->GetNameHashKey()) return modelinfo; } return nil; diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index 8da3a86a..9ca4d292 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -173,7 +173,7 @@ CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID) } } -#define NEAR_DRAW_DIST 0.0f // 100.0f in liberty city +#define NEAR_DRAW_DIST 100.0f // 0.0f in vice city void CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID) diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index dfd6519b..4fc455de 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -1106,6 +1106,7 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data) void CVehicleModelInfo::SetEnvironmentMap(void) { +/* CSimpleModelInfo *wheelmi; int32 i; @@ -1123,6 +1124,7 @@ CVehicleModelInfo::SetEnvironmentMap(void) for(i = 0; i < wheelmi->m_numAtomics; i++) SetEnvironmentMapCB(wheelmi->m_atomics[i], nil); } +*/ #ifdef EXTENDED_PIPELINES CustomPipes::AttachVehiclePipe(m_clump); @@ -1137,21 +1139,23 @@ CVehicleModelInfo::LoadEnvironmentMaps(void) txdslot = CTxdStore::FindTxdSlot("particle"); CTxdStore::PushCurrentTxd(); CTxdStore::SetCurrentTxd(txdslot); - if(gpWhiteTexture == nil){ + /*if(gpWhiteTexture == nil){ gpWhiteTexture = RwTextureRead("white", nil); RwTextureGetName(gpWhiteTexture)[0] = '@'; RwTextureSetFilterMode(gpWhiteTexture, rwFILTERLINEAR); - } + }*/ CTxdStore::PopCurrentTxd(); } void CVehicleModelInfo::ShutdownEnvironmentMaps(void) { +/* RwTextureDestroy(gpWhiteTexture); gpWhiteTexture = nil; RwFrameDestroy(pMatFxIdentityFrame); pMatFxIdentityFrame = nil; +*/ } int diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index c7a41126..f9217a41 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -3,8 +3,8 @@ #include "ClumpModelInfo.h" enum { - NUM_FIRST_MATERIALS = 24, - NUM_SECOND_MATERIALS = 20, + NUM_FIRST_MATERIALS = 25, + NUM_SECOND_MATERIALS = 25, NUM_VEHICLE_COLOURS = 8, }; @@ -31,6 +31,7 @@ enum eVehicleType { VEHICLE_TYPE_HELI, VEHICLE_TYPE_PLANE, VEHICLE_TYPE_BIKE, + VEHICLE_TYPE_FERRY, NUM_VEHICLE_TYPES }; @@ -97,7 +98,7 @@ public: uint8 m_lastColorVariation; uint8 m_currentColour1; uint8 m_currentColour2; - RpAtomic *m_comps[6]; + RpAtomic *m_comps[6]; // LCS(TODO): pointer // This is stupid, CClumpModelInfo already has it! union { int32 m_animFileIndex; |