<commit_before>#include "OBJLIGHT.H"

#include "CAMERA.H"
#include "CONTROL.H"
#include "SPECIFIC.H"

#if PSX_VERSION || PSXPC_VERSION
#include "SPHERES.H"
#include "BUBBLES.H"
#endif

struct FOOTPRINT FootPrint[32];
int FootPrintNum;

//void /*$ra*/ TriggerAlertLight(long x /*$s2*/, long y /*$s3*/, long z /*$s1*/, long r /*$s5*/, long g /*stack 16*/, long b /*stack 20*/, long angle /*stack 24*/, int room_no /*stack 28*/, int falloff /*stack 32*/)
void TriggerAlertLight(long x, long y, long z, long r, long g, long b, long angle, int room_no, int falloff)//5D018, 5D494
{
	UNIMPLEMENTED();
}

void ControlStrobeLight(short item_number)//5D118(<), 5D594
{
	struct ITEM_INFO* item;
	long angle;
	long sin;
	long cos;
	long r;
	long g;
	long b;

	item = &items[item_number];

	if (!TriggerActive(item))
		return;

	angle = item->pos.y_rot + 2912;

	r = (item->trigger_flags) & 0x1F << 3;
	b = (item->trigger_flags << 16) >> 17 & 0xF8;
	g = (item->trigger_flags << 16) >> 12 & 0xF8;
	
	item->pos.y_rot = angle;

	angle += 22528;
	angle >>= 4;
	angle &= 0xFFF;

	TriggerAlertLight(item->box_number, item->pos.y_pos - 512, item->pos.z_pos, r, g, b, angle, 12, item->room_number);

	sin = rcossin_tbl[angle];
	angle |= 2;
	cos = rcossin_tbl[angle | 1];

	TriggerDynamic(item->pos.x_pos + ((sin << 16) >> 14), item->pos.y_pos - 768, (item->pos.z_pos + (cos << 16) >> 14), 12, r, g ,b);
}

void ControlPulseLight(short item_number)//5D254, 5D6D0
{
	UNIMPLEMENTED();
}

void ControlColouredLight(short item_number)//5D368, 5D7E4
{
	UNIMPLEMENTED();
}


void ControlElectricalLight(short item_number)//5D3F8, 5D874
{
	UNIMPLEMENTED();
}

void ControlBlinker(short item_number)//5D660(<), 5DADC (F)
{
	struct ITEM_INFO* item;
	struct PHD_VECTOR pos;
	long r;
	long g;
	long b;
<commit_msg>Add ControlPulseLight<commit_after>#include "OBJLIGHT.H"

#include "CAMERA.H"
#include "CONTROL.H"
#include "SPECIFIC.H"

#if PSX_VERSION || PSXPC_VERSION
#include "SPHERES.H"
#include "BUBBLES.H"
#endif

struct FOOTPRINT FootPrint[32];
int FootPrintNum;

//void /*$ra*/ TriggerAlertLight(long x /*$s2*/, long y /*$s3*/, long z /*$s1*/, long r /*$s5*/, long g /*stack 16*/, long b /*stack 20*/, long angle /*stack 24*/, int room_no /*stack 28*/, int falloff /*stack 32*/)
void TriggerAlertLight(long x, long y, long z, long r, long g, long b, long angle, int room_no, int falloff)//5D018, 5D494
{
	UNIMPLEMENTED();
}

void ControlStrobeLight(short item_number)//5D118(<), 5D594 ///@FIXME im not sure this is correct redo this
{
	struct ITEM_INFO* item;
	long angle;
	long sin;
	long cos;
	long r;
	long g;
	long b;

	item = &items[item_number];

	if (!TriggerActive(item))
		return;

	angle = item->pos.y_rot + 2912;

	r = (item->trigger_flags) & 0x1F << 3;
	b = (item->trigger_flags << 16) >> 17 & 0xF8;
	g = (item->trigger_flags << 16) >> 12 & 0xF8;
	
	item->pos.y_rot = angle;

	angle += 22528;
	angle >>= 4;
	angle &= 0xFFF;

	TriggerAlertLight(item->box_number, item->pos.y_pos - 512, item->pos.z_pos, r, g, b, angle, 12, item->room_number);

	sin = rcossin_tbl[angle];
	cos = rcossin_tbl[angle | 1];

	TriggerDynamic(item->pos.x_pos + ((sin << 16) >> 14), item->pos.y_pos - 768, (item->pos.z_pos + (cos << 16) >> 14), 12, r, g ,b);
}

void ControlPulseLight(short item_number)//5D254(<), 5D6D0 (F)
{
	struct ITEM_INFO* item;
	long sin;
	long r;
	long g;
	long b;

	item = &items[item_number];

	if (!TriggerActive(item))
		return;

	item->item_flags[0] -= 1024;
	sin = ABS(SIN((item->pos.y_pos & 0x3FFF) << 2) << 16 >> 14);

	if (sin > 255)
	{
		sin = 255;
	}//5D2F0

	r = sin * ((item->trigger_flags & 0x1F) << 3) >> 9;
	g = sin * ((item->trigger_flags << 10) >> 12) & 0xF8 >> 9;
	b = sin * ((item->trigger_flags >> 17) & 0xF8) >> 9;

	TriggerDynamic(item->pos.x_pos, item->pos.y_pos, item->pos.z_pos, 24, r, g, b);
}

void ControlColouredLight(short item_number)//5D368, 5D7E4
{
	UNIMPLEMENTED();
}

void ControlElectricalLight(short item_number)//5D3F8, 5D874
{
	UNIMPLEMENTED();
}

void ControlBlinker(short item_number)//5D660(<), 5DADC (F)
{
	struct ITEM_INFO* item;
	struct PHD_VECTOR pos;
	long r;
	long g;
	long b;

{'fraction_non_alphanumeric': 0.17850194552529183, 'fraction_numerical': 0.05982490272373541, 'mean_word_length': 4.021978021978022, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4843446', 'n_tokens_mistral': 1940, 'n_tokens_neox': 1721, 'n_words': 440}