diff options
Diffstat (limited to 'src/modelinfo')
-rw-r--r-- | src/modelinfo/BaseModelInfo.h | 4 | ||||
-rw-r--r-- | src/modelinfo/MloModelInfo.h | 26 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.cpp | 17 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.h | 3 | ||||
-rw-r--r-- | src/modelinfo/PedModelInfo.cpp | 2 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.cpp | 21 | ||||
-rw-r--r-- | src/modelinfo/XtraCompsModelInfo.h | 22 |
7 files changed, 52 insertions, 43 deletions
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index a9bafb64..0c4bf934 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -2,6 +2,8 @@ #include "Collision.h" +#define MAX_MODEL_NAME (24) + enum ModeInfoType : uint8 { MITYPE_NA = 0, @@ -21,7 +23,7 @@ class CBaseModelInfo { protected: // TODO?: make more things protected - char m_name[24]; + char m_name[MAX_MODEL_NAME]; CColModel *m_colModel; C2dEffect *m_twodEffects; int16 m_objectId; diff --git a/src/modelinfo/MloModelInfo.h b/src/modelinfo/MloModelInfo.h index 19ae63d5..d4344706 100644 --- a/src/modelinfo/MloModelInfo.h +++ b/src/modelinfo/MloModelInfo.h @@ -1,14 +1,14 @@ -#pragma once
-
-#include "ClumpModelInfo.h"
-
-class CMloModelInfo : public CClumpModelInfo
-{
-public:
- float field_34; // draw distance?
- int firstInstance;
- int lastInstance;
-public:
- CMloModelInfo(void) : CClumpModelInfo(MITYPE_MLO) {}
- void ConstructClump();
+#pragma once + +#include "ClumpModelInfo.h" + +class CMloModelInfo : public CClumpModelInfo +{ +public: + float field_34; // draw distance? + int firstInstance; + int lastInstance; +public: + CMloModelInfo(void) : CClumpModelInfo(MITYPE_MLO) {} + void ConstructClump(); };
\ No newline at end of file diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index d956abaa..b6a95992 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -234,12 +234,6 @@ CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level) } } -CStore<CInstance, MLOINSTANCESIZE>& -CModelInfo::GetMloInstanceStore() -{ - return CModelInfo::ms_mloInstanceStore; -} - void CModelInfo::ConstructMloClumps() { @@ -247,6 +241,17 @@ CModelInfo::ConstructMloClumps() ms_mloModelStore.store[i].ConstructClump(); } +void +CModelInfo::ReInit2dEffects() +{ + ms_2dEffectStore.clear(); + + for (int i = 0; i < MODELINFOSIZE; i++) { + if (ms_modelInfoPtrs[i]) + ms_modelInfoPtrs[i]->Init2dEffects(); + } +} + STARTPATCHES InjectHook(0x50B310, CModelInfo::Initialise, PATCH_JUMP); InjectHook(0x50B5B0, CModelInfo::ShutDown, PATCH_JUMP); diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h index 13756ddf..e6dec1d8 100644 --- a/src/modelinfo/ModelInfo.h +++ b/src/modelinfo/ModelInfo.h @@ -36,7 +36,7 @@ public: static CVehicleModelInfo *AddVehicleModel(int id); static CStore<C2dEffect, TWODFXSIZE> &Get2dEffectStore(void) { return ms_2dEffectStore; } - static CStore<CInstance, MLOINSTANCESIZE> &GetMloInstanceStore(); + static CStore<CInstance, MLOINSTANCESIZE> &GetMloInstanceStore(void) { return ms_mloInstanceStore; } static CBaseModelInfo *GetModelInfo(const char *name, int *id); static CBaseModelInfo *GetModelInfo(int id){ @@ -47,4 +47,5 @@ public: static bool IsBikeModel(int32 id); static void RemoveColModelsFromOtherLevels(eLevelName level); static void ConstructMloClumps(); + static void ReInit2dEffects(); }; diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 7b087fbd..015c6949 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -216,7 +216,7 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame) RwMatrixCopy(mat, RwFrameGetMatrix(f)); for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f)) { - RwMatrixTransform(mat, &f->modelling, rwCOMBINEPOSTCONCAT); + RwMatrixTransform(mat, RwFrameGetMatrix(f), rwCOMBINEPOSTCONCAT); if (RwFrameGetParent(f) == frame) break; } diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 42ad635b..0c45aa12 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -12,6 +12,7 @@ #include "World.h" #include "Vehicle.h" #include "Automobile.h" +#include "Boat.h" #include "Train.h" #include "Plane.h" #include "Heli.h" @@ -80,9 +81,9 @@ RwObjectNameIdAssocation carIds[] = { }; RwObjectNameIdAssocation boatIds[] = { - { "boat_moving_hi", 1, VEHICLE_FLAG_COLLAPSE }, - { "boat_rudder_hi", 3, VEHICLE_FLAG_COLLAPSE }, - { "windscreen", 2, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE }, + { "boat_moving_hi", BOAT_MOVING, VEHICLE_FLAG_COLLAPSE }, + { "boat_rudder_hi", BOAT_RUDDER, VEHICLE_FLAG_COLLAPSE }, + { "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE }, { "ped_frontseat", BOAT_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { nil, 0, 0 } }; @@ -707,7 +708,7 @@ RpMaterial* CVehicleModelInfo::GetEditableMaterialListCB(RpMaterial *material, void *data) { static RwRGBA white = { 255, 255, 255, 255 }; - RwRGBA *col; + const RwRGBA *col; editableMatCBData *cbdata; cbdata = (editableMatCBData*)data; @@ -758,8 +759,8 @@ CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2) col = ms_vehicleColourTable[c1]; coltex = ms_colourTextureTable[c1]; for(matp = m_materials1; *matp; matp++){ - if(RpMaterialGetTexture(*matp) && RpMaterialGetTexture(*matp)->name[0] != '@'){ - colp = RpMaterialGetColor(*matp); + if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){ + colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const colp->red = col.red; colp->green = col.green; colp->blue = col.blue; @@ -773,8 +774,8 @@ CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2) col = ms_vehicleColourTable[c2]; coltex = ms_colourTextureTable[c2]; for(matp = m_materials2; *matp; matp++){ - if(RpMaterialGetTexture(*matp) && RpMaterialGetTexture(*matp)->name[0] != '@'){ - colp = RpMaterialGetColor(*matp); + if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){ + colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const colp->red = col.red; colp->green = col.green; colp->blue = col.blue; @@ -861,7 +862,7 @@ CreateCarColourTexture(uint8 r, uint8 g, uint8 b) RwImageDestroy(img); RwFree(pixels); tex = RwTextureCreate(ras); - tex->name[0] = '@'; + RwTextureGetName(tex)[0] = '@'; return tex; } @@ -1058,7 +1059,7 @@ CVehicleModelInfo::LoadEnvironmentMaps(void) } if(gpWhiteTexture == nil){ gpWhiteTexture = RwTextureRead("white", nil); - gpWhiteTexture->name[0] = '@'; + RwTextureGetName(gpWhiteTexture)[0] = '@'; RwTextureSetFilterMode(gpWhiteTexture, rwFILTERLINEAR); } CTxdStore::PopCurrentTxd(); diff --git a/src/modelinfo/XtraCompsModelInfo.h b/src/modelinfo/XtraCompsModelInfo.h index bb37ffe3..9832399c 100644 --- a/src/modelinfo/XtraCompsModelInfo.h +++ b/src/modelinfo/XtraCompsModelInfo.h @@ -1,12 +1,12 @@ -#pragma once
-
-#include "ClumpModelInfo.h"
-
-class CXtraCompsModelInfo : public CClumpModelInfo
-{
- int field_34;
-public:
- CXtraCompsModelInfo(void) : CClumpModelInfo(MITYPE_XTRACOMPS) { field_34 = 0; }
- void SetClump(RpClump*) {};
- void Shutdown(void) {};
+#pragma once + +#include "ClumpModelInfo.h" + +class CXtraCompsModelInfo : public CClumpModelInfo +{ + int field_34; +public: + CXtraCompsModelInfo(void) : CClumpModelInfo(MITYPE_XTRACOMPS) { field_34 = 0; } + void SetClump(RpClump*) {}; + void Shutdown(void) {}; };
\ No newline at end of file |