void CObject::LoadTextures (void) { int v; switch (info.renderType) { case RT_NONE: break; //doesn't render, like the CPlayerData case RT_POLYOBJ: if (rType.polyObjInfo.nTexOverride == -1) LoadModelTextures (rType.polyObjInfo.nModel); else LoadBitmap (gameData.pig.tex.bmIndex [0][rType.polyObjInfo.nTexOverride].index, 0); break; case RT_POWERUP: if (PowerupToDevice ()) LoadTextures (); else if ((info.nId >= MAX_POWERUP_TYPES_D2) && (rType.vClipInfo.nClipIndex >= gameData.eff.nClips [0])) rType.vClipInfo.nClipIndex = -MAX_ADDON_BITMAP_FILES - 1; break; case RT_MORPH: case RT_FIREBALL: case RT_THRUSTER: case RT_WEAPON_VCLIP: break; case RT_HOSTAGE: LoadVClipTextures (gameData.eff.vClips [0] + rType.vClipInfo.nClipIndex, 0); break; case RT_LASER: break; } switch (info.nType) { case OBJ_PLAYER: v = GetExplosionVClip (this, 0); if (v>= 0) LoadVClipTextures (gameData.eff.vClips [0] + v, 0); break; case OBJ_ROBOT: LoadRobotTextures (info.nId); break; case OBJ_REACTOR: LoadWeaponTextures (CONTROLCEN_WEAPON_NUM); if (gameData.models.nDeadModels [rType.polyObjInfo.nModel] != -1) LoadModelTextures (gameData.models.nDeadModels [rType.polyObjInfo.nModel]); break; } }
void LoadWeaponTextures (int nWeaponType) { if ((nWeaponType < 0) || (nWeaponType > gameData.weapons.nTypes [0])) return; if (gameData.weapons.info [nWeaponType].picture.index) LoadBitmap (gameData.weapons.info [nWeaponType].hiresPicture.index, 0); if (gameData.weapons.info [nWeaponType].nFlashVClip >= 0) LoadVClipTextures (&gameData.eff.vClips [0][gameData.weapons.info [nWeaponType].nFlashVClip], 0); if (gameData.weapons.info [nWeaponType].nWallHitVClip >= 0) LoadVClipTextures (&gameData.eff.vClips [0][gameData.weapons.info [nWeaponType].nWallHitVClip], 0); if (WI_damage_radius (nWeaponType)) { // Robot_hit_vclips are actually badass_vclips if (gameData.weapons.info [nWeaponType].nRobotHitVClip >= 0) LoadVClipTextures (&gameData.eff.vClips [0][gameData.weapons.info [nWeaponType].nRobotHitVClip], 0); } switch (gameData.weapons.info [nWeaponType].renderType) { case WEAPON_RENDER_VCLIP: if (gameData.weapons.info [nWeaponType].nVClipIndex >= 0) LoadVClipTextures (&gameData.eff.vClips [0][gameData.weapons.info [nWeaponType].nVClipIndex], 0); break; case WEAPON_RENDER_NONE: break; case WEAPON_RENDER_POLYMODEL: LoadModelTextures (gameData.weapons.info [nWeaponType].nModel); break; case WEAPON_RENDER_BLOB: LoadBitmap (gameData.weapons.info [nWeaponType].bitmap.index, 0); break; } }
bool CModelGTF::LoadModel(LPSTR strPath, LPSTR strModel) { // Create a loader class instance CLoadGTF loadGTF; // Make sure valid model name was passed in if(!strModel) return false; char szFullPath[MAX_PATH] = {0}; // If there is a valid path we want to add the file name to it, // otherwise just use the file name with no path. if(strPath) sprintf(szFullPath, "%s\\%s", strPath, strModel); else strcpy(szFullPath, strModel); // Here we load the .GTF file. We also make sure it loaded correctly. if(!loadGTF.ImportGTF(&m_Model, szFullPath)) { // Display an error message telling us the file could not be found MessageBox(g_hWnd, "Unable to load the model!", "Error", MB_OK); return false; } // After all the data is loaded we can go through and load all the textures. LoadModelTextures(strPath); // The model was loaded correctly so return true return true; }
void LoadRobotTextures (int robotIndex) { int i; // Page in robotIndex LoadModelTextures (ROBOTINFO (robotIndex).nModel); if (ROBOTINFO (robotIndex).nExp1VClip >= 0) LoadVClipTextures (&gameData.eff.vClips [0][ROBOTINFO (robotIndex).nExp1VClip], 0); if (ROBOTINFO (robotIndex).nExp2VClip >= 0) LoadVClipTextures (&gameData.eff.vClips [0][ROBOTINFO (robotIndex).nExp2VClip], 0); // Page in his weapons LoadWeaponTextures (ROBOTINFO (robotIndex).nWeaponType); // A super-boss can gate in robots... if (ROBOTINFO (robotIndex).bossFlag == 2) { for (i = 0; i < 13; i++) LoadRobotTextures (superBossGateTypeList [i]); LoadVClipTextures (&gameData.eff.vClips [0][VCLIP_MORPHING_ROBOT], 0); } }
bool CModelMD3::Load(LPSTR strPath, LPSTR strModel) { char strWeaponModel[255] = {0}; char strWeaponShader[255] = {0}; CLoadMD3 loadMd3; if(!strPath || !strModel) return false; sprintf(strWeaponModel, "%s\\%s.md3", strPath, strModel); if(!loadMd3.ImportMD3(&m_Weapon, strWeaponModel)) { MessageBox(NULL, "Unable to load the WEAPON model!", "Error", MB_OK); return false; } sprintf(strWeaponShader, "%s\\%s.shader", strPath, strModel); if(!loadMd3.LoadShader(&m_Weapon, strWeaponShader)) { MessageBox(NULL, "Unable to load the SHADER file!", "Error", MB_OK); return false; } LoadModelTextures(&m_Weapon, strPath); return true; }
bool CModelMD3::LoadModel(LPSTR strPath) { char strLowerModel[255] = {0}; char strUpperModel[255] = {0}; char strHeadModel[255] = {0}; char strLowerSkin[255] = {0}; char strUpperSkin[255] = {0}; char strHeadSkin[255] = {0}; CLoadMD3 loadMd3; if(!strPath) return false; sprintf(strLowerModel, "%s\\lower.md3", strPath); sprintf(strUpperModel, "%s\\upper.md3", strPath); sprintf(strHeadModel, "%s\\head.md3", strPath); sprintf(strLowerSkin, "%s\\lower.skin", strPath); sprintf(strUpperSkin, "%s\\upper.skin", strPath); sprintf(strHeadSkin, "%s\\head.skin", strPath); if(!loadMd3.ImportMD3(&m_Head, strHeadModel)) { MessageBox(NULL, "Unable to load the HEAD model!", "Error", MB_OK); return false; } if(!loadMd3.ImportMD3(&m_Upper, strUpperModel)) { MessageBox(NULL, "Unable to load the UPPER model!", "Error", MB_OK); return false; } if(!loadMd3.ImportMD3(&m_Lower, strLowerModel)) { MessageBox(NULL, "Unable to load the LOWER model!", "Error", MB_OK); return false; } if(!loadMd3.LoadSkin(&m_Lower, strLowerSkin)) { MessageBox(NULL, "Unable to load the LOWER skin!", "Error", MB_OK); return false; } if(!loadMd3.LoadSkin(&m_Upper, strUpperSkin)) { MessageBox(NULL, "Unable to load the UPPER skin!", "Error", MB_OK); return false; } if(!loadMd3.LoadSkin(&m_Head, strHeadSkin)) { MessageBox(NULL, "Unable to load the HEAD skin!", "Error", MB_OK); return false; } LoadModelTextures(&m_Lower, strPath); LoadModelTextures(&m_Upper, strPath); LoadModelTextures(&m_Head, strPath); char strConfigFile[255] = {0}; sprintf(strConfigFile, "%s\\animation.cfg", strPath); if(!LoadAnimations(strConfigFile)) { MessageBox(NULL, "Unable to load the Animation Config File!", "Error", MB_OK); return false; } LinkModel(&m_Lower, &m_Upper, "tag_torso"); LinkModel(&m_Upper, &m_Head, "tag_head"); return true; }