Skip to content

Commit

Permalink
console/cmd: move /kill to libtrx
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Sep 20, 2024
1 parent 7d2f02a commit 451e619
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 124 deletions.
2 changes: 2 additions & 0 deletions data/ship/cfg/TR1X_gameflow.json5
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@
"OSD_HEAL_SUCCESS": "Healed Lara back to full health",
"OSD_INVALID_ITEM": "Unknown item: %s",
"OSD_INVALID_LEVEL": "Invalid level",
"OSD_INVALID_OBJECT": "Invalid object",
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
"OSD_KILL": "Bye-bye!",
"OSD_KILL_ALL": "Poof! %d enemies gone!",
Expand All @@ -729,6 +730,7 @@
"OSD_LOAD_GAME": "Loaded game from save slot %d",
"OSD_LOAD_GAME_FAIL_INVALID_SLOT": "Invalid save slot %d",
"OSD_LOAD_GAME_FAIL_UNAVAILABLE_SLOT": "Save slot %d is not available",
"OSD_OBJECT_NOT_FOUND": "Object not found",
"OSD_PERSPECTIVE_FILTER_OFF": "Perspective filter disabled",
"OSD_PERSPECTIVE_FILTER_ON": "Perspective filter enabled",
"OSD_PLAY_LEVEL": "Loading %s",
Expand Down
2 changes: 2 additions & 0 deletions data/ship/cfg/TR1X_gameflow_demo_pc.json5
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
"OSD_HEAL_SUCCESS": "Healed Lara back to full health",
"OSD_INVALID_ITEM": "Unknown item: %s",
"OSD_INVALID_LEVEL": "Invalid level",
"OSD_INVALID_OBJECT": "Invalid object",
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
"OSD_KILL": "Bye-bye!",
"OSD_KILL_ALL": "Poof! %d enemies gone!",
Expand All @@ -224,6 +225,7 @@
"OSD_LOAD_GAME": "Loaded game from save slot %d",
"OSD_LOAD_GAME_FAIL_INVALID_SLOT": "Invalid save slot %d",
"OSD_LOAD_GAME_FAIL_UNAVAILABLE_SLOT": "Save slot %d is not available",
"OSD_OBJECT_NOT_FOUND": "Object not found",
"OSD_PERSPECTIVE_FILTER_OFF": "Perspective filter disabled",
"OSD_PERSPECTIVE_FILTER_ON": "Perspective filter enabled",
"OSD_PLAY_LEVEL": "Loading %s",
Expand Down
2 changes: 2 additions & 0 deletions data/ship/cfg/TR1X_gameflow_ub.json5
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"OSD_HEAL_SUCCESS": "Healed Lara back to full health",
"OSD_INVALID_ITEM": "Unknown item: %s",
"OSD_INVALID_LEVEL": "Invalid level",
"OSD_INVALID_OBJECT": "Invalid object",
"OSD_INVALID_ROOM": "Invalid room: %d. Valid rooms are 0-%d",
"OSD_KILL": "Bye-bye!",
"OSD_KILL_ALL": "Poof! %d enemies gone!",
Expand All @@ -296,6 +297,7 @@
"OSD_LOAD_GAME": "Loaded game from save slot %d",
"OSD_LOAD_GAME_FAIL_INVALID_SLOT": "Invalid save slot %d",
"OSD_LOAD_GAME_FAIL_UNAVAILABLE_SLOT": "Save slot %d is not available",
"OSD_OBJECT_NOT_FOUND": "Object not found",
"OSD_PERSPECTIVE_FILTER_OFF": "Perspective filter disabled",
"OSD_PERSPECTIVE_FILTER_ON": "Perspective filter enabled",
"OSD_PLAY_LEVEL": "Loading %s",
Expand Down
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ sources = [
'src/game/console/cmd/flipmap.c',
'src/game/console/cmd/fly.c',
'src/game/console/cmd/fps.c',
'src/game/console/cmd/kill.c',
'src/game/console/cmd/load_game.c',
'src/game/console/cmd/play_demo.c',
'src/game/console/cmd/play_level.c',
Expand Down
112 changes: 0 additions & 112 deletions src/game/console/cmd/kill.c

This file was deleted.

5 changes: 0 additions & 5 deletions src/game/console/cmd/kill.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/game/console/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "game/console/cmd/flipmap.h"
#include "game/console/cmd/fly.h"
#include "game/console/cmd/fps.h"
#include "game/console/cmd/kill.h"
#include "game/console/cmd/load_game.h"
#include "game/console/cmd/play_demo.h"
#include "game/console/cmd/play_level.h"
Expand All @@ -22,6 +21,7 @@
#include <libtrx/game/console/cmd/config.h>
#include <libtrx/game/console/cmd/give_item.h>
#include <libtrx/game/console/cmd/heal.h>
#include <libtrx/game/console/cmd/kill.h>
#include <libtrx/game/console/cmd/pos.h>
#include <libtrx/game/console/cmd/set_health.h>

Expand Down
10 changes: 10 additions & 0 deletions src/game/creature.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,3 +817,13 @@ static bool M_TestSwitchOrKill(
Item_Kill(item_num);
return false;
}

bool Creature_IsEnemy(const ITEM_INFO *const item)
{
return Object_IsObjectType(item->object_id, g_EnemyObjects);
}

bool Creature_IsAlly(const ITEM_INFO *const item)
{
return Object_IsObjectType(item->object_id, g_AllyObjects);
}
4 changes: 0 additions & 4 deletions src/game/game_string.def
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ GS_DEFINE(OSD_FLIPMAP_ON, "Flipmap set to ON")
GS_DEFINE(OSD_FLIPMAP_OFF, "Flipmap set to OFF")
GS_DEFINE(OSD_FLIPMAP_FAIL_ALREADY_ON, "Flipmap is already ON")
GS_DEFINE(OSD_FLIPMAP_FAIL_ALREADY_OFF, "Flipmap is already OFF")
GS_DEFINE(OSD_KILL_ALL, "Poof! %d enemies gone!")
GS_DEFINE(OSD_KILL_ALL_FAIL, "Uh-oh, there are no enemies left to kill...")
GS_DEFINE(OSD_KILL, "Bye-bye!")
GS_DEFINE(OSD_KILL_FAIL, "No enemy nearby...")
GS_DEFINE(OSD_COMPLETE_LEVEL, "Level complete!")
GS_DEFINE(OSD_PLAY_LEVEL, "Loading %s")
GS_DEFINE(OSD_TEXTURE_FILTER_SET, "Texture filter set to %s")
Expand Down
5 changes: 5 additions & 0 deletions src/game/items.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,3 +838,8 @@ bool Item_TestFrameRange(ITEM_INFO *item, int16_t start, int16_t end)
item->frame_num, g_Anims[item->anim_num].frame_base + start,
g_Anims[item->anim_num].frame_base + end);
}

ITEM_INFO *Item_Get(const int16_t item_num)
{
return &g_Items[item_num];
}
8 changes: 8 additions & 0 deletions src/game/objects/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ const GAME_OBJECT_ID g_EnemyObjects[] = {
// clang-format on
};

const GAME_OBJECT_ID g_AllyObjects[] = {
// clang-format off
O_LARA,
NO_OBJECT,
// Lara's social skills: still loading...
// clang-format on
};

const GAME_OBJECT_ID g_BossObjects[] = {
// clang-format off
O_TREX,
Expand Down
1 change: 1 addition & 0 deletions src/game/objects/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ typedef struct GAME_OBJECT_PAIR {
} GAME_OBJECT_PAIR;

extern const GAME_OBJECT_ID g_EnemyObjects[];
extern const GAME_OBJECT_ID g_AllyObjects[];
extern const GAME_OBJECT_ID g_BossObjects[];
extern const GAME_OBJECT_ID g_PlaceholderObjects[];
extern const GAME_OBJECT_ID g_PickupObjects[];
Expand Down

0 comments on commit 451e619

Please sign in to comment.