Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monsters Reorg #199

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
49f4713
Начал реорганизацию item-ов
APAmk2 Nov 12, 2023
0b5b275
Вынес item_airtank из items.cpp
APAmk2 Nov 12, 2023
fcffcd2
Переместил+разделил healthkit.cpp
APAmk2 Nov 12, 2023
34b1444
Вынес item_antidote из items.cpp
APAmk2 Nov 12, 2023
bbf6919
Вынес item_battery из items.cpp
APAmk2 Nov 12, 2023
3d9386c
Вынес item_generic из items.cpp
APAmk2 Nov 12, 2023
1c94c39
Вынес item_longjump из items.cpp
APAmk2 Nov 12, 2023
392786e
Вынес item_security из items.cpp
APAmk2 Nov 12, 2023
9b23e40
Вынес item_suit из items.cpp
APAmk2 Nov 12, 2023
a7758a5
Исправил/убрал ненужные #include, подправил CMakeLists.txt
APAmk2 Nov 12, 2023
4dfb6de
Перенёс содержимое items в entities, вернул items.* в корень сервера.
APAmk2 Nov 12, 2023
972cc49
Перенёс LINK_ENTITY_TO_CLASS в *.cpp
APAmk2 Nov 12, 2023
0907893
Добавил #pragma once, исправил h_healthkit.*
APAmk2 Nov 13, 2023
dc23a1e
Переименовал h_heathkit.* обратно в healthkit.*
APAmk2 Nov 14, 2023
49859d5
Merge branch 'restruct-server-sources' into items_reorg
SNMetamorph Nov 14, 2023
448b3d5
Реорганизовал Apache, вынес его ракеты в apache_rocket.*
APAmk2 Nov 14, 2023
9621654
Реорганизовал турели
APAmk2 Nov 14, 2023
006fbc8
Реорганизовал зомби
APAmk2 Nov 14, 2023
aca6550
Реорганизовал буллсквида, вынес плевок в bullsquid_split.*
APAmk2 Nov 14, 2023
425f8cb
Реорганизовал барнакла
APAmk2 Nov 14, 2023
44feed2
Реорганизовал G-Man-а
APAmk2 Nov 14, 2023
8b5b3d5
Реорганизовал Hassasin-ку
APAmk2 Nov 14, 2023
5e9b934
Реорганизовал Osprey
APAmk2 Nov 14, 2023
84f0b8a
Реорганизовал крысу
APAmk2 Nov 14, 2023
85093d2
Реорганизовал таракана
APAmk2 Nov 14, 2023
a3473eb
Исправил буллсквида
APAmk2 Nov 14, 2023
a7541c4
Реорганизовал пиявок
APAmk2 Nov 14, 2023
894cab6
Реорганизовал тентакли
APAmk2 Nov 14, 2023
a393e70
Реорганизовал хедкрабов
APAmk2 Nov 15, 2023
2b49742
Реорганизовал tempmonster.*, поправил хедкрабов
APAmk2 Nov 15, 2023
352cc30
Реорганизовал Нихиланта
APAmk2 Nov 16, 2023
f5576af
Реорганизовал Alien Grunt-а
APAmk2 Nov 16, 2023
8792df6
Реорганизовал хаундая
APAmk2 Nov 16, 2023
1c98071
Реорганизовал Ихтиозавра
APAmk2 Nov 16, 2023
9f1e4db
Реорганизовал вортигонта
APAmk2 Nov 16, 2023
3bf955c
Реорганизовал monstermaker.*
APAmk2 Nov 16, 2023
92599c6
Реорганизовал playermonster.*
APAmk2 Nov 16, 2023
d92be4b
Реорганизовал Гонарча
APAmk2 Nov 16, 2023
3761e92
Реорганизовал Гаргантюа
APAmk2 Nov 16, 2023
ee732e8
Реорганизовал Контроллёра
APAmk2 Nov 16, 2023
998f1c3
Реорганизовал Нихиланта
APAmk2 Nov 16, 2023
e2795a6
Реорганизовал aflock.*
APAmk2 Nov 16, 2023
b6d2899
Реорганизовал Хедкрабов
APAmk2 Nov 16, 2023
50d01b2
Реорганизовал учёных, Барни, Военных
APAmk2 Nov 16, 2023
1097f2d
Реорганизовал Bloater-ов
APAmk2 Nov 16, 2023
2c613f9
Реорганизовал spritemonster.*
APAmk2 Nov 16, 2023
8367298
Реорганизовал genericmonster.*
APAmk2 Nov 16, 2023
be32a59
Сделал фиrсы по реквесту SNMetamorph-а
APAmk2 Nov 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include(CompilerRuntime)
check_include_file("tgmath.h" HAVE_TGMATH_H)

