2022-03-24 15:05:44 +01:00
|
|
|
#include "game/effect_routines/bubbles.h"
|
|
|
|
|
2022-05-14 11:40:28 +02:00
|
|
|
#include "game/collide.h"
|
2022-05-05 11:56:29 +02:00
|
|
|
#include "game/effects.h"
|
2022-03-24 15:05:44 +01:00
|
|
|
#include "game/random.h"
|
|
|
|
#include "game/sound.h"
|
2023-01-01 23:06:32 +01:00
|
|
|
#include "global/const.h"
|
2022-03-24 15:05:44 +01:00
|
|
|
#include "global/vars.h"
|
|
|
|
|
2023-01-01 23:06:32 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-09-24 00:09:15 +02:00
|
|
|
void FX_Bubbles(ITEM *item)
|
2022-03-24 15:05:44 +01:00
|
|
|
{
|
|
|
|
// XXX: until we get Robolara, it makes sense for her to breathe underwater
|
|
|
|
if (g_Lara.water_status == LWS_CHEAT
|
2024-09-06 10:03:51 +02:00
|
|
|
&& !(g_RoomInfo[g_LaraItem->room_num].flags & RF_UNDERWATER)) {
|
2022-03-24 15:05:44 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t count = (Random_GetDraw() * 3) / 0x8000;
|
|
|
|
if (!count) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Sound_Effect(SFX_LARA_BUBBLES, &item->pos, SPM_UNDERWATER);
|
|
|
|
|
2024-02-17 00:01:35 +01:00
|
|
|
XYZ_32 offset = {
|
|
|
|
.x = 0,
|
|
|
|
.y = 0,
|
|
|
|
.z = 50,
|
|
|
|
};
|
2022-05-14 11:40:28 +02:00
|
|
|
Collide_GetJointAbsPosition(item, &offset, LM_HEAD);
|
2022-03-24 15:05:44 +01:00
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
2024-09-06 10:03:51 +02:00
|
|
|
int16_t fx_num = Effect_Create(item->room_num);
|
2022-03-24 15:05:44 +01:00
|
|
|
if (fx_num != NO_ITEM) {
|
2024-09-24 00:09:15 +02:00
|
|
|
FX *fx = &g_Effects[fx_num];
|
2022-03-24 15:05:44 +01:00
|
|
|
fx->pos.x = offset.x;
|
|
|
|
fx->pos.y = offset.y;
|
|
|
|
fx->pos.z = offset.z;
|
2024-09-13 21:52:16 +02:00
|
|
|
fx->object_id = O_BUBBLES_1;
|
2024-09-06 10:03:14 +02:00
|
|
|
fx->frame_num = -((Random_GetDraw() * 3) / 0x8000);
|
2022-03-24 15:05:44 +01:00
|
|
|
fx->speed = 10 + ((Random_GetDraw() * 6) / 0x8000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|