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

Function SetMiscModelModels

code/game/g_misc_model.cpp:33–59  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

SetMiscModelDefaultsFunction · 0.70

Calls 1

G_ModelIndexFunction · 0.70

Tested by

no test coverage detected