Skip to content

Commit

Permalink
HLSDK: dlls: included util.h, monsters.h and schedule.h
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyAG authored and YaLTeR committed Jul 27, 2024
1 parent 12082f6 commit c1db76c
Show file tree
Hide file tree
Showing 6 changed files with 324 additions and 12 deletions.
10 changes: 0 additions & 10 deletions BunnymodXT/custom_triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ namespace CustomTriggers

void Trigger::update(const Vector& player_position, bool ducking)
{
const Vector VEC_HULL_MIN(-16, -16, -36);
const Vector VEC_HULL_MAX(16, 16, 36);
const Vector VEC_DUCK_HULL_MIN(-16, -16, -18);
const Vector VEC_DUCK_HULL_MAX(16, 16, 18);

const Vector& hull_max = ducking ? VEC_DUCK_HULL_MAX : VEC_HULL_MAX;
const Vector& hull_min = ducking ? VEC_DUCK_HULL_MIN : VEC_HULL_MIN;

Expand All @@ -111,11 +106,6 @@ namespace CustomTriggers

void Trigger::update(const Vector& player_position_start, const Vector& player_position_end, bool ducking)
{
const Vector VEC_HULL_MIN(-16, -16, -36);
const Vector VEC_HULL_MAX(16, 16, 36);
const Vector VEC_DUCK_HULL_MIN(-16, -16, -18);
const Vector VEC_DUCK_HULL_MAX(16, 16, 18);

const Vector& hull_max = ducking ? VEC_DUCK_HULL_MAX : VEC_HULL_MAX;
const Vector& hull_min = ducking ? VEC_DUCK_HULL_MIN : VEC_HULL_MIN;

Expand Down
2 changes: 0 additions & 2 deletions BunnymodXT/modules/HwDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6751,8 +6751,6 @@ void HwDLL::InsertCommands()
if (ducktap && postype == HLStrafe::PositionType::GROUND && (autojump == false || (autojump == true && CVars::bxt_tas_ducktap_priority.GetBool()))) {
if (!currentKeys.Duck.IsDown() && !playerCopy.InDuckAnimation) {
// This should check against the next frame's origin but meh.
const float VEC_HULL_MIN[3] = { -16, -16, -36 };
const float VEC_DUCK_HULL_MIN[3] = { -16, -16, -18 };
float newOrigin[3];
for (std::size_t i = 0; i < 3; ++i)
newOrigin[i] = playerCopy.Origin[i] + (VEC_DUCK_HULL_MIN[i] - VEC_HULL_MIN[i]);
Expand Down
3 changes: 3 additions & 0 deletions BunnymodXT/stdafx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ using std::ptrdiff_t;
#include "HLSDK/dlls/extdll.h"
#include "HLSDK/dlls/cbase.h"
#include "HLSDK/dlls/doors.h"
#include "HLSDK/dlls/schedule.h"
#include "HLSDK/dlls/monsters.h"
#include "HLSDK/dlls/util.h"
#include "HLSDK/cl_dll/wrect.h"
#include "HLSDK/cl_dll/hud.h"
#include "HLSDK/public/keydefs.h"
Expand Down
83 changes: 83 additions & 0 deletions HLSDK/dlls/monsters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/***
*
* Copyright (c) 1996-2001, 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.
*
****/
#ifndef MONSTERS_H
#define MONSTERS_H

/*
===== monsters.h ========================================================
Header file for monster-related utility code
*/

// Hit Group standards
#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7


// Monster Spawnflags
#define SF_MONSTER_WAIT_TILL_SEEN 1// spawnflag that makes monsters wait until player can see them before attacking.
#define SF_MONSTER_GAG 2 // no idle noises from this monster
#define SF_MONSTER_HITMONSTERCLIP 4
// 8
#define SF_MONSTER_PRISONER 16 // monster won't attack anyone, no one will attacke him.
// 32
// 64
#define SF_MONSTER_WAIT_FOR_SCRIPT 128 //spawnflag that makes monsters wait to check for attacking until the script is done or they've been attacked
#define SF_MONSTER_PREDISASTER 256 //this is a predisaster scientist or barney. Influences how they speak.
#define SF_MONSTER_FADECORPSE 512 // Fade out corpse after death
#define SF_MONSTER_FALL_TO_GROUND 0x80000000


// trigger conditions for scripted AI
// these MUST match the CHOICES interface in halflife.fgd for the base monster
enum
{
AITRIGGER_NONE = 0,
AITRIGGER_SEEPLAYER_ANGRY_AT_PLAYER,
AITRIGGER_TAKEDAMAGE,
AITRIGGER_HALFHEALTH,
AITRIGGER_DEATH,
AITRIGGER_SQUADMEMBERDIE,
AITRIGGER_SQUADLEADERDIE,
AITRIGGER_HEARWORLD,
AITRIGGER_HEARPLAYER,
AITRIGGER_HEARCOMBAT,
AITRIGGER_SEEPLAYER_UNCONDITIONAL,
AITRIGGER_SEEPLAYER_NOT_IN_COMBAT,
};
/*
0 : "No Trigger"
1 : "See Player, Mad at Player"
2 : "Take Damage"
3 : "50% Health Remaining"
4 : "Death"
5 : "Squad Member Dead"
6 : "Squad Leader Dead"
7 : "Hear World"
8 : "Hear Player"
9 : "Hear Combat"
10: "See Player Unconditional"
11: "See Player, Not In Combat"
*/

#endif //MONSTERS_H
193 changes: 193 additions & 0 deletions HLSDK/dlls/schedule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
/***
*
* Copyright (c) 1996-2001, 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.
*
****/
//=========================================================
// Scheduling
//=========================================================

#ifndef SCHEDULE_H
#define SCHEDULE_H

//=========================================================
// These are the schedule types
//=========================================================
typedef enum
{
SCHED_NONE = 0,
SCHED_IDLE_STAND,
SCHED_IDLE_WALK,
SCHED_WAKE_ANGRY,
SCHED_WAKE_CALLED,
SCHED_ALERT_FACE,
SCHED_ALERT_SMALL_FLINCH,
SCHED_ALERT_BIG_FLINCH,
SCHED_ALERT_STAND,
SCHED_INVESTIGATE_SOUND,
SCHED_COMBAT_FACE,
SCHED_COMBAT_STAND,
SCHED_CHASE_ENEMY,
SCHED_CHASE_ENEMY_FAILED,
SCHED_VICTORY_DANCE,
SCHED_TARGET_FACE,
SCHED_TARGET_CHASE,
SCHED_SMALL_FLINCH,
SCHED_TAKE_COVER_FROM_ENEMY,
SCHED_TAKE_COVER_FROM_BEST_SOUND,
SCHED_TAKE_COVER_FROM_ORIGIN,
SCHED_COWER, // usually a last resort!
SCHED_MELEE_ATTACK1,
SCHED_MELEE_ATTACK2,
SCHED_RANGE_ATTACK1,
SCHED_RANGE_ATTACK2,
SCHED_SPECIAL_ATTACK1,
SCHED_SPECIAL_ATTACK2,
SCHED_STANDOFF,
SCHED_ARM_WEAPON,
SCHED_RELOAD,
SCHED_GUARD,
SCHED_AMBUSH,
SCHED_DIE,
SCHED_WAIT_TRIGGER,
SCHED_FOLLOW,
SCHED_SLEEP,
SCHED_WAKE,
SCHED_BARNACLE_VICTIM_GRAB,
SCHED_BARNACLE_VICTIM_CHOMP,
SCHED_AISCRIPT,
SCHED_FAIL,

LAST_COMMON_SCHEDULE // Leave this at the bottom
} SCHEDULE_TYPE;

//=========================================================
// These are the shared tasks
//=========================================================
typedef enum
{
TASK_INVALID = 0,
TASK_WAIT,
TASK_WAIT_FACE_ENEMY,
TASK_WAIT_PVS,
TASK_SUGGEST_STATE,
TASK_WALK_TO_TARGET,
TASK_RUN_TO_TARGET,
TASK_MOVE_TO_TARGET_RANGE,
TASK_GET_PATH_TO_ENEMY,
TASK_GET_PATH_TO_ENEMY_LKP,
TASK_GET_PATH_TO_ENEMY_CORPSE,
TASK_GET_PATH_TO_LEADER,
TASK_GET_PATH_TO_SPOT,
TASK_GET_PATH_TO_TARGET,
TASK_GET_PATH_TO_HINTNODE,
TASK_GET_PATH_TO_LASTPOSITION,
TASK_GET_PATH_TO_BESTSOUND,
TASK_GET_PATH_TO_BESTSCENT,
TASK_RUN_PATH,
TASK_WALK_PATH,
TASK_STRAFE_PATH,
TASK_CLEAR_MOVE_WAIT,
TASK_STORE_LASTPOSITION,
TASK_CLEAR_LASTPOSITION,
TASK_PLAY_ACTIVE_IDLE,
TASK_FIND_HINTNODE,
TASK_CLEAR_HINTNODE,
TASK_SMALL_FLINCH,
TASK_FACE_IDEAL,
TASK_FACE_ROUTE,
TASK_FACE_ENEMY,
TASK_FACE_HINTNODE,
TASK_FACE_TARGET,
TASK_FACE_LASTPOSITION,
TASK_RANGE_ATTACK1,
TASK_RANGE_ATTACK2,
TASK_MELEE_ATTACK1,
TASK_MELEE_ATTACK2,
TASK_RELOAD,
TASK_RANGE_ATTACK1_NOTURN,
TASK_RANGE_ATTACK2_NOTURN,
TASK_MELEE_ATTACK1_NOTURN,
TASK_MELEE_ATTACK2_NOTURN,
TASK_RELOAD_NOTURN,
TASK_SPECIAL_ATTACK1,
TASK_SPECIAL_ATTACK2,
TASK_CROUCH,
TASK_STAND,
TASK_GUARD,
TASK_STEP_LEFT,
TASK_STEP_RIGHT,
TASK_STEP_FORWARD,
TASK_STEP_BACK,
TASK_DODGE_LEFT,
TASK_DODGE_RIGHT,
TASK_SOUND_ANGRY,
TASK_SOUND_DEATH,
TASK_SET_ACTIVITY,
TASK_SET_SCHEDULE,
TASK_SET_FAIL_SCHEDULE,
TASK_CLEAR_FAIL_SCHEDULE,
TASK_PLAY_SEQUENCE,
TASK_PLAY_SEQUENCE_FACE_ENEMY,
TASK_PLAY_SEQUENCE_FACE_TARGET,
TASK_SOUND_IDLE,
TASK_SOUND_WAKE,
TASK_SOUND_PAIN,
TASK_SOUND_DIE,
TASK_FIND_COVER_FROM_BEST_SOUND,// tries lateral cover first, then node cover
TASK_FIND_COVER_FROM_ENEMY,// tries lateral cover first, then node cover
TASK_FIND_LATERAL_COVER_FROM_ENEMY,
TASK_FIND_NODE_COVER_FROM_ENEMY,
TASK_FIND_NEAR_NODE_COVER_FROM_ENEMY,// data for this one is the MAXIMUM acceptable distance to the cover.
TASK_FIND_FAR_NODE_COVER_FROM_ENEMY,// data for this one is there MINIMUM aceptable distance to the cover.
TASK_FIND_COVER_FROM_ORIGIN,
TASK_EAT,
TASK_DIE,
TASK_WAIT_FOR_SCRIPT,
TASK_PLAY_SCRIPT,
TASK_ENABLE_SCRIPT,
TASK_PLANT_ON_SCRIPT,
TASK_FACE_SCRIPT,
TASK_WAIT_RANDOM,
TASK_WAIT_INDEFINITE,
TASK_STOP_MOVING,
TASK_TURN_LEFT,
TASK_TURN_RIGHT,
TASK_REMEMBER,
TASK_FORGET,
TASK_WAIT_FOR_MOVEMENT, // wait until MovementIsComplete()
LAST_COMMON_TASK, // LEAVE THIS AT THE BOTTOM!! (sjb)
} SHARED_TASKS;

// an array of tasks is a task list
// an array of schedules is a schedule list
struct Task_t
{

int iTask;
float flData;
};

struct Schedule_t
{

Task_t *pTasklist;
int cTasks;
int iInterruptMask;// a bit mask of conditions that can interrupt this schedule

// a more specific mask that indicates which TYPES of sounds will interrupt the schedule in the
// event that the schedule is broken by COND_HEAR_SOUND
int iSoundMask;
const char *pName;
};

#endif // SCHEDULE_H
45 changes: 45 additions & 0 deletions HLSDK/dlls/util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/***
*
* Copyright (c) 1996-2001, 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.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/

#ifndef UTIL_DLLS_H
#define UTIL_DLLS_H

const Vector VEC_HULL_MIN(-16, -16, -36);
const Vector VEC_HULL_MAX(16, 16, 36);
const Vector VEC_VIEW(0, 0, 28);

const Vector VEC_DUCK_HULL_MIN(-16, -16, -18);
const Vector VEC_DUCK_HULL_MAX(16, 16, 18);
const Vector VEC_DUCK_VIEW(0, 0, 12);

const Vector VEC_HUMAN_HULL_MIN(-16, -16, 0);
const Vector VEC_HUMAN_HULL_MAX(16, 16, 72);
const Vector VEC_HUMAN_HULL_DUCK(16, 16, 36);

// triggers
#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger
#define SF_TRIGGER_NOCLIENTS 2 // players not allowed to fire this trigger
#define SF_TRIGGER_PUSHABLES 4 // only pushables can fire this trigger

// func breakable
#define SF_BREAK_TRIGGER_ONLY 1 // may only be broken by trigger
#define SF_BREAK_TOUCH 2 // can be 'crashed through' by running player (plate glass)
#define SF_BREAK_PRESSURE 4 // can be broken by a player standing on it
#define SF_BREAK_CROWBAR 256 // instant break if hit with crowbar

// func_pushable (it's also func_breakable, so don't collide with those flags)
#define SF_PUSH_BREAKABLE 128

#endif

0 comments on commit c1db76c

Please sign in to comment.