1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 16:44:50 +02:00

#368 GBA fix shotgun

This commit is contained in:
XProger
2021-07-31 07:55:21 +03:00
parent b5e52c836d
commit 78e5947e43
2 changed files with 27 additions and 21 deletions

View File

@@ -363,8 +363,8 @@ void drawLaraNodes(const Item* lara, const AnimFrame* frameA)
node++; node++;
if (arm->useBasis) { // hands are rotated relative to the basis if (arm->useBasis) { // hands are rotated relative to the basis
matrixSetBasis(matrixGet(), basis); matrixSetBasis(matrixGet(), basis);
}
matrixRotateYXZ(arm->angle.x, arm->angle.y, arm->angle.z); matrixRotateYXZ(arm->angle.x, arm->angle.y, arm->angle.z);
}
matrixFrame(vec3s(0, 0, 0), anglesArm[i]++); matrixFrame(vec3s(0, 0, 0), anglesArm[i]++);
drawMesh(*mesh++); drawMesh(*mesh++);
@@ -495,8 +495,8 @@ void drawLaraNodesLerp(const Item* lara, const AnimFrame* frameA, const AnimFram
node++; node++;
if (arm->useBasis) { // hands are rotated relative to the basis if (arm->useBasis) { // hands are rotated relative to the basis
matrixSetBasis(matrixGet(), basis); matrixSetBasis(matrixGet(), basis);
}
matrixRotateYXZ(arm->angle.x, arm->angle.y, arm->angle.z); matrixRotateYXZ(arm->angle.x, arm->angle.y, arm->angle.z);
}
bool useLerp = frameRateArm[i] > 1; // armed hands always use frameRate == 1 (i.e. useLerp == false) bool useLerp = frameRateArm[i] > 1; // armed hands always use frameRate == 1 (i.e. useLerp == false)

View File

@@ -215,11 +215,11 @@ const WeaponParams weaponParams[WEAPON_MAX] = {
0, // flashOffset 0, // flashOffset
0, // flashTimer 0, // flashTimer
0, // flashIntensity 0, // flashIntensity
ANGLE(60), // aimX ANGLE(55), // aimX
ANGLE(60), // aimY ANGLE(60), // aimY
ANGLE(80), // armX ANGLE(65), // armX
ANGLE(-60), // armMinY ANGLE(-80), // armMinY
ANGLE(170), // armMaxY ANGLE(80), // armMaxY
}, },
}; };
@@ -3397,6 +3397,8 @@ struct Lara : Item
void weaponUpdateShotgun() void weaponUpdateShotgun()
{ {
ExtraInfoLara::Arm &R = extraL->armR; ExtraInfoLara::Arm &R = extraL->armR;
ExtraInfoLara::Arm &L = extraL->armL;
vec3s &H = extraL->head.angle; vec3s &H = extraL->head.angle;
vec3s &T = extraL->torso.angle; vec3s &T = extraL->torso.angle;
@@ -3404,8 +3406,8 @@ struct Lara : Item
if (R.aim) if (R.aim)
{ {
T.x = R.angle.x >> 1; T.x = R.angle.x;
T.y = R.angle.y >> 1; T.y = R.angle.y;
H.x = H.y = 0; H.x = H.y = 0;
} }
@@ -3439,7 +3441,8 @@ struct Lara : Item
} }
case ANIM_SHOTGUN_DRAW: case ANIM_SHOTGUN_DRAW:
{ {
if ((input & IN_ACTION) || arm->aim) { if (((input & IN_ACTION) && !arm->target) || arm->aim)
{
anim = ANIM_SHOTGUN_AIM; anim = ANIM_SHOTGUN_AIM;
frame = 1; frame = 1;
} }
@@ -3447,9 +3450,11 @@ struct Lara : Item
} }
case ANIM_SHOTGUN_AIM: case ANIM_SHOTGUN_AIM:
{ {
if ((input & IN_ACTION) || arm->aim) if (((input & IN_ACTION) && !arm->target) || arm->aim)
{ {
if (frame == animLength) if (frame == animLength)
{
if (input & IN_ACTION)
{ {
frame = 1; frame = 1;
anim = ANIM_SHOTGUN_FIRE; anim = ANIM_SHOTGUN_FIRE;
@@ -3463,6 +3468,7 @@ struct Lara : Item
soundPlay(params.soundId, pos); soundPlay(params.soundId, pos);
} }
} }
}
} else { } else {
frame++; frame++;
} }
@@ -3480,9 +3486,9 @@ struct Lara : Item
} }
} }
extraL->armR.angle = extraL->armL.angle = vec3s(0, 0, 0); R.useBasis = L.useBasis = false;
extraL->armR.animIndex = extraL->armL.animIndex = anim + models[params.animType].animIndex; R.animIndex = L.animIndex = anim + models[params.animType].animIndex;
extraL->armR.frameIndex = extraL->armL.frameIndex = frame; R.frameIndex = L.frameIndex = frame;
} }
void weaponUpdateState() void weaponUpdateState()