This commit is contained in:
Montagna Marco 2020-09-12 07:54:20 +02:00
commit 00f59d9517
2 changed files with 93 additions and 131 deletions

View file

@ -13,59 +13,49 @@
#include "tomb4fx.h"
#include "draw.h"
static long GunRotYAdd = 0;
int fireCount = 0;
void FireBigGun(ITEM_INFO *obj)
{
Lara.hasFired = true;
short itemNumber = CreateItem();
if (itemNumber != NO_ITEM)
{
BIGGUNINFO *gun = (BIGGUNINFO*)obj->data;
ITEM_INFO* item = &g_Level.Items[itemNumber];
item->objectNumber = ID_ROCKET;
item->roomNumber = LaraItem->roomNumber;
PHD_VECTOR jointPos;
jointPos.x = Lara.torsoXrot;
jointPos.y = Lara.torsoYrot + 1300;
jointPos.z = Lara.torsoZrot;
PHD_VECTOR pos;
pos.x = 0;
pos.y = 0;
pos.z = 520;
GetLaraJointPosition(&jointPos, LM_RHAND);
GetJointAbsPosition(obj, &pos, 2);
int x, y, z;
item->pos.xPos = x = jointPos.x;
item->pos.yPos = y = jointPos.y;
item->pos.zPos = z = jointPos.z;
item->pos.xPos = pos.x;
item->pos.yPos = pos.y;
item->pos.zPos = pos.z;
jointPos.x = 0;
jointPos.y = 180 + 1024;
jointPos.z = 0;
InitialiseItem(itemNumber);
item->pos.xRot = -((gun->xRot - 32) * (ANGLE(1)));
item->pos.yRot = obj->pos.yRot;
item->pos.zRot = 0;
item->speed = 512 >> 5;
item->itemFlags[0] = 1;
AddActiveItem(itemNumber);
SmokeCountL = 32;
SmokeWeapon = WEAPON_ROCKET_LAUNCHER;
for (int i = 0; i < 5; i++)
TriggerGunSmoke(x, y, z, jointPos.x - x, jointPos.y - y, jointPos.z - z, 1, WEAPON_ROCKET_LAUNCHER, 32);
InitialiseItem(itemNumber);
item->pos.xRot = LaraItem->pos.xRot + Lara.leftArm.xRot;
item->pos.yRot = LaraItem->pos.yRot + Lara.leftArm.yRot;
item->pos.zRot = 0;
if (!Lara.leftArm.lock)
{
item->pos.xRot += Lara.torsoXrot;
item->pos.yRot += Lara.torsoYrot;
}
item->speed = 512 >> 5;
item->itemFlags[0] = 0;
AddActiveItem(itemNumber);
TriggerGunSmoke(pos.x, pos.y, pos.z, 0, 0, 0, 1, WEAPON_ROCKET_LAUNCHER, 32);
SoundEffect(SFX_EXPLOSION1, 0, 0);
}
@ -180,57 +170,18 @@ int BigGunControl(COLL_INFO *coll)
else
{
if (TrInput & IN_LEFT)
{
if (GunRotYAdd > 0)
GunRotYAdd--;// >>= 1;
gun->yRot -= 8;
else
if (TrInput & IN_RIGHT)
gun->yRot += 8;
GunRotYAdd -= 16;
if (GunRotYAdd < -64)
GunRotYAdd = -64;
if (((Wibble & 7) == 0) && (abs(gun->yRot) < 544))
SoundEffect(SFX_TR3_LARA_UZI_STOP, &obj->pos, NULL);
}
else if (TrInput & IN_RIGHT)
{
if (GunRotYAdd < 0)
GunRotYAdd++;// >>= 1;
GunRotYAdd += 16;
if (GunRotYAdd < 64)
GunRotYAdd = 64;
if (((Wibble & 7) == 0) && (abs(gun->yRot) < (136 << 2)))
SoundEffect(SFX_TR3_LARA_UZI_STOP, &obj->pos, NULL);
}
else
{
// GunRotYAdd -= GunRotYAdd >> 2;
if (abs(GunRotYAdd) < 16)
GunRotYAdd = 0;
}
gun->yRot = GunRotYAdd >> 2;
if (gun->yRot < -(136 << 2))
{
gun->yRot = -(136 << 2);
GunRotYAdd = 0;
}
else if (gun->yRot > (136 << 2))
{
gun->yRot = (136 << 2);
GunRotYAdd = 0;
}
if ((TrInput & IN_FORWARD) && (gun->xRot < 59))
gun->xRot++;
else if ((TrInput & IN_BACK) && (gun->xRot))
gun->xRot--;
}
}
if (gun->flags & 2)
{
if (gun->xRot < 30)
@ -240,7 +191,7 @@ int BigGunControl(COLL_INFO *coll)
else
{
lara->animNumber = Objects[ID_BIGGUN_ANIMS].animIndex + 1;
lara->frameNumber = g_Level.Anims[Objects[ID_BIGGUN_ANIMS].animIndex].frameBase;
lara->frameNumber = g_Level.Anims[Objects[ID_BIGGUN_ANIMS].animIndex + 1].frameBase;
lara->currentAnimState = 1;
lara->goalAnimState = 1;
gun->flags = 4;

View file

@ -150,9 +150,9 @@ static void QuadbikeExplode(ITEM_INFO* item)
for (int i = 0; i < 3; i++)
TriggerExplosionSparks(item->pos.xPos, item->pos.yPos, item->pos.zPos, 3, -1, 0, item->roomNumber);
}
TriggerShockwave(&PHD_3DPOS(item->pos.xPos, item->pos.yPos - 128, item->pos.zPos, 0, item->pos.yRot, 0), 50, 180, 40, 160, 60, 60, 64, ANGLE(45), 0);
ExplodingDeath(Lara.Vehicle, 0xfffffffe, 1);
KillItem(Lara.Vehicle);
// KillItem(Lara.Vehicle);
item->status = ITEM_DEACTIVATED;
SoundEffect(SFX_EXPLOSION1, NULL, 0);
@ -203,60 +203,69 @@ static int QuadCheckGetOff()
if (((LaraItem->currentAnimState == 10) || (LaraItem->currentAnimState == 24)) && (LaraItem->frameNumber == g_Level.Anims[LaraItem->animNumber].frameEnd))
{
if (LaraItem->currentAnimState == QUAD_STATE_GETOFFL)
LaraItem->pos.yRot += ANGLE(90);
else
LaraItem->pos.yRot -= ANGLE(90);
ITEM_INFO* item = &g_Level.Items[Lara.Vehicle];
LaraItem->animNumber = LA_STAND_SOLID;
LaraItem->frameNumber = GF(LaraItem->animNumber, 0);
LaraItem->currentAnimState = LaraItem->goalAnimState = LS_STOP;
LaraItem->pos.xPos -= GETOFF_DISTANCE * phd_sin(LaraItem->pos.yRot) >> W2V_SHIFT;
LaraItem->pos.zPos -= GETOFF_DISTANCE * phd_cos(LaraItem->pos.yRot) >> W2V_SHIFT;
LaraItem->pos.xRot = LaraItem->pos.zRot = 0;
Lara.Vehicle = NO_ITEM;
Lara.gunStatus = LG_NO_ARMS;
}
else if (LaraItem->frameNumber == g_Level.Anims[LaraItem->animNumber].frameEnd)
{
QUAD_INFO* quad;
quad = (QUAD_INFO *)item->data;
if (LaraItem->currentAnimState == QUAD_STATE_FALLOFF)
if (((LaraItem->currentAnimState == 10) || (LaraItem->currentAnimState == 24)) && (LaraItem->frameNumber == g_Level.Anims[LaraItem->animNumber].frameEnd))
{
PHD_VECTOR pos = { 0, 0, 0 };
if (LaraItem->currentAnimState == QUAD_STATE_GETOFFL)
LaraItem->pos.yRot += ANGLE(90);
else
LaraItem->pos.yRot -= ANGLE(90);
LaraItem->animNumber = LA_FREEFALL;
LaraItem->frameNumber = GF(LA_FREEFALL, 0);
LaraItem->currentAnimState = LS_FREEFALL;
GetJointAbsPosition(LaraItem, &pos, LM_HIPS);
LaraItem->pos.xPos = pos.x;
LaraItem->pos.yPos = pos.y;
LaraItem->pos.zPos = pos.z;
LaraItem->fallspeed = item->fallspeed;
LaraItem->gravityStatus = true;
LaraItem->pos.xRot = 0;
LaraItem->pos.zRot = 0;
LaraItem->hitPoints = 0;
LaraItem->animNumber = LA_STAND_SOLID;
LaraItem->frameNumber = GF(LaraItem->animNumber, 0);
LaraItem->currentAnimState = LaraItem->goalAnimState = LS_STOP;
LaraItem->pos.xPos -= GETOFF_DISTANCE * phd_sin(LaraItem->pos.yRot) >> W2V_SHIFT;
LaraItem->pos.zPos -= GETOFF_DISTANCE * phd_cos(LaraItem->pos.yRot) >> W2V_SHIFT;
LaraItem->pos.xRot = LaraItem->pos.zRot = 0;
Lara.Vehicle = NO_ITEM;
Lara.gunStatus = LG_NO_ARMS;
item->flags |= ONESHOT;
return false;
}
else if (LaraItem->currentAnimState == QUAD_STATE_FALLDEATH)
else if (LaraItem->frameNumber == g_Level.Anims[LaraItem->animNumber].frameEnd)
{
LaraItem->goalAnimState = LS_DEATH;
LaraItem->fallspeed = DAMAGE_START + DAMAGE_LENGTH;
LaraItem->speed = 0;
quad->flags |= QUAD_FLAGS_DEAD;
QUAD_INFO* quad;
return false;
quad = (QUAD_INFO *)item->data;
if (LaraItem->currentAnimState == QUAD_STATE_FALLOFF)
{
PHD_VECTOR pos = { 0, 0, 0 };
LaraItem->animNumber = LA_FREEFALL;
LaraItem->frameNumber = GF(LA_FREEFALL, 0);
LaraItem->currentAnimState = LS_FREEFALL;
GetJointAbsPosition(LaraItem, &pos, LM_HIPS);
LaraItem->pos.xPos = pos.x;
LaraItem->pos.yPos = pos.y;
LaraItem->pos.zPos = pos.z;
LaraItem->fallspeed = item->fallspeed;
LaraItem->gravityStatus = true;
LaraItem->pos.xRot = 0;
LaraItem->pos.zRot = 0;
LaraItem->hitPoints = 0;
Lara.gunStatus = LG_NO_ARMS;
item->flags |= ONESHOT;
return false;
}
else if (LaraItem->currentAnimState == QUAD_STATE_FALLDEATH)
{
LaraItem->goalAnimState = LS_DEATH;
LaraItem->fallspeed = DAMAGE_START + DAMAGE_LENGTH;
LaraItem->speed = 0;
quad->flags |= QUAD_FLAGS_DEAD;
return false;
}
}
}
return true;
return true;
}
else
{
return true;
}
}
static int GetOnQuadBike(short itemNumber, COLL_INFO* coll)
@ -925,6 +934,8 @@ static void AnimateQuadBike(ITEM_INFO* item, int collide, int dead)
if (g_Level.Rooms[item->roomNumber].flags & (ENV_FLAG_WATER | ENV_FLAG_SWAMP))
{
LaraItem->goalAnimState = QUAD_STATE_FALLOFF;
LaraItem->pos.yPos = item->pos.yPos + 700;
LaraItem->roomNumber = item->roomNumber;
LaraItem->hitPoints = 0;
QuadbikeExplode(item);
}
@ -938,12 +949,12 @@ static int QuadUserControl(ITEM_INFO* item, int height, int* pitch)
QUAD_INFO* quad = (QUAD_INFO *)item->data;
if (!quad->velocity && !(TrInput & IN_DUCK) && !QuadCanHandbrakeStart)
if (!quad->velocity && !(TrInput & (IN_DUCK | IN_SPRINT)) && !QuadCanHandbrakeStart)
QuadCanHandbrakeStart = true;
else if (quad->velocity)
QuadCanHandbrakeStart = false;
if (!(TrInput & IN_DUCK))
if (!(TrInput & (IN_DUCK | IN_SPRINT)))
QuadHandbrakeStarting = false;
if (!QuadHandbrakeStarting)
@ -964,7 +975,7 @@ static int QuadUserControl(ITEM_INFO* item, int height, int* pitch)
if (quad->velocity > 0)
{
if ((TrInput & IN_DUCK) && !QuadHandbrakeStarting && quad->velocity > MIN_HANDBRAKE_SPEED)
if ((TrInput & (IN_DUCK | IN_SPRINT)) && !QuadHandbrakeStarting && quad->velocity > MIN_HANDBRAKE_SPEED)
{
if (TrInput & IN_LEFT)
{
@ -997,7 +1008,7 @@ static int QuadUserControl(ITEM_INFO* item, int height, int* pitch)
}
else if (quad->velocity < 0)
{
if ((TrInput & IN_DUCK) && !QuadHandbrakeStarting && quad->velocity < -MIN_HANDBRAKE_SPEED + 0x800)
if ((TrInput & (IN_DUCK | IN_SPRINT)) && !QuadHandbrakeStarting && quad->velocity < -MIN_HANDBRAKE_SPEED + 0x800)
{
if (TrInput & IN_RIGHT)
{
@ -1031,7 +1042,7 @@ static int QuadUserControl(ITEM_INFO* item, int height, int* pitch)
if (TrInput & IN_JUMP)
{
if ((TrInput & IN_DUCK) && (QuadCanHandbrakeStart || QuadHandbrakeStarting))
if ((TrInput & (IN_DUCK|IN_SPRINT)) && (QuadCanHandbrakeStart || QuadHandbrakeStarting))
{
QuadHandbrakeStarting = true;
quad->revs -= 0x200;
@ -1051,7 +1062,7 @@ static int QuadUserControl(ITEM_INFO* item, int height, int* pitch)
else if (TrInput & IN_ACTION)
{
if ((TrInput & IN_DUCK) && (QuadCanHandbrakeStart || QuadHandbrakeStarting))
if ((TrInput & (IN_DUCK | IN_SPRINT)) && (QuadCanHandbrakeStart || QuadHandbrakeStarting))
{
QuadHandbrakeStarting = true;
quad->revs += 0x200;