-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "game/objects/traps/spike_ceiling.h" | ||
|
||
#include "game/items.h" | ||
#include "game/lara/control.h" | ||
#include "game/room.h" | ||
#include "game/sound.h" | ||
#include "global/funcs.h" | ||
#include "global/vars.h" | ||
|
||
#define SPIKE_CEILING_DAMAGE 20 | ||
#define SPIKE_CEILING_SPEED 1 | ||
|
||
static void M_Move(int16_t item_num); | ||
static void M_HitLara(ITEM *item); | ||
|
||
static void M_Move(const int16_t item_num) | ||
{ | ||
ITEM *const item = Item_Get(item_num); | ||
const int32_t y = item->pos.y + 5; | ||
int16_t room_num = item->room_num; | ||
const SECTOR *const sector = | ||
Room_GetSector(item->pos.x, y, item->pos.z, &room_num); | ||
if (Room_GetHeight(sector, item->pos.x, y, item->pos.z) < y + WALL_L) { | ||
item->status = IS_DEACTIVATED; | ||
} else { | ||
item->pos.y = y; | ||
if (room_num != item->room_num) { | ||
Item_NewRoom(item_num, room_num); | ||
} | ||
} | ||
Sound_Effect(SFX_DOOR_SLIDE, &item->pos, SPM_NORMAL); | ||
} | ||
|
||
static void M_HitLara(ITEM *const item) | ||
{ | ||
Lara_TakeDamage(SPIKE_CEILING_DAMAGE, true); | ||
|
||
DoLotsOfBlood( | ||
g_LaraItem->pos.x, item->pos.y + LARA_HEIGHT, g_LaraItem->pos.z, | ||
SPIKE_CEILING_SPEED, item->rot.y, g_LaraItem->room_num, 3); | ||
item->touch_bits = 0; | ||
|
||
Sound_Effect(SFX_LARA_FLESH_WOUND, &item->pos, SPM_NORMAL); | ||
} | ||
|
||
void __cdecl SpikeCeiling_Control(const int16_t item_num) | ||
{ | ||
ITEM *const item = Item_Get(item_num); | ||
|
||
const bool is_trigger_active = Item_IsTriggerActive(item); | ||
if (is_trigger_active && item->status != IS_DEACTIVATED) { | ||
M_Move(item_num); | ||
} | ||
|
||
if (item->touch_bits) { | ||
M_HitLara(item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include "global/types.h" | ||
|
||
void __cdecl SpikeCeiling_Control(int16_t item_num); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters