Entity attachment trees

This commit is contained in:
Andrei Drexler 2005-09-07 20:27:42 +00:00
parent 39494fb2eb
commit 9b797f5d56
12 changed files with 163 additions and 80 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.57 2005/09/07 20:27:41 makro
// Entity attachment trees
//
// Revision 1.56 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -1707,3 +1710,27 @@ char *Q_strins(char *dest, char *s, int size)
return dest;
}
//Makro - used for saving ints to char buffers
//not doing this as a simple assignment because
//of endianness (darned Mac users)
void SetIntBytes(int i, char *buf, char count)
{
while (count--)
{
*buf++ = i & 255;
i >>= 8;
}
}
int GetIntBytes(char *buf, char count)
{
int rez = 0, shift = 0;
while (count--)
{
rez |= (*buf << shift);
shift += 8;
}
return rez;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.95 2005/09/07 20:27:41 makro
// Entity attachment trees
//
// Revision 1.94 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -1506,18 +1509,20 @@ static void PM_Footsteps(void)
return;
}
// if not trying to move
if (!pm->cmd.forwardmove && !pm->cmd.rightmove) {
if (pm->xyspeed < 5) {
pm->ps->bobCycle = 0; // start at beginning of cycle again
if (pm->ps->pm_flags & PMF_DUCKED) {
PM_ContinueLegsAnim(LEGS_IDLECR);
} else {
PM_ContinueLegsAnim(LEGS_IDLE);
}
//Makro - changed condition a bit
//if (!pm->cmd.forwardmove && !pm->cmd.rightmove) {
// if (pm->xyspeed < 5) {
if ( (!pm->cmd.forwardmove && !pm->cmd.rightmove) || pm->xyspeed < 5) {
pm->ps->bobCycle = 0; // start at beginning of cycle again
if (pm->ps->pm_flags & PMF_DUCKED) {
PM_ContinueLegsAnim(LEGS_IDLECR);
} else {
PM_ContinueLegsAnim(LEGS_IDLE);
}
return;
}
footstep = qfalse;
if (pm->ps->pm_flags & PMF_DUCKED) {
@ -2798,12 +2803,15 @@ static void PM_LadderMove(void)
//Makro - play footstep sound
if (pm->ps->velocity[2]) {
//...only if we don't have slippers!
if (pm->ps->velocity[2] && !(pm->ps->stats[STAT_HOLDABLE_ITEM] && (1 << HI_SLIPPERS)) )
{
old = pm->ps->bobCycle;
//the faster we move, the more frequent the footsteps
pm->ps->bobCycle = (int) (old + 0.45 * fabs(pm->ps->velocity[2]) / 225.0f * pml.msec) & 255;
// if we just crossed a cycle boundary, play an apropriate footstep event
if (((old + 64) ^ (pm->ps->bobCycle + 64)) & 128) {
if (((old + 64) ^ (pm->ps->bobCycle + 64)) & 128)
{
PM_AddEvent(PM_FootstepForSurface(pml.ladderSurface));
}
} else {

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.111 2005/09/07 20:27:41 makro
// Entity attachment trees
//
// Revision 1.110 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -1570,3 +1573,11 @@ char *skinFromStr(char *s);
char *strchrstr(char *s, char *chars);
char *strins(char *dest, char *s);
char *Q_strins(char *dest, char *s, int size);
//Makro - used for saving ints to char buffers
//not doing this as a simple assignment because
//of endianness (darned Mac users)
void SetIntBytes(int i, char *buf, char count);
int GetIntBytes(char *buf, char count);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.192 2005/09/07 20:27:41 makro
// Entity attachment trees
//
// Revision 1.191 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -992,9 +995,27 @@ void Cmd_Kill_f(gentity_t * ent)
if (g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action) {
return;
}
//Makro - lamer protection
//(if you suicide while hit, the attacker still receives his/her/its frag)
if (g_RQ3_giveMeWhatsMine.integer)
{
if (ent->client->lasthurt_mod != 0)
{
gentity_t *attacker = &g_entities[ent->client->lasthurt_client];
if (attacker != NULL)
{
AddScore(attacker, ent->r.currentOrigin, 1);
trap_SendServerCommand(-1, va("%s tried to steal a frag from %s. And failed\n", ent->client->pers.netname,
attacker->client->pers.netname));
}
}
}
ent->flags &= ~FL_GODMODE;
ent->client->ps.stats[STAT_HEALTH] = ent->health = -999;
player_die(ent, ent, ent, 100000, MOD_SUICIDE);
}
/*
@ -2050,6 +2071,8 @@ void Cmd_CallVote_f(gentity_t * ent)
}
if (!Q_stricmp(arg1, "cyclemap")) {
//Makro - adding "timelimit X"
} else if (!Q_stricmp(arg1, "timelimit")) {
} else if (!Q_stricmp(arg1, "map")) {
} else if (!Q_stricmp(arg1, "g_gametype")) {
} else if (!Q_stricmp(arg1, "kick")) {
@ -2060,13 +2083,13 @@ void Cmd_CallVote_f(gentity_t * ent)
} else if (!Q_stricmp(arg1, "clearscores")) {
} else {
trap_SendServerCommand(ent - g_entities, "print \"^1Invalid vote command.\n\"");
trap_SendServerCommand(ent - g_entities,"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, clientkick <clientnum>,clearscores,resetmatch.\n\"");
trap_SendServerCommand(ent - g_entities,"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, clientkick <clientnum>, clearscores, resetmatch and timelimit <minutes>.\n\"");
return;
}
} else {
trap_SendServerCommand(ent - g_entities, "print \"^1Invalid vote command.\n\"");
trap_SendServerCommand(ent - g_entities,
"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, and clientkick <clientnum>.\n\"");
"print \"Valid vote commands are: cyclemap, map <mapname>, g_gametype <n>, kick <player>, clientkick <clientnum> and timelimit <minutes>.\n\"");
return;
}
}
@ -2082,7 +2105,19 @@ void Cmd_CallVote_f(gentity_t * ent)
// special case for g_gametype, check for bad values
if (!Q_stricmp(arg1, "g_gametype")) {
i = atoi(arg2);
//Makro - added short gametype names
if (!Q_stricmp(arg2, "dm")) {
i = GT_FFA;
} else if (!Q_stricmp(arg2, "tp")) {
i = GT_TEAMPLAY;
} else if (!Q_stricmp(arg2, "tdm")) {
i = GT_TEAM;
} else if (!Q_stricmp(arg2, "ctb")) {
i = GT_CTF;
} else {
//if not a preset name, consider it a number
i = atoi(arg2);
}
if (i != GT_FFA && i != GT_TEAMPLAY && i != GT_CTF && i != GT_TEAM) {
trap_SendServerCommand(ent - g_entities, "print \"^1Invalid gametype. Valid gametypes are 0, 3, 4 and 5.\n\"");
return;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.152 2005/09/07 20:27:41 makro
// Entity attachment trees
//
// Revision 1.151 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -1542,6 +1545,8 @@ extern vmCvar_t g_RQ3_radioFloodTime;
extern vmCvar_t g_RQ3_version;
//Makro - max votes per client;
extern vmCvar_t g_RQ3_maxClientVotes;
//Makro - no lame suicides
extern vmCvar_t g_RQ3_giveMeWhatsMine;
void trap_Printf(const char *fmt);
void trap_Error(const char *fmt);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.151 2005/09/07 20:27:42 makro
// Entity attachment trees
//
// Revision 1.150 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -585,6 +588,9 @@ vmCvar_t g_RQ3_cvarfile;
//Makro - for server browsers
vmCvar_t g_RQ3_version;
//Makro - no lame suicides
vmCvar_t g_RQ3_giveMeWhatsMine;
//Makro - max votes per client
vmCvar_t g_RQ3_maxClientVotes;
@ -641,6 +647,9 @@ static cvarTable_t gameCvarTable[] = {
{&g_allowVote, "g_allowVote", "0", CVAR_ARCHIVE | CVAR_SYSTEMINFO | CVAR_SERVERINFO, 0, qfalse},
{&g_listEntity, "g_listEntity", "0", 0, 0, qfalse},
//Makro - no lame suicides
{&g_RQ3_giveMeWhatsMine, "g_RQ3_giveMeWhatsMine", "0", CVAR_ARCHIVE, 0, qfalse},
// NiceAss: Taken out of the missionpack
{&g_enableBreath, "g_enableBreath", "0", CVAR_SERVERINFO, 0, qfalse},
{&g_enableBreath, "g_enableFogLaser", "1", CVAR_SERVERINFO, 0, qfalse},
@ -1151,7 +1160,7 @@ void RQ3_loadmodels(void)
}
}
//Makro - FIXME: add comment
//Makro - FIXME: add comments
void G_InitMoveParents()
{
int i;
@ -1262,16 +1271,25 @@ void G_SetMoveParentOrder()
p = info;
Com_sprintf(p, 4, "%03i", level.num_attachedEnts);
p += 3;
//SetIntBytes((level.num_attachedEnts << 1) | 1, p, 2);
//p += 2;
for (i=0; i<level.num_attachedEnts; i++)
{
Com_sprintf(p, 4, "%03i", g_parentOrder[i]-g_entities);
p += 3;
//SetIntBytes(((g_parentOrder[i] - g_entities) << 1) | 1, p, 2);
//p += 2;
Com_sprintf(p, 4, "%03i", g_parentOrder[i]->moveParent_rank);
p+=3;
//SetIntBytes(((g_parentOrder[i]->moveParent_rank) << 1) | 1, p, 2);
//p += 2;
G_Printf("%i (%i)> %s, rank %i\n", i, g_parentOrder[i]-g_entities,
g_parentOrder[i]->classname, g_parentOrder[i]->moveParent_rank);
}
G_Printf("INFO STRING: %s\n", info);
//trailing zero
*p = 0;
//G_Printf("INFO STRING: %s\n", info);
trap_SetConfigstring(CS_MOVEPARENTS, info);
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.84 2005/09/07 20:27:42 makro
// Entity attachment trees
//
// Revision 1.83 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -531,7 +534,6 @@ void SP_misc_lens_flare(gentity_t *ent)
G_SpawnInt("sunsize", "0", &ent->mass);
G_SpawnFloat("sunalpha", "0.5", &ent->speed);
//this is so we can use the same values from
if (!ent->target) {
if (!G_SpawnVector("direction", "0 0 1", ent->s.origin2)) {
AngleVectors(ent->s.angles, ent->s.origin2, NULL, NULL);
@ -795,10 +797,16 @@ void Think_SetupSkyPortal(gentity_t *ent)
//G_Printf("^1 SKY PORTAL !!!\n");
if (skyportal) {
//location
Info_SetValueForKey(info, "x", va("%f", skyportal->s.origin[0]));
Info_SetValueForKey(info, "y", va("%f", skyportal->s.origin[1]));
Info_SetValueForKey(info, "z", va("%f", skyportal->s.origin[2]));
//entity number
Info_SetValueForKey(info, "n", va("%i", skyportal->s.number));
//movement
Info_SetValueForKey(info, "mx", va("%f", skyportal->movedir[0]));
Info_SetValueForKey(info, "my", va("%f", skyportal->movedir[1]));
Info_SetValueForKey(info, "mz", va("%f", skyportal->movedir[2]));
//G_Printf("Sky portal origin: %s\n", vtos(skyportal->s.origin));
trap_SetConfigstring(CS_SKYPORTAL, info);
VectorCopy(skyportal->s.origin, ent->s.origin2);
@ -825,6 +833,7 @@ void SP_misc_sky_portal(gentity_t * ent)
ent->r.svFlags |= SVF_PORTAL;
VectorClear(ent->r.mins);
VectorClear(ent->r.maxs);
ent->think = Think_SetupSkyPortal;
ent->nextthink = level.time + FRAMETIME;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.52 2005/09/07 20:27:42 makro
// Entity attachment trees
//
// Revision 1.51 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -248,6 +251,8 @@ field_t fields[] = {
{"light", 0, F_IGNORE},
{"dmg", FOFS(damage), F_INT},
{"angles", FOFS(s.angles), F_VECTOR},
//Makro - only used by the sky portal code
{"portalspeed", FOFS(movedir), F_VECTOR},
{"angle", FOFS(s.angles), F_ANGLEHACK},
{"targetShaderName", FOFS(targetShaderName), F_LSTRING},
{"targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING},

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.154 2005/09/07 20:27:42 makro
// Entity attachment trees
//
// Revision 1.153 2003/09/08 19:19:20 makro
// New code for respawning entities in TP
//
@ -2288,7 +2291,17 @@ void RQ3_Cmd_Use_f(gentity_t * ent)
} else if (Q_stricmp(cmd, "throwing combat knife") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE)) == (1 << WP_KNIFE)) {
weapon = WP_KNIFE;
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_KNIFEMODE;
//Makro - if we already have the knife, but it's in the wrong mode, we don't just set the mode
//instead, we call Cmd_Weapon so that the right animation gets played
if (ent->client->ps.weapon == WP_KNIFE)
{
if ( (ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE) == RQ3_KNIFEMODE )
{
Cmd_Weapon(ent);
}
} else {
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_KNIFEMODE;
}
} else {
trap_SendServerCommand(ent - g_entities, va("print \"Out of item: %s\n\"", RQ3_KNIFE_NAME));
return;
@ -2296,7 +2309,17 @@ void RQ3_Cmd_Use_f(gentity_t * ent)
} else if (Q_stricmp(cmd, "slashing combat knife") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE)) == (1 << WP_KNIFE)) {
weapon = WP_KNIFE;
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_KNIFEMODE;
//Makro - if we already have the knife, but it's in the wrong mode, we don't just set the mode
//instead, we call Cmd_Weapon so that the right animation gets played
if (ent->client->ps.weapon == WP_KNIFE)
{
if ( (ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_KNIFEMODE) == 0 )
{
Cmd_Weapon(ent);
}
} else {
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_KNIFEMODE;
}
} else {
trap_SendServerCommand(ent - g_entities, va("print \"Out of item: %s\n\"", RQ3_KNIFE_NAME));
return;

View file

@ -6,61 +6,6 @@
--------------------Configuration: game - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP375B.tmp" with contents
[
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "BUILDING_REF_GL" /D "DEBUG" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
"D:\Work\rq3source\reaction\game\g_cmds.c"
]
Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP375B.tmp"
Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP375C.tmp" with contents
[
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:yes /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /debug /machine:I386 /def:".\game.def" /out:"D:\Work\rq3source\reaction\Release\qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
c:\reactionoutput\ai_chat.obj
c:\reactionoutput\ai_cmd.obj
c:\reactionoutput\ai_dmnet.obj
c:\reactionoutput\ai_dmq3.obj
c:\reactionoutput\ai_main.obj
c:\reactionoutput\ai_team.obj
c:\reactionoutput\ai_vcmd.obj
c:\reactionoutput\bg_misc.obj
c:\reactionoutput\bg_pmove.obj
c:\reactionoutput\bg_slidemove.obj
c:\reactionoutput\g_active.obj
c:\reactionoutput\g_arenas.obj
c:\reactionoutput\g_bot.obj
c:\reactionoutput\g_client.obj
c:\reactionoutput\g_cmds.obj
c:\reactionoutput\g_combat.obj
c:\reactionoutput\g_fileio.obj
c:\reactionoutput\g_items.obj
c:\reactionoutput\g_main.obj
c:\reactionoutput\g_matchmode.obj
c:\reactionoutput\g_mem.obj
c:\reactionoutput\g_misc.obj
c:\reactionoutput\g_missile.obj
c:\reactionoutput\g_mover.obj
c:\reactionoutput\g_session.obj
c:\reactionoutput\g_spawn.obj
c:\reactionoutput\g_svcmds.obj
c:\reactionoutput\g_syscalls.obj
c:\reactionoutput\g_target.obj
c:\reactionoutput\g_team.obj
c:\reactionoutput\g_teamplay.obj
c:\reactionoutput\g_trigger.obj
c:\reactionoutput\g_unlagged.obj
c:\reactionoutput\g_utils.obj
c:\reactionoutput\g_weapon.obj
c:\reactionoutput\q_math.obj
c:\reactionoutput\q_shared.obj
c:\reactionoutput\rxn_game.obj
c:\reactionoutput\zcam.obj
c:\reactionoutput\zcam_target.obj
]
Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP375C.tmp"
<h3>Output Window</h3>
Compiling...
g_cmds.c
Linking...

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.11 2005/09/07 20:27:42 makro
// Entity attachment trees
//
// Revision 1.10 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
@ -1881,10 +1884,4 @@ void ToAxisAngles(vec3_t in, vec3_t out)
VectorMA(result, in[ROLL], forward, result);
VectorCopy(result, out);
}
void ToQuakeAngles(vec3_t in, vec3_t out)
{
vec3_t result;
}
}

Binary file not shown.