1
0
Fork 0
forked from fte/fteqw

skel_set_bone_world implementation.

fix attempt to fix npfte issues.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3938 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-12-24 04:05:28 +00:00
parent 6bb579f24b
commit de29dce680
7 changed files with 47 additions and 40 deletions

View file

@ -4168,6 +4168,7 @@ static struct {
{"touchtriggers", PF_touchtriggers, 279},//void() touchtriggers = #279;
{"skel_ragupdate", PF_skel_ragedit, 281},// (FTE_QC_RAGDOLL)
{"skel_mmap", PF_skel_mmap, 282},// (FTE_QC_RAGDOLL)
{"skel_set_bone_world", PF_skel_set_bone_world, 283},
//300
{"clearscene", PF_R_ClearScene, 300}, // #300 void() clearscene (EXT_CSQC)
{"addentities", PF_R_AddEntityMask, 301}, // #301 void(float mask) addentities (EXT_CSQC)

View file

@ -788,9 +788,9 @@ void QCBUILTIN PF_skel_set_bone_world (progfuncs_t *prinst, struct globalvars_s
if (*prinst->callargc == 4)
{
vec3_t d[3], a;
a[0] = G_VECTOR(OFS_PARM2)[0] * -1; /*mod_alias bug*/
a[1] = G_VECTOR(OFS_PARM2)[1];
a[2] = G_VECTOR(OFS_PARM2)[2];
a[0] = G_VECTOR(OFS_PARM3)[0] * -1; /*mod_alias bug*/
a[1] = G_VECTOR(OFS_PARM3)[1];
a[2] = G_VECTOR(OFS_PARM3)[2];
AngleVectors(a, d[0], d[1], d[2]);
bonemat_fromqcvectors(childworld, d[0], d[1], d[2], G_VECTOR(OFS_PARM2));
}
@ -823,19 +823,21 @@ void QCBUILTIN PF_skel_set_bone_world (progfuncs_t *prinst, struct globalvars_s
float parentent[12];
framestate_t fstate;
w->Get_FrameState(w, ent, &fstate);
if (!Mod_GetTag(skelobj->model, boneidx+1, &fstate, parentabs))
if (skelobj->type == SKOT_ABSOLUTE || !Mod_GetTag(skelobj->model, Mod_GetBoneParent(skelobj->model, boneidx+1), &fstate, parentabs))
{
bonemat_fromidentity(parentabs);
bonemat_fromentity(w, ent, parentw);
}
else
{
bonemat_fromentity(w, ent, parentent);
Matrix3x4_Multiply(parentent, parentabs, parentw);
Matrix3x4_Invert_Simple(parentw, parentinv);
Matrix3x4_Multiply(parentabs, parentent, parentw);
}
Matrix3x4_Invert(parentw, parentinv);
}
/*calc the result*/
bone = skelobj->bonematrix+12*boneidx;
Matrix3x4_Multiply(parentinv, childworld, bone);
Matrix3x4_Multiply(childworld, parentinv, bone);
}
//void(float skel, float bonenum, vector org) skel_set_bone (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)

View file

@ -4383,3 +4383,22 @@ char *version_string(void)
return s;
}
//C90
void COM_TimeOfDay(date_t *date)
{
struct tm *newtime;
time_t long_time;
time(&long_time);
newtime = localtime(&long_time);
date->day = newtime->tm_mday;
date->mon = newtime->tm_mon;
date->year = newtime->tm_year + 1900;
date->hour = newtime->tm_hour;
date->min = newtime->tm_min;
date->sec = newtime->tm_sec;
strftime( date->str, 128,
"%a %b %d, %H:%M:%S %Y", newtime);
}

View file

@ -480,3 +480,16 @@ typedef struct pc_token_s
} pc_token_t;
#define fileHandle_t int
#define fsMode_t int
typedef struct
{
int sec;
int min;
int hour;
int day;
int mon;
int year;
char str[128];
} date_t;
void COM_TimeOfDay(date_t *date);

View file

@ -2871,7 +2871,7 @@ void QCBUILTIN PF_calltimeofday (progfuncs_t *prinst, struct globalvars_s *pr_gl
f = PR_FindFunction(prinst, "timeofday", PR_ANY);
if (f)
{
SV_TimeOfDay(&date);
COM_TimeOfDay(&date);
G_FLOAT(OFS_PARM0) = (float)date.sec;
G_FLOAT(OFS_PARM1) = (float)date.min;

View file

@ -1296,18 +1296,6 @@ void SV_CalcPHS (void);
void SV_GetConsoleCommands (void);
void SV_CheckTimer(void);
typedef struct
{
int sec;
int min;
int hour;
int day;
int mon;
int year;
char str[128];
} date_t;
void SV_TimeOfDay(date_t *date);
void SV_LogPlayer(client_t *cl, char *msg);
void AddLinksToPmove ( edict_t *player, areanode_t *node );

View file

@ -645,23 +645,7 @@ void DemoWriteQTVTimePad(int msecs) //broadcast to all proxies
}
void SV_TimeOfDay(date_t *date)
{
struct tm *newtime;
time_t long_time;
time( &long_time );
newtime = localtime( &long_time );
date->day = newtime->tm_mday;
date->mon = newtime->tm_mon;
date->year = newtime->tm_year + 1900;
date->hour = newtime->tm_hour;
date->min = newtime->tm_min;
date->sec = newtime->tm_sec;
strftime( date->str, 128,
"%a %b %d, %H:%M:%S %Y", newtime);
}
// returns the file size
// return -1 if file is not present
@ -1431,7 +1415,7 @@ mvddest_t *SV_InitRecordFile (char *name)
char buf[2000];
date_t date;
SV_TimeOfDay(&date);
COM_TimeOfDay(&date);
snprintf(buf, sizeof(buf), "date %s\nmap %s\nteamplay %d\ndeathmatch %d\ntimelimit %d\n%s",date.str, sv.name, (int)teamplay.value, (int)deathmatch.value, (int)timelimit.value, SV_PrintTeams());
VFS_WRITE(f, buf, strlen(buf));