add a firstPersonArm flag for each CustomModelPart, remove hideFirstPersonArm (#681)

This commit is contained in:
SpiralP 2020-06-18 20:50:26 -07:00 committed by GitHub
parent e0fe8f702b
commit e95f7767d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View File

@ -642,14 +642,13 @@ static void CustomModel_GetPickingBounds(struct Entity* e) {
static void CustomModel_DrawArm(struct Entity* e) {
int i;
struct CustomModel* cm = (struct CustomModel*)Models.Active;
if (cm->hideFirstPersonArm) return;
Models.uScale = 1.0f / cm->uScale;
Models.vScale = 1.0f / cm->vScale;
for (i = 0; i < cm->numParts; i++) {
struct CustomModelPart* part = &cm->parts[i];
if (part->anim == CustomModelAnim_RightArm) {
if (part->firstPersonArm) {
Model_DrawArmPart(&part->modelPart);
}
}

View File

@ -249,6 +249,7 @@ struct CustomModelPart {
cc_uint8 anim;
cc_bool fullbright;
cc_bool firstPersonArm;
};
struct CustomModel {
@ -256,7 +257,6 @@ struct CustomModel {
struct ModelVertex* vertices;
char name[STRING_SIZE + 1];
cc_bool hideFirstPersonArm;
float nameY;
float eyeY;

View File

@ -1425,7 +1425,6 @@ static void CPE_DefineModel(cc_uint8* data) {
customModel->model.pushes = (flags >> 1) & 1;
customModel->model.usesHumanSkin = (flags >> 2) & 1;
customModel->model.calcHumanAnims = (flags >> 3) & 1;
customModel->hideFirstPersonArm = (flags >> 4) & 1;
/* read nameY, eyeY */
customModel->nameY = ReadFloat(data);
@ -1561,6 +1560,7 @@ static void CPE_DefineModelPart(cc_uint8* data) {
/* read bool flags */
flags = *data++;
part->fullbright = (flags >> 0) & 1;
part->firstPersonArm = (flags >> 1) & 1;
if (customModel->curPartIndex == customModel->numParts) {
/* we're the last part, so register our model */