char* DebugPrintSabMech(sabmech_t* sabmech, char* output, int bufferSize) { char tempBuffer[64]; if(!sabmech || !output) { return output; } output[0]= '\0'; Com_sprintf(tempBuffer, 64, "BehaveMode: %s", GetStringForID(sabBehaveTable, sabmech->behaveMode)); Q_strcat(output, bufferSize, tempBuffer); if(sabmech->doStun) { Q_strcat(output, bufferSize, ", Stun"); } if(sabmech->doKnockdown) { Q_strcat(output, bufferSize, ", Knockdown"); } if(sabmech->doDisarm) { Q_strcat(output, bufferSize, ", Disarm"); } if(sabmech->doParry) { Q_strcat(output, bufferSize, ", Parry"); } if(sabmech->doSlowBounce) { Q_strcat(output, bufferSize, ", SlowBounce"); } if(sabmech->doHeavySlowBounce) { Q_strcat(output, bufferSize, ", HeavySlowBounce"); } return output; }
/* ================= ConsoleCommand // these are added in cg_main, CG_Init so they tab-complete ================= */ qboolean ConsoleCommand( void ) { char *cmd; cmd = gi.argv(0); if ( Q_stricmp (cmd, "entitylist") == 0 ) { Svcmd_EntityList_f(); return qtrue; } if (Q_stricmp (cmd, "game_memory") == 0) { Svcmd_GameMem_f(); return qtrue; } // if (Q_stricmp (cmd, "addbot") == 0) { // Svcmd_AddBot_f(); // return qtrue; // } if (Q_stricmp (cmd, "nav") == 0) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Svcmd_Nav_f (); return qtrue; } if (Q_stricmp (cmd, "npc") == 0) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Svcmd_NPC_f (); return qtrue; } if (Q_stricmp (cmd, "use") == 0) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Svcmd_Use_f (); return qtrue; } if ( Q_stricmp( cmd, "ICARUS" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Quake3Game()->Svcmd(); return qtrue; } if ( Q_stricmp( cmd, "saberColor" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Svcmd_SaberColor_f(); return qtrue; } if ( Q_stricmp( cmd, "saber" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Svcmd_Saber_f(); return qtrue; } if ( Q_stricmp( cmd, "saberblade" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } Svcmd_SaberBlade_f(); return qtrue; } if ( Q_stricmp( cmd, "setForceJump" ) == 0 ) { Svcmd_ForceJump_f(); return qtrue; } if ( Q_stricmp( cmd, "setSaberThrow" ) == 0 ) { Svcmd_SaberThrow_f(); return qtrue; } if ( Q_stricmp( cmd, "setForceHeal" ) == 0 ) { Svcmd_ForceHeal_f(); return qtrue; } if ( Q_stricmp( cmd, "setForcePush" ) == 0 ) { Svcmd_ForcePush_f(); return qtrue; } if ( Q_stricmp( cmd, "setForcePull" ) == 0 ) { Svcmd_ForcePull_f(); return qtrue; } if ( Q_stricmp( cmd, "setForceSpeed" ) == 0 ) { Svcmd_ForceSpeed_f(); return qtrue; } if ( Q_stricmp( cmd, "setForceGrip" ) == 0 ) { Svcmd_ForceGrip_f(); return qtrue; } if ( Q_stricmp( cmd, "setForceLightning" ) == 0 ) { Svcmd_ForceLightning_f(); return qtrue; } if ( Q_stricmp( cmd, "setMindTrick" ) == 0 ) { Svcmd_MindTrick_f(); return qtrue; } if ( Q_stricmp( cmd, "setSaberDefense" ) == 0 ) { Svcmd_SaberDefense_f(); return qtrue; } if ( Q_stricmp( cmd, "setSaberOffense" ) == 0 ) { Svcmd_SaberOffense_f(); return qtrue; } if ( Q_stricmp( cmd, "setForceRage" ) == 0 ) { Svcmd_ForceSetLevel_f( FP_RAGE ); return qtrue; } if ( Q_stricmp( cmd, "setForceDrain" ) == 0 ) { Svcmd_ForceSetLevel_f( FP_DRAIN ); return qtrue; } if ( Q_stricmp( cmd, "setForceProtect" ) == 0 ) { Svcmd_ForceSetLevel_f( FP_PROTECT ); return qtrue; } if ( Q_stricmp( cmd, "setForceAbsorb" ) == 0 ) { Svcmd_ForceSetLevel_f( FP_ABSORB ); return qtrue; } if ( Q_stricmp( cmd, "setForceSight" ) == 0 ) { Svcmd_ForceSetLevel_f( FP_SEE ); return qtrue; } if ( Q_stricmp( cmd, "setForceAll" ) == 0 ) { Svcmd_ForceJump_f(); Svcmd_SaberThrow_f(); Svcmd_ForceHeal_f(); Svcmd_ForcePush_f(); Svcmd_ForcePull_f(); Svcmd_ForceSpeed_f(); Svcmd_ForceGrip_f(); Svcmd_ForceLightning_f(); Svcmd_MindTrick_f(); Svcmd_SaberDefense_f(); Svcmd_SaberOffense_f(); Svcmd_ForceSetLevel_f( FP_RAGE ); Svcmd_ForceSetLevel_f( FP_DRAIN ); Svcmd_ForceSetLevel_f( FP_PROTECT ); Svcmd_ForceSetLevel_f( FP_ABSORB ); Svcmd_ForceSetLevel_f( FP_SEE ); for ( int i = SS_NONE+1; i < SS_NUM_SABER_STYLES; i++ ) { g_entities[0].client->ps.saberStylesKnown |= (1<<i); } return qtrue; } if ( Q_stricmp( cmd, "saberAttackCycle" ) == 0 ) { Svcmd_SaberAttackCycle_f(); return qtrue; } if ( Q_stricmp( cmd, "runscript" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } char *cmd2 = gi.argv(1); if ( cmd2 && cmd2[0] ) { char *cmd3 = gi.argv(2); if ( cmd3 && cmd3[0] ) { gentity_t *found = NULL; if ( (found = G_Find(NULL, FOFS(targetname), cmd2 ) ) != NULL ) { Quake3Game()->RunScript( found, cmd3 ); } else { //can't find cmd2 gi.Printf( S_COLOR_RED"runscript: can't find targetname %s\n", cmd2 ); } } else { Quake3Game()->RunScript( &g_entities[0], cmd2 ); } } else { gi.Printf( S_COLOR_RED"usage: runscript <ent targetname> scriptname\n" ); } //FIXME: else warning return qtrue; } if ( Q_stricmp( cmd, "playerteam" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } char *cmd2 = gi.argv(1); int n; if ( !*cmd2 || !cmd2[0] ) { gi.Printf( S_COLOR_RED"'playerteam' - change player team, requires a team name!\n" ); gi.Printf( S_COLOR_RED"Valid team names are:\n"); for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ ) { gi.Printf( S_COLOR_RED"%s\n", GetStringForID( TeamTable, n ) ); } } else { team_t team; team = (team_t)GetIDForString( TeamTable, cmd2 ); if ( team == -1 ) { gi.Printf( S_COLOR_RED"'playerteam' unrecognized team name %s!\n", cmd2 ); gi.Printf( S_COLOR_RED"Valid team names are:\n"); for ( n = TEAM_FREE; n < TEAM_NUM_TEAMS; n++ ) { gi.Printf( S_COLOR_RED"%s\n", GetStringForID( TeamTable, n ) ); } } else { g_entities[0].client->playerTeam = team; //FIXME: convert Imperial, Malon, Hirogen and Klingon to Scavenger? } } return qtrue; } if ( Q_stricmp( cmd, "control" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } char *cmd2 = gi.argv(1); if ( !*cmd2 || !cmd2[0] ) { if ( !G_ClearViewEntity( &g_entities[0] ) ) { gi.Printf( S_COLOR_RED"control <NPC_targetname>\n", cmd2 ); } } else { Q3_SetViewEntity( 0, cmd2 ); } return qtrue; } if ( Q_stricmp( cmd, "grab" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } char *cmd2 = gi.argv(1); if ( !*cmd2 || !cmd2[0] ) { if ( !G_ReleaseEntity( &g_entities[0] ) ) { gi.Printf( S_COLOR_RED"grab <NPC_targetname>\n", cmd2 ); } } else { G_GrabEntity( &g_entities[0], cmd2 ); } return qtrue; } if ( Q_stricmp( cmd, "knockdown" ) == 0 ) { if ( !g_cheats->integer ) { gi.SendServerCommand( 0, "print \"Cheats are not enabled on this server.\n\""); return qfalse; } G_Knockdown( &g_entities[0], &g_entities[0], vec3_origin, 300, qtrue ); return qtrue; } if ( Q_stricmp( cmd, "playerModel" ) == 0 ) { if ( gi.argc() == 1 ) { gi.Printf( S_COLOR_RED"USAGE: playerModel <NPC Name>\n playerModel <g2model> <skinhead> <skintorso> <skinlower>\n playerModel player (builds player from customized menu settings)\n" ); gi.Printf( "playerModel = %s ", va("%s %s %s %s\n", g_char_model->string, g_char_skin_head->string, g_char_skin_torso->string, g_char_skin_legs->string ) ); } else if ( gi.argc() == 2 ) { G_ChangePlayerModel( &g_entities[0], gi.argv(1) ); } else if ( gi.argc() == 5 ) { //instead of setting it directly via a command, we now store it in cvars //G_ChangePlayerModel( &g_entities[0], va("%s|%s|%s|%s", gi.argv(1), gi.argv(2), gi.argv(3), gi.argv(4)) ); gi.cvar_set("g_char_model", gi.argv(1) ); gi.cvar_set("g_char_skin_head", gi.argv(2) ); gi.cvar_set("g_char_skin_torso", gi.argv(3) ); gi.cvar_set("g_char_skin_legs", gi.argv(4) ); G_InitPlayerFromCvars( &g_entities[0] ); } return qtrue; } if ( Q_stricmp( cmd, "playerTint" ) == 0 ) { if ( gi.argc() == 4 ) { g_entities[0].client->renderInfo.customRGBA[0] = atoi(gi.argv(1)); g_entities[0].client->renderInfo.customRGBA[1] = atoi(gi.argv(2)); g_entities[0].client->renderInfo.customRGBA[2] = atoi(gi.argv(3)); gi.cvar_set("g_char_color_red", gi.argv(1) ); gi.cvar_set("g_char_color_green", gi.argv(2) ); gi.cvar_set("g_char_color_blue", gi.argv(3) ); } else { gi.Printf( S_COLOR_RED"USAGE: playerTint <red 0 - 255> <green 0 - 255> <blue 0 - 255>\n" ); gi.Printf( "playerTint = %s\n", va("%d %d %d", g_char_color_red->integer, g_char_color_green->integer, g_char_color_blue->integer ) ); } return qtrue; } if ( Q_stricmp( cmd, "nexttestaxes" ) == 0 ) { G_NextTestAxes(); } if ( Q_stricmp( cmd, "exitview" ) == 0 ) { Svcmd_ExitView_f(); } if (Q_stricmp (cmd, "iknowkungfu") == 0) { gi.cvar_set( "g_debugMelee", "1" ); G_SetWeapon( &g_entities[0], WP_MELEE ); for ( int i = FP_FIRST; i < NUM_FORCE_POWERS; i++ ) { g_entities[0].client->ps.forcePowersKnown |= ( 1 << i ); if ( i == FP_TELEPATHY ) { g_entities[0].client->ps.forcePowerLevel[i] = FORCE_LEVEL_4; } else { g_entities[0].client->ps.forcePowerLevel[i] = FORCE_LEVEL_3; } } } return qfalse; }
qboolean G_ActivateBehavior (gentity_t *self, int bset ) { bState_t bSID = (bState_t)-1; char *bs_name = NULL; if ( !self ) { return qfalse; } bs_name = self->behaviorSet[bset]; if( !(VALIDSTRING( bs_name )) ) { return qfalse; } if ( self->NPC ) { bSID = (bState_t)(GetIDForString( BSTable, bs_name )); } if(bSID > -1) { self->NPC->tempBehavior = BS_DEFAULT; self->NPC->behaviorState = bSID; } else { /* char newname[MAX_FILENAME_LENGTH]; sprintf((char *) &newname, "%s/%s", Q3_SCRIPT_DIR, bs_name ); */ //FIXME: between here and actually getting into the ICARUS_RunScript function, the stack gets blown! if ( ( ICARUS_entFilter == -1 ) || ( ICARUS_entFilter == self->s.number ) ) { Q3_DebugPrint( WL_VERBOSE, "%s attempting to run bSet %s (%s)\n", self->targetname, GetStringForID( BSETTable, bset ), bs_name ); } ICARUS_RunScript( self, va( "%s/%s", Q3_SCRIPT_DIR, bs_name ) ); } return qtrue; }
qboolean G_ActivateBehavior (gentity_t *self, int bset ) { bState_t bSID = (bState_t)-1; char *bs_name = NULL; if ( !self ) { return qfalse; } bs_name = self->behaviorSet[bset]; if( !(VALIDSTRING( bs_name )) ) { return qfalse; } if ( self->NPC ) { bSID = (bState_t)(GetIDForString( BSTable, bs_name )); } if(bSID > -1) { self->NPC->tempBehavior = BS_DEFAULT; self->NPC->behaviorState = bSID; } else { /* char newname[MAX_FILENAME_LENGTH]; sprintf((char *) &newname, "%s/%s", Q3_SCRIPT_DIR, bs_name ); */ //FIXME: between here and actually getting into the ICARUS_RunScript function, the stack gets blown! //if ( ( ICARUS_entFilter == -1 ) || ( ICARUS_entFilter == self->s.number ) ) if (0) { G_DebugPrint( WL_VERBOSE, "%s attempting to run bSet %s (%s)\n", self->targetname, GetStringForID( BSETTable, bset ), bs_name ); } //[CoOp] //make the code handle the case of the scripts directory already being given if(!Q_strncmp(bs_name, va( "%s/", Q3_SCRIPT_DIR ), 8 ) ) {//already has script directory specified. trap_ICARUS_RunScript( self, bs_name ); } else { trap_ICARUS_RunScript( self, va( "%s/%s", Q3_SCRIPT_DIR, bs_name ) ); } //trap_ICARUS_RunScript( self, va( "%s/%s", Q3_SCRIPT_DIR, bs_name ) ); //[/CoOp] } return qtrue; }
void SabBeh_AttackVsBlock( gentity_t *attacker, sabmech_t *mechAttacker, gentity_t *blocker, sabmech_t *mechBlocker, vec3_t hitLoc, qboolean hitSaberBlade, qboolean *attackerMishap, qboolean *blockerMishap) {//set the saber behavior for an attacking vs blocking/parrying blade impact qboolean startSaberLock = qfalse; qboolean parried = G_BlockIsParry(blocker, attacker, hitLoc); qboolean atkparry = G_InAttackParry(blocker); qboolean atkfake = (attacker->client->ps.userInt3 & (1 << FLAG_ATTACKFAKE)) ? qtrue : qfalse; G_BlockIsQuickParry(blocker,attacker,hitLoc);//Return value was never used, so I just call it now if(parried && blocker->r.svFlags & SVF_BOT && BOT_ATTACKPARRYRATE * botstates[blocker->s.number]->settings.skill > Q_irand(0,999)) {//bot performed an attack parry (by cheating a bit) //G_Printf("%i: %i: Bot Cheat Attack Parried\n", level.time, blocker->s.number); atkparry = qtrue; } /* if(parried && atkparry) { G_Printf("%i: %i: Attack Parried\n", level.time, blocker->s.number); } */ if(BG_SuperBreakWinAnim(attacker->client->ps.torsoAnim)) {//attacker was attempting a superbreak and he hit someone who could block the move, rail him for screwing up. *attackerMishap = SabBeh_RollBalance(attacker, mechAttacker, qtrue,qfalse); SabBeh_AddBalance(attacker, mechAttacker, MPCOST_BLOCKED_SUPERBREAK, qtrue); #ifdef _DEBUG mechAttacker->behaveMode = SABBEHAVE_ATTACKPARRIED; #endif SabBeh_AddBalance(blocker, mechBlocker, MPCOST_BLOCKING_SUPERBREAK, qfalse); #ifdef _DEBUG mechBlocker->behaveMode = SABBEHAVE_BLOCK; #endif } else if(atkfake) {//attacker faked before making this attack, treat like standard attack/attack if(parried) {//defender parried the attack fake. *attackerMishap = SabBeh_RollBalance(attacker, mechAttacker, atkparry,qtrue); SabBeh_AddBalance(attacker, mechAttacker, MPCOST_PARRIED_ATTACKFAKE, qtrue); #ifdef _DEBUG mechAttacker->behaveMode = SABBEHAVE_ATTACK; #endif //DMURPHY if (blocker->client->pers.cmd.buttons & BUTTON_SPECIALBUTTON2 //(was Button_15) && blocker->client->ps.fd.forcePowerLevel[FP_SABER_DEFENSE] >= FORCE_LEVEL_2) { attacker->client->ps.userInt3 |= (1 << FLAG_QUICKPARRY); } else { attacker->client->ps.userInt3 |= ( 1 << FLAG_PARRIED ); } SabBeh_AddBalance(blocker, mechBlocker, MPCOST_PARRYING_ATTACKFAKE, qfalse); #ifdef _DEBUG mechBlocker->behaveMode = SABBEHAVE_BLOCK; #endif } else if(atkparry) { saberKnockOutOfHand(&g_entities[attacker->client->ps.saberEntityNum], attacker, vec3_origin); } else {//otherwise, the defender stands a good chance of having his defensives broken. SabBeh_AddBalance(attacker, mechAttacker, MPCOST_BLOCKED_ATTACK_FAKE, qtrue); if(attacker->client->ps.fd.saberAnimLevel == SS_DESANN) { SabBeh_AddBalance(blocker, mechBlocker, MPCOST_BLOCKING_DESANN_ATTACK_FAKE, qfalse); } else {//standard attacker SabBeh_AddBalance(blocker, mechBlocker, MPCOST_BLOCKING_ATTACK_FAKE, qfalse); } #ifdef _DEBUG mechAttacker->behaveMode = SABBEHAVE_ATTACK; #endif if (WP_SabersCheckLock(attacker, blocker)) { attacker->client->ps.userInt3 |= ( 1 << FLAG_LOCKWINNER ); attacker->client->ps.saberBlocked = BLOCKED_NONE; blocker->client->ps.saberBlocked = BLOCKED_NONE; startSaberLock = qtrue; } #ifdef _DEBUG mechBlocker->behaveMode = SABBEHAVE_BLOCKFAKED; #endif } } else if(hitSaberBlade && BG_InSlowBounce(&blocker->client->ps) && blocker->client->ps.userInt3 & (1 << FLAG_OLDSLOWBOUNCE) && attacker->client->ps.fd.saberAnimLevel == SS_TAVION) {//blocker's saber was directly hit while in a slow bounce, disarm the blocker! mechBlocker->doDisarm = qtrue; blocker->client->ps.saberAttackChainCount = BALANCE_HIGH; #ifdef _DEBUG mechBlocker->behaveMode = SABBEHAVE_BLOCKFAKED; #endif //set attacker SabBeh_AddBalance(attacker, mechAttacker, MPCOST_TAVION_ATTACK_SLOW_BOUNCE, qtrue); #ifdef _DEBUG mechAttacker->behaveMode = SABBEHAVE_ATTACK; #endif } else {//standard attack //set blocker #ifdef _DEBUG mechBlocker->behaveMode = SABBEHAVE_BLOCK; #endif //set attacker if(parried) { //parry values if(attacker->client->ps.saberMove == LS_A_LUNGE || attacker->client->ps.saberMove == LS_SPINATTACK || attacker->client->ps.saberMove == LS_SPINATTACK_DUAL) {//attacker's lunge was parried, force mishap. *attackerMishap = SabBeh_RollBalance(attacker, mechAttacker, qtrue,atkparry); } else { *attackerMishap = SabBeh_RollBalance(attacker, mechAttacker, atkparry,atkparry); } SabBeh_AddBalance(attacker, mechAttacker, MPCOST_PARRIED, qtrue); #ifdef _DEBUG mechAttacker->behaveMode = SABBEHAVE_ATTACKPARRIED; #endif //[QuickParry] if (blocker->client->pers.cmd.buttons & BUTTON_SPECIALBUTTON2 //Was Button 15 DMURPHY && blocker->client->ps.fd.forcePowerLevel[FP_SABER_DEFENSE] >= FORCE_LEVEL_2) { attacker->client->ps.userInt3 |= ( 1 << FLAG_QUICKPARRY); } else { attacker->client->ps.userInt3 |= ( 1 << FLAG_PARRIED ); } //[/QuickParry] SabBeh_AddBalance(blocker, mechBlocker, MPCOST_PARRYING, qfalse); } else {//blocked values SabBeh_AddBalance(attacker, mechAttacker, MPCOST_BLOCKED_ATTACK, qtrue); if(attacker->client->ps.fd.saberAnimLevel == SS_TAVION) {//aqua styles deals MP to players that don't parry it. SabBeh_AddBalance(blocker, mechBlocker, MPCOST_BLOCKING_TAVION_ATTACK, qfalse); } else if(attacker->client->ps.fd.saberAnimLevel == SS_STRONG) { blocker->client->ps.fd.forcePower -= FPCOST_BLOCKING_STRONG_ATTACK; SabBeh_AddBalance(blocker, mechBlocker, MPCOST_BLOCKING_ATTACK, qfalse); } //racc - This doesn't actually ever happen. :S else if(attacker->client->ps.fd.saberAnimLevel==SS_TAVION && attacker->client->skillLevel[SK_GREENSTYLE] == FORCE_LEVEL_3 && (attacker->client->ps.userInt3 & FLAG_QUICKPARRY)) { SabBeh_AddBalance(blocker, mechBlocker, MPCOST_QUICKPARRY_TAVION_ATTACK, qfalse); } else {//standard blocker cost SabBeh_AddBalance(blocker, mechBlocker, MPCOST_BLOCKING_ATTACK, qfalse); } #ifdef _DEBUG mechAttacker->behaveMode = SABBEHAVE_ATTACKBLOCKED; #endif } } if(!OnSameTeam(attacker, blocker) || g_friendlySaber.integer) {//don't do parries or charge/regen DP unless we're in a situation where we can actually hurt the target. if(parried) {//parries don't cost any DP and they have a special animation //qboolean regenSound = qfalse; mechBlocker->doParry = qtrue; } else if(!startSaberLock) {//normal saber blocks //update the blocker's block move blocker->client->ps.saberLockFrame = 0; //break out of saberlocks. WP_SaberBlockNonRandom(blocker, hitLoc, qfalse); } } //do saber DP cost. /* // debugger message. G_Printf("%i: %i: Saber Block Cost: %i atk: %s %s blk: %s %s\n", level.time, blocker->s.number, OJP_SaberBlockCost(blocker, attacker, hitLoc), GetStringForID( animTable, attacker->client->ps.torsoAnim ), GetStringForID( SaberMoveTable, attacker->client->ps.saberMove ), GetStringForID( animTable, blocker->client->ps.torsoAnim ), GetStringForID( SaberMoveTable, blocker->client->ps.saberMove ) ); */ //[ExpSys] -- [DUALRAWR] G_DodgeDrain(blocker, attacker, OJP_SaberBlockCost(blocker, attacker, hitLoc)); //[/ExpSys] //costs FP as well. BG_AddFatigue(&blocker->client->ps, 1); if(g_debugsaberbehavior.integer) { G_Printf("%i: SaberBeh Attack vs Block: %i (attacker %s:%s): %s, %i (blocker %s:%s): %s\n", level.time, attacker->s.number, GetStringForID(SaberMoveTable, attacker->playerState->saberMove), GetStringForID(SaberBlockedTable, attacker->playerState->saberBlocked), GetStringForID(sabBehaveTable, mechAttacker->behaveMode), blocker->s.number, GetStringForID(SaberMoveTable, blocker->playerState->saberMove), GetStringForID(SaberBlockedTable, blocker->playerState->saberBlocked), GetStringForID(sabBehaveTable, mechBlocker->behaveMode)); } }
void SabBeh_AttackVsAttack( gentity_t *self, sabmech_t *mechSelf, gentity_t *otherOwner, sabmech_t *mechOther, qboolean *selfMishap, qboolean *otherMishap ) {//set the saber behavior for two attacking blades hitting each other qboolean atkfake = (self->client->ps.userInt3 & (1 << FLAG_ATTACKFAKE)) ? qtrue : qfalse; qboolean otherfake = (otherOwner->client->ps.userInt3 & (1 << FLAG_ATTACKFAKE)) ? qtrue : qfalse; if(atkfake && !otherfake) {//self is sololy faking //set self SabBeh_AddBalance(self, mechSelf, MPCOST_ATTACK_FAKE_ATTACKED, qtrue); #ifdef _DEBUG mechSelf->behaveMode = SABBEHAVE_BLOCKFAKED; #endif //set otherOwner if (WP_SabersCheckLock(self, otherOwner)) { self->client->ps.userInt3 |= ( 1 << FLAG_LOCKWINNER ); self->client->ps.saberBlocked = BLOCKED_NONE; otherOwner->client->ps.saberBlocked = BLOCKED_NONE; } SabBeh_AddBalance(otherOwner, mechOther, MPCOST_ATTACKING_ATTACK_FAKE, qtrue); #ifdef _DEBUG mechOther->behaveMode = SABBEHAVE_ATTACK; #endif } else if(otherfake && !atkfake) {//only otherOwner is faking //set self if (WP_SabersCheckLock(otherOwner, self)) { self->client->ps.saberBlocked = BLOCKED_NONE; otherOwner->client->ps.userInt3 |= ( 1 << FLAG_LOCKWINNER ); otherOwner->client->ps.saberBlocked = BLOCKED_NONE; } SabBeh_AddBalance(self, mechSelf, MPCOST_ATTACKING_ATTACK_FAKE, qtrue); #ifdef _DEBUG mechSelf->behaveMode = SABBEHAVE_ATTACK; #endif //set otherOwner SabBeh_AddBalance(otherOwner, mechOther, MPCOST_ATTACK_FAKE_ATTACKED, qtrue); #ifdef _DEBUG mechOther->behaveMode = SABBEHAVE_BLOCKFAKED; #endif } else {//either both are faking or neither is faking. Either way, it's cancelled out //set self SabBeh_AddBalance(self, mechSelf, MPCOST_ATTACK_ATTACK, qtrue); #ifdef _DEBUG mechSelf->behaveMode = SABBEHAVE_ATTACK; #endif //set otherOwner SabBeh_AddBalance(otherOwner, mechOther, MPCOST_ATTACK_ATTACK, qtrue); #ifdef _DEBUG mechOther->behaveMode = SABBEHAVE_ATTACK; #endif } if(g_debugsaberbehavior.integer) { G_Printf("%i: SaberBeh Attack vs Attack: %i (self %s:%s): %s, %i (other %s:%s): %s\n", level.time, self->s.number, GetStringForID(SaberMoveTable, self->playerState->saberMove), GetStringForID(SaberBlockedTable, self->playerState->saberBlocked), GetStringForID(sabBehaveTable, mechSelf->behaveMode), otherOwner->s.number, GetStringForID(SaberMoveTable, otherOwner->playerState->saberMove), GetStringForID(SaberBlockedTable, otherOwner->playerState->saberBlocked), GetStringForID(sabBehaveTable, mechOther->behaveMode)); } }
qboolean G_ActivateBehavior (gentity_t *self, int bset ) { bState_t bSID = (bState_t)-1; char *bs_name = NULL; if ( !self ) { return qfalse; } bs_name = self->behaviorSet[bset]; if( !(VALIDSTRING( bs_name )) ) { return qfalse; } if ( self->NPC ) { bSID = (bState_t)(GetIDForString( BSTable, bs_name )); } if(bSID > -1) { self->NPC->tempBehavior = BS_DEFAULT; self->NPC->behaviorState = bSID; if ( bSID == BS_SEARCH || bSID == BS_WANDER ) { //FIXME: Reimplement? if( self->waypoint != WAYPOINT_NONE ) { NPC_BSSearchStart( self->waypoint, bSID ); } else { self->waypoint = NAV::GetNearestNode(self); if( self->waypoint != WAYPOINT_NONE ) { NPC_BSSearchStart( self->waypoint, bSID ); } } } } else { Quake3Game()->DebugPrint( IGameInterface::WL_VERBOSE, "%s attempting to run bSet %s (%s)\n", self->targetname, GetStringForID( BSETTable, bset ), bs_name ); Quake3Game()->RunScript( self, bs_name ); } return qtrue; }