Skip to content

Commit

Permalink
Added CFlashlight class with device_flashlight
Browse files Browse the repository at this point in the history
  • Loading branch information
revolucas committed Jun 23, 2018
1 parent 34e1f9b commit 4a6702f
Show file tree
Hide file tree
Showing 20 changed files with 1,227 additions and 17 deletions.
547 changes: 547 additions & 0 deletions res/gamedata/configs/misc/devices.ltx

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/textures/item/item_flash.dds
Binary file not shown.
Binary file added res/gamedata/textures/item/item_flash.thm
Binary file not shown.
Binary file added res/gamedata/textures/item/item_flash_bump#.dds
Binary file not shown.
Binary file added res/gamedata/textures/item/item_flash_bump.dds
Binary file not shown.
Binary file added res/gamedata/textures/item/item_flash_bump.thm
Binary file not shown.
12 changes: 12 additions & 0 deletions src/xrGame/ActorInput.cpp
Expand Up @@ -2,6 +2,7 @@
#include <dinput.h>
#include "Actor.h"
#include "Torch.h"
#include "Flashlight.h"
#include "trade.h"
#include "../xrEngine/CameraBase.h"

Expand Down Expand Up @@ -108,6 +109,11 @@ void CActor::IR_OnKeyboardPress(int cmd)
case kTORCH:
{
SwitchTorch();
/*
CFlashlight* flashlight = smart_cast<CFlashlight*>(inventory().ItemFromSlot(DETECTOR_SLOT));
if (flashlight)
flashlight->Switch();
*/
break;
}

Expand All @@ -119,6 +125,12 @@ void CActor::IR_OnKeyboardPress(int cmd)
CCustomDetector* det = smart_cast<CCustomDetector*>(det_active);
if (det)
det->ToggleDetector (g_player_hud->attached_item(0)!=NULL);
else
{
CFlashlight* flashlight = smart_cast<CFlashlight*>(det_active);
if (flashlight)
flashlight->ToggleDevice(g_player_hud->attached_item(0) != NULL);
}
return;
}
}break;
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/CustomDetector.cpp
Expand Up @@ -191,6 +191,7 @@ CCustomDetector::CCustomDetector()
m_ui = NULL;
m_bFastAnimMode = false;
m_bNeedActivation = false;
m_bWorking = false;
}

CCustomDetector::~CCustomDetector()
Expand Down

6 comments on commit 4a6702f

@Roman-n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand correctly - this is a hand lantern, with hud model?

@revolucas
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the same flashlight I implemented in Misery 2 along with model and animation by r_populik. A dedicated class for it makes it no longer necessary for script hack with headlamp.

@Roman-n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I thought so, I already looked through the model. I have here is such a model:
https://youtu.be/31r4ZBGoO0U
https://youtu.be/XoZi-SoQiiM
I did it on SoC, but on the hands of CS.

@revolucas
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever make a hud version for CoP? If you are curious how CFlashlight works, here is video: https://youtu.be/hFsDrN8AZl4

@Roman-n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did. As well as transferred from CoP on SoC, and vice versa.
When I do - I will write Borovos, on your website, in a personal message.

@Roman-n
Copy link
Contributor

@Roman-n Roman-n commented on 4a6702f Jul 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Animation I did. There are several questions:
now there are additional animations -

  1. turn on / off the flashlight, now the flashlight can be activated in the option on a separate button, 2) the animation for the sight, if it's a gun. I wanted to do, as in this modification - https://www.youtube.com/watch?v=BStEEMrQtqk
    I also changed the animation for running, as well as on this video, but the problem is that the light from the flashlight shines somewhere behind the head of the main hero .. It is necessary to make so that the light would turn on and off, and shine from the bone flashlight.
    If that - I have the source code - how it is done on SoC.
    Looks like this: https://www.youtube.com/watch?v=awc6PQtAOVk
    I wrote to you, on your forum.

Please sign in to comment.