1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-04-22 03:51:58 +02:00

fix camera, fix human enemies blood splat, add unused explosive in debug inventory, fix muzzle flash blending

This commit is contained in:
XProger 2018-11-12 04:44:55 +03:00
parent cfb4a0aa61
commit deea28775c
5 changed files with 14 additions and 6 deletions

View File

@ -327,16 +327,18 @@ struct Camera : ICamera {
timer += Core::deltaTime * 30.0f;
float t = timer - int(timer);
int indexA = min(int(timer), level->cameraFramesCount - 1);
int indexB = min((indexA + 1), level->cameraFramesCount - 1);
int indexA = min(int(timer), level->cameraFramesCount - 3);
int indexB = min((indexA + 1), level->cameraFramesCount - 3);
if (indexA == level->cameraFramesCount - 3) {
if (level->isCutsceneLevel())
game->loadNextLevel();
else {
Character *lara = (Character*)owner;
if (lara->health > 0.0f)
if (lara->health > 0.0f) {
mode = MODE_FOLLOW;
return;
}
}
}

View File

@ -307,7 +307,8 @@ struct Enemy : Character {
void bite(int joint, const vec3 &offset, float damage) {
ASSERT(target);
target->hit(damage, this);
game->addEntity(TR::Entity::BLOOD, target->getRoomIndex(), getJoint(joint) * offset);
if (joint >= 0)
game->addEntity(TR::Entity::BLOOD, target->getRoomIndex(), getJoint(joint) * offset);
}
Mood getMoodFixed() {
@ -2574,7 +2575,8 @@ struct Human : Enemy {
game->addMuzzleFlash(this, jointGun, muzzleOffset, -1);
if (targetDist < HUMAN_DIST_SHOT && randf() < ((HUMAN_DIST_SHOT - targetDist) / HUMAN_DIST_SHOT - 0.25f)) {
bite(rand() % target->getModel()->mCount, vec3(0.0f), damage);
bite(-1, vec3(0.0f), damage);
game->addEntity(TR::Entity::BLOOD, target->getRoomIndex(), target->getJoint(rand() % target->getModel()->mCount).pos);
game->playSound(target->stand == STAND_UNDERWATER ? TR::SND_HIT_UNDERWATER : TR::SND_HIT, target->pos, Sound::PAN);
return true;
}

View File

@ -246,6 +246,7 @@ struct Inventory {
case TR::Entity::INV_MAP : desc = Desc( STR_MAP, PAGE_INVENTORY, level->extra.inv.map ); break;
case TR::Entity::INV_COMPASS : desc = Desc( STR_COMPASS, PAGE_INVENTORY, level->extra.inv.compass ); break;
case TR::Entity::INV_STOPWATCH : desc = Desc( STR_STOPWATCH, PAGE_INVENTORY, level->extra.inv.stopwatch ); break;
case TR::Entity::INV_EXPLOSIVE : desc = Desc( STR_EXPLOSIVE, PAGE_INVENTORY, level->extra.inv.explosive ); break;
case TR::Entity::INV_HOME : desc = Desc( STR_HOME, PAGE_OPTION, level->extra.inv.home ); break;
case TR::Entity::INV_DETAIL : desc = Desc( STR_DETAIL, PAGE_OPTION, level->extra.inv.detail ); break;
case TR::Entity::INV_SOUND : desc = Desc( STR_SOUND, PAGE_OPTION, level->extra.inv.sound ); break;
@ -627,6 +628,7 @@ struct Inventory {
add(TR::Entity::INV_PUZZLE_3, 3);
add(TR::Entity::INV_PUZZLE_4, 3);
add(TR::Entity::INV_EXPLOSIVE);
add(TR::Entity::INV_LEADBAR, 3);
#endif
}

View File

@ -274,7 +274,7 @@ struct MuzzleFlash : Controller {
lum = alpha;
game->setShader(Core::pass, Shader::FLASH, false, true);
Core::active.shader->setParam(uMaterial, vec4(lum, 0.0f, 0.0f, alpha));
Core::active.shader->setParam(uMaterial, vec4(lum * alpha, 0.0f, 0.0f, alpha));
Core::setBasis(&b, 1);
mesh->renderModel(level->extra.muzzleFlash);

View File

@ -89,6 +89,7 @@ enum StringID {
, STR_JOY_LAST = STR_JOY_FIRST + jkMAX - 1
// inventory items
, STR_UNKNOWN
, STR_EXPLOSIVE
, STR_PISTOLS
, STR_SHOTGUN
, STR_MAGNUMS
@ -216,6 +217,7 @@ const char *STR[STR_MAX] = {
, "NONE", "A", "B", "X", "Y", "L BUMPER", "R BUMPER", "SELECT", "START", "L STICK", "R STICK", "L TRIGGER", "R TRIGGER", "D-LEFT", "D-RIGHT", "D-UP", "D-DOWN"
// inventory items
, "Unknown"
, "Explosive"
, "Pistols"
, "Shotgun"
, "Magnums"