diff --git a/src/format.h b/src/format.h index 9cbd560..7d5489f 100644 --- a/src/format.h +++ b/src/format.h @@ -1841,11 +1841,11 @@ namespace TR { } static bool isPuzzleItem(Type type) { - return type >= PUZZLE_1 && type <= PUZZLE_4; + return (type >= PUZZLE_1 && type <= PUZZLE_4) || (type >= INV_PUZZLE_1 && type <= INV_PUZZLE_4); } static bool isKeyItem(Type type) { - return type >= KEY_ITEM_1 && type <= KEY_ITEM_4; + return (type >= KEY_ITEM_1 && type <= KEY_ITEM_4) || (type >= INV_KEY_ITEM_1 && type <= INV_KEY_ITEM_4); } static bool isWeapon(Type type) { diff --git a/src/inventory.h b/src/inventory.h index ac0e7eb..060ead3 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -1460,6 +1460,9 @@ struct Inventory { StringID getItemName(StringID def, TR::LevelID id, TR::Entity::Type type) { + if (!TR::Entity::isPuzzleItem(type) && !TR::Entity::isKeyItem(type)) + return def; + #define LVLCHECK(L, T, S) if (id == TR::L && type == TR::Entity::INV_##T) return S; LVLCHECK(LVL_TR1_2, KEY_ITEM_1, STR_KEY_SILVER); diff --git a/src/lara.h b/src/lara.h index b9f5f9f..8fedbd2 100644 --- a/src/lara.h +++ b/src/lara.h @@ -62,6 +62,8 @@ #define UNITS_PER_METER 445.0f +#define LARA_VIBRATE_HIT_TIME 0.2f + struct Lara : Character { // http://www.tombraiderforums.com/showthread.php?t=148859 @@ -1023,7 +1025,7 @@ struct Lara : Character { int count = wpnCurrent == TR::Entity::SHOTGUN ? 6 : 2; float nearDist = 32.0f * 1024.0f; vec3 nearPos; - int shots = 0; + int shots = 0, hits = 0; for (int i = 0; i < count; i++) { int armIndex; @@ -1057,6 +1059,7 @@ struct Lara : Character { int room; vec3 hit = trace(getRoomIndex(), p, t, room, false); if (arm->target && checkHit(arm->target, p, hit, hit)) { + hits++; TR::Entity::Type type = arm->target->getEntity().type; ((Character*)arm->target)->hit(wpnGetDamage(), this); hit -= d * 64.0f; @@ -1078,7 +1081,8 @@ struct Lara : Character { saveStats.ammoUsed += ((wpnCurrent == TR::Entity::SHOTGUN) ? 1 : 2); game->playSound(wpnGetSound(), pos, Sound::PAN); - game->playSound(TR::SND_RICOCHET, nearPos, Sound::PAN); + if (shots != hits) + game->playSound(TR::SND_RICOCHET, nearPos, Sound::PAN); if (wpnAmmo && *wpnAmmo != UNLIMITED_AMMO && wpnCurrent == TR::Entity::SHOTGUN) *wpnAmmo -= 1; @@ -1577,7 +1581,7 @@ struct Lara : Character { Character::hit(damage, enemy, hitType); - hitTimer = 0.2f; + hitTimer = LARA_VIBRATE_HIT_TIME; switch (hitType) { case TR::HIT_DART : addBlood(enemy->pos, vec3(0)); diff --git a/src/platform/win/main.cpp b/src/platform/win/main.cpp index 0dccb3a..59f804f 100644 --- a/src/platform/win/main.cpp +++ b/src/platform/win/main.cpp @@ -169,8 +169,8 @@ bool osJoyReady(int index) { } void osJoyVibrate(int index, float L, float R) { - joyDevice[index].vL = L; - joyDevice[index].vR = R; + joyDevice[index].vL = L; + joyDevice[index].vR = R; } void joyRumble(int index) {