Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
console/cmd: import /abortion
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Sep 21, 2024
1 parent 99c5dd4 commit c984f36
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/libtrx/game/console/cmd/die.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include "../common.h"

extern CONSOLE_COMMAND g_Console_Cmd_Die;
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ sources = [
'src/filesystem.c',
'src/game/backpack.c',
'src/game/console/cmd/config.c',
'src/game/console/cmd/die.c',
'src/game/console/cmd/fly.c',
'src/game/console/cmd/give_item.c',
'src/game/console/cmd/heal.c',
Expand Down
38 changes: 38 additions & 0 deletions src/game/console/cmd/die.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "game/console/cmd/die.h"

#include "game/effects/exploding_death.h"
#include "game/items.h"
#include "game/lara/common.h"
#include "game/objects/common.h"
#include "game/objects/ids.h"
#include "game/sound.h"

static COMMAND_RESULT M_Entrypoint(const char *args);

static COMMAND_RESULT M_Entrypoint(const char *const args)
{
if (!Object_GetObject(O_LARA)->loaded) {
return CR_UNAVAILABLE;
}

LARA_INFO *const lara = Lara_GetLaraInfo();
ITEM_INFO *const lara_item = Lara_GetItem();
if (lara_item->hit_points <= 0) {
return CR_UNAVAILABLE;
}

Sound_Effect(SFX_LARA_FALL, &lara_item->pos, SPM_NORMAL);
#if TR_VERSION == 1
Sound_Effect(SFX_EXPLOSION_CHEAT, &lara_item->pos, SPM_NORMAL);
#endif
Effect_ExplodingDeath(lara->item_num, -1, 1);

lara_item->hit_points = 0;
lara_item->flags |= IF_INVISIBLE;
return CR_SUCCESS;
}

CONSOLE_COMMAND g_Console_Cmd_Die = {
.prefix = "abortion|natlastinks",
.proc = M_Entrypoint,
};

0 comments on commit c984f36

Please sign in to comment.