Adjusted D1 Lifter collision damage according to D2 to scale with FPS as Melee combats can happen in every frame; Actually set velocity from movement when colliding with objects

This commit is contained in:
zicodxx 2009-01-13 01:19:19 +00:00
parent edfe0e0b47
commit f1544295dd
3 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20090113
--------
main/collide.c, main/physics.c: Adjusted D1 Lifter collision damage according to D2 to scale with FPS as Melee combats can happen in every frame; Actually set velocity from movement when colliding with objects
20081230
--------
SConstruct: prefix is now an argument (useful for auto-builds)

View file

@ -167,6 +167,11 @@ void apply_force_damage(object *obj,fix force,object *other_obj)
case OBJ_PLAYER:
// If colliding with a claw type robot, do damage proportional to FrameTime because you can collide with those
// bots every frame since they don't move.
if ( (other_obj->type == OBJ_ROBOT) && (Robot_info[other_obj->id].attack_type) )
damage = fixmul(damage, FrameTime*2);
apply_damage_to_player(obj,other_obj,damage);
break;

View file

@ -697,7 +697,8 @@ void do_physics_sim(object *obj)
}
// After collision with objects and walls, set velocity from actual movement
if (!obj_stopped && ((fate == HIT_WALL) || (fate == HIT_BAD_P0))) {
if (!obj_stopped && ((fate == HIT_WALL) || (fate == HIT_OBJECT) || (fate == HIT_BAD_P0)))
{
vms_vector moved_vec;
vm_vec_sub(&moved_vec,&obj->pos,&start_pos);
vm_vec_copy_scale(&obj->mtype.phys_info.velocity,&moved_vec,fixdiv(f1_0,FrameTime));
@ -708,7 +709,7 @@ void do_physics_sim(object *obj)
and "bump" back by the value saying how far we are in already.
*/
if (
obj==ConsoleObject && (obj->mtype.phys_info.velocity.x==0 && obj->mtype.phys_info.velocity.y==0 && obj->mtype.phys_info.velocity.z==0) &&
obj==ConsoleObject && fate == HIT_WALL && (obj->mtype.phys_info.velocity.x==0 && obj->mtype.phys_info.velocity.y==0 && obj->mtype.phys_info.velocity.z==0) &&
!(obj->mtype.phys_info.thrust.x==0 && obj->mtype.phys_info.thrust.y==0 && obj->mtype.phys_info.thrust.z==0))
{
vms_vector center,bump_vec;