mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-02-21 11:10:51 +00:00
Finished Weapons + Damage
This commit is contained in:
parent
cf8e4ac640
commit
31ec8e1f54
3 changed files with 49 additions and 25 deletions
|
@ -910,12 +910,18 @@ void RTCWVR_Vibrate( int duration, int channel, float intensity )
|
|||
|
||||
void RTCWVR_Haptic( int duration, int channel, float intensity, char *description, float yaw, float height )
|
||||
{
|
||||
if(strstr(description,"camera_shake") == NULL)
|
||||
Com_Printf("Vibrate Description: %s", description);
|
||||
/*if(strstr(description,"camera_shake") == NULL && strstr(description,"ignore") == NULL && strstr(description,"dead_") == NULL)
|
||||
Com_Printf("GBRTCW: Vibrate Description: %s (Yaw: %f Pitch: %f)", description, yaw, height);*/
|
||||
|
||||
if(strstr(description,"damage_") != NULL) {
|
||||
RTCWVR_HapticEvent(description, 0, 0, 100.0f * intensity, yaw, height);
|
||||
}
|
||||
else if(strstr(description,"stop_firing_") != NULL) {
|
||||
/*
|
||||
if(strcmp(description,"stop_firing_9") == 0 || strcmp(description,"stop_firing_flames") == 0) {
|
||||
RTCWVR_HapticStopEvent("fire_flamethrower");
|
||||
}*/
|
||||
}
|
||||
else if(strstr(description,"fire_") != NULL) {
|
||||
if(strcmp(description,"fire_11") == 0 || strcmp(description,"fire_2") == 0) {
|
||||
RTCWVR_HapticEvent("fire_pistol", channel == 1 ? 2 : 1, 0, 100.0f * intensity, 0, 0);
|
||||
|
@ -995,7 +1001,7 @@ void jni_haptic_disable();
|
|||
|
||||
void RTCWVR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight )
|
||||
{
|
||||
Com_Printf( "Vibrate Event Fired: %s", event );
|
||||
//Com_Printf( "Vibrate Event Fired: %s", event );
|
||||
jni_haptic_event(event, position, flags, intensity, angle, yHeight);
|
||||
}
|
||||
|
||||
|
@ -1020,6 +1026,7 @@ void RTCWVR_HapticEnable()
|
|||
if (firstTime) {
|
||||
jni_haptic_enable();
|
||||
firstTime = false;
|
||||
jni_haptic_event("fire_pistol", 0, 0, 100, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3378,8 +3378,11 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
|
|||
|
||||
if (wasfiring) {
|
||||
//Stop haptics
|
||||
trap_Vibrate(0, 0, 0.0, "stop_firing", 0.0, 0.0);
|
||||
trap_Vibrate(0, 1, 0.0, "stop_firing", 0.0, 0.0);
|
||||
char *fire_command = (char*)malloc(8 * sizeof(char));
|
||||
sprintf(fire_command, "stop_firing_%i", weaponNum);
|
||||
|
||||
trap_Vibrate(0, 0, 0.0, fire_command, 0.0, 0.0);
|
||||
trap_Vibrate(0, 1, 0.0, "ignore", 0.0, 0.0);
|
||||
wasfiring = qfalse;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ void P_DamageFeedback( gentity_t *player ) {
|
|||
|
||||
// total points of damage shot at the player this frame
|
||||
count = client->damage_blood + client->damage_armor;
|
||||
if ( count == 0 ) {
|
||||
if ( count == 0 ) {
|
||||
return; // didn't take any damage
|
||||
}
|
||||
|
||||
|
@ -95,17 +95,31 @@ void P_DamageFeedback( gentity_t *player ) {
|
|||
client->ps.damageCount = count;
|
||||
|
||||
if (!client->ps.aiChar) {
|
||||
vec3_t viewangle;
|
||||
float_t pitch, yaw;
|
||||
pitch = (abs(angles[PITCH]) / 360.0) - 0.5;
|
||||
VectorCopy( client->ps.viewangles, viewangle );
|
||||
//If this doesn't work try (+ 360) instead of abs
|
||||
//Com_Printf( "GBRTCW: viewangle yaw = %f", viewangle[YAW] );
|
||||
//Com_Printf( "GBRTCW: damage location yaw = %f", angles[YAW] );
|
||||
|
||||
yaw = angles[YAW] - (viewangle[YAW] + 180.0f);
|
||||
if(yaw < 0.0f)
|
||||
yaw += 360.0f;
|
||||
if(yaw > 360.0f)
|
||||
yaw -= 360.0f;
|
||||
|
||||
//AnglesToAxis( viewangle, wolfkick.axis );
|
||||
switch(client->lasthurt_mod)
|
||||
{
|
||||
case MOD_SHOTGUN:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_shotgun", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_shotgun", yaw, pitch);
|
||||
break;
|
||||
case MOD_GRENADE:
|
||||
case MOD_GRENADE_SPLASH:
|
||||
case MOD_GRENADE_LAUNCHER:
|
||||
case MOD_GRENADE_PINEAPPLE:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_frag", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_frag", yaw, pitch);
|
||||
break;
|
||||
case MOD_ROCKET:
|
||||
case MOD_ROCKET_SPLASH:
|
||||
|
@ -115,12 +129,12 @@ void P_DamageFeedback( gentity_t *player ) {
|
|||
case MOD_BFG_SPLASH:
|
||||
case MOD_MORTAR:
|
||||
case MOD_MORTAR_SPLASH:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_rocket", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_rocket", yaw, pitch);
|
||||
break;
|
||||
case MOD_KNIFE:
|
||||
case MOD_KNIFE2:
|
||||
case MOD_KNIFE_STEALTH:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_knife", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_knife", yaw, pitch);
|
||||
break;
|
||||
case MOD_LUGER:
|
||||
case MOD_COLT:
|
||||
|
@ -128,7 +142,7 @@ void P_DamageFeedback( gentity_t *player ) {
|
|||
case MOD_AKIMBO:
|
||||
case MOD_SPEARGUN_CO2:
|
||||
case MOD_TARGET_LASER:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_low_bullet", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_low_bullet", yaw, pitch);
|
||||
break;
|
||||
case MOD_THOMPSON:
|
||||
case MOD_STEN:
|
||||
|
@ -137,7 +151,7 @@ void P_DamageFeedback( gentity_t *player ) {
|
|||
case MOD_GARAND:
|
||||
case MOD_SPEARGUN:
|
||||
case MOD_CROSS:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_mid_bullet", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_mid_bullet", yaw, pitch);
|
||||
break;
|
||||
case MOD_RAILGUN:
|
||||
case MOD_SNIPERRIFLE:
|
||||
|
@ -148,59 +162,59 @@ void P_DamageFeedback( gentity_t *player ) {
|
|||
case MOD_MACHINEGUN:
|
||||
case MOD_VENOM:
|
||||
case MOD_VENOM_FULL:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_high_bullet", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_high_bullet", yaw, pitch);
|
||||
break;
|
||||
case MOD_FLAMETHROWER:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_flamethrower", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_flamethrower", yaw, pitch);
|
||||
break;
|
||||
case MOD_LIGHTNING:
|
||||
case MOD_TESLA:
|
||||
case MOD_TELEFRAG:
|
||||
case MOD_LOPER_HIT:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_electric", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_electric", yaw, pitch);
|
||||
break;
|
||||
case MOD_EXPLOSIVE:
|
||||
case MOD_DYNAMITE:
|
||||
case MOD_DYNAMITE_SPLASH:
|
||||
case MOD_AIRSTRIKE:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_explosion", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_explosion", yaw, pitch);
|
||||
break;
|
||||
case MOD_GRAPPLE:
|
||||
case MOD_KICKED:
|
||||
case MOD_GRABBER:
|
||||
case MOD_LOPER_LEAP:
|
||||
case MOD_LOPER_GROUND:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_melee", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_melee", yaw, pitch);
|
||||
break;
|
||||
case MOD_FALLING:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_fall", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_fall", yaw, pitch);
|
||||
break;
|
||||
case MOD_SUICIDE:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_death", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_death", yaw, pitch);
|
||||
break;
|
||||
case MOD_POISONGAS:
|
||||
case MOD_WATER:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_gas", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_gas", yaw, pitch);
|
||||
break;
|
||||
case MOD_ZOMBIESPIRIT:
|
||||
case MOD_ZOMBIESPIRIT_SPLASH:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_zombiespirit", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_zombiespirit", yaw, pitch);
|
||||
break;
|
||||
case MOD_SLIME:
|
||||
case MOD_ZOMBIESPIT:
|
||||
case MOD_ZOMBIESPIT_SPLASH:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_slime", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_slime", yaw, pitch);
|
||||
break;
|
||||
case MOD_LAVA:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_fire", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_fire", yaw, pitch);
|
||||
break;
|
||||
case MOD_CRUSH:
|
||||
case MOD_TRIGGER_HURT:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_crush", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage_crush", yaw, pitch);
|
||||
break;
|
||||
|
||||
default:
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage", client->ps.damageYaw, client->ps.damagePitch);
|
||||
trap_Vibrate(1000, 1, (count / 255.0) + 0.5f, "damage", yaw, pitch);
|
||||
break;
|
||||
}
|
||||
trap_Vibrate(1000, 0, (count / 255.0) + 0.5f, "ignore", 0.0, 0.0);
|
||||
|
|
Loading…
Reference in a new issue