mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 08:47:58 +03:00
commit
d6f35e6034
9 changed files with 337 additions and 15 deletions
|
@ -23,7 +23,7 @@
|
|||
#include "setup.h"
|
||||
|
||||
#include "motorbike.h"
|
||||
#include "cannon.h"
|
||||
#include "biggun.h"
|
||||
#include "quad.h"
|
||||
#include "snowmobile.h"
|
||||
#include "jeep.h"
|
||||
|
@ -446,6 +446,11 @@ void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
|||
// return;
|
||||
// break;
|
||||
|
||||
case ID_BIGGUN:
|
||||
if (BigGunControl(coll))
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
291
TR5Main/Objects/TR3/Vehicles/biggun.cpp
Normal file
291
TR5Main/Objects/TR3/Vehicles/biggun.cpp
Normal file
|
@ -0,0 +1,291 @@
|
|||
#include "framework.h"
|
||||
#include "biggun.h"
|
||||
#include "items.h"
|
||||
#include "level.h"
|
||||
#include "collide.h"
|
||||
#include "input.h"
|
||||
#include "lara.h"
|
||||
#include "laraflar.h"
|
||||
#include "sound.h"
|
||||
#include "sphere.h"
|
||||
#include "effect2.h"
|
||||
#include "lara_struct.h"
|
||||
#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)
|
||||
{
|
||||
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;
|
||||
|
||||
GetLaraJointPosition(&jointPos, LM_RHAND);
|
||||
|
||||
int x, y, z;
|
||||
item->pos.xPos = x = jointPos.x;
|
||||
item->pos.yPos = y = jointPos.y;
|
||||
item->pos.zPos = z = jointPos.z;
|
||||
|
||||
jointPos.x = 0;
|
||||
jointPos.y = 180 + 1024;
|
||||
jointPos.z = 0;
|
||||
|
||||
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);
|
||||
|
||||
SoundEffect(SFX_EXPLOSION1, 0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int CanUseGun(ITEM_INFO *obj, ITEM_INFO *lara)
|
||||
{
|
||||
int dist;
|
||||
long x, z;
|
||||
|
||||
if ((!(TrInput & IN_ACTION))
|
||||
|| (Lara.gunStatus != LG_NO_ARMS)
|
||||
|| (lara->gravityStatus))
|
||||
return 0;
|
||||
|
||||
x = lara->pos.xPos - obj->pos.xPos;
|
||||
z = lara->pos.zPos - obj->pos.zPos;
|
||||
|
||||
dist = SQUARE(x) + SQUARE(z);
|
||||
|
||||
if (dist > 30000)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
void BigGunInitialise(short itemNum)
|
||||
{
|
||||
ITEM_INFO *obj;
|
||||
BIGGUNINFO *gun;
|
||||
|
||||
obj = &g_Level.Items[itemNum];
|
||||
|
||||
gun = (BIGGUNINFO*)malloc(sizeof(BIGGUNINFO));
|
||||
obj->data = malloc(sizeof(BIGGUNINFO));
|
||||
|
||||
gun->flags = 0;
|
||||
fireCount = 0;
|
||||
gun->yRot = 30;
|
||||
gun->yRot = 0;
|
||||
gun->startYRot = obj->pos.yRot;
|
||||
}
|
||||
|
||||
void BigGunCollision(short itemNum, ITEM_INFO* lara, COLL_INFO* coll)
|
||||
{
|
||||
ITEM_INFO* obj;
|
||||
BIGGUNINFO *gun;
|
||||
|
||||
if (lara->hitPoints <= 0 || Lara.Vehicle != NO_ITEM)
|
||||
return;
|
||||
|
||||
obj = &g_Level.Items[itemNum];
|
||||
|
||||
if (CanUseGun(obj, lara))
|
||||
{
|
||||
Lara.Vehicle = itemNum;
|
||||
|
||||
if (Lara.gunType == WEAPON_FLARE)
|
||||
{
|
||||
CreateFlare(ID_FLARE_ITEM, 0);
|
||||
undraw_flare_meshes();
|
||||
Lara.flareControlLeft = false;
|
||||
Lara.requestGunType = WEAPON_NONE;
|
||||
Lara.gunType = WEAPON_NONE;
|
||||
}
|
||||
|
||||
Lara.gunStatus = LG_HANDS_BUSY;
|
||||
|
||||
lara->pos.xPos = obj->pos.xPos;
|
||||
lara->pos.xRot = obj->pos.xRot;
|
||||
lara->pos.yPos = obj->pos.yPos;
|
||||
lara->pos.yRot = obj->pos.yRot;
|
||||
lara->pos.zPos = obj->pos.zPos;
|
||||
lara->pos.zRot = obj->pos.zRot;
|
||||
|
||||
lara->animNumber = Objects[ID_BIGGUN_ANIMS].animIndex + 0;
|
||||
lara->frameNumber = g_Level.Anims[Objects[ID_BIGGUN_ANIMS].animIndex].frameBase;
|
||||
lara->currentAnimState = 0;
|
||||
lara->goalAnimState = 0;
|
||||
|
||||
gun = (BIGGUNINFO*)obj->data;
|
||||
gun->flags = 0;
|
||||
gun->xRot = 30;
|
||||
|
||||
}
|
||||
else
|
||||
ObjectCollision(itemNum, lara, coll);
|
||||
}
|
||||
|
||||
int BigGunControl(COLL_INFO *coll)
|
||||
{
|
||||
BIGGUNINFO *gun;
|
||||
ITEM_INFO *obj;
|
||||
ITEM_INFO *lara;
|
||||
|
||||
lara = LaraItem;
|
||||
obj = &g_Level.Items[Lara.Vehicle];
|
||||
gun = (BIGGUNINFO *)obj->data;
|
||||
|
||||
if (gun->flags & 1)
|
||||
{
|
||||
if ((lara->hitPoints <= 0) || (TrInput & IN_ROLL))
|
||||
{
|
||||
gun->flags = 2;
|
||||
}
|
||||
else if ((TrInput & IN_ACTION) && fireCount == 0)
|
||||
{
|
||||
FireBigGun(obj);
|
||||
fireCount = 26;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TrInput & IN_LEFT)
|
||||
{
|
||||
if (GunRotYAdd > 0)
|
||||
GunRotYAdd--;// >>= 1;
|
||||
|
||||
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)
|
||||
gun->xRot++;
|
||||
else if (gun->xRot > 30)
|
||||
gun->xRot--;
|
||||
else
|
||||
{
|
||||
lara->animNumber = Objects[ID_BIGGUN_ANIMS].animIndex + 1;
|
||||
lara->frameNumber = g_Level.Anims[Objects[ID_BIGGUN_ANIMS].animIndex].frameBase;
|
||||
lara->currentAnimState = 1;
|
||||
lara->goalAnimState = 1;
|
||||
gun->flags = 4;
|
||||
}
|
||||
}
|
||||
|
||||
switch (lara->currentAnimState)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
AnimateItem(lara);
|
||||
obj->animNumber = Objects[ID_BIGGUN].animIndex + (lara->animNumber - Objects[ID_BIGGUN_ANIMS].animIndex);
|
||||
obj->frameNumber = g_Level.Anims[obj->animNumber].frameBase + (lara->frameNumber - g_Level.Anims[lara->animNumber].frameBase);
|
||||
|
||||
if ((gun->flags & 4) && lara->frameNumber == g_Level.Anims[lara->animNumber].frameEnd)
|
||||
{
|
||||
lara->animNumber = LA_STAND_SOLID;
|
||||
lara->frameNumber = g_Level.Anims[lara->animNumber].frameBase;
|
||||
lara->currentAnimState = LS_STOP;
|
||||
lara->goalAnimState = LS_STOP;
|
||||
Lara.Vehicle = NO_ITEM;
|
||||
Lara.gunStatus = LG_NO_ARMS;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
lara->animNumber = Objects[ID_BIGGUN_ANIMS].animIndex + 2;
|
||||
lara->frameNumber = g_Level.Anims[Objects[ID_BIGGUN].animIndex + 2].frameBase + gun->xRot;
|
||||
|
||||
obj->animNumber = Objects[ID_BIGGUN].animIndex + (lara->animNumber - Objects[ID_BIGGUN_ANIMS].animIndex);
|
||||
obj->frameNumber = g_Level.Anims[obj->animNumber].frameBase + (lara->frameNumber - g_Level.Anims[lara->animNumber].frameBase);
|
||||
|
||||
if (fireCount)
|
||||
fireCount--;
|
||||
|
||||
gun->flags = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
lara->pos.yRot = gun->startYRot + (gun->yRot * (ANGLE(1) >> 2));
|
||||
obj->pos.yRot = gun->startYRot + (gun->yRot * (ANGLE(1) >> 2));
|
||||
|
||||
coll->enableSpaz = false;
|
||||
coll->enableBaddiePush = false;
|
||||
LaraBaddieCollision(lara, coll);
|
||||
|
||||
Camera.targetElevation = -ANGLE(15);
|
||||
return 1;
|
||||
}
|
15
TR5Main/Objects/TR3/Vehicles/biggun.h
Normal file
15
TR5Main/Objects/TR3/Vehicles/biggun.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "lara_struct.h"
|
||||
|
||||
typedef struct {
|
||||
short xRot;
|
||||
short yRot;
|
||||
short startYRot;
|
||||
char flags;
|
||||
}BIGGUNINFO;
|
||||
void FireBigGun(ITEM_INFO *obj);
|
||||
void BigGunInitialise(short itemNum);
|
||||
static int CanUseGun(ITEM_INFO *obj, ITEM_INFO *lara);
|
||||
void BigGunInitialise(short itemNum);
|
||||
void BigGunCollision(short itemNum, ITEM_INFO* lara, COLL_INFO* coll);
|
||||
int BigGunControl(COLL_INFO *coll);
|
|
@ -1,2 +0,0 @@
|
|||
#include "framework.h"
|
||||
#include "cannon.h"
|
|
@ -1,2 +0,0 @@
|
|||
#pragma once
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
/// switch
|
||||
|
||||
/// vehicles
|
||||
#include "cannon.h"
|
||||
#include "biggun.h"
|
||||
#include "kayak.h"
|
||||
#include "minecart.h"
|
||||
#include "quad.h"
|
||||
|
@ -392,6 +392,18 @@ static void StartVehicles(OBJECT_INFO* obj)
|
|||
obj->saveFlags = true;
|
||||
obj->savePosition = true;
|
||||
}
|
||||
|
||||
obj = &Objects[ID_BIGGUN];
|
||||
if (obj->loaded)
|
||||
{
|
||||
obj->initialise = BigGunInitialise;
|
||||
obj->collision = BigGunCollision;
|
||||
// obj->draw_routine = BigGunDraw;
|
||||
obj->savePosition = 1;
|
||||
obj->saveFlags = 1;
|
||||
obj->saveAnim = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void StartProjectiles(OBJECT_INFO* obj)
|
||||
|
|
|
@ -61,6 +61,9 @@ typedef enum GAME_OBJECT_ID
|
|||
ID_MOTORBIKE,
|
||||
ID_RUBBER_BOAT_LARA_ANIMS,
|
||||
ID_RUBBER_BOAT_BOAT, // TR3 / (TR4 TRNG)
|
||||
ID_BIGGUN_ANIMS,
|
||||
ID_BIGGUN, // TR3
|
||||
|
||||
|
||||
ID_VEHICLE_SMASHABLE_FLOOR = 90, // NEW
|
||||
ID_VEHICLE_SMASHABLE_WALL, // NEW
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<ProjectGuid>{15AB0220-541C-4DA1-94EB-ED3C47E4582E}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>TR5Main</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
|
@ -314,7 +314,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClInclude Include="Objects\TR4\tr4_objects.h" />
|
||||
<ClInclude Include="Objects\TR5\tr5_objects.h" />
|
||||
<ClInclude Include="Objects\TR2\Vehicles\boat.h" />
|
||||
<ClInclude Include="Objects\TR3\Vehicles\cannon.h" />
|
||||
<ClInclude Include="Objects\TR3\Vehicles\biggun.h" />
|
||||
<ClInclude Include="Objects\TR4\Vehicles\jeep.h" />
|
||||
<ClInclude Include="Objects\TR3\Vehicles\kayak.h" />
|
||||
<ClInclude Include="Objects\TR3\Vehicles\minecart.h" />
|
||||
|
@ -534,7 +534,7 @@ xcopy /Y "$(ProjectDir)Scripting\Scripts\*.lua" "$(TargetDir)\Scripts"</Command>
|
|||
<ClCompile Include="Objects\TR3\Entity\tr3_shiva.cpp" />
|
||||
<ClCompile Include="Objects\TR2\Entity\tr2_worker_shotgun.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Entity\tr4_horseman.cpp" />
|
||||
<ClCompile Include="Objects\TR3\Vehicles\cannon.cpp" />
|
||||
<ClCompile Include="Objects\TR3\Vehicles\biggun.cpp" />
|
||||
<ClCompile Include="Objects\TR4\Vehicles\jeep.cpp" />
|
||||
<ClCompile Include="Objects\TR3\Vehicles\kayak.cpp" />
|
||||
<ClCompile Include="Objects\TR2\Entity\tr2_knifethrower.cpp" />
|
||||
|
|
|
@ -414,9 +414,6 @@
|
|||
<ClInclude Include="Objects\TR2\Trap\tr2_spinningblade.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Objects\TR3\Vehicles\cannon.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Objects\TR3\Vehicles\kayak.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
|
@ -879,6 +876,9 @@
|
|||
<ClInclude Include="Objects\TR4\Object\tr4_element_puzzle.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Objects\TR3\Vehicles\biggun.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Game\box.cpp">
|
||||
|
@ -1376,9 +1376,6 @@
|
|||
<ClCompile Include="Objects\TR2\Trap\tr2_spinningblade.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Objects\TR3\Vehicles\cannon.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Objects\TR3\Vehicles\kayak.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1604,6 +1601,9 @@
|
|||
<ClCompile Include="Objects\TR4\Object\tr4_element_puzzle.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Objects\TR3\Vehicles\biggun.cpp">
|
||||
<Filter>File di origine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue