[iortcw] 66/497: MP: Fix control point flag model animations in CGame QVM
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:22 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit fd642480025b9c6258619e66c4df51f90116ed23
Author: ZTurtleMan at gmail.com <ZTurtleMan at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Fri Mar 14 23:12:22 2014 +0000
MP: Fix control point flag model animations in CGame QVM
QVM cannot initialize struct with mixed char/int data correctly.
---
MP/code/cgame/cg_ents.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++---
MP/code/cgame/cg_main.c | 3 +++
2 files changed, 56 insertions(+), 3 deletions(-)
diff --git a/MP/code/cgame/cg_ents.c b/MP/code/cgame/cg_ents.c
index abf98a9..41df60d 100644
--- a/MP/code/cgame/cg_ents.c
+++ b/MP/code/cgame/cg_ents.c
@@ -1122,8 +1122,39 @@ static void CG_Bat( centity_t *cent ) {
CG_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.batsFlyingLoopSound, 5 );
}
+static animation_t grabberAnims[6];
+static animation_t footlockerAnims[3];
+static animation_t multi_flagpoleAnims[9];
+
+typedef struct {
+ char *name; // for QVM this cannot be char name[MAX_QPATH];
+ int firstFrame;
+ int numFrames;
+ int loopFrames; // 0 to numFrames
+ int frameLerp; // msec between frames
+ int initialLerp; // msec to get to first frame
+ int moveSpeed;
+ int animBlend; // take this long to blend to next anim
+ //
+ // derived
+ //
+ int duration;
+ int nameHash;
+ int flags;
+ int movetype;
+} animationInline_t;
+
+static void CG_InlineAnimToFullAnim( const animationInline_t *inl, animation_t *anim ) {
+ Com_Memset( anim, 0, sizeof ( animation_t ) );
+ anim->firstFrame = inl->firstFrame;
+ anim->numFrames = inl->numFrames;
+ anim->loopFrames = inl->loopFrames;
+ anim->frameLerp = inl->frameLerp;
+ anim->initialLerp = inl->initialLerp;
+}
+
//----(SA) animation_t struct changed, so changes are to keep this working
-static animation_t grabberAnims[] = {
+static animationInline_t grabberAnimsInline[6] = {
{"", 0, 6, 6, 1000 / 5, 1000 / 5 }, // (main idle)
{"", 5, 21, 21, 1000 / 7, 1000 / 7 }, // (random idle)
{"", 25, 11, 0, 1000 / 15, 1000 / 15 }, // (attack big swipe)
@@ -1133,7 +1164,7 @@ static animation_t grabberAnims[] = {
};
//----(SA) added
-static animation_t footlockerAnims[] = {
+static animationInline_t footlockerAnimsInline[3] = {
{"", 0, 1, 1, 1000 / 5, 1000 / 5 }, // (main idle)
{"", 0, 5, 5, 1000 / 5, 1000 / 5 }, // (lock rattle)
{"", 5, 6, 0, 1000 / 5, 1000 / 5 } // (break open)
@@ -1143,7 +1174,7 @@ static animation_t footlockerAnims[] = {
// DHM - Nerve :: capture and hold flag
-static animation_t multi_flagpoleAnims[] = {
+static animationInline_t multi_flagpoleAnimsInline[] = {
{"", 0, 1, 0, 1000 / 15, 1000 / 15 }, // (no flags, idle)
{"", 0, 15, 0, 1000 / 15, 1000 / 15 }, // (axis flag rising)
{"", 490, 15, 0, 1000 / 15, 1000 / 15 }, // (american flag rising)
@@ -1157,6 +1188,25 @@ static animation_t multi_flagpoleAnims[] = {
// dhm - end
+/*
+===============
+CG_InitTrapAnimations
+===============
+*/
+void CG_InitTrapAnimations( void ) {
+ int i;
+
+ for ( i = 0; i < ARRAY_LEN(grabberAnims); i++ ) {
+ CG_InlineAnimToFullAnim( &grabberAnimsInline[i], &grabberAnims[i] );
+ }
+ for ( i = 0; i < ARRAY_LEN(footlockerAnims); i++ ) {
+ CG_InlineAnimToFullAnim( &footlockerAnimsInline[i], &footlockerAnims[i] );
+ }
+ for ( i = 0; i < ARRAY_LEN(multi_flagpoleAnims); i++ ) {
+ CG_InlineAnimToFullAnim( &multi_flagpoleAnimsInline[i], &multi_flagpoleAnims[i] );
+ }
+}
+
extern void CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation, float speedScale );
diff --git a/MP/code/cgame/cg_main.c b/MP/code/cgame/cg_main.c
index 90e66f8..6084681 100644
--- a/MP/code/cgame/cg_main.c
+++ b/MP/code/cgame/cg_main.c
@@ -2252,6 +2252,7 @@ extern qboolean initTrails;
void CG_ClearTrails( void );
extern qboolean initparticles;
void CG_ClearParticles( void );
+void CG_InitTrapAnimations( void );
/*
=================
@@ -2357,6 +2358,8 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {
CG_InitMarkPolys();
+ CG_InitTrapAnimations();
+
// remove the last loading update
cg.infoScreenText[0] = 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list