MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SetMiscModelModels

Function SetMiscModelModels

codeJK2/game/g_misc_model.cpp:36–62  ·  view source on GitHub ↗

Helper functions ------------------------------------------------------------

Source from the content-addressed store, hash-verified

34//
35//------------------------------------------------------------
36void SetMiscModelModels( char *modelNameString, gentity_t *ent, qboolean damage_model )
37{
38 char damageModel[MAX_QPATH];
39 char chunkModel[MAX_QPATH];
40 int len;
41
42 //Main model
43 ent->s.modelindex = G_ModelIndex( modelNameString );
44
45 if ( damage_model )
46 {
47 len = strlen( modelNameString ) - 4; // extract the extension
48
49 //Dead/damaged model
50 strncpy( damageModel, modelNameString, len );
51 damageModel[len] = 0;
52 strncpy( chunkModel, damageModel, sizeof(chunkModel));
53 strcat( damageModel, "_d1.md3" );
54 ent->s.modelindex2 = G_ModelIndex( damageModel );
55
56 ent->spawnflags |= 4; // deadsolid
57
58 //Chunk model
59 strcat( chunkModel, "_c1.md3" );
60 ent->s.modelindex3 = G_ModelIndex( chunkModel );
61 }
62}
63
64//------------------------------------------------------------
65void SetMiscModelDefaults( gentity_t *ent, useFunc_t use_func, char *material, int solid_mask,int animFlag,

Callers 1

SetMiscModelDefaultsFunction · 0.70

Calls 1

G_ModelIndexFunction · 0.70

Tested by

no test coverage detected