2018-08-19 09:46:58 +02:00
|
|
|
#include "inventory.h"
|
|
|
|
#include "draw.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "larafire.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "gameflow.h"
|
2018-08-24 23:36:49 +02:00
|
|
|
#include "sound.h"
|
2018-09-03 21:08:40 +02:00
|
|
|
#include "savegame.h"
|
2019-11-21 07:43:34 +01:00
|
|
|
#include "Lara.h"
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
#include "..\Global\global.h"
|
|
|
|
#include "..\Specific\input.h"
|
2019-05-08 21:11:18 +02:00
|
|
|
#include "..\Specific\configuration.h"
|
2019-04-26 15:10:32 +02:00
|
|
|
#include "lara1gun.h"
|
|
|
|
#include "lara2gun.h"
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
Inventory* g_Inventory;
|
2018-09-22 23:54:36 +02:00
|
|
|
extern GameFlow* g_GameFlow;
|
2018-11-01 22:45:59 +01:00
|
|
|
extern LaraExtraInfo g_LaraExtra;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle1(int action)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[0] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[0] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 0);
|
|
|
|
}
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle2(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[1] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 2));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[1] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 2);
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle3(int action)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[2] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 4));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[2] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle4(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[3] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 6));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[3] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle5(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[4] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 8));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[4] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle6(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[5] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 10));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[5] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle7(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[6] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 12));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[6] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePuzzle8(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[7] = true;
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 14));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.puzzleItems[7] = false;
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 14);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey1(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1<<0);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 0);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey2(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 1);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 2));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 1);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey3(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 2);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 4));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 2);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 4);
|
|
|
|
}
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey4(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 3);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 6));
|
|
|
|
}
|
|
|
|
else
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
Lara.keyItems &= ~(1 << 3);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 6);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey5(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 4);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 8));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 4);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey6(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 5);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 10));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 5);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey7(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 6);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 12));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 6);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineKey8(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.keyItems |= (1 << 7);
|
|
|
|
Lara.puzzleItemsCombo &= (~(3 << 14));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.keyItems &= ~(1 << 7);
|
|
|
|
Lara.puzzleItemsCombo |= (3 << 14);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePickup1(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.pickupItems |= (1 << 0);
|
|
|
|
Lara.pickupItemsCombo &= (~(3 << 0));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.pickupItems &= ~(1 << 0);
|
|
|
|
Lara.pickupItemsCombo |= (3 << 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePickup2(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.pickupItems |= (1 << 1);
|
|
|
|
Lara.pickupItemsCombo &= (~(3 << 2));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.pickupItems &= ~(1 << 1);
|
|
|
|
Lara.pickupItemsCombo |= (3 << 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePickup3(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.pickupItems |= (1 << 2);
|
|
|
|
Lara.pickupItemsCombo &= (~(3 << 4));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.pickupItems &= ~(1 << 2);
|
|
|
|
Lara.pickupItemsCombo |= (3 << 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombinePickup4(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
|
|
|
Lara.pickupItems |= (1 << 3);
|
|
|
|
Lara.pickupItemsCombo &= (~(3 << 6));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.pickupItems &= ~(1 << 3);
|
|
|
|
Lara.pickupItemsCombo |= (3 << 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineRevolverLasersight(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
Lara.laserSight = false;
|
2019-04-26 15:10:32 +02:00
|
|
|
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
Lara.laserSight = true;
|
2019-04-26 15:10:32 +02:00
|
|
|
g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Lara.gunStatus && Lara.gunType == WEAPON_REVOLVER)
|
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
undraw_pistol_mesh_right(WEAPON_REVOLVER);
|
|
|
|
draw_pistol_meshes(WEAPON_REVOLVER);
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void CombineCrossbowLasersight(int action)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
if (action == INV_COMBINE_COMBINE)
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
Lara.laserSight = false;
|
2019-04-26 15:10:32 +02:00
|
|
|
g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
Lara.laserSight = true;
|
2019-04-26 15:10:32 +02:00
|
|
|
g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Lara.gunStatus && Lara.gunType == WEAPON_CROSSBOW)
|
|
|
|
{
|
2019-12-01 08:13:19 +01:00
|
|
|
undraw_shotgun_meshes(WEAPON_CROSSBOW);
|
|
|
|
draw_shotgun_meshes(WEAPON_CROSSBOW);
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Inject_Inventory()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Inventory::Inventory()
|
|
|
|
{
|
|
|
|
ZeroMemory(&m_objectsTable[0], sizeof(InventoryObjectDefinition) * INVENTORY_TABLE_SIZE);
|
|
|
|
|
|
|
|
// Create objects table
|
2019-05-08 21:11:18 +02:00
|
|
|
m_objectsTable[INV_OBJECT_UZIS] = InventoryObjectDefinition(ID_UZI_ITEM, STRING_UZI, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_PISTOLS] = InventoryObjectDefinition(ID_PISTOLS_ITEM, STRING_PISTOLS, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SHOTGUN] = InventoryObjectDefinition(ID_SHOTGUN_ITEM, STRING_SHOTGUN, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_REVOLVER] = InventoryObjectDefinition(ID_REVOLVER_ITEM, STRING_REVOLVER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_REVOLVER_LASER] = InventoryObjectDefinition(ID_REVOLVER_ITEM, STRING_REVOLVER_LASER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HK] = InventoryObjectDefinition(ID_HK_ITEM, STRING_HK, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SHOTGUN_AMMO1] = InventoryObjectDefinition(ID_SHOTGUN_AMMO1_ITEM, STRING_SHOTGUN_AMMO1, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SHOTGUN_AMMO2] = InventoryObjectDefinition(ID_SHOTGUN_AMMO2_ITEM, STRING_SHOTGUN_AMMO2, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HK_AMMO1] = InventoryObjectDefinition(ID_HK_AMMO_ITEM, STRING_HK_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_REVOLVER_AMMO] = InventoryObjectDefinition(ID_REVOLVER_AMMO_ITEM, STRING_REVOLVER_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_UZI_AMMO] = InventoryObjectDefinition(ID_UZI_AMMO_ITEM, STRING_UZI_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_PISTOLS_AMMO] = InventoryObjectDefinition(ID_PISTOLS_AMMO_ITEM, STRING_PISTOLS_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_LASERSIGHT] = InventoryObjectDefinition(ID_LASERSIGHT_ITEM, STRING_LASERSIGHT, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SILENCER] = InventoryObjectDefinition(ID_SILENCER_ITEM, STRING_SILENCER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_LARGE_MEDIPACK] = InventoryObjectDefinition(ID_BIGMEDI_ITEM, STRING_LARGE_MEDIPACK, -1, 0x8000);
|
|
|
|
m_objectsTable[INV_OBJECT_SMALL_MEDIPACK] = InventoryObjectDefinition(ID_SMALLMEDI_ITEM, STRING_SMALL_MEDIPACK, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_BINOCULARS] = InventoryObjectDefinition(ID_BINOCULARS_ITEM, STRING_BINOCULARS, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_FLARES] = InventoryObjectDefinition(ID_FLARE_INV_ITEM, STRING_FLARES, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_TIMEX] = InventoryObjectDefinition(ID_COMPASS_ITEM, STRING_TIMEX, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROWBAR] = InventoryObjectDefinition(ID_CROWBAR_ITEM, STRING_CROWBAR, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_LAUNCHER] = InventoryObjectDefinition(ID_GRENADE_ITEM, STRING_GRENADE_LAUNCHER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_AMMO1] = InventoryObjectDefinition(ID_GRENADE_AMMO1_ITEM, STRING_GRENADE_AMMO1, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_AMMO2] = InventoryObjectDefinition(ID_GRENADE_AMMO2_ITEM, STRING_GRENADE_AMMO2, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_AMMO3] = InventoryObjectDefinition(ID_GRENADE_AMMO3_ITEM, STRING_GRENADE_AMMO3, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HARPOON_GUN] = InventoryObjectDefinition(ID_HARPOON_ITEM, STRING_HARPOON_GUN, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HARPOON_AMMO] = InventoryObjectDefinition(ID_HARPOON_AMMO_ITEM, STRING_HARPOON_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_ROCKET_LAUNCHER] = InventoryObjectDefinition(ID_ROCKET_LAUNCHER_ITEM, STRING_ROCKET_LAUNCHER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_ROCKET_AMMO] = InventoryObjectDefinition(ID_ROCKET_LAUNCHER_AMMO_ITEM, STRING_ROCKET_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW] = InventoryObjectDefinition(ID_CROSSBOW_ITEM, STRING_CROSSBOW, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_LASER] = InventoryObjectDefinition(ID_CROSSBOW_ITEM, STRING_CROSSBOW_LASER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_AMMO1] = InventoryObjectDefinition(ID_CROSSBOW_AMMO1_ITEM, STRING_CROSSBOW_AMMO1, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_AMMO2] = InventoryObjectDefinition(ID_CROSSBOW_AMMO2_ITEM, STRING_CROSSBOW_AMMO2, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_AMMO3] = InventoryObjectDefinition(ID_CROSSBOW_AMMO3_ITEM, STRING_CROSSBOW_AMMO3, -1, 0);
|
2019-12-13 13:52:47 +01:00
|
|
|
m_objectsTable[INV_OBJECT_PASSPORT] = InventoryObjectDefinition(ID_INVENTORY_PASSPORT, STRING_PASSPORT, -1, 0);
|
2019-05-08 21:11:18 +02:00
|
|
|
m_objectsTable[INV_OBJECT_KEYS] = InventoryObjectDefinition(ID_INVENTORY_KEYS, STRING_CONTROLS, -1, 0x4000);
|
|
|
|
m_objectsTable[INV_OBJECT_SUNGLASSES] = InventoryObjectDefinition(ID_INVENTORY_SUNGLASSES, STRING_DISPLAY, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_POLAROID] = InventoryObjectDefinition(ID_INVENTORY_POLAROID, STRING_LARA_HOME, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HEADPHONES] = InventoryObjectDefinition(ID_INVENTORY_HEADPHONES, STRING_SOUND, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_DIARY] = InventoryObjectDefinition(ID_DIARY, STRING_DIARY, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_WATERSKIN1] = InventoryObjectDefinition(ID_WATERSKIN1_EMPTY, STRING_WATERSKIN1_EMPTY, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_WATERSKIN2] = InventoryObjectDefinition(ID_WATERSKIN2_EMPTY, STRING_WATERSKIN2_EMPTY, -1, 0);
|
2019-06-23 16:47:39 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 8; i++)
|
2019-06-23 16:47:39 +02:00
|
|
|
m_objectsTable[INV_OBJECT_PUZZLE1 + i] = InventoryObjectDefinition(ID_PUZZLE_ITEM1 + i, STRING_PISTOLS, -1, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 16; i++)
|
2019-06-23 16:47:39 +02:00
|
|
|
m_objectsTable[INV_OBJECT_PUZZLE1_COMBO1 + i] = InventoryObjectDefinition(ID_PUZZLE_ITEM1_COMBO1 + i, STRING_PISTOLS, -1, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 8; i++)
|
2019-06-23 16:47:39 +02:00
|
|
|
m_objectsTable[INV_OBJECT_KEY1 + i] = InventoryObjectDefinition(ID_KEY_ITEM1 + i, STRING_PISTOLS, -1, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 16; i++)
|
2019-06-23 16:47:39 +02:00
|
|
|
m_objectsTable[INV_OBJECT_KEY1_COMBO1 + i] = InventoryObjectDefinition(ID_KEY_ITEM1_COMBO1 + i, STRING_PISTOLS, -1, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 4; i++)
|
2019-06-23 16:47:39 +02:00
|
|
|
m_objectsTable[INV_OBJECT_PICKUP1 + i] = InventoryObjectDefinition(ID_PICKUP_ITEM1 + i, STRING_PISTOLS, -1, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
2019-06-23 16:47:39 +02:00
|
|
|
m_objectsTable[INV_OBJECT_EXAMINE1 + i] = InventoryObjectDefinition(ID_EXAMINE1 + i, STRING_PISTOLS, -1, 0);
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
// Add combinations
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE1_COMBO1, INV_OBJECT_PUZZLE1_COMBO2, INV_OBJECT_PUZZLE1, CombinePuzzle1);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE2_COMBO1, INV_OBJECT_PUZZLE2_COMBO2, INV_OBJECT_PUZZLE2, CombinePuzzle2);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE3_COMBO1, INV_OBJECT_PUZZLE3_COMBO2, INV_OBJECT_PUZZLE3, CombinePuzzle3);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE4_COMBO1, INV_OBJECT_PUZZLE4_COMBO2, INV_OBJECT_PUZZLE4, CombinePuzzle4);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE5_COMBO1, INV_OBJECT_PUZZLE5_COMBO2, INV_OBJECT_PUZZLE5, CombinePuzzle5);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE6_COMBO1, INV_OBJECT_PUZZLE6_COMBO2, INV_OBJECT_PUZZLE6, CombinePuzzle6);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE7_COMBO1, INV_OBJECT_PUZZLE7_COMBO2, INV_OBJECT_PUZZLE7, CombinePuzzle7);
|
|
|
|
AddCombination(INV_OBJECT_PUZZLE8_COMBO1, INV_OBJECT_PUZZLE8_COMBO2, INV_OBJECT_PUZZLE8, CombinePuzzle8);
|
|
|
|
AddCombination(INV_OBJECT_KEY1_COMBO1, INV_OBJECT_KEY1_COMBO2, INV_OBJECT_KEY1, CombineKey1);
|
|
|
|
AddCombination(INV_OBJECT_KEY2_COMBO1, INV_OBJECT_KEY2_COMBO2, INV_OBJECT_KEY2, CombineKey2);
|
|
|
|
AddCombination(INV_OBJECT_KEY3_COMBO1, INV_OBJECT_KEY3_COMBO2, INV_OBJECT_KEY3, CombineKey3);
|
|
|
|
AddCombination(INV_OBJECT_KEY4_COMBO1, INV_OBJECT_KEY4_COMBO2, INV_OBJECT_KEY4, CombineKey4);
|
|
|
|
AddCombination(INV_OBJECT_KEY5_COMBO1, INV_OBJECT_KEY5_COMBO2, INV_OBJECT_KEY5, CombineKey5);
|
|
|
|
AddCombination(INV_OBJECT_KEY6_COMBO1, INV_OBJECT_KEY6_COMBO2, INV_OBJECT_KEY6, CombineKey6);
|
|
|
|
AddCombination(INV_OBJECT_KEY7_COMBO1, INV_OBJECT_KEY7_COMBO2, INV_OBJECT_KEY7, CombineKey7);
|
|
|
|
AddCombination(INV_OBJECT_KEY8_COMBO1, INV_OBJECT_KEY8_COMBO2, INV_OBJECT_KEY8, CombineKey8);
|
|
|
|
AddCombination(INV_OBJECT_PICKUP1_COMBO1, INV_OBJECT_PICKUP1_COMBO2, INV_OBJECT_PICKUP1, CombinePickup1);
|
|
|
|
AddCombination(INV_OBJECT_PICKUP2_COMBO1, INV_OBJECT_PICKUP2_COMBO2, INV_OBJECT_PICKUP2, CombinePickup2);
|
|
|
|
AddCombination(INV_OBJECT_PICKUP3_COMBO1, INV_OBJECT_PICKUP3_COMBO2, INV_OBJECT_PICKUP3, CombinePickup3);
|
|
|
|
AddCombination(INV_OBJECT_PICKUP4_COMBO1, INV_OBJECT_PICKUP4_COMBO2, INV_OBJECT_PICKUP4, CombinePickup4);
|
|
|
|
AddCombination(INV_OBJECT_REVOLVER, INV_OBJECT_LASERSIGHT, INV_OBJECT_REVOLVER_LASER, CombineRevolverLasersight);
|
|
|
|
AddCombination(INV_OBJECT_CROSSBOW, INV_OBJECT_LASERSIGHT, INV_OBJECT_CROSSBOW_LASER, CombineCrossbowLasersight);
|
2019-04-27 10:24:44 +02:00
|
|
|
|
|
|
|
m_rings[INV_RING_PUZZLES].y = -INV_RINGS_OFFSET;
|
|
|
|
m_rings[INV_RING_WEAPONS].y = 0;
|
|
|
|
m_rings[INV_RING_OPTIONS].y = INV_RINGS_OFFSET;
|
|
|
|
m_rings[INV_RING_CHOOSE_AMMO].y = 0;
|
|
|
|
m_rings[INV_RING_COMBINE].y = 0;
|
|
|
|
|
2019-05-08 21:11:18 +02:00
|
|
|
m_rings[INV_RING_PUZZLES].titleStringIndex = STRING_TITLE_PUZZLES;
|
|
|
|
m_rings[INV_RING_WEAPONS].titleStringIndex = STRING_TITLE_ITEMS;
|
|
|
|
m_rings[INV_RING_OPTIONS].titleStringIndex = STRING_TITLE_SETTINGS;
|
|
|
|
m_rings[INV_RING_CHOOSE_AMMO].titleStringIndex = STRING_TITLE_CHOOSE_AMMO;
|
|
|
|
m_rings[INV_RING_COMBINE].titleStringIndex = STRING_TITLE_COMBINE;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Inventory::~Inventory()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
InventoryRing* Inventory::GetRing(int index)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
return &m_rings[index];
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::GetActiveRing()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
return m_activeRing;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::SetActiveRing(int index)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
m_activeRing = index;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::InsertObject(int ring, int objectNumber)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
m_rings[ring].objects[m_rings[ring].numObjects].inventoryObject = objectNumber;
|
|
|
|
m_rings[ring].numObjects++;
|
|
|
|
}
|
|
|
|
|
2019-04-26 21:09:58 +02:00
|
|
|
void Inventory::LoadObjects(bool isReload)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
// Reset the objects in inventory
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < NUM_INVENTORY_RINGS; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
m_rings[i].numObjects = 0;
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[i].rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
m_rings[i].currentObject = 0;
|
2019-04-26 21:09:58 +02:00
|
|
|
|
|
|
|
if (!isReload)
|
|
|
|
{
|
|
|
|
m_rings[i].focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
m_rings[i].objects[j].inventoryObject = -1;
|
|
|
|
m_rings[i].objects[j].rotation = 0;
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[i].objects[j].scale = INV_OBJECTS_SCALE;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DEBUG
|
|
|
|
{
|
2019-05-06 23:48:35 +02:00
|
|
|
/*g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present = true;
|
2019-04-26 15:10:32 +02:00
|
|
|
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] = 1000;
|
|
|
|
g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1] = 1000;
|
|
|
|
g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo = WEAPON_AMMO1;
|
|
|
|
|
|
|
|
g_LaraExtra.Weapons[WEAPON_REVOLVER].Present = true;
|
|
|
|
g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0] = 1000;
|
|
|
|
g_LaraExtra.Weapons[WEAPON_REVOLVER].SelectedAmmo = WEAPON_AMMO1;
|
|
|
|
|
|
|
|
Lara.laserSight = true;
|
|
|
|
|
2018-12-29 14:27:39 +01:00
|
|
|
/*g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present = true;
|
2018-11-21 09:34:01 +01:00
|
|
|
g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] = 1000;
|
2018-11-24 09:39:37 +01:00
|
|
|
g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo = WEAPON_AMMO1;
|
2018-11-01 22:45:59 +01:00
|
|
|
|
2018-11-21 09:34:01 +01:00
|
|
|
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Present = true;
|
|
|
|
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] = 1000;
|
2018-11-24 09:39:37 +01:00
|
|
|
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = WEAPON_AMMO1;
|
2018-11-02 13:02:10 +01:00
|
|
|
|
2018-11-24 09:39:37 +01:00
|
|
|
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Present = true;
|
2018-12-29 14:27:39 +01:00
|
|
|
g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0] = 1000;*/
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Now fill the rings
|
2019-04-30 12:56:27 +02:00
|
|
|
if (g_GameFlow->GetLevel(CurrentLevel)->LaraType != LARA_YOUNG)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-11-14 20:54:18 +01:00
|
|
|
// Pistols
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_PISTOLS].Present)
|
2018-08-19 09:46:58 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_PISTOLS);
|
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Uzi
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_UZI].Present)
|
2018-08-19 09:46:58 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_UZIS);
|
2018-11-21 09:34:01 +01:00
|
|
|
else if (g_LaraExtra.Weapons[WEAPON_UZI].Ammo[0])
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_UZI_AMMO);
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Revolver
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].Present)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].HasLasersight)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER_LASER);
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2018-11-14 20:54:18 +01:00
|
|
|
else
|
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_REVOLVER].Ammo[0])
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_REVOLVER_AMMO);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shotgun
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Present)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN);
|
2018-08-19 09:46:58 +02:00
|
|
|
//if (Lara.shotgunTypeCarried & 0x10)
|
|
|
|
// CurrentShotGunAmmoType = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0])
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN_AMMO1);
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1])
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SHOTGUN_AMMO2);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// HK
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_HK].Present)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_HK].HasSilencer)
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK_LASER);
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK);
|
|
|
|
}
|
2018-11-21 09:34:01 +01:00
|
|
|
else if (g_LaraExtra.Weapons[WEAPON_HK].Ammo[0])
|
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HK_AMMO1);
|
2018-11-14 20:54:18 +01:00
|
|
|
|
|
|
|
// Crossbow
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Present)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].HasLasersight)
|
2019-04-26 15:10:32 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_LASER);
|
|
|
|
else
|
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2018-11-14 20:54:18 +01:00
|
|
|
else
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0])
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO1);
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[1])
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO2);
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[2])
|
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_AMMO3);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Grenade launcher
|
2018-11-21 09:34:01 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Present)
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_LAUNCHER);
|
2018-11-21 09:34:01 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0])
|
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO1);
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1])
|
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO2);
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2])
|
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_GRENADE_AMMO3);
|
|
|
|
}
|
2018-11-14 20:54:18 +01:00
|
|
|
|
|
|
|
// Harpoon
|
2018-11-24 09:39:37 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Present)
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HARPOON_GUN);
|
2018-11-24 09:39:37 +01:00
|
|
|
else if (g_LaraExtra.Weapons[WEAPON_HARPOON_GUN].Ammo[0])
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_HARPOON_AMMO);
|
|
|
|
|
|
|
|
// Rocket launcher
|
2018-11-24 09:39:37 +01:00
|
|
|
if (g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Present)
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_ROCKET_LAUNCHER);
|
2018-11-24 09:39:37 +01:00
|
|
|
else if (g_LaraExtra.Weapons[WEAPON_ROCKET_LAUNCHER].Ammo[0])
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_ROCKET_AMMO);
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Lasersight
|
2018-08-19 09:46:58 +02:00
|
|
|
if (Lara.laserSight)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_LASERSIGHT);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Silencer
|
2018-08-19 09:46:58 +02:00
|
|
|
if (Lara.silencer)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SILENCER);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Binoculars
|
2018-08-19 09:46:58 +02:00
|
|
|
if (Lara.binoculars)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_BINOCULARS);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-11-14 20:54:18 +01:00
|
|
|
// Flares
|
2018-08-19 09:46:58 +02:00
|
|
|
if (Lara.numFlares)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_FLARES);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Lara.numSmallMedipack)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_SMALL_MEDIPACK);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.numLargeMedipack)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_LARGE_MEDIPACK);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.crowbar)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROWBAR);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < 8; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if (Lara.puzzleItems[i])
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1);
|
2019-12-13 13:52:47 +01:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
for (i = 0; i < 16; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.puzzleItemsCombo)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1_COMBO1);
|
2019-12-13 13:52:47 +01:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
for (i = 0; i < 8; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.keyItems)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1);
|
2019-12-13 13:52:47 +01:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
for (i = 0; i < 16; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.keyItemsCombo)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1_COMBO1);
|
2019-12-13 13:52:47 +01:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
for (i = 0; i < 4; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.pickupItems)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1);
|
2019-12-13 13:52:47 +01:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
for (i = 0; i < 8; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.pickupItemsCombo)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1_COMBO1);
|
2019-12-13 13:52:47 +01:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.examine1)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_EXAMINE1);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.examine2)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_EXAMINE2);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
if (Lara.examine3)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_EXAMINE3);
|
|
|
|
|
|
|
|
if (Lara.wetcloth == 2)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WETCLOTH1);
|
|
|
|
|
|
|
|
if (Lara.wetcloth == 1)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WETCLOTH2);
|
|
|
|
|
|
|
|
if (Lara.bottle)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_BOTTLE);
|
|
|
|
|
|
|
|
if (g_LaraExtra.Waterskin1.Present)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN1);
|
|
|
|
|
|
|
|
if (g_LaraExtra.Waterskin2.Present)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN2);
|
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
InventoryRing* ring = &m_rings[INV_RING_OPTIONS];
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
// Reset the objects in inventory
|
|
|
|
ring->numObjects = 0;
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
ring->currentObject = 0;
|
|
|
|
ring->focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
ring->objects[j].inventoryObject = -1;
|
|
|
|
ring->objects[j].rotation = 0;
|
|
|
|
ring->objects[j].scale = 2.0f;
|
|
|
|
}
|
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_PASSPORT);
|
2019-04-26 15:10:32 +02:00
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_SUNGLASSES);
|
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_HEADPHONES);
|
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_KEYS);
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::SelectObject(int r, int object, float scale)
|
2019-04-26 21:09:58 +02:00
|
|
|
{
|
2019-12-13 13:52:47 +01:00
|
|
|
if (object != NO_ITEM)
|
2019-04-26 21:09:58 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[r];
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < ring->numObjects; i++)
|
2019-04-26 21:09:58 +02:00
|
|
|
{
|
|
|
|
if (ring->objects[i].inventoryObject == object)
|
|
|
|
{
|
|
|
|
ring->currentObject = i;
|
|
|
|
ring->objects[i].scale = scale;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
void Inventory::Initialise()
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
LoadObjects(false);
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
m_activeRing = INV_RING_WEAPONS;
|
|
|
|
m_type = INV_TYPE_GAME;
|
|
|
|
m_deltaMovement = 0;
|
|
|
|
m_movement = INV_MOVE_STOPPED;
|
|
|
|
m_type = INV_TYPE_GAME;
|
2019-11-18 07:48:35 +01:00
|
|
|
m_selectedObject = NO_ITEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
short Inventory::GetEnterObject()
|
2019-11-18 07:48:35 +01:00
|
|
|
{
|
|
|
|
return m_enterObject;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
short Inventory::GetSelectedObject()
|
2019-11-18 07:48:35 +01:00
|
|
|
{
|
|
|
|
return m_selectedObject;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::SetEnterObject(short objNum)
|
2019-11-18 07:48:35 +01:00
|
|
|
{
|
|
|
|
m_enterObject = objNum;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::SetSelectedObject(short objNum)
|
2019-11-18 07:48:35 +01:00
|
|
|
{
|
|
|
|
m_selectedObject = objNum;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::DoInventory()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
Initialise();
|
|
|
|
|
|
|
|
// If Lara is dead, then we can use only the passport
|
|
|
|
if (LaraItem->hitPoints <= 0 && CurrentLevel > 0)
|
|
|
|
{
|
|
|
|
m_rings[INV_RING_PUZZLES].draw = false;
|
|
|
|
m_rings[INV_RING_WEAPONS].draw = false;
|
|
|
|
m_rings[INV_RING_OPTIONS].draw = true;
|
|
|
|
m_rings[INV_RING_COMBINE].draw = false;
|
|
|
|
m_rings[INV_RING_CHOOSE_AMMO].draw = false;
|
|
|
|
|
|
|
|
m_activeRing = INV_RING_OPTIONS;
|
|
|
|
m_rings[m_activeRing].currentObject = 0;
|
|
|
|
|
2019-06-23 21:05:13 +02:00
|
|
|
g_Renderer->DumpGameScene();
|
|
|
|
|
|
|
|
OpenRing(m_activeRing, true);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int passportResult = DoPassport();
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < FADE_FRAMES_COUNT; i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-06-23 21:05:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return passportResult;
|
|
|
|
}
|
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[INV_RING_PUZZLES].draw = false;
|
2019-06-23 16:47:39 +02:00
|
|
|
m_rings[INV_RING_WEAPONS].draw = false;
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[INV_RING_OPTIONS].draw = false;
|
2019-04-26 15:10:32 +02:00
|
|
|
m_rings[INV_RING_COMBINE].draw = false;
|
|
|
|
m_rings[INV_RING_CHOOSE_AMMO].draw = false;
|
|
|
|
|
2019-11-18 07:48:35 +01:00
|
|
|
if (m_enterObject != NO_ITEM)
|
2019-06-23 16:47:39 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int r = 0; r < 3; r++)
|
|
|
|
for (int o = 0; o < m_rings[r].numObjects; o++)
|
2019-11-18 07:48:35 +01:00
|
|
|
if (m_objectsTable[m_rings[r].objects[o].inventoryObject].objectNumber == m_enterObject)
|
2019-06-23 16:47:39 +02:00
|
|
|
{
|
|
|
|
m_activeRing = r;
|
|
|
|
m_rings[m_activeRing].currentObject = o;
|
|
|
|
m_rings[m_activeRing].draw = true;
|
|
|
|
}
|
|
|
|
|
2019-11-18 07:48:35 +01:00
|
|
|
m_enterObject = NO_ITEM;
|
2019-06-23 16:47:39 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_activeRing = INV_RING_WEAPONS;
|
|
|
|
m_rings[m_activeRing].draw = true;
|
|
|
|
}
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int result = INV_RESULT_NONE;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
g_Renderer->DumpGameScene();
|
2019-04-27 10:24:44 +02:00
|
|
|
|
|
|
|
OpenRing(m_activeRing, true);
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
while (!ResetFlag)
|
|
|
|
{
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
// Exit from inventory
|
2019-11-18 07:48:35 +01:00
|
|
|
m_enterObject = NO_ITEM;
|
2019-04-27 10:24:44 +02:00
|
|
|
result = INV_RESULT_NONE;
|
|
|
|
break;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
2019-12-13 13:52:47 +01:00
|
|
|
else if (DbInput & IN_FORWARD && (m_activeRing == INV_RING_WEAPONS && m_rings[INV_RING_PUZZLES].numObjects != 0 || m_activeRing == INV_RING_OPTIONS))
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int newRing = INV_RING_WEAPONS;
|
2019-04-26 15:10:32 +02:00
|
|
|
if (m_activeRing == INV_RING_WEAPONS)
|
2019-04-27 10:24:44 +02:00
|
|
|
newRing = INV_RING_PUZZLES;
|
2019-04-26 15:10:32 +02:00
|
|
|
else
|
2019-04-27 10:24:44 +02:00
|
|
|
newRing = INV_RING_WEAPONS;
|
|
|
|
|
|
|
|
SwitchRing(m_activeRing, newRing, -1);
|
|
|
|
m_activeRing = newRing;
|
2019-04-26 15:10:32 +02:00
|
|
|
m_movement = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_BACK && (m_activeRing == INV_RING_PUZZLES || m_activeRing == INV_RING_WEAPONS))
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int newRing = INV_RING_WEAPONS;
|
2019-04-27 10:24:44 +02:00
|
|
|
if (m_activeRing == INV_RING_WEAPONS)
|
|
|
|
newRing = INV_RING_OPTIONS;
|
|
|
|
else
|
|
|
|
newRing = INV_RING_WEAPONS;
|
|
|
|
|
|
|
|
SwitchRing(m_activeRing, newRing, 1);
|
|
|
|
m_activeRing = newRing;
|
2019-04-26 15:10:32 +02:00
|
|
|
m_movement = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_LEFT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2019-04-28 09:56:33 +02:00
|
|
|
// Change object left
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / m_rings[m_activeRing].numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
m_rings[m_activeRing].rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[m_activeRing].rotation += deltaAngle;
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_rings[m_activeRing].currentObject == m_rings[m_activeRing].numObjects - 1)
|
|
|
|
m_rings[m_activeRing].currentObject = 0;
|
|
|
|
else
|
|
|
|
m_rings[m_activeRing].currentObject++;
|
|
|
|
|
|
|
|
m_rings[m_activeRing].selectedIndex = INV_ACTION_USE;
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[m_activeRing].rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
else if (DbInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2019-04-28 09:56:33 +02:00
|
|
|
// Change object right
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / m_rings[m_activeRing].numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
m_rings[m_activeRing].rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[m_activeRing].rotation -= deltaAngle;
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_rings[m_activeRing].currentObject == 0)
|
|
|
|
m_rings[m_activeRing].currentObject = m_rings[m_activeRing].numObjects - 1;
|
|
|
|
else
|
|
|
|
m_rings[m_activeRing].currentObject--;
|
|
|
|
|
|
|
|
m_rings[m_activeRing].selectedIndex = INV_ACTION_USE;
|
2019-04-27 10:24:44 +02:00
|
|
|
m_rings[m_activeRing].rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
|
|
|
// Handle action
|
|
|
|
if (m_activeRing == INV_RING_OPTIONS)
|
|
|
|
{
|
2019-12-13 13:52:47 +01:00
|
|
|
if (m_rings[INV_RING_OPTIONS].objects[m_rings[INV_RING_OPTIONS].currentObject].inventoryObject == INV_OBJECT_PASSPORT)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
int passportResult = DoPassport();
|
2019-04-26 15:10:32 +02:00
|
|
|
if (passportResult == INV_RESULT_NEW_GAME ||
|
|
|
|
passportResult == INV_RESULT_EXIT_TO_TILE ||
|
|
|
|
passportResult == INV_RESULT_LOAD_GAME)
|
|
|
|
{
|
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < FADE_FRAMES_COUNT; i++)
|
2019-05-10 20:38:48 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-05-10 20:38:48 +02:00
|
|
|
}
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
return passportResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[INV_RING_OPTIONS].objects[m_rings[INV_RING_OPTIONS].currentObject].inventoryObject;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
if (currentObject == INV_OBJECT_KEYS)
|
|
|
|
DoControlsSettings();
|
|
|
|
|
|
|
|
if (currentObject == INV_OBJECT_SUNGLASSES)
|
|
|
|
DoGraphicsSettings();
|
|
|
|
|
|
|
|
if (currentObject == INV_OBJECT_HEADPHONES)
|
|
|
|
DoSoundSettings();
|
|
|
|
}
|
|
|
|
else if (m_activeRing == INV_RING_WEAPONS || m_activeRing == INV_RING_PUZZLES)
|
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[m_activeRing].objects[m_rings[m_activeRing].currentObject].inventoryObject;
|
|
|
|
int result = INV_RESULT_NONE;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
if (IsCurrentObjectPuzzle())
|
|
|
|
// Puzzles have Use, Combine, Separe
|
|
|
|
result = DoPuzzle();
|
|
|
|
else if (IsCurrentObjectWeapon())
|
|
|
|
// Weapons have Use, Select Ammo
|
|
|
|
result = DoWeapon();
|
|
|
|
else if (IsCurrentObjectExamine())
|
|
|
|
// Examines have just Examine
|
|
|
|
DoExamine();
|
|
|
|
else if (currentObject == INV_OBJECT_TIMEX)
|
|
|
|
// Do statistics
|
|
|
|
DoStatistics();
|
|
|
|
else
|
|
|
|
// All other objects have just Use
|
|
|
|
result = DoGenericObject();
|
|
|
|
|
|
|
|
// If an item is set to be used, then use it and close inventory
|
|
|
|
if (result == INV_RESULT_USE_ITEM)
|
|
|
|
{
|
|
|
|
UseCurrentItem();
|
|
|
|
|
|
|
|
// Exit from inventory
|
2019-11-18 07:48:35 +01:00
|
|
|
m_enterObject = NO_ITEM;
|
2019-04-27 10:24:44 +02:00
|
|
|
result = INV_RESULT_USE_ITEM;
|
|
|
|
break;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
CloseRing(m_activeRing, true);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Inventory::IsCurrentObjectWeapon()
|
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[m_activeRing].objects[m_rings[m_activeRing].currentObject].inventoryObject;
|
2019-04-26 15:10:32 +02:00
|
|
|
return (currentObject == INV_OBJECT_PISTOLS || currentObject == INV_OBJECT_UZIS ||
|
|
|
|
currentObject == INV_OBJECT_REVOLVER_LASER || currentObject == INV_OBJECT_CROSSBOW_LASER ||
|
|
|
|
currentObject == INV_OBJECT_REVOLVER || currentObject == INV_OBJECT_SHOTGUN ||
|
|
|
|
currentObject == INV_OBJECT_HK || currentObject == INV_OBJECT_CROSSBOW ||
|
|
|
|
currentObject == INV_OBJECT_ROCKET_LAUNCHER || currentObject == INV_OBJECT_GRENADE_LAUNCHER ||
|
|
|
|
currentObject == INV_OBJECT_HARPOON_GUN);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Inventory::IsCurrentObjectPuzzle()
|
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[m_activeRing].objects[m_rings[m_activeRing].currentObject].inventoryObject;
|
2019-04-26 15:10:32 +02:00
|
|
|
return (currentObject >= INV_OBJECT_PUZZLE1 && currentObject <= INV_OBJECT_PICKUP4_COMBO2);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Inventory::IsCurrentObjectGeneric()
|
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[m_activeRing].objects[m_rings[m_activeRing].currentObject].inventoryObject;
|
2019-04-26 15:10:32 +02:00
|
|
|
return (!IsCurrentObjectPuzzle() && !IsCurrentObjectExamine() && !IsCurrentObjectWeapon() &&
|
|
|
|
currentObject != INV_OBJECT_TIMEX);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Inventory::IsCurrentObjectExamine()
|
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[m_activeRing].objects[m_rings[m_activeRing].currentObject].inventoryObject;
|
2019-04-26 15:10:32 +02:00
|
|
|
return (currentObject >= INV_OBJECT_EXAMINE1 && currentObject <= INV_OBJECT_EXAMINE1);
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::DoPuzzle()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
2019-06-23 16:47:39 +02:00
|
|
|
ring->selectedIndex = 0;
|
|
|
|
ring->numActions = 0;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int result = INV_RESULT_NONE;
|
2019-06-23 16:47:39 +02:00
|
|
|
bool closeObject = false;
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = ring->objects[ring->currentObject].inventoryObject;
|
2019-06-23 16:47:39 +02:00
|
|
|
|
|
|
|
ring->numActions = 0;
|
|
|
|
ring->actions[ring->numActions++] = INV_ACTION_USE;
|
|
|
|
if (IsObjectCombinable(currentObject))
|
|
|
|
ring->actions[ring->numActions++] = INV_ACTION_COMBINE;
|
|
|
|
//if (IsObjectSeparable(currentObject))
|
|
|
|
// ring->actions[ring->numActions++] = INV_ACTION_SEPARE;
|
|
|
|
|
|
|
|
// If only use action then select the weapon directly
|
|
|
|
if (ring->numActions == 1)
|
|
|
|
return INV_RESULT_USE_ITEM;
|
|
|
|
|
|
|
|
PopupObject();
|
|
|
|
|
|
|
|
// Do the menu
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
|
|
|
{
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_FORWARD)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex > 0)
|
|
|
|
ring->selectedIndex--;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_BACK)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-06-23 16:47:39 +02:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex < ring->numActions)
|
|
|
|
ring->selectedIndex++;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
if (ring->actions[ring->selectedIndex] == INV_ACTION_USE)
|
|
|
|
{
|
|
|
|
result = INV_RESULT_USE_ITEM;
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (ring->actions[ring->selectedIndex] == INV_ACTION_COMBINE)
|
|
|
|
{
|
|
|
|
if (DoCombine())
|
|
|
|
{
|
|
|
|
ring->actions[1] = INV_ACTION_SEPARE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ring->actions[ring->selectedIndex] == INV_ACTION_SEPARE)
|
|
|
|
{
|
|
|
|
if (DoSepare())
|
|
|
|
{
|
|
|
|
ring->actions[1] = INV_ACTION_COMBINE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateSceneAndDrawInventory();
|
|
|
|
}
|
|
|
|
|
|
|
|
PopoverObject();
|
|
|
|
|
|
|
|
return result;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::DoWeapon()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
ring->selectedIndex = 0;
|
|
|
|
ring->numActions = 0;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int result = INV_RESULT_NONE;
|
2019-04-26 15:10:32 +02:00
|
|
|
bool closeObject = false;
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = ring->objects[ring->currentObject].inventoryObject;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-06-23 16:47:39 +02:00
|
|
|
ring->numActions = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
ring->actions[ring->numActions++] = INV_ACTION_USE;
|
|
|
|
if (IsObjectCombinable(currentObject)) ring->actions[ring->numActions++] = INV_ACTION_COMBINE;
|
|
|
|
if (IsObjectSeparable(currentObject)) ring->actions[ring->numActions++] = INV_ACTION_SEPARE;
|
2019-04-28 09:56:33 +02:00
|
|
|
if (HasWeaponMultipleAmmos(currentObject)) ring->actions[ring->numActions++] = INV_ACTION_SELECT_AMMO;
|
|
|
|
|
|
|
|
// If only use action then select the weapon directly
|
|
|
|
if (ring->numActions == 1)
|
|
|
|
return INV_RESULT_USE_ITEM;
|
|
|
|
|
|
|
|
PopupObject();
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
// Do the menu
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
|
|
|
{
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_FORWARD)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex > 0)
|
|
|
|
ring->selectedIndex--;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_BACK)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex < ring->numActions)
|
|
|
|
ring->selectedIndex++;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
if (ring->actions[ring->selectedIndex] == INV_ACTION_USE)
|
|
|
|
{
|
|
|
|
result = INV_RESULT_USE_ITEM;
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (ring->actions[ring->selectedIndex] == INV_ACTION_COMBINE)
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
if (DoCombine())
|
|
|
|
{
|
|
|
|
ring->actions[1] = INV_ACTION_SEPARE;
|
|
|
|
}
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
else if (ring->actions[ring->selectedIndex] == INV_ACTION_SEPARE)
|
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
if (DoSepare())
|
|
|
|
{
|
|
|
|
ring->actions[1] = INV_ACTION_COMBINE;
|
|
|
|
}
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
else if (ring->actions[ring->selectedIndex] == INV_ACTION_SELECT_AMMO)
|
|
|
|
{
|
|
|
|
DoSelectAmmo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
PopoverObject();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
return result;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
bool Inventory::IsObjectPresentInInventory(short object)
|
2019-06-23 16:47:39 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int r = 0; r < 3; r++)
|
|
|
|
for (int o = 0; o < m_rings[r].numObjects; o++)
|
2019-06-23 16:47:39 +02:00
|
|
|
if (m_objectsTable[m_rings[r].objects[o].inventoryObject].objectNumber == object)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
bool Inventory::IsInventoryObjectPresentInInventory(short object)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int r = 0; r < 3; r++)
|
|
|
|
for (int o = 0; o < m_rings[r].numObjects; o++)
|
2019-04-26 15:10:32 +02:00
|
|
|
if (m_rings[r].objects[o].inventoryObject == object)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::FindObjectIndex(short object)
|
2019-06-23 16:47:39 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int r = 0; r < 3; r++)
|
|
|
|
for (int o = 0; o < m_rings[r].numObjects; o++)
|
2019-06-23 16:47:39 +02:00
|
|
|
if (m_rings[r].objects[o].inventoryObject == object)
|
|
|
|
return o;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::FindObjectRing(short object)
|
2019-06-23 16:47:39 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int r = 0; r < 3; r++)
|
|
|
|
for (int o = 0; o < m_rings[r].numObjects; o++)
|
2019-06-23 16:47:39 +02:00
|
|
|
if (m_rings[r].objects[o].inventoryObject == object)
|
|
|
|
return r;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
bool Inventory::IsObjectCombinable(short object)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < m_combinations.size(); i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
if (m_combinations[i].piece1 == object || m_combinations[i].piece2 == object)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2018-11-28 13:19:01 +01:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::AddCombination(short piece1, short piece2, short combinedObject, void (*f) (int))
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryObjectCombination combination;
|
|
|
|
combination.piece1 = piece1;
|
|
|
|
combination.piece2 = piece2;
|
|
|
|
combination.combinedObject = combinedObject;
|
|
|
|
combination.combineRoutine = f;
|
|
|
|
m_combinations.push_back(combination);
|
|
|
|
}
|
2018-11-28 13:19:01 +01:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::DoGenericObject()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
return INV_RESULT_USE_ITEM;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
void Inventory::DoStatistics()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
void Inventory::DoExamine()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
2018-09-08 21:30:48 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
2018-09-08 21:30:48 +02:00
|
|
|
|
2019-04-26 21:09:58 +02:00
|
|
|
bool Inventory::DoCombine()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
2019-11-27 15:12:35 +01:00
|
|
|
int oldRing = m_activeRing;
|
2018-09-08 21:30:48 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Fill the objects ring
|
2019-04-28 09:56:33 +02:00
|
|
|
InventoryRing* combineRing = &m_rings[INV_RING_COMBINE];
|
2019-04-26 15:10:32 +02:00
|
|
|
combineRing->numObjects = 0;
|
2019-04-28 09:56:33 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = ring->objects[ring->currentObject].inventoryObject;
|
2018-09-08 21:30:48 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < m_combinations.size(); i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryObjectCombination* combination = &m_combinations[i];
|
|
|
|
|
|
|
|
// Add piece 1
|
2019-06-23 16:47:39 +02:00
|
|
|
if (currentObject != combination->piece1 && IsInventoryObjectPresentInInventory(combination->piece1))
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-04-27 18:22:30 +02:00
|
|
|
bool found = false;
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int j = 0; j < combineRing->numObjects; j++)
|
2019-04-27 18:22:30 +02:00
|
|
|
{
|
|
|
|
if (combineRing->objects[j].inventoryObject == combination->piece1)
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
combineRing->objects[combineRing->numObjects++].inventoryObject = combination->piece1;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Add piece 2
|
2019-06-23 16:47:39 +02:00
|
|
|
if (currentObject != combination->piece2 && IsInventoryObjectPresentInInventory(combination->piece2))
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-04-27 18:22:30 +02:00
|
|
|
bool found = false;
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int j = 0; j < combineRing->numObjects; j++)
|
2019-04-27 18:22:30 +02:00
|
|
|
{
|
|
|
|
if (combineRing->objects[j].inventoryObject == combination->piece2)
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
combineRing->objects[combineRing->numObjects++].inventoryObject = combination->piece2;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// If no objects then exit
|
|
|
|
if (combineRing->numObjects == 0)
|
2019-04-27 18:22:30 +02:00
|
|
|
{
|
2019-04-26 21:09:58 +02:00
|
|
|
return false;
|
2019-04-27 18:22:30 +02:00
|
|
|
}
|
2018-09-08 21:30:48 +02:00
|
|
|
|
2019-04-27 18:22:30 +02:00
|
|
|
ring->draw = false;
|
|
|
|
combineRing->draw = true;
|
2019-04-26 15:10:32 +02:00
|
|
|
combineRing->selectedIndex = 0;
|
2019-04-27 10:24:44 +02:00
|
|
|
|
2019-04-27 13:19:44 +02:00
|
|
|
OpenRing(INV_RING_COMBINE, false);
|
2019-04-27 10:24:44 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
bool closeObject = false;
|
2019-04-26 21:09:58 +02:00
|
|
|
bool combined = false;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Do the menu
|
|
|
|
while (true)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
// Handle input
|
2018-08-19 09:46:58 +02:00
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
2019-04-26 15:10:32 +02:00
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = true;
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2019-04-28 09:56:33 +02:00
|
|
|
else if (DbInput & IN_LEFT && combineRing->numObjects > 1)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = false;
|
|
|
|
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Change object left
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / combineRing->numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
combineRing->rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
combineRing->rotation += deltaAngle;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
if (combineRing->currentObject > 0)
|
|
|
|
combineRing->currentObject--;
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2019-04-26 15:10:32 +02:00
|
|
|
combineRing->currentObject = combineRing->numObjects - 1;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
combineRing->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2019-04-28 09:56:33 +02:00
|
|
|
else if (DbInput & IN_RIGHT && combineRing->numObjects > 1)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
// Change object right
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / combineRing->numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
combineRing->rotation = 0;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
combineRing->rotation -= deltaAngle;
|
2019-04-26 15:10:32 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
if (combineRing->currentObject < combineRing->numObjects - 1)
|
|
|
|
combineRing->currentObject++;
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2019-04-26 15:10:32 +02:00
|
|
|
combineRing->currentObject = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
combineRing->rotation = 0;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Check if can be combined
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = combineRing->objects[combineRing->currentObject].inventoryObject;
|
|
|
|
for (int i = 0; i < m_combinations.size(); i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryObjectCombination* combination = &m_combinations[i];
|
|
|
|
if (combination->piece1 == currentObject && combination->piece2 == ring->objects[ring->currentObject].inventoryObject ||
|
|
|
|
combination->piece2 == currentObject && combination->piece1 == ring->objects[ring->currentObject].inventoryObject)
|
|
|
|
{
|
|
|
|
// I can do the combination
|
|
|
|
SoundEffect(SFX_MENU_COMBINE, NULL, 0);
|
|
|
|
combination->combineRoutine(INV_COMBINE_COMBINE);
|
2019-04-26 21:09:58 +02:00
|
|
|
LoadObjects(true);
|
2019-04-27 10:24:44 +02:00
|
|
|
SelectObject(oldRing, combination->combinedObject, 2 * INV_OBJECTS_SCALE);
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = true;
|
2019-04-26 21:09:58 +02:00
|
|
|
combined = true;
|
2019-04-26 15:10:32 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!closeObject)
|
|
|
|
SayNo();
|
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 13:19:44 +02:00
|
|
|
CloseRing(INV_RING_COMBINE, false);
|
2019-04-27 10:24:44 +02:00
|
|
|
|
2019-04-26 21:09:58 +02:00
|
|
|
m_activeRing = oldRing;
|
2019-04-26 15:10:32 +02:00
|
|
|
combineRing->draw = false;
|
2019-04-27 13:19:44 +02:00
|
|
|
ring->draw = true;
|
2019-04-26 21:09:58 +02:00
|
|
|
|
|
|
|
return combined;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
2019-04-26 21:09:58 +02:00
|
|
|
bool Inventory::DoSepare()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
short currentObject = m_rings[m_activeRing].objects[m_rings[m_activeRing].currentObject].inventoryObject;
|
2019-04-28 09:56:33 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < m_combinations.size(); i++)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
InventoryObjectCombination* combination = &m_combinations[i];
|
|
|
|
if (combination->combinedObject == currentObject)
|
|
|
|
{
|
2019-04-28 09:56:33 +02:00
|
|
|
// Separation can be done
|
2019-04-26 15:10:32 +02:00
|
|
|
SoundEffect(SFX_MENU_COMBINE, NULL, 0);
|
|
|
|
combination->combineRoutine(INV_COMBINE_SEPARE);
|
2019-04-26 21:09:58 +02:00
|
|
|
LoadObjects(true);
|
2019-04-27 10:24:44 +02:00
|
|
|
SelectObject(m_activeRing, combination->piece1, 2 * INV_OBJECTS_SCALE);
|
2019-04-26 21:09:58 +02:00
|
|
|
return true;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
}
|
2019-04-26 21:09:58 +02:00
|
|
|
|
|
|
|
return false;
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::DoSelectAmmo()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
|
|
|
|
// Enable the secondary GUI
|
|
|
|
m_activeRing = INV_RING_CHOOSE_AMMO;
|
|
|
|
|
|
|
|
// Fill the secondary ring
|
|
|
|
InventoryRing* ammoRing = &m_rings[INV_RING_CHOOSE_AMMO];
|
2019-04-27 13:19:44 +02:00
|
|
|
ring->draw = false;
|
2019-04-26 15:10:32 +02:00
|
|
|
ammoRing->draw = true;
|
|
|
|
ammoRing->numObjects = 0;
|
|
|
|
|
|
|
|
switch (ring->objects[ring->currentObject].inventoryObject)
|
|
|
|
{
|
|
|
|
case INV_OBJECT_SHOTGUN:
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[0] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_SHOTGUN_AMMO1;
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_SHOTGUN].Ammo[1] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_SHOTGUN_AMMO2;
|
|
|
|
ammoRing->selectedIndex = g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_OBJECT_GRENADE_LAUNCHER:
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[0] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO1;
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[1] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO2;
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].Ammo[2] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_GRENADE_AMMO3;
|
|
|
|
ammoRing->selectedIndex = g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_OBJECT_CROSSBOW:
|
|
|
|
case INV_OBJECT_CROSSBOW_LASER:
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[0] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO1;
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[1] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO2;
|
|
|
|
if (g_LaraExtra.Weapons[WEAPON_CROSSBOW].Ammo[2] != 0)
|
|
|
|
ammoRing->objects[ammoRing->numObjects++].inventoryObject = INV_OBJECT_CROSSBOW_AMMO3;
|
|
|
|
ammoRing->selectedIndex = g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If no objects then exit
|
|
|
|
if (ammoRing->numObjects == 0)
|
|
|
|
return;
|
2019-04-27 13:19:44 +02:00
|
|
|
|
|
|
|
OpenRing(INV_RING_CHOOSE_AMMO, false);
|
2019-04-26 15:10:32 +02:00
|
|
|
|
|
|
|
bool closeObject = false;
|
|
|
|
|
|
|
|
// Do the menu
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
|
|
|
{
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2019-04-28 09:56:33 +02:00
|
|
|
else if (DbInput & IN_LEFT && ammoRing->numObjects > 1)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = false;
|
|
|
|
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Change object left
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / ammoRing->numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
ammoRing->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
ammoRing->rotation += deltaAngle;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
if (ammoRing->currentObject > 0)
|
|
|
|
ammoRing->currentObject--;
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2019-04-26 15:10:32 +02:00
|
|
|
ammoRing->currentObject = ammoRing->numObjects - 1;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
ammoRing->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2019-04-28 09:56:33 +02:00
|
|
|
else if (DbInput & IN_RIGHT && ammoRing->numObjects > 1)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = false;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Change object right
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / ammoRing->numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
ammoRing->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
ammoRing->rotation -= deltaAngle;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
if (ammoRing->currentObject < ammoRing->numObjects - 1)
|
|
|
|
ammoRing->currentObject++;
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2019-04-26 15:10:32 +02:00
|
|
|
ammoRing->currentObject = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
ammoRing->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-26 15:10:32 +02:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Choose ammo
|
|
|
|
switch (ring->objects[ring->currentObject].inventoryObject)
|
|
|
|
{
|
|
|
|
case INV_OBJECT_SHOTGUN:
|
|
|
|
g_LaraExtra.Weapons[WEAPON_SHOTGUN].SelectedAmmo = ring->selectedIndex;
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
case INV_OBJECT_GRENADE_LAUNCHER:
|
|
|
|
g_LaraExtra.Weapons[WEAPON_GRENADE_LAUNCHER].SelectedAmmo = ring->selectedIndex;
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
case INV_OBJECT_CROSSBOW:
|
|
|
|
case INV_OBJECT_CROSSBOW_LASER:
|
|
|
|
g_LaraExtra.Weapons[WEAPON_CROSSBOW].SelectedAmmo = ring->selectedIndex;
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
closeObject = true;
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 13:19:44 +02:00
|
|
|
CloseRing(INV_RING_CHOOSE_AMMO, false);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Reset secondary GUI
|
|
|
|
m_activeRing = INV_RING_WEAPONS;
|
|
|
|
ammoRing->draw = false;
|
2019-04-27 13:19:44 +02:00
|
|
|
ring->draw = true;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::UseCurrentItem()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
InventoryObject* inventoryObject = &ring->objects[ring->currentObject];
|
2019-11-27 15:12:35 +01:00
|
|
|
short objectNumber = m_objectsTable[inventoryObject->inventoryObject].objectNumber;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
LaraItem->meshBits = -1;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int binocularRange = BinocularRange;
|
2018-11-11 11:16:37 +01:00
|
|
|
BinocularRange = 0;
|
|
|
|
OldLaraBusy = false;
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Small medipack
|
|
|
|
if (objectNumber == ID_SMALLMEDI_ITEM)
|
|
|
|
{
|
|
|
|
if ((LaraItem->hitPoints <= 0 || LaraItem->hitPoints >= 1000) && !Lara.poisoned)
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Lara.numSmallMedipack != -1)
|
|
|
|
Lara.numSmallMedipack--;
|
|
|
|
|
|
|
|
Lara.dpoisoned = 0;
|
|
|
|
LaraItem->hitPoints += 500;
|
|
|
|
if (LaraItem->hitPoints > 1000)
|
|
|
|
LaraItem->hitPoints = 1000;
|
|
|
|
|
|
|
|
SoundEffect(116, 0, 2);
|
|
|
|
Savegame.Game.HealthUsed++;
|
|
|
|
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_MEDI, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Big medipack
|
|
|
|
if (objectNumber == ID_BIGMEDI_ITEM)
|
|
|
|
{
|
|
|
|
if ((LaraItem->hitPoints <= 0 || LaraItem->hitPoints >= 1000) && !Lara.poisoned)
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Lara.numLargeMedipack != -1)
|
|
|
|
Lara.numLargeMedipack--;
|
|
|
|
|
|
|
|
Lara.dpoisoned = 0;
|
|
|
|
LaraItem->hitPoints += 1000;
|
|
|
|
if (LaraItem->hitPoints > 1000)
|
|
|
|
LaraItem->hitPoints = 1000;
|
|
|
|
|
|
|
|
SoundEffect(116, 0, 2);
|
|
|
|
Savegame.Game.HealthUsed++;
|
|
|
|
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_MEDI, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Binoculars
|
|
|
|
if (objectNumber == ID_BINOCULARS_ITEM)
|
|
|
|
{
|
2018-11-11 11:16:37 +01:00
|
|
|
if (LaraItem->currentAnimState == 2 && LaraItem->animNumber == 103 || Lara.isDucked && !(TrInput & 0x20000000))
|
|
|
|
{
|
|
|
|
if (!SniperCameraActive && !UseSpotCam && !TrackCameraInit)
|
|
|
|
{
|
|
|
|
OldLaraBusy = true;
|
|
|
|
BinocularRange = 128;
|
|
|
|
if (Lara.gunStatus)
|
|
|
|
Lara.gunStatus = LG_UNDRAW_GUNS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (binocularRange)
|
|
|
|
BinocularRange = binocularRange;
|
|
|
|
else
|
|
|
|
BinocularOldCamera = Camera.oldType;
|
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Crowbar and puzzles
|
|
|
|
if (objectNumber == ID_CROWBAR_ITEM ||
|
|
|
|
objectNumber >= ID_PUZZLE_ITEM1 && objectNumber <= ID_PUZZLE_ITEM8 ||
|
|
|
|
objectNumber >= ID_PUZZLE_ITEM1_COMBO1 && objectNumber <= ID_PUZZLE_ITEM8_COMBO2 ||
|
|
|
|
objectNumber >= ID_KEY_ITEM1 && objectNumber <= ID_KEY_ITEM8 ||
|
|
|
|
objectNumber >= ID_KEY_ITEM1_COMBO1 && objectNumber <= ID_KEY_ITEM8_COMBO2 ||
|
|
|
|
objectNumber >= ID_PICKUP_ITEM1 && objectNumber <= ID_PICKUP_ITEM3 ||
|
|
|
|
objectNumber >= ID_PICKUP_ITEM1_COMBO1 && objectNumber <= ID_PICKUP_ITEM3_COMBO2)
|
|
|
|
{
|
|
|
|
// Only if above water
|
|
|
|
if (Lara.waterStatus == LW_ABOVE_WATER)
|
|
|
|
{
|
2019-11-18 07:48:35 +01:00
|
|
|
m_selectedObject = objectNumber;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Flares
|
|
|
|
if (objectNumber == ID_FLARE_INV_ITEM)
|
|
|
|
{
|
|
|
|
if (Lara.waterStatus == LW_ABOVE_WATER)
|
|
|
|
{
|
2019-11-18 07:48:35 +01:00
|
|
|
m_selectedObject = objectNumber;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
// TODO: can cause problem with harpoongun in underwater and wading !
|
2019-03-20 23:43:52 +01:00
|
|
|
bool canUseWeapons = !(LaraItem->currentAnimState == STATE_LARA_CRAWL_IDLE ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CRAWL_FORWARD ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CRAWL_TURN_LEFT ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CRAWL_TURN_RIGHT ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CRAWL_BACK ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CRAWL_TO_CLIMB ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CROUCH_IDLE ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CROUCH_TURN_LEFT ||
|
|
|
|
LaraItem->currentAnimState == STATE_LARA_CROUCH_TURN_RIGHT ||
|
|
|
|
Lara.waterStatus != LW_ABOVE_WATER);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
// Pistols
|
|
|
|
if (objectNumber == ID_PISTOLS_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
|
|
|
Lara.requestGunType = WEAPON_PISTOLS;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_PISTOLS)
|
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Uzis
|
|
|
|
if (objectNumber == ID_UZI_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
|
|
|
Lara.requestGunType = WEAPON_UZI;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_UZI)
|
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Revolver
|
|
|
|
if (objectNumber == ID_REVOLVER_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
|
|
|
Lara.requestGunType = WEAPON_REVOLVER;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_REVOLVER)
|
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Shotgun
|
|
|
|
if (objectNumber == ID_SHOTGUN_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
|
|
|
Lara.requestGunType = WEAPON_SHOTGUN;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_SHOTGUN)
|
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2018-11-01 22:45:59 +01:00
|
|
|
// Grenade launcher
|
|
|
|
if (objectNumber == ID_GRENADE_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
2018-11-21 09:34:01 +01:00
|
|
|
Lara.requestGunType = WEAPON_GRENADE_LAUNCHER;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_GRENADE_LAUNCHER)
|
2018-11-01 22:45:59 +01:00
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-11-01 22:45:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Harpoon gun
|
|
|
|
if (objectNumber == ID_HARPOON_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
2018-11-24 09:39:37 +01:00
|
|
|
Lara.requestGunType = WEAPON_HARPOON_GUN;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_HARPOON_GUN)
|
2018-11-01 22:45:59 +01:00
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-11-01 22:45:59 +01:00
|
|
|
}
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Crossbow/grappling gun
|
|
|
|
if (objectNumber == ID_CROSSBOW_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
|
|
|
Lara.requestGunType = WEAPON_CROSSBOW;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_CROSSBOW)
|
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// HK
|
|
|
|
if (objectNumber == ID_HK_ITEM)
|
|
|
|
{
|
|
|
|
if (canUseWeapons)
|
|
|
|
{
|
|
|
|
Lara.requestGunType = WEAPON_HK;
|
|
|
|
if (!Lara.gunStatus && Lara.gunType == WEAPON_HK)
|
|
|
|
Lara.gunStatus = LG_DRAW_GUNS;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Flares
|
|
|
|
if (objectNumber == ID_FLARE_INV_ITEM)
|
|
|
|
{
|
|
|
|
if (!Lara.gunStatus)
|
|
|
|
{
|
2019-03-20 23:43:52 +01:00
|
|
|
if (LaraItem->currentAnimState != STATE_LARA_CRAWL_IDLE &&
|
|
|
|
LaraItem->currentAnimState != STATE_LARA_CRAWL_FORWARD &&
|
|
|
|
LaraItem->currentAnimState != STATE_LARA_CRAWL_TURN_LEFT &&
|
|
|
|
LaraItem->currentAnimState != STATE_LARA_CRAWL_TURN_RIGHT &&
|
|
|
|
LaraItem->currentAnimState != STATE_LARA_CRAWL_BACK &&
|
|
|
|
LaraItem->currentAnimState != STATE_LARA_CRAWL_TO_CLIMB &&
|
|
|
|
Lara.waterStatus == LW_ABOVE_WATER)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
if (Lara.gunType != WEAPON_FLARE)
|
|
|
|
{
|
|
|
|
TrInput = 0x80000;
|
|
|
|
LaraGun();
|
|
|
|
TrInput = 0;
|
2018-08-24 23:36:49 +02:00
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SayNo();
|
|
|
|
}
|
2018-11-11 11:16:37 +01:00
|
|
|
|
|
|
|
return;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SayNo();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Inventory::GetVerticalOffset()
|
|
|
|
{
|
|
|
|
return m_movement;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::InitialiseTitle()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[INV_RING_OPTIONS];
|
|
|
|
|
|
|
|
// Reset the objects in inventory
|
|
|
|
ring->numObjects = 0;
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->currentObject = 0;
|
|
|
|
ring->focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
ring->objects[j].inventoryObject = -1;
|
|
|
|
ring->objects[j].rotation = 0;
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->objects[j].scale = INV_OBJECTS_SCALE;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_PASSPORT);
|
2018-08-19 09:46:58 +02:00
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_POLAROID);
|
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_SUNGLASSES);
|
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_HEADPHONES);
|
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_KEYS);
|
|
|
|
|
|
|
|
m_activeRing = INV_RING_OPTIONS;
|
|
|
|
m_deltaMovement = 0;
|
|
|
|
m_movement = INV_MOVE_STOPPED;
|
|
|
|
m_type = INV_TYPE_TITLE;
|
2019-11-18 07:48:35 +01:00
|
|
|
m_selectedObject = NO_ITEM;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
bool Inventory::UpdateSceneAndDrawInventory()
|
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
int nframes;
|
2019-05-31 21:45:13 +02:00
|
|
|
|
|
|
|
if (CurrentLevel == 0 && g_GameFlow->TitleType == TITLE_FLYBY)
|
|
|
|
{
|
|
|
|
// Control routines uses joints calculated here for getting Lara joint positions
|
|
|
|
CalcLaraMatrices(0);
|
|
|
|
phd_PushUnitMatrix();
|
|
|
|
CalcLaraMatrices(1);
|
|
|
|
|
|
|
|
// Calls my new rock & roll renderer :)
|
|
|
|
g_Renderer->DumpGameScene();
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
Camera.numberFrames = g_Renderer->SyncRenderer();
|
|
|
|
|
|
|
|
// We need to pop the matrix stack or the game will crash
|
2019-11-24 17:01:13 +01:00
|
|
|
phd_PopMatrix();
|
|
|
|
phd_PopDxMatrix();
|
2019-05-31 21:45:13 +02:00
|
|
|
|
|
|
|
nframes = Camera.numberFrames;
|
|
|
|
ControlPhase(nframes, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::DoTitleInventory()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
InitialiseTitle();
|
|
|
|
|
|
|
|
m_rings[INV_RING_PUZZLES].draw = false;
|
|
|
|
m_rings[INV_RING_WEAPONS].draw = false;
|
|
|
|
m_rings[INV_RING_OPTIONS].draw = true;
|
|
|
|
|
|
|
|
InventoryRing* ring = &m_rings[INV_RING_OPTIONS];
|
|
|
|
m_activeRing = INV_RING_OPTIONS;
|
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
// Fade in
|
|
|
|
g_Renderer->FadeIn();
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < FADE_FRAMES_COUNT; i++)
|
2019-05-10 20:38:48 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-05-10 20:38:48 +02:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-05-10 20:38:48 +02:00
|
|
|
CurrentAtmosphere = CDA_XA11_FLYBY1;
|
|
|
|
IsAtmospherePlaying = true;
|
|
|
|
S_CDPlay(CurrentAtmosphere, 1);
|
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
OpenRing(INV_RING_OPTIONS, true);
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int result = INV_RESULT_NONE;
|
2018-09-03 21:08:40 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
while (!ResetFlag)
|
|
|
|
{
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
2018-12-31 11:37:06 +01:00
|
|
|
if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-03 21:08:40 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Change object right
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / ring->numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
ring->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation += deltaAngle;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ring->currentObject == ring->numObjects - 1)
|
|
|
|
ring->currentObject = 0;
|
|
|
|
else
|
|
|
|
ring->currentObject++;
|
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-03 21:08:40 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Change object left
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaAngle = 360.0f / ring->numObjects / INV_NUM_FRAMES_ROTATE;
|
|
|
|
ring->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < INV_NUM_FRAMES_ROTATE; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation -= deltaAngle;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ring->currentObject == 0)
|
|
|
|
ring->currentObject = ring->numObjects - 1;
|
|
|
|
else
|
|
|
|
ring->currentObject--;
|
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-03 21:08:40 +02:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
2019-12-13 13:52:47 +01:00
|
|
|
if (ring->objects[ring->currentObject].inventoryObject == INV_OBJECT_PASSPORT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
int passportResult = DoPassport();
|
2019-04-26 15:10:32 +02:00
|
|
|
if (passportResult == INV_RESULT_NEW_GAME ||
|
|
|
|
passportResult == INV_RESULT_EXIT_GAME ||
|
|
|
|
passportResult == INV_RESULT_LOAD_GAME)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
2019-04-27 13:19:44 +02:00
|
|
|
result = passportResult;
|
|
|
|
break;
|
2018-09-03 21:08:40 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
if (ring->objects[ring->currentObject].inventoryObject == INV_OBJECT_KEYS)
|
|
|
|
DoControlsSettings();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
if (ring->objects[ring->currentObject].inventoryObject == INV_OBJECT_SUNGLASSES)
|
|
|
|
DoGraphicsSettings();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
if (ring->objects[ring->currentObject].inventoryObject == INV_OBJECT_HEADPHONES)
|
|
|
|
DoSoundSettings();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 10:24:44 +02:00
|
|
|
CloseRing(INV_RING_OPTIONS, true);
|
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < FADE_FRAMES_COUNT; i++)
|
2019-05-10 20:38:48 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-05-10 20:38:48 +02:00
|
|
|
}
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
return result;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
InventoryObjectDefinition* Inventory::GetInventoryObject(int index)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
return &m_objectsTable[index];
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::DoPassport()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
short choice = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
vector<int> choices;
|
2018-08-19 09:46:58 +02:00
|
|
|
if (m_type == INV_TYPE_TITLE)
|
|
|
|
{
|
|
|
|
choices.push_back(INV_WHAT_PASSPORT_NEW_GAME);
|
2018-09-03 21:08:40 +02:00
|
|
|
choices.push_back(INV_WHAT_PASSPORT_SELECT_LEVEL);
|
2018-08-19 09:46:58 +02:00
|
|
|
choices.push_back(INV_WHAT_PASSPORT_LOAD_GAME);
|
|
|
|
choices.push_back(INV_WHAT_PASSPORT_EXIT_GAME);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
choices.push_back(INV_WHAT_PASSPORT_NEW_GAME);
|
|
|
|
choices.push_back(INV_WHAT_PASSPORT_LOAD_GAME);
|
2018-09-08 21:30:48 +02:00
|
|
|
if (LaraItem->hitPoints > 0 || CurrentLevel == 0)
|
|
|
|
choices.push_back(INV_WHAT_PASSPORT_SAVE_GAME);
|
2018-08-19 09:46:58 +02:00
|
|
|
choices.push_back(INV_WHAT_PASSPORT_EXIT_TO_TITLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = choices[0];
|
|
|
|
|
|
|
|
PopupObject();
|
|
|
|
|
|
|
|
// Open the passport
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 14; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->frameIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool moveLeft = false;
|
|
|
|
bool moveRight = false;
|
|
|
|
bool closePassport = false;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int result = INV_RESULT_NONE;
|
2018-09-03 21:08:40 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Do the passport
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT || closePassport)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT || moveLeft)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
if (choice > 0)
|
|
|
|
{
|
|
|
|
ring->frameIndex = 19;
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 5; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->frameIndex--;
|
|
|
|
}
|
|
|
|
|
|
|
|
choice--;
|
|
|
|
}
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT || moveRight)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
2018-09-03 21:08:40 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
if (choice < choices.size() - 1)
|
|
|
|
{
|
|
|
|
ring->frameIndex = 14;
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < 5; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->frameIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
choice++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (choices[choice] == INV_WHAT_PASSPORT_LOAD_GAME)
|
|
|
|
{
|
|
|
|
// Load game
|
2019-11-27 15:12:35 +01:00
|
|
|
int selectedSavegame = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
SetDebounce = 1;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = 0;
|
|
|
|
|
|
|
|
// Process input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-08 21:30:48 +02:00
|
|
|
if (CurrentLevel == 0 || LaraItem->hitPoints > 0)
|
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_FORWARD && selectedSavegame > 0)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
selectedSavegame--;
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_BACK && selectedSavegame < MAX_SAVEGAMES - 1)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
selectedSavegame++;
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = true;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = true;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
2018-12-31 10:38:34 +01:00
|
|
|
|
2018-10-24 23:32:22 +02:00
|
|
|
//ReadSavegame(selectedSavegame);
|
|
|
|
g_GameFlow->SelectedSaveGame = selectedSavegame;
|
2019-04-26 15:10:32 +02:00
|
|
|
result = INV_RESULT_LOAD_GAME;
|
2018-09-03 21:08:40 +02:00
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->selectedIndex = selectedSavegame;
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_LOAD_GAME;
|
|
|
|
|
|
|
|
LoadSavegameInfos();
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_SAVE_GAME)
|
|
|
|
{
|
|
|
|
// Save game
|
2019-11-27 15:12:35 +01:00
|
|
|
int selectedSavegame = 0;
|
2018-08-19 09:46:58 +02:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
SetDebounce = 1;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = 0;
|
|
|
|
|
|
|
|
// Process input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-08 21:30:48 +02:00
|
|
|
if (CurrentLevel == 0 || LaraItem->hitPoints > 0)
|
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_FORWARD && selectedSavegame > 0)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
selectedSavegame--;
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_BACK && selectedSavegame < MAX_SAVEGAMES - 1)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
selectedSavegame++;
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = true;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = true;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
2018-12-31 10:38:34 +01:00
|
|
|
|
2018-10-09 00:02:14 +02:00
|
|
|
// Use the new savegame system
|
|
|
|
char fileName[255];
|
|
|
|
ZeroMemory(fileName, 255);
|
|
|
|
sprintf(fileName, "savegame.%d", selectedSavegame);
|
|
|
|
SaveGame::Save(fileName);
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->selectedIndex = selectedSavegame;
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_SAVE_GAME;
|
|
|
|
|
|
|
|
LoadSavegameInfos();
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
2018-09-03 21:08:40 +02:00
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_SELECT_LEVEL)
|
|
|
|
{
|
|
|
|
// Save game
|
2019-11-27 15:12:35 +01:00
|
|
|
int selectedLevel = 0;
|
2018-09-03 21:08:40 +02:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
SetDebounce = 1;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = 0;
|
|
|
|
|
|
|
|
// Process input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
2018-09-08 21:30:48 +02:00
|
|
|
if (CurrentLevel == 0 || LaraItem->hitPoints > 0)
|
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
}
|
2018-09-03 21:08:40 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_FORWARD && selectedLevel > 0)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-09-03 21:08:40 +02:00
|
|
|
selectedLevel--;
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_BACK && selectedLevel < g_GameFlow->GetNumLevels() - 1)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-09-03 21:08:40 +02:00
|
|
|
selectedLevel++;
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
|
|
|
moveLeft = true;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = true;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
2018-12-31 10:38:34 +01:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
result = INV_RESULT_NEW_GAME;
|
2018-09-22 23:54:36 +02:00
|
|
|
g_GameFlow->SelectedLevelForNewGame = selectedLevel + 1;
|
2018-09-03 21:08:40 +02:00
|
|
|
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ring->selectedIndex = selectedLevel;
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_SELECT_LEVEL;
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-09-03 21:08:40 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_NEW_GAME)
|
|
|
|
{
|
|
|
|
// New game
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
SetDebounce = 1;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = 0;
|
|
|
|
|
|
|
|
// Process input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-08 21:30:48 +02:00
|
|
|
if (CurrentLevel == 0 || LaraItem->hitPoints > 0)
|
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = true;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = true;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
result = INV_RESULT_NEW_GAME;
|
2018-09-03 21:08:40 +02:00
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_NEW_GAME;
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_EXIT_GAME)
|
|
|
|
{
|
|
|
|
// Exit game
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
SetDebounce = 1;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = 0;
|
|
|
|
|
|
|
|
// Process input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-08 21:30:48 +02:00
|
|
|
if (CurrentLevel == 0 || LaraItem->hitPoints > 0)
|
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = true;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = true;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
result = INV_RESULT_EXIT_GAME;
|
2018-09-03 21:08:40 +02:00
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_EXIT_GAME;
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_EXIT_TO_TITLE)
|
|
|
|
{
|
|
|
|
// Exit game
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
SetDebounce = 1;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = 0;
|
|
|
|
|
|
|
|
// Process input
|
2018-12-30 11:41:48 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-09-08 21:30:48 +02:00
|
|
|
if (CurrentLevel == 0 || LaraItem->hitPoints > 0)
|
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = true;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = true;
|
|
|
|
closePassport = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-12-31 11:37:06 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
result = INV_RESULT_EXIT_TO_TILE;
|
2018-09-03 21:08:40 +02:00
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_EXIT_TO_TITLE;
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close the passport
|
|
|
|
ring->frameIndex = 24;
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 24; i < 30; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->frameIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
|
|
|
|
PopoverObject();
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
return result;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::PopupObject()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int steps = INV_NUM_FRAMES_POPUP;
|
|
|
|
int deltaAngle = (0 - ring->objects[ring->currentObject].rotation) / steps;
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaScale = INV_OBJECTS_SCALE / (float)steps;
|
2019-05-06 23:48:35 +02:00
|
|
|
float deltaTilt = 90.0f / steps;
|
|
|
|
float deltaDistance = INV_OBJECT_DISTANCE / steps;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
ring->focusState = INV_FOCUS_STATE_POPUP;
|
2019-05-06 23:48:35 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < steps; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
ring->objects[ring->currentObject].rotation += deltaAngle;
|
|
|
|
ring->objects[ring->currentObject].scale += deltaScale;
|
|
|
|
}
|
2019-05-06 23:48:35 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->focusState = INV_FOCUS_STATE_FOCUSED;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::PopoverObject()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int steps = INV_NUM_FRAMES_POPUP;
|
|
|
|
int deltaAngle = (0 - ring->objects[ring->currentObject].rotation) / steps;
|
2019-04-27 10:24:44 +02:00
|
|
|
float deltaScale = INV_OBJECTS_SCALE / (float)steps;
|
2019-05-06 23:48:35 +02:00
|
|
|
float deltaTilt = INV_OBJECT_TILT / steps;
|
|
|
|
float deltaDistance = INV_OBJECT_DISTANCE / steps;
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
ring->focusState = INV_FOCUS_STATE_POPOVER;
|
2019-05-06 23:48:35 +02:00
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < steps; i++)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
ring->objects[ring->currentObject].rotation -= deltaAngle;
|
|
|
|
ring->objects[ring->currentObject].scale -= deltaScale;
|
|
|
|
}
|
2019-05-06 23:48:35 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
ring->focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::GetType()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
return m_type;
|
2018-09-07 18:34:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::DoControlsSettings()
|
|
|
|
{
|
2019-04-27 18:22:30 +02:00
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
ring->selectedIndex = 0;
|
2019-04-28 16:48:29 +02:00
|
|
|
ring->waitingForKey = false;
|
2019-04-29 13:10:58 +02:00
|
|
|
|
2019-04-27 18:22:30 +02:00
|
|
|
PopupObject();
|
|
|
|
|
|
|
|
bool closeObject = false;
|
|
|
|
|
2019-04-29 13:10:58 +02:00
|
|
|
// Copy configuration to a temporary object
|
|
|
|
memcpy(&ring->Configuration.KeyboardLayout, &KeyboardLayout1, NUM_CONTROLS);
|
|
|
|
|
2019-04-27 18:22:30 +02:00
|
|
|
// Do the passport
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2019-04-27 18:22:30 +02:00
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
|
|
|
{
|
2019-04-28 16:48:29 +02:00
|
|
|
if (!ring->waitingForKey)
|
|
|
|
closeObject = true;
|
|
|
|
else
|
|
|
|
ring->waitingForKey = false;
|
2019-04-27 18:22:30 +02:00
|
|
|
|
2019-04-28 16:48:29 +02:00
|
|
|
break;
|
2019-04-27 18:22:30 +02:00
|
|
|
}
|
|
|
|
else if (DbInput & IN_FORWARD)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex > 0)
|
|
|
|
ring->selectedIndex--;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_BACK)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2019-04-28 16:48:29 +02:00
|
|
|
if (ring->selectedIndex < NUM_CONTROLS + 2 - 1)
|
2019-04-27 18:22:30 +02:00
|
|
|
ring->selectedIndex++;
|
2019-04-28 16:48:29 +02:00
|
|
|
}
|
2019-04-27 18:22:30 +02:00
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
2019-04-28 16:48:29 +02:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2019-04-27 18:22:30 +02:00
|
|
|
|
2019-04-28 16:48:29 +02:00
|
|
|
if (ring->selectedIndex == NUM_CONTROLS)
|
2019-04-27 18:22:30 +02:00
|
|
|
{
|
2019-04-29 13:10:58 +02:00
|
|
|
memcpy(KeyboardLayout1, ring->Configuration.KeyboardLayout, NUM_CONTROLS);
|
2019-04-27 18:22:30 +02:00
|
|
|
SaveConfiguration();
|
2019-04-29 13:10:58 +02:00
|
|
|
|
2019-04-27 18:22:30 +02:00
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
2019-04-28 16:48:29 +02:00
|
|
|
else if (ring->selectedIndex == NUM_CONTROLS + 1)
|
2019-04-27 18:22:30 +02:00
|
|
|
{
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-28 16:48:29 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// If RETURN is pressed, then wait for a new key
|
|
|
|
if (KeyMap[TR_KEY_RETURN] & 0x80)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
if (!ring->waitingForKey)
|
|
|
|
{
|
|
|
|
ring->waitingForKey = true;
|
|
|
|
|
|
|
|
TrInput = 0;
|
|
|
|
DbInput = 0;
|
|
|
|
ZeroMemory(KeyMap, 256);
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
if (DbInput & IN_DESELECT)
|
|
|
|
{
|
|
|
|
ring->waitingForKey = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int selectedKey = 0;
|
2019-04-28 16:48:29 +02:00
|
|
|
for (selectedKey = 0; selectedKey < 256; selectedKey++)
|
|
|
|
{
|
|
|
|
if (KeyMap[selectedKey] & 0x80)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectedKey == 256)
|
|
|
|
selectedKey = 0;
|
|
|
|
|
|
|
|
if (selectedKey && g_KeyNames[selectedKey])
|
|
|
|
{
|
|
|
|
// Can't rededefine special keys or the inventory will be not usable
|
|
|
|
if (!(selectedKey == TR_KEY_RETURN || selectedKey == TR_KEY_LEFT || selectedKey == TR_KEY_RIGHT ||
|
|
|
|
selectedKey == TR_KEY_UP || selectedKey == TR_KEY_DOWN))
|
|
|
|
{
|
|
|
|
if (selectedKey != TR_KEY_ESCAPE)
|
|
|
|
{
|
|
|
|
KeyboardLayout1[ring->selectedIndex] = selectedKey;
|
|
|
|
CheckKeyConflicts();
|
|
|
|
ring->waitingForKey = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-27 18:22:30 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-28 16:48:29 +02:00
|
|
|
|
2019-04-28 20:19:27 +02:00
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
2019-04-28 16:48:29 +02:00
|
|
|
}
|
2019-04-27 18:22:30 +02:00
|
|
|
}
|
2019-04-28 16:48:29 +02:00
|
|
|
}
|
2019-04-27 18:22:30 +02:00
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-27 18:22:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PopoverObject();
|
2018-09-07 18:34:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::DoGraphicsSettings()
|
|
|
|
{
|
2018-12-30 11:41:48 +01:00
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
ring->selectedIndex = 0;
|
|
|
|
|
|
|
|
PopupObject();
|
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
// Copy configuration to a temporary object
|
|
|
|
memcpy(&ring->Configuration, &g_Configuration, sizeof(GameConfiguration));
|
|
|
|
|
|
|
|
// Get current display mode
|
2019-03-20 23:43:52 +01:00
|
|
|
vector<RendererVideoAdapter>* adapters = g_Renderer->GetAdapters();
|
2018-12-31 10:38:34 +01:00
|
|
|
RendererVideoAdapter* adapter = &(*adapters)[ring->Configuration.Adapter];
|
|
|
|
ring->SelectedVideoMode = 0;
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < adapter->DisplayModes.size(); i++)
|
2018-12-31 10:38:34 +01:00
|
|
|
{
|
|
|
|
RendererDisplayMode* mode = &adapter->DisplayModes[i];
|
|
|
|
if (mode->Width == ring->Configuration.Width && mode->Height == ring->Configuration.Height &&
|
|
|
|
mode->RefreshRate == ring->Configuration.RefreshRate)
|
|
|
|
{
|
|
|
|
ring->SelectedVideoMode = i;
|
|
|
|
break;
|
|
|
|
}
|
2019-03-20 23:43:52 +01:00
|
|
|
}
|
2018-12-31 10:38:34 +01:00
|
|
|
|
2018-12-30 11:41:48 +01:00
|
|
|
bool closeObject = false;
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2019-04-26 15:10:32 +02:00
|
|
|
// Do the menu
|
2018-12-30 11:41:48 +01:00
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
|
|
|
{
|
2018-12-31 10:38:34 +01:00
|
|
|
closeObject = true;
|
2018-12-30 11:41:48 +01:00
|
|
|
break;
|
|
|
|
}
|
2018-12-31 10:38:34 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-12-30 11:41:48 +01:00
|
|
|
{
|
|
|
|
closeObject = false;
|
2018-12-31 10:38:34 +01:00
|
|
|
|
|
|
|
switch (ring->selectedIndex)
|
|
|
|
{
|
|
|
|
case INV_DISPLAY_RESOLUTION:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->SelectedVideoMode > 0)
|
|
|
|
ring->SelectedVideoMode--;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2019-05-02 21:19:24 +02:00
|
|
|
case INV_DISPLAY_WINDOWED:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.Windowed = !ring->Configuration.Windowed;
|
|
|
|
break;
|
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
case INV_DISPLAY_SHADOWS:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableShadows = !ring->Configuration.EnableShadows;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_DISPLAY_CAUSTICS:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableCaustics = !ring->Configuration.EnableCaustics;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_DISPLAY_VOLUMETRIC_FOG:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableVolumetricFog = !ring->Configuration.EnableVolumetricFog;
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
}
|
2018-12-31 10:38:34 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-12-30 11:41:48 +01:00
|
|
|
{
|
|
|
|
closeObject = false;
|
2018-12-31 10:38:34 +01:00
|
|
|
|
|
|
|
switch (ring->selectedIndex)
|
|
|
|
{
|
|
|
|
case INV_DISPLAY_RESOLUTION:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2019-04-29 13:10:58 +02:00
|
|
|
if (ring->SelectedVideoMode < adapter->DisplayModes.size() - 1)
|
2018-12-31 10:38:34 +01:00
|
|
|
ring->SelectedVideoMode++;
|
|
|
|
break;
|
|
|
|
|
2019-05-02 21:19:24 +02:00
|
|
|
case INV_DISPLAY_WINDOWED:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.Windowed = !ring->Configuration.Windowed;
|
|
|
|
break;
|
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
case INV_DISPLAY_SHADOWS:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableShadows = !ring->Configuration.EnableShadows;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_DISPLAY_CAUSTICS:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableCaustics = !ring->Configuration.EnableCaustics;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_DISPLAY_VOLUMETRIC_FOG:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableVolumetricFog = !ring->Configuration.EnableVolumetricFog;
|
|
|
|
break;
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
}
|
|
|
|
else if (DbInput & IN_FORWARD)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
2018-12-30 11:41:48 +01:00
|
|
|
if (ring->selectedIndex > 0)
|
|
|
|
ring->selectedIndex--;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_BACK)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex < INV_DISPLAY_COUNT)
|
2018-12-30 11:41:48 +01:00
|
|
|
ring->selectedIndex++;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
2018-12-31 10:38:34 +01:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
2018-12-30 11:41:48 +01:00
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
if (ring->selectedIndex == INV_DISPLAY_APPLY)
|
|
|
|
{
|
|
|
|
// Save the configuration
|
2019-03-20 23:43:52 +01:00
|
|
|
RendererDisplayMode* mode = &adapter->DisplayModes[ring->SelectedVideoMode];
|
2018-12-31 10:38:34 +01:00
|
|
|
ring->Configuration.Width = mode->Width;
|
|
|
|
ring->Configuration.Height = mode->Height;
|
|
|
|
ring->Configuration.RefreshRate = mode->RefreshRate;
|
2019-05-02 21:19:24 +02:00
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
memcpy(&g_Configuration, &ring->Configuration, sizeof(GameConfiguration));
|
2019-03-20 23:43:52 +01:00
|
|
|
SaveConfiguration();
|
2018-12-31 10:38:34 +01:00
|
|
|
|
|
|
|
// Reset screen and go back
|
|
|
|
g_Renderer->ChangeScreenResolution(ring->Configuration.Width, ring->Configuration.Height,
|
|
|
|
ring->Configuration.RefreshRate, ring->Configuration.Windowed);
|
|
|
|
closeObject = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (ring->selectedIndex == INV_DISPLAY_CANCEL)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
closeObject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2018-12-30 11:41:48 +01:00
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-12-30 11:41:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
PopoverObject();
|
2018-09-07 18:34:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::DoSoundSettings()
|
|
|
|
{
|
2018-12-31 10:38:34 +01:00
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
ring->selectedIndex = 0;
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2018-12-31 10:38:34 +01:00
|
|
|
PopupObject();
|
|
|
|
|
|
|
|
// Copy configuration to a temporary object
|
|
|
|
memcpy(&ring->Configuration, &g_Configuration, sizeof(GameConfiguration));
|
|
|
|
|
|
|
|
bool closeObject = false;
|
2019-11-27 15:12:35 +01:00
|
|
|
int oldVolume = ring->Configuration.MusicVolume;
|
|
|
|
int oldSfxVolume = ring->Configuration.SfxVolume;
|
2018-12-31 10:38:34 +01:00
|
|
|
bool wasSoundEnabled = ring->Configuration.EnableSound;
|
|
|
|
|
|
|
|
// Do the passport
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
// Handle input
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
|
|
|
if (DbInput & IN_DESELECT || closeObject)
|
|
|
|
{
|
|
|
|
closeObject = true;
|
|
|
|
GlobalMusicVolume = oldVolume;
|
|
|
|
GlobalFXVolume = oldSfxVolume;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_LEFT)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
switch (ring->selectedIndex)
|
|
|
|
{
|
|
|
|
case INV_SOUND_ENABLED:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableSound = !ring->Configuration.EnableSound;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_SOUND_SPECIAL_EFFECTS:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableAudioSpecialEffects = !ring->Configuration.EnableAudioSpecialEffects;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_SOUND_MUSIC_VOLUME:
|
|
|
|
if (ring->Configuration.MusicVolume > 0)
|
|
|
|
{
|
|
|
|
ring->Configuration.MusicVolume--;
|
|
|
|
GlobalMusicVolume = ring->Configuration.MusicVolume;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_SOUND_SFX_VOLUME:
|
|
|
|
if (ring->Configuration.SfxVolume > 0)
|
|
|
|
{
|
|
|
|
ring->Configuration.SfxVolume--;
|
|
|
|
GlobalFXVolume = ring->Configuration.SfxVolume;
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
switch (ring->selectedIndex)
|
|
|
|
{
|
|
|
|
case INV_SOUND_ENABLED:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableSound = !ring->Configuration.EnableSound;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_SOUND_SPECIAL_EFFECTS:
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
ring->Configuration.EnableAudioSpecialEffects = !ring->Configuration.EnableAudioSpecialEffects;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_SOUND_MUSIC_VOLUME:
|
|
|
|
if (ring->Configuration.MusicVolume < 100)
|
|
|
|
{
|
|
|
|
ring->Configuration.MusicVolume++;
|
|
|
|
GlobalMusicVolume = ring->Configuration.MusicVolume;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INV_SOUND_SFX_VOLUME:
|
|
|
|
if (ring->Configuration.SfxVolume < 100)
|
|
|
|
{
|
|
|
|
ring->Configuration.SfxVolume++;
|
|
|
|
GlobalFXVolume = ring->Configuration.SfxVolume;
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_FORWARD)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex > 0)
|
|
|
|
ring->selectedIndex--;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_BACK)
|
|
|
|
{
|
|
|
|
closeObject = false;
|
|
|
|
|
|
|
|
SoundEffect(SFX_MENU_CHOOSE, NULL, 0);
|
|
|
|
if (ring->selectedIndex < INV_DISPLAY_COUNT)
|
|
|
|
ring->selectedIndex++;
|
|
|
|
}
|
|
|
|
else if (DbInput & IN_SELECT)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
if (ring->selectedIndex == INV_DISPLAY_APPLY)
|
|
|
|
{
|
|
|
|
// Save the configuration
|
|
|
|
GlobalMusicVolume = ring->Configuration.MusicVolume;
|
|
|
|
GlobalFXVolume = ring->Configuration.SfxVolume;
|
|
|
|
memcpy(&g_Configuration, &ring->Configuration, sizeof(GameConfiguration));
|
|
|
|
SaveConfiguration();
|
|
|
|
|
|
|
|
// Init or deinit the sound system
|
|
|
|
if (wasSoundEnabled && !g_Configuration.EnableSound)
|
|
|
|
Sound_DeInit();
|
|
|
|
else if (!wasSoundEnabled && g_Configuration.EnableSound)
|
|
|
|
Sound_Init();
|
|
|
|
|
|
|
|
closeObject = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (ring->selectedIndex == INV_DISPLAY_CANCEL)
|
|
|
|
{
|
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
|
|
|
closeObject = true;
|
|
|
|
GlobalMusicVolume = oldVolume;
|
|
|
|
GlobalFXVolume = oldSfxVolume;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2018-12-31 10:38:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
PopoverObject();
|
2019-04-26 15:10:32 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int Inventory::GetActiveGui()
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
|
|
|
return m_activeGui;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
bool Inventory::IsObjectSeparable(short object)
|
2019-04-26 15:10:32 +02:00
|
|
|
{
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < m_combinations.size(); i++)
|
2019-04-26 21:09:58 +02:00
|
|
|
if (m_combinations[i].combinedObject == object)
|
|
|
|
return true;
|
2019-04-26 15:10:32 +02:00
|
|
|
return false;
|
2019-04-27 10:24:44 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::OpenRing(int r, bool animateCamera)
|
2019-04-27 10:24:44 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[r];
|
|
|
|
|
|
|
|
m_activeRing = r;
|
|
|
|
m_cameraY = ring->y;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int numFrames = INV_NUM_FRAMES_OPEN_CLOSE;
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation = 90;
|
|
|
|
ring->distance = 0;
|
|
|
|
float deltaAngle = ring->rotation / numFrames;
|
|
|
|
float deltaShift = INV_OBJECTS_DISTANCE / numFrames;
|
|
|
|
|
|
|
|
float deltaTilt = 0;
|
2019-04-27 13:19:44 +02:00
|
|
|
m_cameraTilt = INV_CAMERA_TILT;
|
2019-04-27 10:24:44 +02:00
|
|
|
if (animateCamera)
|
|
|
|
{
|
|
|
|
deltaTilt = (INV_CAMERA_ANIMATION_TILT - INV_CAMERA_TILT) / numFrames;
|
|
|
|
m_cameraTilt = INV_CAMERA_ANIMATION_TILT;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < numFrames; i++)
|
2019-04-27 10:24:44 +02:00
|
|
|
{
|
|
|
|
ring->distance += deltaShift;
|
|
|
|
ring->rotation -= deltaAngle;
|
|
|
|
|
|
|
|
m_cameraTilt -= deltaTilt;
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-27 10:24:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
m_cameraTilt = INV_CAMERA_TILT;
|
|
|
|
m_cameraY = m_rings[r].y;
|
|
|
|
ring->distance = INV_OBJECTS_DISTANCE;
|
|
|
|
ring->rotation = 0;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::CloseRing(int r, bool animateCamera)
|
2019-04-27 10:24:44 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[r];
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int numFrames = INV_NUM_FRAMES_OPEN_CLOSE;
|
2019-04-27 10:24:44 +02:00
|
|
|
ring->rotation = 0;
|
|
|
|
ring->distance = INV_OBJECTS_DISTANCE;
|
|
|
|
float deltaAngle = 90.0f / numFrames;
|
|
|
|
float deltaShift = INV_OBJECTS_DISTANCE / numFrames;
|
|
|
|
|
|
|
|
float deltaTilt = 0;
|
2019-04-27 13:19:44 +02:00
|
|
|
m_cameraTilt = INV_CAMERA_TILT;
|
2019-04-27 10:24:44 +02:00
|
|
|
if (animateCamera)
|
|
|
|
{
|
|
|
|
deltaTilt = (INV_CAMERA_ANIMATION_TILT - INV_CAMERA_TILT) / numFrames;
|
|
|
|
m_cameraTilt = INV_CAMERA_TILT;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < numFrames; i++)
|
2019-04-27 10:24:44 +02:00
|
|
|
{
|
|
|
|
ring->distance -= deltaShift;
|
|
|
|
ring->rotation += deltaAngle;
|
|
|
|
|
|
|
|
m_cameraTilt += deltaTilt;
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-27 10:24:44 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 13:19:44 +02:00
|
|
|
m_cameraTilt = (animateCamera ? INV_CAMERA_ANIMATION_TILT : INV_CAMERA_TILT);
|
2019-04-27 10:24:44 +02:00
|
|
|
|
|
|
|
ring->distance = 0;
|
|
|
|
ring->rotation = 90;
|
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
void Inventory::SwitchRing(int from, int to, float verticalShift)
|
2019-04-27 10:24:44 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring1 = &m_rings[from];
|
|
|
|
InventoryRing* ring2 = &m_rings[to];
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
int numFrames = INV_NUM_FRAMES_OPEN_CLOSE;
|
2019-04-27 10:24:44 +02:00
|
|
|
|
|
|
|
ring1->rotation = 0;
|
|
|
|
ring1->distance = INV_OBJECTS_DISTANCE;
|
|
|
|
ring2->rotation = 90;
|
|
|
|
ring2->distance = 0;
|
|
|
|
|
|
|
|
float deltaAngle = 90.0f / numFrames;
|
|
|
|
float deltaShift = INV_OBJECTS_DISTANCE / numFrames;
|
|
|
|
float deltaY = INV_RINGS_OFFSET * verticalShift / numFrames;
|
|
|
|
|
|
|
|
m_cameraTilt = INV_CAMERA_TILT;
|
|
|
|
|
|
|
|
ring1->draw = true;
|
|
|
|
ring2->draw = false;
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
for (int i = 0; i < numFrames; i++)
|
2019-04-27 10:24:44 +02:00
|
|
|
{
|
|
|
|
ring1->distance -= deltaShift;
|
|
|
|
ring1->rotation += deltaAngle;
|
|
|
|
|
|
|
|
ring2->distance += deltaShift;
|
|
|
|
ring2->rotation -= deltaAngle;
|
|
|
|
|
|
|
|
m_cameraY += deltaY;
|
|
|
|
|
|
|
|
if (i >= 2)
|
|
|
|
{
|
|
|
|
ring1->draw = false;
|
|
|
|
ring2->draw = true;
|
|
|
|
}
|
|
|
|
|
2019-05-31 21:45:13 +02:00
|
|
|
UpdateSceneAndDrawInventory();
|
2019-04-27 10:24:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring1->distance = 0;
|
|
|
|
ring1->rotation = 90;
|
|
|
|
|
|
|
|
ring2->distance = INV_OBJECTS_DISTANCE;
|
|
|
|
ring2->rotation = 0;
|
|
|
|
|
|
|
|
m_cameraY = ring2->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Inventory::GetCameraY()
|
|
|
|
{
|
|
|
|
return m_cameraY;
|
|
|
|
}
|
|
|
|
|
|
|
|
float Inventory::GetCameraTilt()
|
|
|
|
{
|
|
|
|
return m_cameraTilt;
|
2019-04-28 09:56:33 +02:00
|
|
|
}
|
|
|
|
|
2019-11-27 15:12:35 +01:00
|
|
|
bool Inventory::HasWeaponMultipleAmmos(short object)
|
2019-04-28 09:56:33 +02:00
|
|
|
{
|
|
|
|
return (object == INV_OBJECT_SHOTGUN || object == INV_OBJECT_CROSSBOW || object == INV_OBJECT_GRENADE_LAUNCHER);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|