mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-21 19:51:33 +00:00
If saber model name is missing, just use the default saber model
looks better than no saber model at all and right now I can't be bothered to dig any deeper into this one
This commit is contained in:
parent
fc72b58bb6
commit
5a6ef6f77a
2 changed files with 16 additions and 4 deletions
|
@ -8533,25 +8533,35 @@ Ghoul2 Insert End
|
|||
|
||||
for ( int saberNum = 0; saberNum < numSabers; saberNum++ )
|
||||
{
|
||||
if ((saberNum == 0 && cent->currentState.saberInFlight) ||
|
||||
cent->gent->client->ps.saber[saberNum].name == nullptr)
|
||||
if (saberNum == 0 && cent->currentState.saberInFlight)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
char saberModel[256];
|
||||
if (cent->gent->client->ps.saber[saberNum].model == nullptr)
|
||||
{
|
||||
//Bit of a fiddle, but if we have no saber model for some reason, just use a default one
|
||||
strcpy(saberModel, "models/weapons2/saber_1/saber_1.glm");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(saberModel, cent->gent->client->ps.saber[saberNum].model);
|
||||
}
|
||||
|
||||
refEntity_t hiltEnt;
|
||||
memset( &hiltEnt, 0, sizeof(refEntity_t) );
|
||||
|
||||
BG_CalculateVRSaberPosition(saberNum, hiltEnt.origin, hiltEnt.angles);
|
||||
|
||||
int saberModelIndex = G_ModelIndex( cent->gent->client->ps.saber[saberNum].model );
|
||||
int saberModelIndex = G_ModelIndex( saberModel );
|
||||
if (saberModelIndex != cg.saberModelIndex[saberNum])
|
||||
{
|
||||
if (cg.saber_ghoul2[saberNum].size() != 0)
|
||||
{
|
||||
gi.G2API_RemoveGhoul2Model(cg.saber_ghoul2[saberNum], cg.saberG2Num[saberNum]);
|
||||
}
|
||||
cg.saberG2Num[saberNum] = gi.G2API_InitGhoul2Model( cg.saber_ghoul2[saberNum], cent->gent->client->ps.saber[saberNum].model, saberModelIndex , NULL_HANDLE, NULL_HANDLE, 0, 0 );
|
||||
cg.saberG2Num[saberNum] = gi.G2API_InitGhoul2Model( cg.saber_ghoul2[saberNum], saberModel, saberModelIndex , NULL_HANDLE, NULL_HANDLE, 0, 0 );
|
||||
cg.saberModelIndex[saberNum] = saberModelIndex;
|
||||
}
|
||||
hiltEnt.ghoul2 = &cg.saber_ghoul2[saberNum];
|
||||
|
|
|
@ -1307,6 +1307,7 @@ typedef struct
|
|||
saved_game.read<int32_t>(fullName);
|
||||
saved_game.read<int32_t>(type);
|
||||
saved_game.read<int32_t>(model);
|
||||
model = NULL;
|
||||
saved_game.read<int32_t>(skin);
|
||||
saved_game.read<int32_t>(soundOn);
|
||||
saved_game.read<int32_t>(soundLoop);
|
||||
|
@ -1540,6 +1541,7 @@ public:
|
|||
saved_game.read<int32_t>(fullName);
|
||||
saved_game.read<int32_t>(type);
|
||||
saved_game.read<int32_t>(model);
|
||||
model = NULL;
|
||||
saved_game.read<int32_t>(skin);
|
||||
saved_game.read<int32_t>(soundOn);
|
||||
saved_game.read<int32_t>(soundLoop);
|
||||
|
|
Loading…
Reference in a new issue