Use array<> for jointlist
This commit is contained in:
parent
68e2168377
commit
2c63744fd3
|
@ -146,9 +146,8 @@ struct robot_info : prohibit_void_ptr<robot_info>
|
||||||
ubyte behavior; // Default behavior.
|
ubyte behavior; // Default behavior.
|
||||||
ubyte aim; // 255 = perfect, less = more likely to miss. 0 != random, would look stupid. 0=45 degree spread. Specify in bitmaps.tbl in range 0.0..1.0
|
ubyte aim; // 255 = perfect, less = more likely to miss. 0 != random, would look stupid. 0=45 degree spread. Specify in bitmaps.tbl in range 0.0..1.0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//animation info
|
//animation info
|
||||||
jointlist anim_states[MAX_GUNS+1][N_ANIM_STATES];
|
array<array<jointlist, N_ANIM_STATES>, MAX_GUNS+1> anim_states;
|
||||||
int always_0xabcd; // debugging
|
int always_0xabcd; // debugging
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -180,15 +180,13 @@ void robot_set_angles(robot_info *r,polymodel *pm,vms_angvec angs[N_ANIM_STATES]
|
||||||
/*
|
/*
|
||||||
* reads n jointlist structs from a PHYSFS_file
|
* reads n jointlist structs from a PHYSFS_file
|
||||||
*/
|
*/
|
||||||
static int jointlist_read_n(jointlist *jl, int n, PHYSFS_file *fp)
|
static void jointlist_read(PHYSFS_File *fp, array<jointlist, N_ANIM_STATES> &jl)
|
||||||
{
|
{
|
||||||
int i;
|
range_for (auto &i, jl)
|
||||||
|
{
|
||||||
for (i = 0; i < n; i++) {
|
i.n_joints = PHYSFSX_readShort(fp);
|
||||||
jl[i].n_joints = PHYSFSX_readShort(fp);
|
i.offset = PHYSFSX_readShort(fp);
|
||||||
jl[i].offset = PHYSFSX_readShort(fp);
|
|
||||||
}
|
}
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -294,7 +292,7 @@ void robot_info_read(PHYSFS_File *fp, robot_info &ri)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
range_for (auto &j, ri.anim_states)
|
range_for (auto &j, ri.anim_states)
|
||||||
jointlist_read_n(j, N_ANIM_STATES, fp);
|
jointlist_read(fp, j);
|
||||||
|
|
||||||
ri.always_0xabcd = PHYSFSX_readInt(fp);
|
ri.always_0xabcd = PHYSFSX_readInt(fp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue