Skip to content

Commit

Permalink
lara/cheat: fix kill cheat not fully killing enemies
Browse files Browse the repository at this point in the history
Resolves #1482.
  • Loading branch information
rr- committed Sep 3, 2024
1 parent 9283375 commit 0e3c01a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- fixed `/give` console command giving duplicate items under some circumstances (#1463, regression from 3.0)
- fixed `/give` console command confusing logging around mismatched items (#1463, regression from 3.0)
- fixed `/flip` console command misreporting an already enabled flipmap as off (regression from 4.0)
- fixed `/kill` console command not fully killing enemies (#1482, regression from 3.0)
- fixed console commands causing improper ring shutdown with selected inventory item (#1460, regression from 3.0)
- fixed console input immediately ending demo (#1480, regression from 4.1)
- improved level load times
Expand Down
2 changes: 1 addition & 1 deletion src/game/console_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static COMMAND_RESULT Console_Cmd_Kill(const char *args)
break;
}

struct ITEM_INFO *item = &g_Items[best_item_num];
ITEM_INFO *const item = &g_Items[best_item_num];
const int32_t distance = Item_GetDistance(item, &g_LaraItem->pos);
found |= Lara_Cheat_KillEnemy(best_item_num);
if (distance >= WALL_L) {
Expand Down
2 changes: 1 addition & 1 deletion src/game/lara/lara.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ bool Lara_MovePosition(ITEM_INFO *item, XYZ_32 *vec)

void Lara_Push(ITEM_INFO *item, COLL_INFO *coll, bool spaz_on, bool big_push)
{
struct ITEM_INFO *lara_item = g_LaraItem;
ITEM_INFO *const lara_item = g_LaraItem;
int32_t x = lara_item->pos.x - item->pos.x;
int32_t z = lara_item->pos.z - item->pos.z;
const int32_t c = Math_Cos(item->rot.y);
Expand Down
5 changes: 4 additions & 1 deletion src/game/lara/lara_cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "game/inventory.h"
#include "game/items.h"
#include "game/lara.h"
#include "game/lot.h"
#include "game/objects/common.h"
#include "game/room.h"
#include "game/sound.h"
Expand Down Expand Up @@ -353,7 +354,7 @@ bool Lara_Cheat_OpenNearestDoor(void)

bool Lara_Cheat_KillEnemy(const int16_t item_num)
{
struct ITEM_INFO *item = &g_Items[item_num];
ITEM_INFO *const item = &g_Items[item_num];
if (!Object_IsObjectType(item->object_number, g_EnemyObjects)
|| item->hit_points <= 0) {
return false;
Expand All @@ -362,6 +363,8 @@ bool Lara_Cheat_KillEnemy(const int16_t item_num)
Effect_ExplodingDeath(item_num, -1, 0);
Sound_Effect(SFX_EXPLOSION_CHEAT, &item->pos, SPM_NORMAL);
Item_Kill(item_num);
LOT_DisableBaddieAI(item_num);
item->flags |= IF_ONESHOT;
Carrier_TestItemDrops(item_num);
return true;
}
2 changes: 1 addition & 1 deletion src/global/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ typedef struct CARRIED_ITEM {
struct CARRIED_ITEM *next_item;
} CARRIED_ITEM;

typedef struct ITEM_INFO {
typedef struct {
int32_t floor;
uint32_t touch_bits;
uint32_t mesh_bits;
Expand Down

0 comments on commit 0e3c01a

Please sign in to comment.