From 4effa1c3eacfd05622448a395e353c9f792f477a Mon Sep 17 00:00:00 2001 From: Wanne Date: Mon, 21 May 2007 18:09:15 +0000 Subject: [PATCH] - new: Merged source code of item throwing animation in crouched stance, AI was not changed (look for comments marked ) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@890 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Animation Control.cpp | 27 ++++++++++++++++++++++++++- Tactical/Animation Control.h | 4 ++++ Tactical/Animation Data.cpp | 6 ++++++ Tactical/Animation Data.h | 6 ++++++ Tactical/Handle Items.cpp | 29 +++++++++++++++++++++++++---- Tactical/Handle UI.cpp | 3 +++ Tactical/Soldier Control.cpp | 3 +++ 7 files changed, 73 insertions(+), 5 deletions(-) diff --git a/Tactical/Animation Control.cpp b/Tactical/Animation Control.cpp index 806a53b79..7f1bffcbc 100644 --- a/Tactical/Animation Control.cpp +++ b/Tactical/Animation Control.cpp @@ -32,6 +32,11 @@ typedef struct } ANIMSUBTYPE; + +// crouch throwing +static UINT16 CrouchedThrowAnimationScript[MAX_FRAMES_PER_ANIM] = { 1,2,3,4,5,6,7,8,9,460,10,11,12,13,14,442,603,999,0,0,0,0 }; +// + ANI_SPEED_DEF gubAnimCrawlSpeeds[ TOTALBODYTYPES ]; //Block for anim file UINT16 gusAnimInst[ MAX_ANIMATIONS ][ MAX_FRAMES_PER_ANIM ]; @@ -915,6 +920,10 @@ ANIMCONTROLTYPE gAnimControl[ NUMANIMATIONSTATES ] = //CROUCH PICK LOCK "CROUCH PICK LOCK" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_LOWER_WEAPON | ANIM_LIGHT_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + + // crouch throwing + "THROW ITEM CROUCHED", 0, 80, (FLOAT)0, ANIM_STATIONARY | ANIM_NOMOVE_MARKER | ANIM_NONINTERRUPT | ANIM_MIN_EFFORT, ANIM_CROUCH, ANIM_CROUCH, -1, + // crouch throwing + gubAnimSurfaceIndex[ REGMALE ][ THROW_ITEM_CROUCHED ] = RGMCRTHROW; + // gubAnimSurfaceMidWaterSubIndex[ REGMALE ][ STANDING][0] = RGMWATER_R_STD; gubAnimSurfaceMidWaterSubIndex[ REGMALE ][ WALKING ][0] = RGMWATER_R_WALK; @@ -1649,6 +1661,9 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ BIGMALE ][ REFUEL_VEHICLE ] = BGMMEDIC; gubAnimSurfaceIndex[ BIGMALE ][ LOCKPICK_CROUCHED ] = BGMMEDIC; + // crouch throwing + gubAnimSurfaceIndex[ BIGMALE ][ THROW_ITEM_CROUCHED ] = BGMCRTHROW; + // gubAnimSurfaceItemSubIndex[ BIGMALE ][ STANDING ] = BGMPISTOLBREATH; gubAnimSurfaceItemSubIndex[ BIGMALE ][ WALKING ] = BGMNOTHING_WALK; @@ -2014,6 +2029,9 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ STOCKYMALE ][ REFUEL_VEHICLE ] = RGMMEDIC; gubAnimSurfaceIndex[ STOCKYMALE ][ LOCKPICK_CROUCHED ] = RGMMEDIC; + // crouch throwing + gubAnimSurfaceIndex[ STOCKYMALE ][ THROW_ITEM_CROUCHED ] = RGMCRTHROW; + // gubAnimSurfaceItemSubIndex[ STOCKYMALE ][ STANDING ] = RGMPISTOLBREATH; gubAnimSurfaceItemSubIndex[ STOCKYMALE ][ WALKING ] = RGMNOTHING_WALK; @@ -2366,6 +2384,9 @@ void InitAnimationSurfacesPerBodytype( ) gubAnimSurfaceIndex[ REGFEMALE ][ REFUEL_VEHICLE ] = RGFMEDIC; gubAnimSurfaceIndex[ REGFEMALE ][ LOCKPICK_CROUCHED ] = RGFMEDIC; + // crouch throwing + gubAnimSurfaceIndex[ REGFEMALE ][ THROW_ITEM_CROUCHED ] = RGFCRTHROW; + // gubAnimSurfaceItemSubIndex[ REGFEMALE ][ STANDING ] = RGFPISTOLBREATH; gubAnimSurfaceItemSubIndex[ REGFEMALE ][ WALKING ] = RGFNOTHING_WALK; @@ -3026,6 +3047,10 @@ BOOLEAN LoadAnimationStateInstructions( ) FileClose( hFile ); + // crouch throwing + memcpy(gusAnimInst[ THROW_ITEM_CROUCHED ],CrouchedThrowAnimationScript,sizeof(CrouchedThrowAnimationScript)); + // crouch throwing + return( TRUE ); } diff --git a/Tactical/Animation Control.h b/Tactical/Animation Control.h index 4a1a46d76..ba888a9d3 100644 --- a/Tactical/Animation Control.h +++ b/Tactical/Animation Control.h @@ -529,6 +529,10 @@ enum AnimationStates CRIPPLE_END_OPEN_LOCKED_DOOR, LOCKPICK_CROUCHED, + // crouch throwing + THROW_ITEM_CROUCHED, + // + NUMANIMATIONSTATES }; diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index d08dde3a6..67786424c 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -466,6 +466,12 @@ AnimationSurfaceType gAnimSurfaceDatabase[ NUMANIMATIONSURFACETYPES ] = JEEP_DIE, "ANIMS\\VEHICLES\\HM_WREK.STI", NO_STRUCT, 0, 2, TO_INIT, NULL, NULL, 0, -1, BODYEXPLODE, "ANIMS\\S_MERC\\BOD_BLOW.STI", NO_STRUCT, 0, 1, TO_INIT, NULL, NULL, 0, -1, + + // crouch throwing + RGMCRTHROW, "ANIMS\\S_MERC\\S_CR_THR.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + BGMCRTHROW, "ANIMS\\M_MERC\\M_CR_THR.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + RGFCRTHROW, "ANIMS\\F_MERC\\F_CR_THR.STI", C_STRUCT, 0, 8, TO_INIT, NULL, NULL, 0, -1, + // }; diff --git a/Tactical/Animation Data.h b/Tactical/Animation Data.h index 4e2a9bcea..e9f031e68 100644 --- a/Tactical/Animation Data.h +++ b/Tactical/Animation Data.h @@ -502,6 +502,12 @@ typedef enum BODYEXPLODE, + // crouch throwing + RGMCRTHROW, + BGMCRTHROW, + RGFCRTHROW, +// + NUMANIMATIONSURFACETYPES } AnimationSurfaceTypes; diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 7a45a9a38..f0e694efb 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -1500,9 +1500,24 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo ) } break; - case ANIM_CROUCH: + // crouch throwing case ANIM_PRONE: + if ( sGridNo == pSoldier->sGridNo ) + { + // OK, JUST DROP ITEM! + if ( pSoldier->pTempObject != NULL ) + { + AddItemToPool( sGridNo, pSoldier->pTempObject, 1, pSoldier->bLevel, 0, -1 ); + NotifySoldiersToLookforItems( ); + MemFree( pSoldier->pTempObject ); + pSoldier->pTempObject = NULL; + } + break; + } + ChangeSoldierStance( pSoldier, ANIM_CROUCH ); + + case ANIM_CROUCH: // CHECK IF WE ARE NOT ON THE SAME GRIDNO if ( sGridNo == pSoldier->sGridNo ) { @@ -1518,12 +1533,18 @@ void HandleSoldierThrowItem( SOLDIERTYPE *pSoldier, INT16 sGridNo ) } else { - // OK, go from prone/crouch to stand first! + // CHANGE DIRECTION AT LEAST ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); - EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); - ChangeSoldierState( pSoldier, THROW_ITEM, 0 , FALSE ); + SoldierGotoStationaryStance( pSoldier ); + + EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection ); + pSoldier->fTurningUntilDone = TRUE; + + pSoldier->usPendingAnimation = THROW_ITEM_CROUCHED; } + break; +// } } diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 5254dc0d8..c17062b5b 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -6109,6 +6109,9 @@ BOOLEAN SelectedGuyInBusyAnimation( ) if ( pSoldier->usAnimState == LOB_ITEM || pSoldier->usAnimState == THROW_ITEM || + // crouch throwing + pSoldier->usAnimState == THROW_ITEM_CROUCHED || + // crouch throwing pSoldier->usAnimState == PICKUP_ITEM || pSoldier->usAnimState == DROP_ITEM || pSoldier->usAnimState == OPEN_DOOR || diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 1cc9fe6e5..328c83181 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -3437,6 +3437,9 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa case SHOOT_ROCKET: case SHOOT_MORTAR: case THROW_ITEM: + // crouch throwing + case THROW_ITEM_CROUCHED: + // crouch throwing case LOB_ITEM: DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - ATTACK ANIMATION %s ENDED BY HIT ANIMATION, Now %d", gAnimControl[ pSoldier->usAnimState ].zAnimStr, gTacticalStatus.ubAttackBusyCount ) );