list(APPEND SVDLL_SOURCES
"airtank.cpp"
"bmodels.cpp"
"buttons.cpp"
"cbase.cpp"
Expand All @@ -25,7 +24,6 @@ list(APPEND SVDLL_SOURCES
"globals.cpp"
"h_battery.cpp"
"h_cycler.cpp"
"healthkit.cpp"
"items.cpp"
"lights.cpp"
"mapents.cpp"
Expand Down
107 changes: 107 additions & 0 deletions server/entities/apache_rocket.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/

#include "apache_rocket.h"

LINK_ENTITY_TO_CLASS( hvr_rocket, CApacheHVR );

BEGIN_DATADESC( CApacheHVR )
DEFINE_FIELD( m_vecForward, FIELD_VECTOR ),
DEFINE_FUNCTION( IgniteThink ),
DEFINE_FUNCTION( AccelerateThink ),
END_DATADESC()

void CApacheHVR :: Spawn( void )
{
Precache( );
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;

SET_MODEL(ENT(pev), "models/HVR.mdl");
UTIL_SetSize(pev, Vector( 0, 0, 0), Vector(0, 0, 0));
RelinkEntity( TRUE );

SetThink( &CApacheHVR::IgniteThink );
SetTouch( &CApacheHVR::ExplodeTouch );

UTIL_MakeVectors( GetAbsAngles() );
m_vecForward = gpGlobals->v_forward;
pev->gravity = 0.5;

pev->nextthink = gpGlobals->time + 0.1;

pev->dmg = 150;
}


void CApacheHVR :: Precache( void )
{
PRECACHE_MODEL("models/HVR.mdl");
m_iTrail = PRECACHE_MODEL("sprites/smoke.spr");
PRECACHE_SOUND ("weapons/rocket1.wav");
}

void CApacheHVR :: IgniteThink( void )
{
// pev->movetype = MOVETYPE_TOSS;

// pev->movetype = MOVETYPE_FLY;
pev->effects |= EF_LIGHT;

// make rocket sound
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5 );

// rocket trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );

WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT(entindex()); // entity
WRITE_SHORT(m_iTrail ); // model
WRITE_BYTE( 15 ); // life
WRITE_BYTE( 5 ); // width
WRITE_BYTE( 224 ); // r, g, b
WRITE_BYTE( 224 ); // r, g, b
WRITE_BYTE( 255 ); // r, g, b
WRITE_BYTE( 255 ); // brightness

MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)

// set to accelerate
SetThink( &CApacheHVR::AccelerateThink );
pev->nextthink = gpGlobals->time + 0.1;
}

void CApacheHVR :: AccelerateThink( void )
{
// check world boundaries
if ( !IsInWorld( FALSE ))
{
UTIL_Remove( this );
return;
}

// accelerate
float flSpeed = GetAbsVelocity().Length();
if (flSpeed < 1800)
{
SetAbsVelocity( GetAbsVelocity() + m_vecForward * 200 );
}

// re-aim
SetAbsAngles( UTIL_VecToAngles( GetAbsVelocity() ));

SetNextThink( 0.1 );
}
39 changes: 39 additions & 0 deletions server/entities/apache_rocket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/

#pragma once

#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "effects.h"

class CApacheHVR : public CGrenade
{
public:
DECLARE_CLASS( CApacheHVR, CGrenade );
SNMetamorph marked this conversation as resolved.
Show resolved Hide resolved
void Spawn( void );
void Precache( void );
void IgniteThink( void );
void AccelerateThink( void );

DECLARE_DATADESC();

int m_iTrail;
Vector m_vecForward;
};
149 changes: 149 additions & 0 deletions server/entities/bigmomma_mortar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/

//=========================================================
// Mortar shot entity
//=========================================================
#include "bigmomma_mortar.h"

extern int gSpitSprite;

LINK_ENTITY_TO_CLASS( bmortar, CBMortar );

BEGIN_DATADESC( CBMortar )
DEFINE_FIELD( m_maxFrame, FIELD_INTEGER ),
DEFINE_FUNCTION( Animate ),
END_DATADESC()

void MortarSpray(const Vector &position, const Vector &direction, int spriteModel, int count)
{
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, position);
WRITE_BYTE(TE_SPRITE_SPRAY);
WRITE_COORD(position.x); // pos
WRITE_COORD(position.y);
WRITE_COORD(position.z);
WRITE_COORD(direction.x); // dir
WRITE_COORD(direction.y);
WRITE_COORD(direction.z);
WRITE_SHORT(spriteModel); // model
WRITE_BYTE(count); // count
WRITE_BYTE(130); // speed
WRITE_BYTE(80); // noise ( client will divide by 100 )
MESSAGE_END();
}

// ---------------------------------
//
// Mortar
//
// ---------------------------------

// UNDONE: right now this is pretty much a copy of the squid spit with minor changes to the way it does damage
void CBMortar:: Spawn( void )
{
pev->movetype = MOVETYPE_TOSS;
pev->classname = MAKE_STRING( "bmortar" );

pev->solid = SOLID_BBOX;
pev->rendermode = kRenderTransAlpha;
pev->renderamt = 255;

SET_MODEL(ENT(pev), "sprites/mommaspit.spr");
pev->frame = 0;
pev->scale = 0.5;

UTIL_SetSize( pev, Vector( 0, 0, 0), Vector(0, 0, 0) );

m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
pev->dmgtime = gpGlobals->time + 0.4;
}

void CBMortar::Animate( void )
{
pev->nextthink = gpGlobals->time + 0.1;

if ( gpGlobals->time > pev->dmgtime )
{
pev->dmgtime = gpGlobals->time + 0.2;
MortarSpray( GetAbsOrigin(), -GetAbsVelocity().Normalize(), gSpitSprite, 3 );
}
if ( pev->frame++ )
{
if ( pev->frame > m_maxFrame )
{
pev->frame = 0;
}
}
}

CBMortar *CBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity )
{
CBMortar *pSpit = GetClassPtr( (CBMortar *)NULL );
pSpit->Spawn();

UTIL_SetOrigin( pSpit, vecStart );
pSpit->SetAbsVelocity( vecVelocity );
pSpit->pev->owner = pOwner;
pSpit->pev->scale = 2.5;
pSpit->SetThink( &CBMortar::Animate );
pSpit->pev->nextthink = gpGlobals->time + 0.1;

return pSpit;
}


void CBMortar::Touch( CBaseEntity *pOther )
{
TraceResult tr;
int iPitch;

// splat sound
iPitch = RANDOM_FLOAT( 90, 110 );

EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "bullchicken/bc_acid1.wav", 1, ATTN_NORM, 0, iPitch );

switch ( RANDOM_LONG( 0, 1 ) )
{
case 0:
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "bullchicken/bc_spithit1.wav", 1, ATTN_NORM, 0, iPitch );
break;
case 1:
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "bullchicken/bc_spithit2.wav", 1, ATTN_NORM, 0, iPitch );
break;
}

if ( pOther->IsBSPModel() )
{

// make a splat on the wall
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + GetAbsVelocity() * 10, dont_ignore_monsters, edict(), &tr );
UTIL_DecalTrace(&tr, "{mommablob");
}
else
{
tr.vecEndPos = GetAbsOrigin();
tr.vecPlaneNormal = -GetAbsVelocity().Normalize();
}

// make some flecks
MortarSpray( tr.vecEndPos, tr.vecPlaneNormal, gSpitSprite, 24 );

entvars_t *pevOwner = NULL;
if ( pev->owner )
pevOwner = VARS(pev->owner);

RadiusDamage( GetAbsOrigin(), pev, pevOwner, gSkillData.bigmommaDmgBlast, gSkillData.bigmommaRadiusBlast, CLASS_NONE, DMG_ACID );
UTIL_Remove( this );
}
44 changes: 44 additions & 0 deletions server/entities/bigmomma_mortar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/

//=========================================================
// Mortar shot entity
//=========================================================

#pragma once

#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
#include "decals.h"
#include "weapons.h"
#include "game.h"

class CBMortar : public CBaseEntity
{
DECLARE_CLASS( CBMortar, CBaseEntity );
public:
void Spawn( void );

static CBMortar *Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity );
void Touch( CBaseEntity *pOther );
void Animate( void );

DECLARE_DATADESC();

int m_maxFrame;
};
Loading