mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
inventory: fix interactions near key item receptacles (#1267)
Fixes Lara saying "no" near key item receptacles even when taking valid actions such as using a medipack, equipping guns, or using the passport menu. Also, fixes Lara being able to cancel a key item placement animation by holding down an input after selecting the correct key item from the inventory. Resolves #1268 and #1254.
This commit is contained in:
parent
2510d837a2
commit
32e61c581b
20 changed files with 177 additions and 250 deletions
|
@ -26,6 +26,7 @@
|
|||
- fixed the remember played music option always being enabled (#1249, regression since 2.16)
|
||||
- fixed the underwater SFX playing for one frame at the start of Palace Midas (#1251)
|
||||
- fixed an incorrect frame in Lara's underwater twist animation (OG bug in TR2 onwards) (#1242)
|
||||
- fixed Lara saying "no" when taking valid actions in front of a key item receptacle (#1268)
|
||||
|
||||
## [3.1.1](https://github.com/LostArtefacts/TR1X/compare/3.1...3.1.1) - 2024-01-19
|
||||
- changed quick load to show empty passport instead of opening the save game menu when there are no saves (#1141)
|
||||
|
|
|
@ -316,6 +316,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
|
|||
- fixed various bugs with falling movable blocks
|
||||
- fixed bugs when trying to stack multiple movable blocks
|
||||
- fixed Midas's touch having unrestricted vertical range
|
||||
- fixed Lara saying "no" when taking valid actions in front of a key item receptacle
|
||||
|
||||
#### Cheats
|
||||
- added a fly cheat
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
static int16_t m_AnimatingCount = 0;
|
||||
|
||||
static ITEM_INFO *Carrier_GetCarrier(int16_t item_num);
|
||||
static GAME_OBJECT_ID Carrier_GetCognate(
|
||||
GAME_OBJECT_ID key_id, const GAME_OBJECT_PAIR *test_map);
|
||||
static void Carrier_AnimateDrop(CARRIED_ITEM *item);
|
||||
|
||||
static const GAME_OBJECT_PAIR m_LegacyMap[] = {
|
||||
|
@ -114,20 +112,6 @@ static ITEM_INFO *Carrier_GetCarrier(int16_t item_num)
|
|||
return item;
|
||||
}
|
||||
|
||||
static GAME_OBJECT_ID Carrier_GetCognate(
|
||||
GAME_OBJECT_ID key_id, const GAME_OBJECT_PAIR *test_map)
|
||||
{
|
||||
const GAME_OBJECT_PAIR *pair = &test_map[0];
|
||||
while (pair->key_id != NO_OBJECT) {
|
||||
if (pair->key_id == key_id) {
|
||||
return pair->value_id;
|
||||
}
|
||||
pair++;
|
||||
}
|
||||
|
||||
return NO_OBJECT;
|
||||
}
|
||||
|
||||
int32_t Carrier_GetItemCount(int16_t item_num)
|
||||
{
|
||||
ITEM_INFO *carrier = Carrier_GetCarrier(item_num);
|
||||
|
@ -183,7 +167,7 @@ void Carrier_TestItemDrops(int16_t item_num)
|
|||
if (g_GameFlow.convert_dropped_guns
|
||||
&& Object_IsObjectType(object_id, g_GunObjects)
|
||||
&& Inv_RequestItem(object_id)) {
|
||||
object_id = Carrier_GetCognate(object_id, g_GunAmmoObjectMap);
|
||||
object_id = Object_GetCognate(object_id, g_GunAmmoObjectMap);
|
||||
}
|
||||
|
||||
item->spawn_number = Item_Spawn(carrier, object_id);
|
||||
|
@ -215,7 +199,7 @@ void Carrier_TestLegacyDrops(int16_t item_num)
|
|||
// them by using a test cognate in each case. Ensure also that
|
||||
// collected items do not re-spawn now or in future saves.
|
||||
GAME_OBJECT_ID test_id =
|
||||
Carrier_GetCognate(carrier->object_number, m_LegacyMap);
|
||||
Object_GetCognate(carrier->object_number, m_LegacyMap);
|
||||
if (test_id == NO_OBJECT) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -203,10 +203,6 @@ GAMEFLOW_OPTION Game_Stop(void)
|
|||
return GF_LEVEL_COMPLETE | g_GameInfo.select_level_num;
|
||||
}
|
||||
|
||||
if (!g_InvChosen) {
|
||||
return GF_EXIT_TO_TITLE;
|
||||
}
|
||||
|
||||
if (g_GameInfo.passport_selection == PASSPORT_MODE_LOAD_GAME) {
|
||||
return GF_START_SAVED_GAME | g_GameInfo.current_save_slot;
|
||||
} else if (g_GameInfo.passport_selection == PASSPORT_MODE_SELECT_LEVEL) {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
bool Inv_Display(const INV_MODE inv_mode)
|
||||
{
|
||||
if (inv_mode == INV_KEYS_MODE && !g_InvKeysObjects) {
|
||||
g_InvChosen = -1;
|
||||
return false;
|
||||
}
|
||||
Phase_Set(PHASE_INVENTORY, (void *)(intptr_t)inv_mode);
|
||||
|
|
|
@ -20,7 +20,7 @@ void Lara_InitialiseMeshes(int32_t level_num);
|
|||
|
||||
void Lara_SwapMeshExtra(void);
|
||||
bool Lara_IsNearItem(const XYZ_32 *pos, int32_t distance);
|
||||
void Lara_UseItem(int16_t object_num);
|
||||
void Lara_UseItem(GAME_OBJECT_ID object_num);
|
||||
int16_t Lara_GetNearestEnemy(void);
|
||||
|
||||
bool Lara_TestBoundsCollide(ITEM_INFO *item, int32_t radius);
|
||||
|
|
|
@ -334,7 +334,7 @@ void Lara_AnimateUntil(ITEM_INFO *lara_item, int32_t goal)
|
|||
} while (lara_item->current_anim_state != goal);
|
||||
}
|
||||
|
||||
void Lara_UseItem(int16_t object_num)
|
||||
void Lara_UseItem(GAME_OBJECT_ID object_num)
|
||||
{
|
||||
LOG_INFO("%d", object_num);
|
||||
switch (object_num) {
|
||||
|
@ -396,6 +396,40 @@ void Lara_UseItem(int16_t object_num)
|
|||
Inv_RemoveItem(O_BIGMEDI_ITEM);
|
||||
Sound_Effect(SFX_MENU_MEDI, NULL, SPM_ALWAYS);
|
||||
break;
|
||||
|
||||
case O_KEY_ITEM1:
|
||||
case O_KEY_OPTION1:
|
||||
case O_KEY_ITEM2:
|
||||
case O_KEY_OPTION2:
|
||||
case O_KEY_ITEM3:
|
||||
case O_KEY_OPTION3:
|
||||
case O_KEY_ITEM4:
|
||||
case O_KEY_OPTION4:
|
||||
case O_PUZZLE_ITEM1:
|
||||
case O_PUZZLE_OPTION1:
|
||||
case O_PUZZLE_ITEM2:
|
||||
case O_PUZZLE_OPTION2:
|
||||
case O_PUZZLE_ITEM3:
|
||||
case O_PUZZLE_OPTION3:
|
||||
case O_PUZZLE_ITEM4:
|
||||
case O_PUZZLE_OPTION4:
|
||||
case O_LEADBAR_ITEM:
|
||||
case O_LEADBAR_OPTION: {
|
||||
int16_t receptacle_item_number = Object_FindReceptacle(object_num);
|
||||
if (receptacle_item_number == NO_OBJECT) {
|
||||
Sound_Effect(SFX_LARA_NO, NULL, SPM_NORMAL);
|
||||
return;
|
||||
}
|
||||
ITEM_INFO *item = &g_Items[receptacle_item_number];
|
||||
g_Lara.interact_target.item_num = receptacle_item_number;
|
||||
g_Lara.interact_target.is_moving = true;
|
||||
g_Lara.interact_target.move_count = 0;
|
||||
Inv_RemoveItem(object_num);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -447,6 +481,9 @@ void Lara_Initialise(int32_t level_num)
|
|||
g_Lara.left_arm.flash_gun = 0;
|
||||
g_Lara.right_arm.lock = 0;
|
||||
g_Lara.left_arm.lock = 0;
|
||||
g_Lara.interact_target.is_moving = false;
|
||||
g_Lara.interact_target.item_num = NO_OBJECT;
|
||||
g_Lara.interact_target.move_count = 0;
|
||||
|
||||
if (g_RoomInfo[g_LaraItem->room_number].flags & RF_UNDERWATER) {
|
||||
g_Lara.water_status = LWS_UNDERWATER;
|
||||
|
|
|
@ -175,8 +175,6 @@ static void Lara_BaddieCollision(ITEM_INFO *lara_item, COLL_INFO *coll)
|
|||
if (g_Lara.hit_direction == -1) {
|
||||
g_Lara.hit_frame = 0;
|
||||
}
|
||||
|
||||
g_InvChosen = -1;
|
||||
}
|
||||
|
||||
void Lara_HandleAboveWater(ITEM_INFO *item, COLL_INFO *coll)
|
||||
|
|
|
@ -148,6 +148,10 @@ void Lara_State_Stop(ITEM_INFO *item, COLL_INFO *coll)
|
|||
return;
|
||||
}
|
||||
|
||||
if (g_Lara.interact_target.is_moving) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Input.roll) {
|
||||
item->current_anim_state = LS_ROLL;
|
||||
item->goal_anim_state = LS_STOP;
|
||||
|
|
|
@ -51,6 +51,45 @@ const GAME_OBJECT_PAIR g_GunAmmoObjectMap[] = {
|
|||
{ NO_OBJECT, NO_OBJECT },
|
||||
};
|
||||
|
||||
const GAME_OBJECT_PAIR g_KeyItemToHoleMap[] = {
|
||||
{ O_KEY_OPTION1, O_KEY_HOLE1 }, { O_KEY_OPTION2, O_KEY_HOLE2 },
|
||||
{ O_KEY_OPTION3, O_KEY_HOLE3 }, { O_KEY_OPTION4, O_KEY_HOLE4 },
|
||||
{ O_PUZZLE_OPTION1, O_PUZZLE_HOLE1 }, { O_PUZZLE_OPTION2, O_PUZZLE_HOLE2 },
|
||||
{ O_PUZZLE_OPTION3, O_PUZZLE_HOLE3 }, { O_PUZZLE_OPTION4, O_PUZZLE_HOLE4 },
|
||||
{ O_LEADBAR_OPTION, O_MIDAS_TOUCH }, { NO_OBJECT, NO_OBJECT },
|
||||
};
|
||||
|
||||
GAME_OBJECT_ID Object_GetCognate(
|
||||
GAME_OBJECT_ID key_id, const GAME_OBJECT_PAIR *test_map)
|
||||
{
|
||||
const GAME_OBJECT_PAIR *pair = &test_map[0];
|
||||
while (pair->key_id != NO_OBJECT) {
|
||||
if (pair->key_id == key_id) {
|
||||
return pair->value_id;
|
||||
}
|
||||
pair++;
|
||||
}
|
||||
|
||||
return NO_OBJECT;
|
||||
}
|
||||
|
||||
int16_t Object_FindReceptacle(GAME_OBJECT_ID object_id)
|
||||
{
|
||||
GAME_OBJECT_ID receptacle_to_check =
|
||||
Object_GetCognate(object_id, g_KeyItemToHoleMap);
|
||||
for (int item_num = 0; item_num < g_LevelItemCount; item_num++) {
|
||||
ITEM_INFO *item = &g_Items[item_num];
|
||||
if (item->object_number == receptacle_to_check) {
|
||||
const OBJECT_INFO *const obj = &g_Objects[item->object_number];
|
||||
if (Lara_TestPosition(item, obj->bounds())) {
|
||||
return item_num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NO_OBJECT;
|
||||
}
|
||||
|
||||
bool Object_IsObjectType(
|
||||
GAME_OBJECT_ID object_id, const GAME_OBJECT_ID *test_arr)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,9 @@ extern const GAME_OBJECT_ID g_PickupObjects[];
|
|||
extern const GAME_OBJECT_ID g_GunObjects[];
|
||||
extern const GAME_OBJECT_PAIR g_GunAmmoObjectMap[];
|
||||
|
||||
GAME_OBJECT_ID Object_GetCognate(
|
||||
GAME_OBJECT_ID key_id, const GAME_OBJECT_PAIR *test_map);
|
||||
int16_t Object_FindReceptacle(GAME_OBJECT_ID object_id);
|
||||
bool Object_IsObjectType(
|
||||
GAME_OBJECT_ID object_id, const GAME_OBJECT_ID *test_arr);
|
||||
void Object_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);
|
||||
|
|
|
@ -22,10 +22,6 @@ static const OBJECT_BOUNDS m_KeyHoleBounds = {
|
|||
},
|
||||
};
|
||||
|
||||
int32_t g_PickUpX;
|
||||
int32_t g_PickUpY;
|
||||
int32_t g_PickUpZ;
|
||||
|
||||
static const OBJECT_BOUNDS *KeyHole_Bounds(void);
|
||||
|
||||
static const OBJECT_BOUNDS *KeyHole_Bounds(void)
|
||||
|
@ -45,12 +41,20 @@ void KeyHole_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll)
|
|||
ITEM_INFO *item = &g_Items[item_num];
|
||||
const OBJECT_INFO *const obj = &g_Objects[item->object_number];
|
||||
|
||||
if (lara_item->current_anim_state != LS_STOP) {
|
||||
return;
|
||||
if (g_Lara.interact_target.is_moving
|
||||
&& g_Lara.interact_target.item_num == item_num) {
|
||||
Lara_AlignPosition(item, &g_KeyHolePosition);
|
||||
Lara_AnimateUntil(lara_item, LS_USE_KEY);
|
||||
lara_item->goal_anim_state = LS_STOP;
|
||||
g_Lara.gun_status = LGS_HANDS_BUSY;
|
||||
item->status = IS_ACTIVE;
|
||||
g_Lara.interact_target.is_moving = false;
|
||||
g_Lara.interact_target.item_num = NO_OBJECT;
|
||||
}
|
||||
|
||||
if ((g_InvChosen == -1 && !g_Input.action)
|
||||
|| g_Lara.gun_status != LGS_ARMLESS || lara_item->gravity_status) {
|
||||
if (!g_Input.action || g_Lara.gun_status != LGS_ARMLESS
|
||||
|| lara_item->gravity_status
|
||||
|| lara_item->current_anim_state != LS_STOP) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -59,82 +63,11 @@ void KeyHole_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll)
|
|||
}
|
||||
|
||||
if (item->status != IS_NOT_ACTIVE) {
|
||||
if (lara_item->pos.x != g_PickUpX || lara_item->pos.y != g_PickUpY
|
||||
|| lara_item->pos.z != g_PickUpZ) {
|
||||
g_PickUpX = lara_item->pos.x;
|
||||
g_PickUpY = lara_item->pos.y;
|
||||
g_PickUpZ = lara_item->pos.z;
|
||||
Sound_Effect(SFX_LARA_NO, &lara_item->pos, SPM_NORMAL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_InvChosen == -1) {
|
||||
Inv_Display(INV_KEYS_MODE);
|
||||
} else {
|
||||
g_PickUpY = lara_item->pos.y - 1;
|
||||
}
|
||||
|
||||
if (g_InvChosen == -1 && g_InvKeysObjects) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_InvChosen != -1) {
|
||||
g_PickUpY = lara_item->pos.y - 1;
|
||||
}
|
||||
|
||||
int32_t correct = 0;
|
||||
switch (item->object_number) {
|
||||
case O_KEY_HOLE1:
|
||||
if (g_InvChosen == O_KEY_OPTION1) {
|
||||
Inv_RemoveItem(O_KEY_OPTION1);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case O_KEY_HOLE2:
|
||||
if (g_InvChosen == O_KEY_OPTION2) {
|
||||
Inv_RemoveItem(O_KEY_OPTION2);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case O_KEY_HOLE3:
|
||||
if (g_InvChosen == O_KEY_OPTION3) {
|
||||
Inv_RemoveItem(O_KEY_OPTION3);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case O_KEY_HOLE4:
|
||||
if (g_InvChosen == O_KEY_OPTION4) {
|
||||
Inv_RemoveItem(O_KEY_OPTION4);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_InvChosen = -1;
|
||||
if (correct) {
|
||||
Lara_AlignPosition(item, &g_KeyHolePosition);
|
||||
Lara_AnimateUntil(lara_item, LS_USE_KEY);
|
||||
lara_item->goal_anim_state = LS_STOP;
|
||||
g_Lara.gun_status = LGS_HANDS_BUSY;
|
||||
item->status = IS_ACTIVE;
|
||||
g_PickUpX = lara_item->pos.x;
|
||||
g_PickUpY = lara_item->pos.y;
|
||||
g_PickUpZ = lara_item->pos.z;
|
||||
} else if (
|
||||
lara_item->pos.x != g_PickUpX || lara_item->pos.y != g_PickUpY
|
||||
|| lara_item->pos.z != g_PickUpZ) {
|
||||
Sound_Effect(SFX_LARA_NO, &lara_item->pos, SPM_NORMAL);
|
||||
g_PickUpX = lara_item->pos.x;
|
||||
g_PickUpY = lara_item->pos.y;
|
||||
g_PickUpZ = lara_item->pos.z;
|
||||
return;
|
||||
}
|
||||
|
||||
Inv_Display(INV_KEYS_MODE);
|
||||
}
|
||||
|
||||
bool KeyHole_Trigger(int16_t item_num)
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
extern XYZ_32 g_KeyHolePosition;
|
||||
|
||||
extern int32_t g_PickUpX;
|
||||
extern int32_t g_PickUpY;
|
||||
extern int32_t g_PickUpZ;
|
||||
|
||||
void KeyHole_Setup(OBJECT_INFO *obj);
|
||||
void KeyHole_Collision(int16_t item_num, ITEM_INFO *lara_item, COLL_INFO *coll);
|
||||
bool KeyHole_Trigger(int16_t item_num);
|
||||
|
|
|
@ -208,6 +208,7 @@ void Pickup_CollisionControlled(
|
|||
g_Lara.interact_target.is_moving
|
||||
&& g_Lara.interact_target.item_num == item_num) {
|
||||
g_Lara.interact_target.is_moving = false;
|
||||
g_Lara.interact_target.item_num = NO_OBJECT;
|
||||
g_Lara.gun_status = LGS_ARMLESS;
|
||||
}
|
||||
if (have_item) {
|
||||
|
@ -248,6 +249,7 @@ void Pickup_CollisionControlled(
|
|||
g_Lara.interact_target.is_moving
|
||||
&& g_Lara.interact_target.item_num == item_num) {
|
||||
g_Lara.interact_target.is_moving = false;
|
||||
g_Lara.interact_target.item_num = NO_OBJECT;
|
||||
g_Lara.gun_status = LGS_ARMLESS;
|
||||
}
|
||||
} else if (
|
||||
|
|
|
@ -93,90 +93,30 @@ void PuzzleHole_Collision(
|
|||
return;
|
||||
}
|
||||
|
||||
if ((g_InvChosen == -1 && !g_Input.action)
|
||||
|| g_Lara.gun_status != LGS_ARMLESS || lara_item->gravity_status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Lara_TestPosition(item, &m_PuzzleHoleBounds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->status != IS_NOT_ACTIVE) {
|
||||
if (lara_item->pos.x != g_PickUpX || lara_item->pos.y != g_PickUpY
|
||||
|| lara_item->pos.z != g_PickUpZ) {
|
||||
g_PickUpX = lara_item->pos.x;
|
||||
g_PickUpY = lara_item->pos.y;
|
||||
g_PickUpZ = lara_item->pos.z;
|
||||
Sound_Effect(SFX_LARA_NO, &lara_item->pos, SPM_NORMAL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_InvChosen == -1) {
|
||||
Inv_Display(INV_KEYS_MODE);
|
||||
} else {
|
||||
g_PickUpY = lara_item->pos.y - 1;
|
||||
}
|
||||
|
||||
if (g_InvChosen == -1 && g_InvKeysObjects) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_InvChosen != -1) {
|
||||
g_PickUpY = lara_item->pos.y - 1;
|
||||
}
|
||||
|
||||
int32_t correct = 0;
|
||||
switch (item->object_number) {
|
||||
case O_PUZZLE_HOLE1:
|
||||
if (g_InvChosen == O_PUZZLE_OPTION1) {
|
||||
Inv_RemoveItem(O_PUZZLE_OPTION1);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case O_PUZZLE_HOLE2:
|
||||
if (g_InvChosen == O_PUZZLE_OPTION2) {
|
||||
Inv_RemoveItem(O_PUZZLE_OPTION2);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case O_PUZZLE_HOLE3:
|
||||
if (g_InvChosen == O_PUZZLE_OPTION3) {
|
||||
Inv_RemoveItem(O_PUZZLE_OPTION3);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case O_PUZZLE_HOLE4:
|
||||
if (g_InvChosen == O_PUZZLE_OPTION4) {
|
||||
Inv_RemoveItem(O_PUZZLE_OPTION4);
|
||||
correct = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_InvChosen = -1;
|
||||
if (correct) {
|
||||
if (g_Lara.interact_target.is_moving
|
||||
&& g_Lara.interact_target.item_num == item_num) {
|
||||
Lara_AlignPosition(item, &m_PuzzleHolePosition);
|
||||
Lara_AnimateUntil(lara_item, LS_USE_PUZZLE);
|
||||
lara_item->goal_anim_state = LS_STOP;
|
||||
g_Lara.gun_status = LGS_HANDS_BUSY;
|
||||
item->status = IS_ACTIVE;
|
||||
g_PickUpX = lara_item->pos.x;
|
||||
g_PickUpY = lara_item->pos.y;
|
||||
g_PickUpZ = lara_item->pos.z;
|
||||
} else if (
|
||||
lara_item->pos.x != g_PickUpX || lara_item->pos.y != g_PickUpY
|
||||
|| lara_item->pos.z != g_PickUpZ) {
|
||||
Sound_Effect(SFX_LARA_NO, &lara_item->pos, SPM_NORMAL);
|
||||
g_PickUpX = lara_item->pos.x;
|
||||
g_PickUpY = lara_item->pos.y;
|
||||
g_PickUpZ = lara_item->pos.z;
|
||||
g_Lara.interact_target.is_moving = false;
|
||||
g_Lara.interact_target.item_num = NO_OBJECT;
|
||||
}
|
||||
|
||||
if (!g_Input.action || g_Lara.gun_status != LGS_ARMLESS
|
||||
|| lara_item->gravity_status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Lara_TestPosition(item, obj->bounds())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->status != IS_NOT_ACTIVE) {
|
||||
Sound_Effect(SFX_LARA_NO, &lara_item->pos, SPM_NORMAL);
|
||||
return;
|
||||
}
|
||||
|
||||
Inv_Display(INV_KEYS_MODE);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
extern XYZ_32 g_PuzzleHolePosition;
|
||||
|
||||
void PuzzleHole_Setup(OBJECT_INFO *obj);
|
||||
void PuzzleHole_SetupDone(OBJECT_INFO *obj);
|
||||
void PuzzleHole_Collision(
|
||||
|
|
|
@ -44,6 +44,22 @@ void MidasTouch_Collision(
|
|||
ITEM_INFO *item = &g_Items[item_num];
|
||||
const OBJECT_INFO *const obj = &g_Objects[item->object_number];
|
||||
|
||||
DIRECTION quadrant = (uint16_t)(lara_item->rot.y + PHD_45) / PHD_90;
|
||||
switch (quadrant) {
|
||||
case DIR_NORTH:
|
||||
item->rot.y = 0;
|
||||
break;
|
||||
case DIR_EAST:
|
||||
item->rot.y = PHD_90;
|
||||
break;
|
||||
case DIR_SOUTH:
|
||||
item->rot.y = -PHD_180;
|
||||
break;
|
||||
case DIR_WEST:
|
||||
item->rot.y = -PHD_90;
|
||||
break;
|
||||
}
|
||||
|
||||
if (lara_item->current_anim_state == LS_USE_MIDAS) {
|
||||
if (Item_TestFrameEqual(lara_item, LF_PICKUP_GOLD_BAR)) {
|
||||
Overlay_AddPickup(O_PUZZLE_ITEM1);
|
||||
|
@ -75,41 +91,25 @@ void MidasTouch_Collision(
|
|||
return;
|
||||
}
|
||||
|
||||
if ((g_InvChosen == -1 && !g_Input.action)
|
||||
|| g_Lara.gun_status != LGS_ARMLESS || lara_item->gravity_status
|
||||
|| lara_item->current_anim_state != LS_STOP) {
|
||||
return;
|
||||
if (g_Lara.interact_target.is_moving
|
||||
&& g_Lara.interact_target.item_num == item_num) {
|
||||
lara_item->current_anim_state = LS_USE_MIDAS;
|
||||
lara_item->goal_anim_state = LS_USE_MIDAS;
|
||||
Item_SwitchToObjAnim(lara_item, EXTRA_ANIM_PLACE_BAR, 0, O_LARA_EXTRA);
|
||||
g_Lara.gun_status = LGS_HANDS_BUSY;
|
||||
g_Lara.interact_target.is_moving = false;
|
||||
g_Lara.interact_target.item_num = NO_OBJECT;
|
||||
}
|
||||
|
||||
DIRECTION quadrant = (uint16_t)(lara_item->rot.y + PHD_45) / PHD_90;
|
||||
switch (quadrant) {
|
||||
case DIR_NORTH:
|
||||
item->rot.y = 0;
|
||||
break;
|
||||
case DIR_EAST:
|
||||
item->rot.y = PHD_90;
|
||||
break;
|
||||
case DIR_SOUTH:
|
||||
item->rot.y = -PHD_180;
|
||||
break;
|
||||
case DIR_WEST:
|
||||
item->rot.y = -PHD_90;
|
||||
break;
|
||||
if (!g_Input.action || g_Lara.gun_status != LGS_ARMLESS
|
||||
|| lara_item->gravity_status
|
||||
|| lara_item->current_anim_state != LS_STOP) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Lara_TestPosition(item, obj->bounds())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_InvChosen == -1) {
|
||||
Inv_Display(INV_KEYS_MODE);
|
||||
}
|
||||
|
||||
if (g_InvChosen == O_LEADBAR_OPTION) {
|
||||
Inv_RemoveItem(O_LEADBAR_OPTION);
|
||||
lara_item->current_anim_state = LS_USE_MIDAS;
|
||||
lara_item->goal_anim_state = LS_USE_MIDAS;
|
||||
Item_SwitchToObjAnim(lara_item, EXTRA_ANIM_PLACE_BAR, 0, O_LARA_EXTRA);
|
||||
g_Lara.gun_status = LGS_HANDS_BUSY;
|
||||
}
|
||||
Inv_Display(INV_KEYS_MODE);
|
||||
}
|
||||
|
|
|
@ -48,12 +48,13 @@ static TEXTSTRING *m_VersionText = NULL;
|
|||
static int16_t m_CompassNeedle = 0;
|
||||
static int16_t m_CompassSpeed = 0;
|
||||
static CAMERA_INFO m_OldCamera;
|
||||
static GAME_OBJECT_ID m_InvChosen;
|
||||
RING_INFO m_Ring;
|
||||
IMOTION_INFO m_Motion;
|
||||
|
||||
static void Inv_Draw(RING_INFO *ring, IMOTION_INFO *motion);
|
||||
static void Inv_Construct(void);
|
||||
static GAMEFLOW_OPTION Inv_Close(void);
|
||||
static GAMEFLOW_OPTION Inv_Close(GAME_OBJECT_ID inv_chosen);
|
||||
static void Inv_SelectMeshes(INVENTORY_ITEM *inv_item);
|
||||
static bool Inv_AnimateItem(INVENTORY_ITEM *inv_item);
|
||||
static void Inv_DrawItem(INVENTORY_ITEM *inv_item);
|
||||
|
@ -136,7 +137,7 @@ static void Inv_Construct(void)
|
|||
g_PhdBottom = Viewport_GetMaxY();
|
||||
g_PhdRight = Viewport_GetMaxX();
|
||||
|
||||
g_InvChosen = 0;
|
||||
m_InvChosen = NO_OBJECT;
|
||||
if (g_InvMode == INV_TITLE_MODE) {
|
||||
g_InvOptionObjects = TITLE_RING_OBJECTS;
|
||||
m_VersionText = Text_Create(-20, -18, g_TR1XVersion);
|
||||
|
@ -175,7 +176,7 @@ static void Inv_Construct(void)
|
|||
}
|
||||
}
|
||||
|
||||
static GAMEFLOW_OPTION Inv_Close(void)
|
||||
static GAMEFLOW_OPTION Inv_Close(GAME_OBJECT_ID inv_chosen)
|
||||
{
|
||||
// finish fading
|
||||
if (g_InvMode == INV_TITLE_MODE) {
|
||||
|
@ -187,6 +188,7 @@ static GAMEFLOW_OPTION Inv_Close(void)
|
|||
}
|
||||
|
||||
Inv_Ring_RemoveAlText();
|
||||
m_InvChosen = NO_OBJECT;
|
||||
|
||||
if (m_VersionText) {
|
||||
Text_Remove(m_VersionText);
|
||||
|
@ -201,9 +203,8 @@ static GAMEFLOW_OPTION Inv_Close(void)
|
|||
return GF_START_DEMO;
|
||||
}
|
||||
|
||||
switch (g_InvChosen) {
|
||||
switch (inv_chosen) {
|
||||
case O_PASSPORT_OPTION:
|
||||
|
||||
switch (g_GameInfo.passport_selection) {
|
||||
case PASSPORT_MODE_LOAD_GAME:
|
||||
return GF_START_SAVED_GAME | g_GameInfo.current_save_slot;
|
||||
|
@ -238,27 +239,24 @@ static GAMEFLOW_OPTION Inv_Close(void)
|
|||
return GF_START_GYM | g_GameFlow.gym_level_num;
|
||||
|
||||
case O_GUN_OPTION:
|
||||
Lara_UseItem(O_GUN_OPTION);
|
||||
break;
|
||||
|
||||
case O_SHOTGUN_OPTION:
|
||||
Lara_UseItem(O_SHOTGUN_OPTION);
|
||||
break;
|
||||
|
||||
case O_MAGNUM_OPTION:
|
||||
Lara_UseItem(O_MAGNUM_OPTION);
|
||||
break;
|
||||
|
||||
case O_UZI_OPTION:
|
||||
Lara_UseItem(O_UZI_OPTION);
|
||||
break;
|
||||
|
||||
case O_MEDI_OPTION:
|
||||
Lara_UseItem(O_MEDI_OPTION);
|
||||
case O_BIGMEDI_OPTION:
|
||||
case O_KEY_OPTION1:
|
||||
case O_KEY_OPTION2:
|
||||
case O_KEY_OPTION3:
|
||||
case O_KEY_OPTION4:
|
||||
case O_PUZZLE_OPTION1:
|
||||
case O_PUZZLE_OPTION2:
|
||||
case O_PUZZLE_OPTION3:
|
||||
case O_PUZZLE_OPTION4:
|
||||
case O_LEADBAR_OPTION:
|
||||
Lara_UseItem(inv_chosen);
|
||||
break;
|
||||
|
||||
case O_BIGMEDI_OPTION:
|
||||
Lara_UseItem(O_BIGMEDI_OPTION);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -562,7 +560,7 @@ static GAMEFLOW_OPTION Phase_Inventory_ControlFrame(void)
|
|||
}
|
||||
|
||||
if (motion->status == RNG_DONE) {
|
||||
return Inv_Close();
|
||||
return Inv_Close(m_InvChosen);
|
||||
}
|
||||
|
||||
Inv_Ring_CalcAdders(ring, ROTATE_DURATION);
|
||||
|
@ -632,7 +630,7 @@ static GAMEFLOW_OPTION Phase_Inventory_ControlFrame(void)
|
|||
if (m_StartLevel != -1 || m_StartDemo
|
||||
|| (g_InputDB.menu_back && g_InvMode != INV_TITLE_MODE)) {
|
||||
Sound_Effect(SFX_MENU_SPINOUT, NULL, SPM_ALWAYS);
|
||||
g_InvChosen = -1;
|
||||
m_InvChosen = NO_OBJECT;
|
||||
|
||||
if (ring->type == RT_MAIN) {
|
||||
g_InvMainCurrent = ring->current_object;
|
||||
|
@ -888,7 +886,7 @@ static GAMEFLOW_OPTION Phase_Inventory_ControlFrame(void)
|
|||
|
||||
if (g_InputDB.menu_confirm) {
|
||||
inv_item->sprlist = NULL;
|
||||
g_InvChosen = inv_item->object_number;
|
||||
m_InvChosen = inv_item->object_number;
|
||||
if (ring->type == RT_MAIN) {
|
||||
g_InvMainCurrent = ring->current_object;
|
||||
} else {
|
||||
|
@ -942,7 +940,7 @@ static GAMEFLOW_OPTION Phase_Inventory_ControlFrame(void)
|
|||
case RNG_EXITING_INVENTORY:
|
||||
if (g_InvMode == INV_TITLE_MODE) {
|
||||
} else if (
|
||||
g_InvChosen == O_PASSPORT_OPTION
|
||||
m_InvChosen == O_PASSPORT_OPTION
|
||||
&& ((g_InvMode == INV_LOAD_MODE && g_SavedGamesCount) /* f6 menu */
|
||||
|| g_InvMode == INV_DEATH_MODE /* Lara died */
|
||||
|| (g_InvMode == INV_GAME_MODE /* esc menu */
|
||||
|
|
|
@ -96,7 +96,6 @@ int16_t g_RoomsToDrawCount = 0;
|
|||
|
||||
int16_t g_InvMode = INV_TITLE_MODE;
|
||||
int32_t g_InvExtraData[8] = { 0 };
|
||||
int16_t g_InvChosen = -1;
|
||||
|
||||
int32_t g_LsAdder = 0;
|
||||
int32_t g_LsDivider = 0;
|
||||
|
|
|
@ -86,4 +86,3 @@ extern REQUEST_INFO g_SavegameRequester;
|
|||
|
||||
extern int16_t g_InvMode;
|
||||
extern int32_t g_InvExtraData[8];
|
||||
extern int16_t g_InvChosen;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue