mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-13 05:57:05 +03:00
Cleanup control.cpp
This commit is contained in:
parent
af476df8dd
commit
08964e8da7
6 changed files with 85 additions and 86 deletions
|
@ -1875,3 +1875,36 @@ void ResetLook()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RumbleScreen()
|
||||
{
|
||||
if (!(GlobalCounter & 0x1FF))
|
||||
SoundEffect(SFX_TR5_KLAXON, 0, 4104);
|
||||
|
||||
if (RumbleTimer >= 0)
|
||||
RumbleTimer++;
|
||||
|
||||
if (RumbleTimer > 450)
|
||||
{
|
||||
if (!(GetRandomControl() & 0x1FF))
|
||||
{
|
||||
InGameCounter = 0;
|
||||
RumbleTimer = -32 - (GetRandomControl() & 0x1F);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (RumbleTimer < 0)
|
||||
{
|
||||
if (InGameCounter >= abs(RumbleTimer))
|
||||
{
|
||||
Camera.bounce = -(GetRandomControl() % abs(RumbleTimer));
|
||||
RumbleTimer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
InGameCounter++;
|
||||
Camera.bounce = -(GetRandomControl() % InGameCounter);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -87,3 +87,4 @@ void CalculateCamera();
|
|||
void LookLeftRight();
|
||||
void LookUpDown();
|
||||
void ResetLook();
|
||||
void RumbleScreen();
|
|
@ -880,89 +880,6 @@ int GetCeiling(FLOOR_INFO *floor, int x, int y, int z)
|
|||
return GetCeilingHeight(ROOM_VECTOR{floor->Room, y}, x, z).value_or(NO_HEIGHT);
|
||||
}
|
||||
|
||||
void RumbleScreen()
|
||||
{
|
||||
if (!(GlobalCounter & 0x1FF))
|
||||
SoundEffect(SFX_TR5_KLAXON, 0, 4104);
|
||||
|
||||
if (RumbleTimer >= 0)
|
||||
RumbleTimer++;
|
||||
|
||||
if (RumbleTimer > 450)
|
||||
{
|
||||
if (!(GetRandomControl() & 0x1FF))
|
||||
{
|
||||
InGameCounter = 0;
|
||||
RumbleTimer = -32 - (GetRandomControl() & 0x1F);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (RumbleTimer < 0)
|
||||
{
|
||||
if (InGameCounter >= abs(RumbleTimer))
|
||||
{
|
||||
Camera.bounce = -(GetRandomControl() % abs(RumbleTimer));
|
||||
RumbleTimer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
InGameCounter++;
|
||||
Camera.bounce = -(GetRandomControl() % InGameCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshCamera(short type, short *data)
|
||||
{
|
||||
short trigger, value, targetOk;
|
||||
|
||||
targetOk = 2;
|
||||
|
||||
do
|
||||
{
|
||||
trigger = *(data++);
|
||||
value = trigger & VALUE_BITS;
|
||||
|
||||
switch (TRIG_BITS(trigger))
|
||||
{
|
||||
case TO_CAMERA:
|
||||
data++;
|
||||
|
||||
if (value == Camera.last)
|
||||
{
|
||||
Camera.number = value;
|
||||
|
||||
if ((Camera.timer < 0) || (Camera.type == LOOK_CAMERA) || (Camera.type == COMBAT_CAMERA))
|
||||
{
|
||||
Camera.timer = -1;
|
||||
targetOk = 0;
|
||||
break;
|
||||
}
|
||||
Camera.type = FIXED_CAMERA;
|
||||
targetOk = 1;
|
||||
}
|
||||
else
|
||||
targetOk = 0;
|
||||
break;
|
||||
|
||||
case TO_TARGET:
|
||||
if (Camera.type == LOOK_CAMERA || Camera.type == COMBAT_CAMERA)
|
||||
break;
|
||||
|
||||
Camera.item = &g_Level.Items[value];
|
||||
break;
|
||||
}
|
||||
} while (!(trigger & END_BIT));
|
||||
|
||||
if (Camera.item)
|
||||
if (!targetOk || (targetOk == 2 && Camera.item->lookedAt && Camera.item != Camera.lastItem))
|
||||
Camera.item = NULL;
|
||||
|
||||
if (Camera.number == -1 && Camera.timer > 0)
|
||||
Camera.timer = -1;
|
||||
}
|
||||
|
||||
int ExplodeItemNode(ITEM_INFO *item, int Node, int NoXZVel, int bits)
|
||||
{
|
||||
if (1 << Node & item->meshBits)
|
||||
|
|
|
@ -84,9 +84,6 @@ void KillMoveEffects();
|
|||
void UpdateShatters();
|
||||
int ExplodeItemNode(ITEM_INFO* item, int Node, int NoXZVel, int bits);
|
||||
|
||||
void RumbleScreen();
|
||||
void RefreshCamera(short type, short* data);
|
||||
|
||||
void CleanUp();
|
||||
|
||||
void AlterFloorHeight(ITEM_INFO* item, int height);
|
||||
|
|
|
@ -189,6 +189,56 @@ int PickupTrigger(short itemNum)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void RefreshCamera(short type, short* data)
|
||||
{
|
||||
short trigger, value, targetOk;
|
||||
|
||||
targetOk = 2;
|
||||
|
||||
do
|
||||
{
|
||||
trigger = *(data++);
|
||||
value = trigger & VALUE_BITS;
|
||||
|
||||
switch (TRIG_BITS(trigger))
|
||||
{
|
||||
case TO_CAMERA:
|
||||
data++;
|
||||
|
||||
if (value == Camera.last)
|
||||
{
|
||||
Camera.number = value;
|
||||
|
||||
if ((Camera.timer < 0) || (Camera.type == LOOK_CAMERA) || (Camera.type == COMBAT_CAMERA))
|
||||
{
|
||||
Camera.timer = -1;
|
||||
targetOk = 0;
|
||||
break;
|
||||
}
|
||||
Camera.type = FIXED_CAMERA;
|
||||
targetOk = 1;
|
||||
}
|
||||
else
|
||||
targetOk = 0;
|
||||
break;
|
||||
|
||||
case TO_TARGET:
|
||||
if (Camera.type == LOOK_CAMERA || Camera.type == COMBAT_CAMERA)
|
||||
break;
|
||||
|
||||
Camera.item = &g_Level.Items[value];
|
||||
break;
|
||||
}
|
||||
} while (!(trigger & END_BIT));
|
||||
|
||||
if (Camera.item)
|
||||
if (!targetOk || (targetOk == 2 && Camera.item->lookedAt && Camera.item != Camera.lastItem))
|
||||
Camera.item = NULL;
|
||||
|
||||
if (Camera.number == -1 && Camera.timer > 0)
|
||||
Camera.timer = -1;
|
||||
}
|
||||
|
||||
short* GetTriggerIndex(FLOOR_INFO* floor, int x, int y, int z)
|
||||
{
|
||||
auto bottomBlock = GetCollisionResult(x, y, z, floor->Room).BottomBlock;
|
||||
|
|
|
@ -65,6 +65,7 @@ int GetSwitchTrigger(ITEM_INFO* item, short* itemNos, int attatchedToSwitch);
|
|||
int SwitchTrigger(short itemNum, short timer);
|
||||
int KeyTrigger(short itemNum);
|
||||
int PickupTrigger(short itemNum);
|
||||
void RefreshCamera(short type, short* data);
|
||||
int TriggerActive(ITEM_INFO* item);
|
||||
short* GetTriggerIndex(FLOOR_INFO* floor, int x, int y, int z);
|
||||
short* GetTriggerIndex(ITEM_INFO* item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue