Skip to content

Commit

Permalink
move to addons/trigger_bomb_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Shorokhov committed Dec 13, 2022
1 parent 38b1b6d commit 9513084
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 28 deletions.
1 change: 1 addition & 0 deletions regamedll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ set(GAMEDLL_SRCS
"dlls/API/CSPlayerItem.cpp"
"dlls/addons/item_airbox.cpp"
"dlls/addons/point_command.cpp"
"dlls/addons/trigger_bomb_reset.cpp"
"dlls/addons/trigger_random.cpp"
"dlls/addons/trigger_setorigin.cpp"
"dlls/wpn_shared/wpn_ak47.cpp"
Expand Down
38 changes: 38 additions & 0 deletions regamedll/dlls/addons/trigger_bomb_reset.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include "precompiled.h"

LINK_ENTITY_TO_CLASS(trigger_bomb_reset, CTriggerBombReset, CCSTriggerBombReset)

void CTriggerBombReset::Spawn()
{
InitTrigger();
SetTouch(&CTriggerBombReset::Touch);
}

void CTriggerBombReset::Touch(CBaseEntity *pOther)
{
CWeaponBox *pWeaponBox = dynamic_cast<CWeaponBox *>(pOther);

if (pWeaponBox && pWeaponBox->m_bIsBomb)
{
// If the bomb touches this trigger, tell it to reset to its last known valid position.
pWeaponBox->ResetToLastValidPlayerHeldPosition();
}
}
28 changes: 28 additions & 0 deletions regamedll/dlls/addons/trigger_bomb_reset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#pragma once

#include "triggers.h"

class CTriggerBombReset: public CBaseTrigger
{
public:
virtual void Spawn();
virtual void Touch(CBaseEntity *pOther);
};
19 changes: 0 additions & 19 deletions regamedll/dlls/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1814,25 +1814,6 @@ void CTriggerTeleport::Spawn()
SetTouch(&CTriggerTeleport::TeleportTouch);
}

LINK_ENTITY_TO_CLASS(trigger_bomb_reset, CTriggerBombReset, CCSTriggerBombReset)

void CTriggerBombReset::Spawn()
{
InitTrigger();
SetTouch(&CTriggerBombReset::Touch);
}

void CTriggerBombReset::Touch(CBaseEntity *pOther)
{
CWeaponBox *pWeaponBox = dynamic_cast<CWeaponBox *>(pOther);

if (pWeaponBox && pWeaponBox->m_bIsBomb)
{
// If the bomb touches this trigger, tell it to reset to its last known valid position.
pWeaponBox->ResetToLastValidPlayerHeldPosition();
}
}

LINK_ENTITY_TO_CLASS(info_teleport_destination, CPointEntity, CCSPointEntity)
LINK_ENTITY_TO_CLASS(func_buyzone, CBuyZone, CCSBuyZone)

Expand Down
7 changes: 0 additions & 7 deletions regamedll/dlls/triggers.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,6 @@ class CTriggerTeleport: public CBaseTrigger
virtual void Spawn();
};

class CTriggerBombReset: public CBaseTrigger
{
public:
virtual void Spawn();
virtual void Touch(CBaseEntity *pOther);
};

class CBuyZone: public CBaseTrigger
{
public:
Expand Down
4 changes: 3 additions & 1 deletion regamedll/msvc/ReGameDLL.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Play|Win32">
Expand All @@ -25,6 +25,7 @@
<ItemGroup>
<ClCompile Include="..\dlls\addons\item_airbox.cpp" />
<ClCompile Include="..\dlls\addons\point_command.cpp" />
<ClCompile Include="..\dlls\addons\trigger_bomb_reset.cpp" />
<ClCompile Include="..\dlls\addons\trigger_random.cpp" />
<ClCompile Include="..\dlls\addons\trigger_setorigin.cpp" />
<ClCompile Include="..\dlls\airtank.cpp" />
Expand Down Expand Up @@ -616,6 +617,7 @@
<ClInclude Include="..\dlls\activity.h" />
<ClInclude Include="..\dlls\addons\item_airbox.h" />
<ClInclude Include="..\dlls\addons\point_command.h" />
<ClInclude Include="..\dlls\addons\trigger_bomb_reset.h" />
<ClInclude Include="..\dlls\addons\trigger_random.h" />
<ClInclude Include="..\dlls\addons\trigger_setorigin.h" />
<ClInclude Include="..\dlls\airtank.h" />
Expand Down
8 changes: 7 additions & 1 deletion regamedll/msvc/ReGameDLL.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="engine">
Expand Down Expand Up @@ -549,6 +549,9 @@
<ClCompile Include="..\dlls\addons\point_command.cpp">
<Filter>dlls\addons</Filter>
</ClCompile>
<ClCompile Include="..\dlls\addons\trigger_bomb_reset.cpp">
<Filter>dlls\addons</Filter>
</ClCompile>
<ClCompile Include="..\public\FileSystem.cpp">
<Filter>public</Filter>
</ClCompile>
Expand Down Expand Up @@ -1049,5 +1052,8 @@
<ClInclude Include="..\dlls\addons\point_command.h">
<Filter>dlls\addons</Filter>
</ClInclude>
<ClInclude Include="..\dlls\addons\trigger_bomb_reset.h">
<Filter>dlls\addons</Filter>
</ClInclude>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions regamedll/regamedll/dlls.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ using FloatRef = float;
#include "addons/trigger_setorigin.h"
#include "addons/trigger_random.h"
#include "addons/point_command.h"
#include "addons/trigger_bomb_reset.h"

// Tutor
#include "tutor.h"
Expand Down

0 comments on commit 9513084

Please sign in to comment.