Add r_drawTriggers debugging dvar to draw triggers on the map
This commit is contained in:
parent
06301f5f85
commit
e9f78eedb7
@ -1049,6 +1049,61 @@ namespace Components
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Dvar::OnInit([]
|
||||||
|
{
|
||||||
|
Dvar::Register<bool>("r_drawTriggers", false, Game::DVAR_FLAG_CHEAT, "Draw triggers");
|
||||||
|
});
|
||||||
|
|
||||||
|
Scheduler::OnFrame([]()
|
||||||
|
{
|
||||||
|
if (!Game::CL_IsCgameInitialized() || !Dvar::Var("r_drawTriggers").get<bool>()) return;
|
||||||
|
|
||||||
|
float hurt[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||||
|
float hurtTouch[4] = { 0.75f, 0.0f, 0.0f, 1.0f };
|
||||||
|
float damage[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||||
|
float once[4] = { 0.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
float multiple[4] = { 0.0f, 1.0f, 0.0f, 1.0f };
|
||||||
|
|
||||||
|
auto* entities = Game::g_entities;
|
||||||
|
for(auto i = 0u; i < 0x800; i++)
|
||||||
|
{
|
||||||
|
auto* ent = &entities[i];
|
||||||
|
|
||||||
|
if(ent->r.isInUse)
|
||||||
|
{
|
||||||
|
auto b = ent->r.box;
|
||||||
|
b.midPoint[0] += ent->r.currentOrigin[0];
|
||||||
|
b.midPoint[1] += ent->r.currentOrigin[1];
|
||||||
|
b.midPoint[2] += ent->r.currentOrigin[2];
|
||||||
|
|
||||||
|
switch(ent->handler)
|
||||||
|
{
|
||||||
|
case Game::ENT_HANDLER_TRIGGER_HURT:
|
||||||
|
Game::R_AddDebugBounds(hurt, &b);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Game::ENT_HANDLER_TRIGGER_HURT_TOUCH:
|
||||||
|
Game::R_AddDebugBounds(hurtTouch, &b);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Game::ENT_HANDLER_TRIGGER_DAMAGE:
|
||||||
|
Game::R_AddDebugBounds(damage, &b);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Game::ENT_HANDLER_TRIGGER_MULTIPLE:
|
||||||
|
if(ent->spawnflags & 0x40)
|
||||||
|
Game::R_AddDebugBounds(once, &b);
|
||||||
|
else
|
||||||
|
Game::R_AddDebugBounds(multiple, &b);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Dvars
|
// Dvars
|
||||||
Dvar::Register<bool>("ui_streamFriendly", false, Game::DVAR_FLAG_SAVED, "Stream friendly UI");
|
Dvar::Register<bool>("ui_streamFriendly", false, Game::DVAR_FLAG_SAVED, "Stream friendly UI");
|
||||||
|
@ -411,7 +411,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
Logger::Error(5, "Entity: %i is not a client", gentity);
|
Logger::Error(5, "Entity: %i is not a client", gentity);
|
||||||
}
|
}
|
||||||
return &Game::svs_clients[gentity->number];
|
return &Game::svs_clients[gentity->s.number];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Script::AddFunctions()
|
void Script::AddFunctions()
|
||||||
|
@ -4474,7 +4474,6 @@ namespace Game
|
|||||||
char pad3[724];
|
char pad3[724];
|
||||||
} gclient_t;
|
} gclient_t;
|
||||||
|
|
||||||
|
|
||||||
/* 1571 */
|
/* 1571 */
|
||||||
struct DSkelPartBits
|
struct DSkelPartBits
|
||||||
{
|
{
|
||||||
@ -4510,20 +4509,114 @@ namespace Game
|
|||||||
XModel** models;
|
XModel** models;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct gentity_s
|
|
||||||
|
struct LerpEntityState
|
||||||
|
{
|
||||||
|
char pad[0x70];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct clientLinkInfo_t
|
||||||
|
{
|
||||||
|
__int16 parentId;
|
||||||
|
char tagName;
|
||||||
|
char flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct entityState_s
|
||||||
{
|
{
|
||||||
int number;
|
int number;
|
||||||
unsigned char pad[139]; // 4
|
int eType;
|
||||||
unsigned int brushModelIndex;
|
LerpEntityState lerp;
|
||||||
unsigned char pad3[135];
|
int time2;
|
||||||
int brushModelContents;
|
int otherEntityNum;
|
||||||
unsigned char pad4[26];
|
int attackerEntityNum;
|
||||||
float origin[3]; // 312
|
int groundEntityNum;
|
||||||
float angles[3]; // 324
|
int loopSound;
|
||||||
char pad2[8];
|
int surfType;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
int brushModel;
|
||||||
|
int triggerModel;
|
||||||
|
int item;
|
||||||
|
int xmodel;
|
||||||
|
int primaryLight;
|
||||||
|
} index;
|
||||||
|
|
||||||
|
int clientNum;
|
||||||
|
int iHeadIcon;
|
||||||
|
int iHeadIconTeam;
|
||||||
|
int solid;
|
||||||
|
unsigned int eventParm;
|
||||||
|
int eventSequence;
|
||||||
|
int events[4];
|
||||||
|
unsigned int eventParms[4];
|
||||||
|
unsigned __int16 weapon;
|
||||||
|
int legsAnim;
|
||||||
|
int torsoAnim;
|
||||||
|
int un1;
|
||||||
|
int un2;
|
||||||
|
clientLinkInfo_t clientLinkInfo;
|
||||||
|
unsigned int partBits[6];
|
||||||
|
int clientMask[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EntHandle
|
||||||
|
{
|
||||||
|
unsigned __int16 number;
|
||||||
|
unsigned __int16 infoIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct entityShared_t
|
||||||
|
{
|
||||||
|
char isLinked;
|
||||||
|
char modelType;
|
||||||
|
char svFlags;
|
||||||
|
char isInUse;
|
||||||
|
Bounds box;
|
||||||
|
int contents;
|
||||||
|
Bounds absBox;
|
||||||
|
float currentOrigin[3];
|
||||||
|
float currentAngles[3];
|
||||||
|
EntHandle ownerNum;
|
||||||
|
int eventTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EntHandler
|
||||||
|
{
|
||||||
|
ENT_HANDLER_NULL = 0x0,
|
||||||
|
ENT_HANDLER_TRIGGER_MULTIPLE = 0x1,
|
||||||
|
ENT_HANDLER_TRIGGER_HURT = 0x2,
|
||||||
|
ENT_HANDLER_TRIGGER_HURT_TOUCH = 0x3,
|
||||||
|
ENT_HANDLER_TRIGGER_DAMAGE = 0x4,
|
||||||
|
ENT_HANDLER_SCRIPT_MOVER = 0x5,
|
||||||
|
ENT_HANDLER_SCRIPT_MODEL = 0x6,
|
||||||
|
ENT_HANDLER_GRENADE = 0x7,
|
||||||
|
ENT_HANDLER_TIMED_OBJECT = 0x8,
|
||||||
|
ENT_HANDLER_ROCKET = 0x9,
|
||||||
|
ENT_HANDLER_CLIENT = 0xA,
|
||||||
|
ENT_HANDLER_CLIENT_SPECTATOR = 0xB,
|
||||||
|
ENT_HANDLER_CLIENT_DEAD = 0xC,
|
||||||
|
ENT_HANDLER_PLAYER_CLONE = 0xD,
|
||||||
|
ENT_HANDLER_TURRET_INIT = 0xE,
|
||||||
|
ENT_HANDLER_TURRET = 0xF,
|
||||||
|
ENT_HANDLER_DROPPED_ITEM = 0x10,
|
||||||
|
ENT_HANDLER_ITEM_INIT = 0x11,
|
||||||
|
ENT_HANDLER_ITEM = 0x12,
|
||||||
|
ENT_HANDLER_PRIMARY_LIGHT = 0x13,
|
||||||
|
ENT_HANDLER_PLAYER_BLOCK = 0x14,
|
||||||
|
ENT_HANDLER_VEHICLE = 0x15,
|
||||||
|
|
||||||
|
ENT_HANDLER_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct gentity_s
|
||||||
|
{
|
||||||
|
entityState_s s;
|
||||||
|
entityShared_t r;
|
||||||
gclient_t* client; // 344
|
gclient_t* client; // 344
|
||||||
void /*Turret*/ *turret;
|
void /*Turret*/* turret;
|
||||||
//Vehicle *vehicle;
|
void /*Vehicle*/* vehicle;
|
||||||
int physObjId;
|
int physObjId;
|
||||||
unsigned __int16 model;
|
unsigned __int16 model;
|
||||||
char physicsObject;
|
char physicsObject;
|
||||||
@ -4538,7 +4631,27 @@ namespace Game
|
|||||||
unsigned __int16 script_linkName;
|
unsigned __int16 script_linkName;
|
||||||
unsigned __int16 target;
|
unsigned __int16 target;
|
||||||
unsigned __int16 targetname;
|
unsigned __int16 targetname;
|
||||||
unsigned char pad5[242];
|
unsigned int attachIgnoreCollision;
|
||||||
|
int spawnflags;
|
||||||
|
int flags;
|
||||||
|
int eventTime;
|
||||||
|
int clipmask;
|
||||||
|
int processedFrame;
|
||||||
|
EntHandle parent;
|
||||||
|
int nextthink;
|
||||||
|
int health;
|
||||||
|
int maxHealth;
|
||||||
|
int damage;
|
||||||
|
int count;
|
||||||
|
EntHandle missileTargetEnt;
|
||||||
|
EntHandle remoteControlledOwner;
|
||||||
|
gentity_s* tagChildren;
|
||||||
|
unsigned __int16 attachModelNames[19];
|
||||||
|
unsigned __int16 attachTagNames[19];
|
||||||
|
int useCount;
|
||||||
|
gentity_s* nextFree;
|
||||||
|
int birthTime;
|
||||||
|
char pad[100];
|
||||||
} gentity_t;
|
} gentity_t;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user