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"
|
2018-11-01 22:45:59 +01:00
|
|
|
#include "lara.h"
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
#include "..\Global\global.h"
|
|
|
|
#include "..\Specific\input.h"
|
2018-12-31 10:38:34 +01:00
|
|
|
#include "..\Specific\config.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
|
|
|
|
|
|
|
void Inject_Inventory()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Inventory::Inventory()
|
|
|
|
{
|
|
|
|
ZeroMemory(&m_objectsTable[0], sizeof(InventoryObjectDefinition) * INVENTORY_TABLE_SIZE);
|
|
|
|
|
|
|
|
// Copy the old table
|
|
|
|
for (__int32 i = 0; i < 100; i++)
|
|
|
|
{
|
|
|
|
m_objectsTable[i].objectNumber = InventoryObjectsList[i].objectNumber;
|
2018-11-11 23:42:30 +01:00
|
|
|
m_objectsTable[i].objectName = InventoryObjectsList[i].objectName;
|
2018-08-19 09:46:58 +02:00
|
|
|
m_objectsTable[i].meshBits = InventoryObjectsList[i].meshBits;
|
|
|
|
}
|
|
|
|
|
2018-11-11 23:42:30 +01:00
|
|
|
// Assign new strings
|
2018-11-14 20:54:18 +01:00
|
|
|
m_objectsTable[INV_OBJECT_UZIS] = InventoryObjectDefinition(ID_UZI_ITEM, STRING_INV_UZI, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_PISTOLS] = InventoryObjectDefinition(ID_PISTOLS_ITEM, STRING_INV_PISTOLS, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SHOTGUN] = InventoryObjectDefinition(ID_SHOTGUN_ITEM, STRING_INV_SHOTGUN, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_REVOLVER] = InventoryObjectDefinition(ID_REVOLVER_ITEM, STRING_INV_REVOLVER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_REVOLVER_LASER] = InventoryObjectDefinition(ID_REVOLVER_ITEM, STRING_INV_REVOLVER_LASER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HK] = InventoryObjectDefinition(ID_HK_ITEM, STRING_INV_HK, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SHOTGUN_AMMO1] = InventoryObjectDefinition(ID_SHOTGUN_AMMO1_ITEM, STRING_INV_SHOTGUN_AMMO1, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SHOTGUN_AMMO2] = InventoryObjectDefinition(ID_SHOTGUN_AMMO2_ITEM, STRING_INV_SHOTGUN_AMMO2, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HK_AMMO1] = InventoryObjectDefinition(ID_HK_AMMO_ITEM, STRING_INV_HK_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_REVOLVER_AMMO] = InventoryObjectDefinition(ID_REVOLVER_AMMO_ITEM, STRING_INV_REVOLVER_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_UZI_AMMO] = InventoryObjectDefinition(ID_UZI_AMMO_ITEM, STRING_INV_UZI_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_PISTOLS_AMMO] = InventoryObjectDefinition(ID_PISTOLS_AMMO_ITEM, STRING_INV_PISTOLS_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_LASERSIGHT] = InventoryObjectDefinition(ID_LASERSIGHT_ITEM, STRING_INV_LASERSIGHT, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SILENCER] = InventoryObjectDefinition(ID_SILENCER_ITEM, STRING_INV_SILENCER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_LARGE_MEDIPACK] = InventoryObjectDefinition(ID_BIGMEDI_ITEM, STRING_INV_LARGE_MEDIPACK, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SMALL_MEDIPACK] = InventoryObjectDefinition(ID_SMALLMEDI_ITEM, STRING_INV_SMALL_MEDIPACK, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_BINOCULARS] = InventoryObjectDefinition(ID_BINOCULARS_ITEM, STRING_INV_BINOCULARS, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_FLARES] = InventoryObjectDefinition(ID_FLARE_INV_ITEM, STRING_INV_FLARES, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_TIMEX] = InventoryObjectDefinition(ID_COMPASS_ITEM, STRING_INV_TIMEX, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROWBAR] = InventoryObjectDefinition(ID_CROWBAR_ITEM, STRING_INV_CROWBAR, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_LAUNCHER] = InventoryObjectDefinition(ID_GRENADE_ITEM, STRING_INV_GRENADE_LAUNCHER, -1, 0);
|
2018-11-21 09:34:01 +01:00
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_AMMO1] = InventoryObjectDefinition(ID_GRENADE_AMMO1_ITEM, STRING_INV_GRENADE_AMMO1, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_AMMO2] = InventoryObjectDefinition(ID_GRENADE_AMMO2_ITEM, STRING_INV_GRENADE_AMMO2, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_GRENADE_AMMO3] = InventoryObjectDefinition(ID_GRENADE_AMMO3_ITEM, STRING_INV_GRENADE_AMMO3, -1, 0);
|
2018-11-14 20:54:18 +01:00
|
|
|
m_objectsTable[INV_OBJECT_HARPOON_GUN] = InventoryObjectDefinition(ID_HARPOON_ITEM, STRING_INV_HARPOON_GUN, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HARPOON_AMMO] = InventoryObjectDefinition(ID_HARPOON_AMMO_ITEM, STRING_INV_HARPOON_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_ROCKET_LAUNCHER] = InventoryObjectDefinition(ID_ROCKET_LAUNCHER_ITEM, STRING_INV_ROCKET_LAUNCHER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_ROCKET_AMMO] = InventoryObjectDefinition(ID_ROCKET_LAUNCHER_AMMO_ITEM, STRING_INV_ROCKET_AMMO, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW] = InventoryObjectDefinition(ID_CROSSBOW_ITEM, STRING_INV_CROSSBOW, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_LASER] = InventoryObjectDefinition(ID_CROSSBOW_ITEM, STRING_INV_CROSSBOW_LASER, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_AMMO1] = InventoryObjectDefinition(ID_CROSSBOW_AMMO1_ITEM, STRING_INV_CROSSBOW_AMMO1, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_AMMO2] = InventoryObjectDefinition(ID_CROSSBOW_AMMO2_ITEM, STRING_INV_CROSSBOW_AMMO2, -1, 0);
|
2018-11-21 09:34:01 +01:00
|
|
|
m_objectsTable[INV_OBJECT_CROSSBOW_AMMO3] = InventoryObjectDefinition(ID_CROSSBOW_AMMO3_ITEM, STRING_INV_CROSSBOW_AMMO3, -1, 0);
|
2018-11-14 20:54:18 +01:00
|
|
|
m_objectsTable[INV_OBJECT_PASSAPORT] = InventoryObjectDefinition(ID_INVENTORY_PASSPORT, STRING_INV_PASSPORT, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_KEYS] = InventoryObjectDefinition(ID_INVENTORY_KEYS, STRING_INV_CONTROLS, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_SUNGLASSES] = InventoryObjectDefinition(ID_INVENTORY_SUNGLASSES, STRING_INV_DISPLAY, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_POLAROID] = InventoryObjectDefinition(ID_INVENTORY_POLAROID, STRING_INV_LARA_HOME, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_HEADPHONES] = InventoryObjectDefinition(ID_INVENTORY_HEADPHONES, STRING_INV_SOUND, -1, 0);
|
2018-11-21 09:34:01 +01:00
|
|
|
m_objectsTable[INV_OBJECT_DIARY] = InventoryObjectDefinition(ID_DIARY, STRING_INV_DIARY, -1, 0);
|
2018-11-28 13:19:01 +01:00
|
|
|
m_objectsTable[INV_OBJECT_WATERSKIN1] = InventoryObjectDefinition(ID_WATERSKIN1_EMPTY, STRING_INV_WATERSKIN1_EMPTY, -1, 0);
|
|
|
|
m_objectsTable[INV_OBJECT_WATERSKIN2] = InventoryObjectDefinition(ID_WATERSKIN2_EMPTY, STRING_INV_WATERSKIN2_EMPTY, -1, 0);
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Inventory::~Inventory()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
InventoryRing* Inventory::GetRing(__int32 index)
|
|
|
|
{
|
|
|
|
return &m_rings[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
__int32 Inventory::GetActiveRing()
|
|
|
|
{
|
|
|
|
return m_activeRing;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::SetActiveRing(__int32 index)
|
|
|
|
{
|
|
|
|
m_activeRing = index;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::InsertObject(__int32 ring, __int32 objectNumber)
|
|
|
|
{
|
|
|
|
m_rings[ring].objects[m_rings[ring].numObjects].inventoryObject = objectNumber;
|
|
|
|
m_rings[ring].numObjects++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::Initialise()
|
|
|
|
{
|
|
|
|
// Reset the objects in inventory
|
|
|
|
for (__int32 i = 0; i < NUM_INVENTORY_RINGS; i++)
|
|
|
|
{
|
|
|
|
m_rings[i].numObjects = 0;
|
|
|
|
m_rings[i].movement = 0;
|
|
|
|
m_rings[i].currentObject = 0;
|
|
|
|
m_rings[i].focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
|
|
|
for (__int32 j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++)
|
|
|
|
{
|
|
|
|
m_rings[i].objects[j].inventoryObject = -1;
|
|
|
|
m_rings[i].objects[j].rotation = 0;
|
|
|
|
m_rings[i].objects[j].scale = INV_OBJECT_SCALE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DEBUG
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// Now fill the rings
|
2018-12-29 14:27:39 +01:00
|
|
|
if (g_GameFlow->GetLevel(CurrentLevel)->LaraType != LARA_DRAW_TYPE::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);
|
2018-08-19 09:46:58 +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)
|
2018-11-14 20:54:18 +01:00
|
|
|
InsertObject(INV_RING_WEAPONS, INV_OBJECT_CROSSBOW_LASER);
|
2018-08-19 09:46:58 +02:00
|
|
|
else
|
2018-11-14 20:54:18 +01:00
|
|
|
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);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
__int32 i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (Lara.puzzleItems[i])
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1);
|
2018-08-19 09:46:58 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 8);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.puzzleItemsCombo)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PUZZLE1_COMBO1);
|
2018-08-19 09:46:58 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 16);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.keyItems)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1);
|
2018-08-19 09:46:58 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 8);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.keyItemsCombo)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_KEY1_COMBO1);
|
2018-08-19 09:46:58 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 16);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.pickupItems)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1);
|
2018-08-19 09:46:58 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 4);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((1 << i) & Lara.pickupItemsCombo)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, i + INV_OBJECT_PICKUP1_COMBO1);
|
2018-08-19 09:46:58 +02:00
|
|
|
i++;
|
|
|
|
} while (i < 8);
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
if (Lara.examine3)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_EXAMINE3);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.wetcloth == 2)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WETCLOTH1);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.wetcloth == 1)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WETCLOTH2);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
|
|
|
if (Lara.bottle)
|
2018-10-10 22:29:40 +02:00
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_BOTTLE);
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-11-28 13:19:01 +01:00
|
|
|
if (g_LaraExtra.Waterskin1.Present)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN1);
|
|
|
|
|
|
|
|
if (g_LaraExtra.Waterskin2.Present)
|
|
|
|
InsertObject(INV_RING_PUZZLES, INV_OBJECT_WATERSKIN2);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
InventoryRing* ring = &m_rings[INV_RING_OPTIONS];
|
|
|
|
|
|
|
|
// Reset the objects in inventory
|
|
|
|
ring->numObjects = 0;
|
|
|
|
ring->movement = 0;
|
|
|
|
ring->currentObject = 0;
|
|
|
|
ring->focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
|
|
|
for (__int32 j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++)
|
|
|
|
{
|
|
|
|
ring->objects[j].inventoryObject = -1;
|
|
|
|
ring->objects[j].rotation = 0;
|
|
|
|
ring->objects[j].scale = 2.0f;
|
|
|
|
}
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_PASSAPORT);
|
|
|
|
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_WEAPONS;
|
|
|
|
m_type = INV_TYPE_GAME;
|
|
|
|
m_deltaMovement = 0;
|
|
|
|
m_movement = INV_MOVE_STOPPED;
|
|
|
|
m_type = INV_TYPE_GAME;
|
|
|
|
InventoryItemChosen = -1;
|
|
|
|
}
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
INVENTORY_RESULT Inventory::DoInventory()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
Initialise();
|
|
|
|
|
2018-09-08 21:30:48 +02:00
|
|
|
// 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_activeRing = INV_RING_OPTIONS;
|
|
|
|
m_rings[m_activeRing].currentObject = 0;
|
|
|
|
|
|
|
|
INVENTORY_RESULT passportResult = DoPassport();
|
|
|
|
|
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
|
|
|
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
|
|
|
|
return passportResult;
|
|
|
|
}
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
m_rings[INV_RING_PUZZLES].draw = true;
|
|
|
|
m_rings[INV_RING_WEAPONS].draw = true;
|
|
|
|
m_rings[INV_RING_OPTIONS].draw = true;
|
|
|
|
|
|
|
|
m_activeRing = INV_RING_WEAPONS;
|
|
|
|
|
2018-09-08 21:30:48 +02:00
|
|
|
INVENTORY_RESULT result = INVENTORY_RESULT::INVENTORY_RESULT_NONE;
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
g_Renderer->DumpGameScene();
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
|
|
|
|
while (!ResetFlag)
|
|
|
|
{
|
|
|
|
SetDebounce = true;
|
|
|
|
S_UpdateInput();
|
|
|
|
SetDebounce = false;
|
|
|
|
|
|
|
|
GameTimer++;
|
|
|
|
|
|
|
|
// Handle input
|
2018-12-31 11:37:06 +01:00
|
|
|
if (DbInput & IN_DESELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_SELECT, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Exit from inventory
|
|
|
|
GlobalEnterInventory = -1;
|
2018-09-03 21:08:40 +02:00
|
|
|
return INVENTORY_RESULT::INVENTORY_RESULT_NONE;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_FORWARD &&
|
2018-09-08 21:30:48 +02:00
|
|
|
(m_activeRing == INV_RING_WEAPONS && m_rings[INV_RING_PUZZLES].numObjects != 0 ||
|
|
|
|
m_activeRing == INV_RING_OPTIONS))
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Go to the upper ring
|
|
|
|
for (__int32 i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
m_movement -= 1024.0f;
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_activeRing == INV_RING_WEAPONS)
|
|
|
|
m_activeRing = INV_RING_PUZZLES;
|
|
|
|
else
|
|
|
|
m_activeRing = INV_RING_WEAPONS;
|
|
|
|
|
|
|
|
m_movement = 0;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_BACK && (m_activeRing == INV_RING_PUZZLES || m_activeRing == INV_RING_WEAPONS))
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Go to the lower ring
|
|
|
|
for (__int32 i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
m_movement += 1024.0f;
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_activeRing == INV_RING_WEAPONS)
|
|
|
|
m_activeRing = INV_RING_OPTIONS;
|
|
|
|
else
|
|
|
|
m_activeRing = INV_RING_WEAPONS;
|
|
|
|
|
|
|
|
m_movement = 0;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_LEFT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Change object right
|
|
|
|
float deltaAngle = 360.0f / m_rings[m_activeRing].numObjects / 8.0f;
|
|
|
|
m_rings[m_activeRing].movement = 0;
|
|
|
|
|
|
|
|
for (__int32 i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
m_rings[m_activeRing].movement += deltaAngle;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
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].movement = 0;
|
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_RIGHT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
2018-08-24 23:36:49 +02:00
|
|
|
SoundEffect(SFX_MENU_ROTATE, NULL, 0);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
// Change object left
|
|
|
|
float deltaAngle = 360.0f / m_rings[m_activeRing].numObjects / 8.0f;
|
|
|
|
m_rings[m_activeRing].movement = 0;
|
|
|
|
|
|
|
|
for (__int32 i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
m_rings[m_activeRing].movement -= deltaAngle;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
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].movement = 0;
|
|
|
|
}
|
2018-12-31 11:37:06 +01:00
|
|
|
else if (DbInput & IN_SELECT)
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
// Handle action
|
|
|
|
if (m_activeRing == INV_RING_OPTIONS)
|
|
|
|
{
|
|
|
|
if (m_rings[INV_RING_OPTIONS].objects[m_rings[INV_RING_OPTIONS].currentObject].inventoryObject == INV_OBJECT_PASSAPORT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
|
|
|
INVENTORY_RESULT passportResult = DoPassport();
|
|
|
|
if (passportResult == INVENTORY_RESULT::INVENTORY_RESULT_NEW_GAME ||
|
|
|
|
passportResult == INVENTORY_RESULT::INVENTORY_RESULT_EXIT_TO_TILE ||
|
|
|
|
passportResult == INVENTORY_RESULT::INVENTORY_RESULT_LOAD_GAME)
|
|
|
|
{
|
2018-09-07 18:34:18 +02:00
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
|
|
|
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
return passportResult;
|
|
|
|
}
|
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
if (m_rings[INV_RING_OPTIONS].objects[m_rings[INV_RING_OPTIONS].currentObject].inventoryObject == INV_OBJECT_KEYS)
|
|
|
|
DoControlsSettings();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
if (m_rings[INV_RING_OPTIONS].objects[m_rings[INV_RING_OPTIONS].currentObject].inventoryObject == INV_OBJECT_SUNGLASSES)
|
|
|
|
DoGraphicsSettings();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
if (m_rings[INV_RING_OPTIONS].objects[m_rings[INV_RING_OPTIONS].currentObject].inventoryObject == INV_OBJECT_HEADPHONES)
|
|
|
|
DoSoundSettings();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
else if (m_activeRing == INV_RING_WEAPONS || m_activeRing == INV_RING_PUZZLES)
|
|
|
|
{
|
|
|
|
UseCurrentItem();
|
|
|
|
|
|
|
|
// Exit from inventory
|
|
|
|
GlobalEnterInventory = -1;
|
2018-09-03 21:08:40 +02:00
|
|
|
return INVENTORY_RESULT::INVENTORY_RESULT_USE_ITEM;
|
2018-09-08 21:30:48 +02:00
|
|
|
}
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
return result;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::UseCurrentItem()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
InventoryObject* inventoryObject = &ring->objects[ring->currentObject];
|
|
|
|
__int16 objectNumber = m_objectsTable[inventoryObject->inventoryObject].objectNumber;
|
|
|
|
|
|
|
|
LaraItem->meshBits = -1;
|
|
|
|
|
2018-11-11 11:16:37 +01:00
|
|
|
__int32 binocularRange = BinocularRange;
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
InventoryItemChosen = 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)
|
|
|
|
{
|
|
|
|
InventoryItemChosen = 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool canUseWeapons = !(LaraItem->currentAnimState == 80 || LaraItem->currentAnimState == 81 ||
|
|
|
|
LaraItem->currentAnimState == 84 || LaraItem->currentAnimState == 85 ||
|
|
|
|
LaraItem->currentAnimState == 86 || LaraItem->currentAnimState == 88 ||
|
|
|
|
LaraItem->currentAnimState == 71 || LaraItem->currentAnimState == 105 ||
|
|
|
|
LaraItem->currentAnimState == 106 || Lara.waterStatus != LW_ABOVE_WATER);
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
{
|
|
|
|
if (LaraItem->currentAnimState != 80
|
|
|
|
&& LaraItem->currentAnimState != 81
|
|
|
|
&& LaraItem->currentAnimState != 84
|
|
|
|
&& LaraItem->currentAnimState != 85
|
|
|
|
&& LaraItem->currentAnimState != 86
|
|
|
|
&& LaraItem->currentAnimState != 88
|
|
|
|
&& Lara.waterStatus == LW_ABOVE_WATER)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
ring->movement = 0;
|
|
|
|
ring->currentObject = 0;
|
|
|
|
ring->focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
|
|
|
for (__int32 j = 0; j < NUM_INVENTORY_OBJECTS_PER_RING; j++)
|
|
|
|
{
|
|
|
|
ring->objects[j].inventoryObject = -1;
|
|
|
|
ring->objects[j].rotation = 0;
|
|
|
|
ring->objects[j].scale = INV_OBJECT_SCALE;
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertObject(INV_RING_OPTIONS, INV_OBJECT_PASSAPORT);
|
|
|
|
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;
|
|
|
|
InventoryItemChosen = -1;
|
|
|
|
}
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
INVENTORY_RESULT 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();
|
|
|
|
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
|
|
|
|
g_Renderer->DrawInventory();
|
2018-08-19 09:46:58 +02:00
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
INVENTORY_RESULT result = INVENTORY_RESULT::INVENTORY_RESULT_NONE;
|
|
|
|
|
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
|
|
|
|
float deltaAngle = 360.0f / ring->numObjects / 8.0f;
|
|
|
|
ring->movement = 0;
|
|
|
|
|
|
|
|
for (__int32 i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
ring->movement += deltaAngle;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ring->currentObject == ring->numObjects - 1)
|
|
|
|
ring->currentObject = 0;
|
|
|
|
else
|
|
|
|
ring->currentObject++;
|
|
|
|
|
|
|
|
ring->movement = 0;
|
|
|
|
}
|
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
|
|
|
|
float deltaAngle = 360.0f / ring->numObjects / 8.0f;
|
|
|
|
ring->movement = 0;
|
|
|
|
|
|
|
|
for (__int32 i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
ring->movement -= deltaAngle;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ring->currentObject == 0)
|
|
|
|
ring->currentObject = ring->numObjects - 1;
|
|
|
|
else
|
|
|
|
ring->currentObject--;
|
|
|
|
|
|
|
|
ring->movement = 0;
|
|
|
|
}
|
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);
|
|
|
|
|
2018-08-19 09:46:58 +02:00
|
|
|
if (ring->objects[ring->currentObject].inventoryObject == INV_OBJECT_PASSAPORT)
|
2018-09-03 21:08:40 +02:00
|
|
|
{
|
|
|
|
INVENTORY_RESULT passportResult = DoPassport();
|
|
|
|
if (passportResult == INVENTORY_RESULT::INVENTORY_RESULT_NEW_GAME ||
|
|
|
|
passportResult == INVENTORY_RESULT::INVENTORY_RESULT_EXIT_GAME ||
|
|
|
|
passportResult == INVENTORY_RESULT::INVENTORY_RESULT_LOAD_GAME)
|
|
|
|
{
|
2018-09-07 18:34:18 +02:00
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
|
|
|
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
|
2018-10-24 23:32:22 +02:00
|
|
|
return passportResult;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
2018-09-07 18:34:18 +02:00
|
|
|
// Fade out
|
|
|
|
g_Renderer->FadeOut();
|
|
|
|
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
return result;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
InventoryObjectDefinition* Inventory::GetInventoryObject(__int32 index)
|
|
|
|
{
|
|
|
|
return &m_objectsTable[index];
|
|
|
|
}
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
INVENTORY_RESULT Inventory::DoPassport()
|
2018-08-19 09:46:58 +02:00
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
|
|
|
|
__int16 choice = 0;
|
|
|
|
|
|
|
|
vector<__int32> choices;
|
|
|
|
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
|
|
|
|
for (__int32 i = 0; i < 14; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
ring->frameIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool moveLeft = false;
|
|
|
|
bool moveRight = false;
|
|
|
|
bool closePassport = false;
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
INVENTORY_RESULT result = INVENTORY_RESULT::INVENTORY_RESULT_NONE;
|
|
|
|
|
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;
|
|
|
|
for (__int32 i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
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;
|
|
|
|
for (__int32 i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
ring->frameIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
choice++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (choices[choice] == INV_WHAT_PASSPORT_LOAD_GAME)
|
|
|
|
{
|
|
|
|
// Load game
|
|
|
|
__int32 selectedSavegame = 0;
|
|
|
|
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;
|
2018-09-03 21:08:40 +02:00
|
|
|
result = INVENTORY_RESULT::INVENTORY_RESULT_LOAD_GAME;
|
|
|
|
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();
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_SAVE_GAME)
|
|
|
|
{
|
|
|
|
// Save game
|
|
|
|
__int32 selectedSavegame = 0;
|
|
|
|
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();
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
2018-09-03 21:08:40 +02:00
|
|
|
else if (choices[choice] == INV_WHAT_PASSPORT_SELECT_LEVEL)
|
|
|
|
{
|
|
|
|
// Save game
|
|
|
|
__int32 selectedLevel = 0;
|
|
|
|
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
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
result = INVENTORY_RESULT::INVENTORY_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;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
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);
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
result = INVENTORY_RESULT::INVENTORY_RESULT_NEW_GAME;
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_NEW_GAME;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
result = INVENTORY_RESULT::INVENTORY_RESULT_EXIT_GAME;
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_EXIT_GAME;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
result = INVENTORY_RESULT::INVENTORY_RESULT_EXIT_TO_TILE;
|
|
|
|
moveLeft = false;
|
|
|
|
moveRight = false;
|
|
|
|
closePassport = true;
|
|
|
|
|
|
|
|
break;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ring->passportAction = INV_WHAT_PASSPORT_EXIT_TO_TITLE;
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close the passport
|
|
|
|
ring->frameIndex = 24;
|
|
|
|
for (__int32 i = 24; i < 30; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
ring->frameIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ring->frameIndex = 0;
|
|
|
|
|
|
|
|
PopoverObject();
|
|
|
|
|
2018-09-03 21:08:40 +02:00
|
|
|
return result;
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
__int32 Inventory::PopupObject()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
|
|
|
|
__int32 steps = 8;
|
|
|
|
__int32 deltaAngle = (0 - ring->objects[ring->currentObject].rotation) / steps;
|
|
|
|
float deltaScale = INV_OBJECT_SCALE / (float)steps;
|
|
|
|
|
|
|
|
ring->focusState = INV_FOCUS_STATE_POPUP;
|
|
|
|
for (__int32 i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
|
|
|
|
ring->objects[ring->currentObject].rotation += deltaAngle;
|
|
|
|
ring->objects[ring->currentObject].scale += deltaScale;
|
|
|
|
}
|
|
|
|
ring->focusState = INV_FOCUS_STATE_FOCUSED;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__int32 Inventory::PopoverObject()
|
|
|
|
{
|
|
|
|
InventoryRing* ring = &m_rings[m_activeRing];
|
|
|
|
|
|
|
|
__int32 steps = 8;
|
|
|
|
__int32 deltaAngle = (0 - ring->objects[ring->currentObject].rotation) / steps;
|
|
|
|
float deltaScale = INV_OBJECT_SCALE / (float)steps;
|
|
|
|
|
|
|
|
ring->focusState = INV_FOCUS_STATE_POPOVER;
|
|
|
|
for (__int32 i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
|
|
|
|
ring->objects[ring->currentObject].rotation -= deltaAngle;
|
|
|
|
ring->objects[ring->currentObject].scale -= deltaScale;
|
|
|
|
}
|
|
|
|
ring->focusState = INV_FOCUS_STATE_NONE;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__int32 Inventory::GetType()
|
|
|
|
{
|
|
|
|
return m_type;
|
2018-09-07 18:34:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inventory::DoControlsSettings()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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-01-13 21:57:16 +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;
|
|
|
|
for (__int32 i = 0; i < adapter->DisplayModes.size(); i++)
|
|
|
|
{
|
|
|
|
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-01-13 21:57:16 +01:00
|
|
|
}*/
|
2018-12-31 10:38:34 +01:00
|
|
|
|
2018-12-30 11:41:48 +01:00
|
|
|
// Open the passport
|
|
|
|
for (__int32 i = 0; i < 14; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool closeObject = false;
|
2018-09-07 18:34:18 +02:00
|
|
|
|
2018-12-30 11:41:48 +01:00
|
|
|
// Do the passport
|
|
|
|
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;
|
|
|
|
|
|
|
|
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-01-13 21:57:16 +01:00
|
|
|
//if (ring->SelectedVideoMode < adapter->DisplayModes.size() - 1)
|
2018-12-31 10:38:34 +01:00
|
|
|
ring->SelectedVideoMode++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
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-01-13 21:57:16 +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;
|
|
|
|
memcpy(&g_Configuration, &ring->Configuration, sizeof(GameConfiguration));
|
2019-01-13 21:57:16 +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
|
|
|
}
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
// Open the passport
|
|
|
|
for (__int32 i = 0; i < 14; i++)
|
|
|
|
{
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool closeObject = false;
|
|
|
|
__int32 oldVolume = ring->Configuration.MusicVolume;
|
|
|
|
__int32 oldSfxVolume = ring->Configuration.SfxVolume;
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_Renderer->DrawInventory();
|
|
|
|
g_Renderer->SyncRenderer();
|
|
|
|
}
|
|
|
|
|
|
|
|
PopoverObject();
|
2018-08-19 09:46:58 +02:00
|
|
|
}
|