mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-07 13:46:45 +02:00
#368 GBA fix free camera mode in combat mode, fix ammo shells consumption for shotgun
This commit is contained in:
@@ -482,6 +482,9 @@ struct Camera
|
|||||||
|
|
||||||
void toCombat()
|
void toCombat()
|
||||||
{
|
{
|
||||||
|
if (mode == CAMERA_MODE_FREE)
|
||||||
|
return;
|
||||||
|
|
||||||
if (mode == CAMERA_MODE_CUTSCENE)
|
if (mode == CAMERA_MODE_CUTSCENE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -3003,7 +3003,7 @@ struct Lara : Item
|
|||||||
pos.z += (c * ((phd_cos(angle.y) * vSpeed) >> 16)) >> FIXED_SHIFT;
|
pos.z += (c * ((phd_cos(angle.y) * vSpeed) >> 16)) >> FIXED_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool weaponShoot(const ExtraInfoLara::Arm* arm)
|
bool weaponFire(const ExtraInfoLara::Arm* arm)
|
||||||
{
|
{
|
||||||
int16 ammo = extraL->ammo[extraL->weapon];
|
int16 ammo = extraL->ammo[extraL->weapon];
|
||||||
|
|
||||||
@@ -3025,6 +3025,10 @@ struct Lara : Item
|
|||||||
from.pos.z = pos.z;
|
from.pos.z = pos.z;
|
||||||
from.room = room;
|
from.room = room;
|
||||||
|
|
||||||
|
int32 count = (extraL->weapon == WEAPON_SHOTGUN) ? 6 : 1;
|
||||||
|
|
||||||
|
for (int32 i = 0; i < count; i++)
|
||||||
|
{
|
||||||
int32 aimX = int32(rand_logic() - 0x4000) * params.spread >> 16;
|
int32 aimX = int32(rand_logic() - 0x4000) * params.spread >> 16;
|
||||||
int32 aimY = int32(rand_logic() - 0x4000) * params.spread >> 16;
|
int32 aimY = int32(rand_logic() - 0x4000) * params.spread >> 16;
|
||||||
|
|
||||||
@@ -3071,9 +3075,10 @@ struct Lara : Item
|
|||||||
|
|
||||||
if (minDist != INT_MAX)
|
if (minDist != INT_MAX)
|
||||||
{
|
{
|
||||||
to.pos.x += dir.x * minDist >> FIXED_SHIFT;
|
dir *= minDist;
|
||||||
to.pos.y += dir.y * minDist >> FIXED_SHIFT;
|
to.pos.x += dir.x >> FIXED_SHIFT;
|
||||||
to.pos.z += dir.z * minDist >> FIXED_SHIFT;
|
to.pos.y += dir.y >> FIXED_SHIFT;
|
||||||
|
to.pos.z += dir.z >> FIXED_SHIFT;
|
||||||
|
|
||||||
arm->target->hit(params.damage, to.pos, 0);
|
arm->target->hit(params.damage, to.pos, 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -3082,6 +3087,9 @@ struct Lara : Item
|
|||||||
trace(from, to);
|
trace(from, to);
|
||||||
fxRicochet(to.room, to.pos, true);
|
fxRicochet(to.room, to.pos, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
soundPlay(params.soundId, pos);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3330,8 +3338,6 @@ struct Lara : Item
|
|||||||
H.y = T.y = aY >> 1;
|
H.y = T.y = aY >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shotFlag = false;
|
|
||||||
|
|
||||||
const WeaponParams ¶ms = weaponParams[extraL->weapon];
|
const WeaponParams ¶ms = weaponParams[extraL->weapon];
|
||||||
|
|
||||||
for (int32 i = 0; i < LARA_ARM_MAX; i++)
|
for (int32 i = 0; i < LARA_ARM_MAX; i++)
|
||||||
@@ -3349,7 +3355,7 @@ struct Lara : Item
|
|||||||
{
|
{
|
||||||
if (frame == animLength)
|
if (frame == animLength)
|
||||||
{
|
{
|
||||||
if ((input & IN_ACTION) && weaponShoot(arm))
|
if ((input & IN_ACTION) && weaponFire(arm))
|
||||||
{
|
{
|
||||||
anim = ANIM_PISTOLS_FIRE;
|
anim = ANIM_PISTOLS_FIRE;
|
||||||
frame = 0;
|
frame = 0;
|
||||||
@@ -3358,12 +3364,6 @@ struct Lara : Item
|
|||||||
arm->flash.angle = int16(rand_draw() << 1);
|
arm->flash.angle = int16(rand_draw() << 1);
|
||||||
arm->flash.offset = params.flashOffset;
|
arm->flash.offset = params.flashOffset;
|
||||||
arm->flash.intensity = params.flashIntensity << 8;
|
arm->flash.intensity = params.flashIntensity << 8;
|
||||||
|
|
||||||
if (!shotFlag) // skip sound replay if double shoot
|
|
||||||
{
|
|
||||||
shotFlag = true;
|
|
||||||
soundPlay(params.soundId, pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
frame++;
|
frame++;
|
||||||
@@ -3454,20 +3454,10 @@ struct Lara : Item
|
|||||||
{
|
{
|
||||||
if (frame == animLength)
|
if (frame == animLength)
|
||||||
{
|
{
|
||||||
if (input & IN_ACTION)
|
if ((input & IN_ACTION) && weaponFire(arm))
|
||||||
{
|
{
|
||||||
frame = 1;
|
frame = 1;
|
||||||
anim = ANIM_SHOTGUN_FIRE;
|
anim = ANIM_SHOTGUN_FIRE;
|
||||||
|
|
||||||
for (int32 i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
if (!weaponShoot(arm))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == 5) {
|
|
||||||
soundPlay(params.soundId, pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
frame++;
|
frame++;
|
||||||
@@ -3697,7 +3687,6 @@ struct Lara : Item
|
|||||||
case WEAPON_STATE_READY:
|
case WEAPON_STATE_READY:
|
||||||
{
|
{
|
||||||
gCamera->toCombat();
|
gCamera->toCombat();
|
||||||
|
|
||||||
weaponUpdateTargets();
|
weaponUpdateTargets();
|
||||||
|
|
||||||
if (extraL->weapon < WEAPON_SHOTGUN) {
|
if (extraL->weapon < WEAPON_SHOTGUN) {
|
||||||
|
Reference in New Issue
Block a user