void Bot_Die(edict_t *eBot,edict_t *eOther) { char sound[MAX_QPATH]; if(eBot->monster.iState == STATE_DEAD) return; // [15/7/2012] He's dead, Jim. ~hogsy Monster_SetState(eBot,STATE_DEAD); eBot->v.movetype = MOVETYPE_TOSS; eBot->v.flags -= (eBot->v.flags & FL_ONGROUND); eBot->v.angles[0] = eBot->v.angles[2] = 0; eBot->Physics.iSolid = SOLID_NOT; if(rand()%2) Entity_Animate(eBot,PlayerAnimation_Death1); else Entity_Animate(eBot,PlayerAnimation_Death2); // [4/10/2012] Let the player know how we're feeling :) ~hogsy Bot_BroadcastMessage(eBot,eOther); #ifdef OPENKATANA // [26/7/2012] Character-based sounds ~hogsy switch(eBot->local.style) { case BOT_MIKIKO: sprintf(sound,"player/mikiko/mikikodeath%i.wav",rand()%5+1); break; case BOT_SUPERFLY: sprintf(sound,"player/superfly/superflydeath%i.wav",rand()%4+1); break; default: #endif sprintf(sound,"player/playerdeath%i.wav",rand()%4+1); #ifdef OPENKATANA } #endif Sound(eBot,CHAN_VOICE,sound,255,ATTN_NORM); if(eBot->v.iHealth < BOT_MIN_HEALTH) { Sound(eBot,CHAN_VOICE,"misc/gib1.wav",255,ATTN_NORM); ThrowGib(eBot->v.origin,eBot->v.velocity,PHYSICS_MODEL_GIB0,(float)(eBot->v.iHealth*-1),true); ThrowGib(eBot->v.origin,eBot->v.velocity,PHYSICS_MODEL_GIB1,(float)(eBot->v.iHealth*-1),true); ThrowGib(eBot->v.origin,eBot->v.velocity,PHYSICS_MODEL_GIB2,(float)(eBot->v.iHealth*-1),true); } }
void Bot_Die(ServerEntity_t *eBot, ServerEntity_t *eOther, EntityDamageType_t type) { char sound[MAX_QPATH]; if (eBot->Monster.state == AI_STATE_DEAD) return; // He's dead, Jim. AI_SetState(eBot, AI_STATE_DEAD); eBot->v.movetype = MOVETYPE_TOSS; eBot->v.flags -= (eBot->v.flags & FL_ONGROUND); eBot->v.angles.x = eBot->v.angles.z = 0; eBot->Physics.solid = SOLID_NOT; if(rand()%2) Entity_Animate(eBot,PlayerAnimation_Death1); else Entity_Animate(eBot,PlayerAnimation_Death2); // Let the player know how we're feeling. Bot_BroadcastMessage(eBot,eOther); #ifdef GAME_OPENKATANA // Character-based sounds. switch(eBot->local.style) { case BOT_COMPANION: sprintf(sound,"player/superfly/death%i.wav",rand()%4+1); break; default: #endif sprintf(sound,"player/playerdeath%i.wav",rand()%4+1); #ifdef GAME_OPENKATANA } #endif Sound(eBot,CHAN_VOICE,sound,255,ATTN_NORM); if(eBot->v.health < BOT_MIN_HEALTH) { Sound(eBot, CHAN_VOICE, "misc/gib1.wav", 255, ATTN_NORM); ThrowGib(eBot->v.origin,eBot->v.velocity,PHYSICS_MODEL_GIB0,(float)(eBot->v.health*-1),true); ThrowGib(eBot->v.origin,eBot->v.velocity,PHYSICS_MODEL_GIB1,(float)(eBot->v.health*-1),true); ThrowGib(eBot->v.origin,eBot->v.velocity,PHYSICS_MODEL_GIB2,(float)(eBot->v.health*-1),true); } }
void Inmater_Think(ServerEntity_t *eInmater) { switch (eInmater->Monster.state) { case AI_STATE_ASLEEP: //if (eInmater->Monster.meEmotion[EMOTION_BOREDOM].iEmotion > INMATER_MAX_BOREDOM) { AI_SetState(eInmater, AI_STATE_AWAKE); AI_SetThink(eInmater, AI_THINK_WANDERING); return; } break; case AI_STATE_AWAKE: switch (eInmater->Monster.think) { case AI_THINK_IDLE: if(!eInmater->local.animation_time || (eInmater->local.iAnimationCurrent == eInmater->local.animation_end)) Entity_Animate(eInmater,efInmaterIdle); AI_RandomMovement(eInmater, INMATER_MAX_SPEED); break; } break; case AI_STATE_DEAD: break; default: AI_SetState(eInmater, AI_STATE_ASLEEP); } }
void Bot_Idle(ServerEntity_t *entity) { if (!Entity_IsAnimating(entity)) Entity_Animate(entity, PlayerAnimation_Idle); // Attempt to find an enemy. ServerEntity_t *enttarg = Monster_GetEnemy(entity); if (enttarg && Monster_IsVisible(entity, enttarg)) { Engine.Con_DPrintf("I see you!\n"); AI_SetThink(entity, AI_THINK_PURSUING); return; } // Otherwise look for a point of interest. Waypoint_t *targ_interest = Waypoint_GetByType(entity->v.origin, WAYPOINT_TYPE_INTEREST, 0); if (targ_interest) { } }
void Inmater_Die(ServerEntity_t *eInmater, ServerEntity_t *eOther, EntityDamageType_t type) { if(eInmater->v.health < INMATER_MIN_HEALTH) { int iGibs = (rand()%5)+5, i; Sound(eInmater,CHAN_VOICE,"misc/gib1.wav",255,ATTN_NORM); // [13/9/2012] Updated paths ~hogsy for(i = 0; i < iGibs; i++) { char cModel[64]; int j; PLVector3D vOrigin,vGibVelocity; vOrigin.x = eInmater->v.origin.x + ((eInmater->v.mins.x + eInmater->v.maxs.x) * (rand()%10)); vOrigin.y = eInmater->v.origin.y + ((eInmater->v.mins.y + eInmater->v.maxs.y) * (rand()%10)); vOrigin.z = eInmater->v.origin.z + ((eInmater->v.mins.z + eInmater->v.maxs.z) * (rand()%10)); // [26/2/2014] Add some random velocity on top of the velocity that the inmater already has ~hogsy vGibVelocity = eInmater->v.velocity; plAddVector3Df(&vGibVelocity, (float)(rand() % 5)); PHYSICS_MODEL_METAL(cModel); ThrowGib(vOrigin, vGibVelocity, cModel, (float)eInmater->v.health*-1, true); } Engine.Particle(eInmater->v.origin,eInmater->v.velocity,10.0f,"blood",20); Entity_Remove(eInmater); return; } Entity_Animate(eInmater,efInmaterDeath); AI_SetState(eInmater, AI_STATE_DEAD); }
void Bot_Think(edict_t *eBot) { // If the bot isn't dead, then add animations. if(eBot->monster.iState != STATE_DEAD) { if(eBot->v.flags & FL_ONGROUND) { if(( (eBot->v.velocity[0] < -4.0f || eBot->v.velocity[0] > 4.0f) || (eBot->v.velocity[1] < -4.0f || eBot->v.velocity[1] > 4.0f)) && (!eBot->local.dAnimationTime || eBot->local.iAnimationEnd == 9)) Entity_Animate(eBot,PlayerAnimation_Walk); else if((eBot->v.velocity[0] == 0 || eBot->v.velocity[1] == 0) && (!eBot->local.dAnimationTime || eBot->local.iAnimationEnd > 9)) { #ifdef GAME_OPENKATANA if(eBot->v.iActiveWeapon == WEAPON_DAIKATANA) Entity_Animate(eBot,PlayerAnimation_KatanaIdle); else #endif Entity_Animate(eBot,PlayerAnimation_Idle); } } } switch(eBot->monster.iThink) { case THINK_IDLE: #if 1 // Add some random movement. ~hogsy if(rand()%120 == 0) { int iResult = rand()%3; if(iResult == 0) eBot->v.velocity[0] += BOT_MIN_SPEED; else if(iResult == 1) eBot->v.velocity[0] -= BOT_MIN_SPEED; iResult = rand()%3; if(iResult == 0) eBot->v.velocity[1] += BOT_MIN_SPEED; else if(iResult == 1) eBot->v.velocity[1] -= BOT_MIN_SPEED; eBot->v.angles[1] = Math_VectorToYaw(eBot->v.velocity); } else if(rand()%150 == 0) { Monster_Jump(eBot,200.0f); Entity_Animate(eBot,PlayerAnimation_Jump); } #endif break; case THINK_WANDERING: { edict_t *eTarget; Waypoint_t *wPoint; // Weapon_t *wMyWeapon; // vec3_t vAngle; eTarget = Monster_GetTarget(eBot); if(eTarget) { if(Monster_GetRelationship(eBot,eTarget) == RELATIONSHIP_HATE) { // [22/3/2013] Begin attacking next frame ~hogsy Monster_SetThink(eBot,THINK_ATTACKING); return; } } if(!eBot->monster.vTarget) { // [28/7/2012] TODO: Find specific waypoint such as an item ~hogsy wPoint = Waypoint_GetByVisibility(eBot->v.origin); if(wPoint) { if(wPoint->bOpen) { // [22/3/2013] TODO: Tell that current entity it's time to move... ~hogsy } Math_VectorCopy(wPoint->position,eBot->monster.vTarget); } } #if 0 wMyWeapon = Weapon_GetCurrentWeapon(eBot); if(MONSTER_GetRange(eBot,eBot->v.enemy->v.origin) > 4000) return; else if(wMyWeapon->iPrimaryType == AM_MELEE && MONSTER_GetRange(eBot,eBot->v.enemy->v.origin) > MONSTER_RANGE_MELEE) return; else if(Monster_IsVisible(eBot,eBot->v.enemy)) { // [5/8/2012] No ammo and it's not a melee weapon? ~hogsy if(!Weapon_CheckPrimaryAmmo(eBot) && wMyWeapon->iPrimaryType != AM_MELEE) { // [5/8/2012] Should probably flee ~hogsy Monster_SetThink(eBot,THINK_FLEEING); return; } Math_VectorSubtract(eBot->v.enemy->v.origin,eBot->v.origin,vAngle); // ent->v.ideal_yaw = VectorToAngles(vAngle); ChangeYaw(eBot); } #endif } break; } }