Added some randomness to collision sound delays and synced robot-player collision sprites to same steps

This commit is contained in:
zicodxx 2009-01-13 16:53:10 +00:00
parent 81de582264
commit 6038280726
3 changed files with 17 additions and 7 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
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
arch/sdl/jukebox.c: Use a 2D array to allow playing of songs by track number in future
main/collide.c: Added some randomness to collision sound delays and synced robot-player collision sprites to same steps
20081230
--------

View file

@ -826,7 +826,7 @@ bool g3_draw_bitmap(vms_vector *pos,fix width,fix height,grs_bitmap *bm, object
glDepthFunc(GL_ALWAYS);
glBegin(GL_QUADS);
// Define alpha by looking for object TYPE or ID. We do this here so we have it seperated from the rest of the code.
if (PlayerCfg.OglAlphaEffects && // if -gl_transparency draw following bitmaps
(obj->type==OBJ_FIREBALL || // all types of explosions and energy-effects

View file

@ -84,12 +84,13 @@ int Ugly_robot_texture = 0;
#define STANDARD_EXPL_DELAY (f1_0/4)
int check_collision_sound_exec()
int check_collision_delayfunc_exec()
{
static int last_play_time=0;
static fix last_play_time=0;
if (last_play_time + (F1_0/3) < GameTime || last_play_time > GameTime)
{
last_play_time = GameTime;
last_play_time -= (d_rand()/2); // add some randomness
return 1;
}
return 0;
@ -663,9 +664,17 @@ void collide_robot_and_player( object * robot, object * player, vms_vector *coll
multi_robot_request_change(robot, player->id);
#endif
#endif
if (check_collision_sound_exec())
if (check_collision_delayfunc_exec())
{
int collision_seg = find_point_seg(collision_point, player->segnum);
digi_link_sound_to_pos( SOUND_ROBOT_HIT_PLAYER, player->segnum, 0, collision_point, 0, F1_0 );
if (collision_seg != -1)
object_create_explosion( collision_seg, collision_point, Weapon_info[0].impact_size, Weapon_info[0].wall_hit_vclip );
}
bump_two_objects(robot, player, 1);
return;
@ -753,7 +762,7 @@ void collide_player_and_controlcen( object * controlcen, object * player, vms_ve
ai_do_cloak_stuff(); // In case player cloaked, make control center know where he is.
}
if (check_collision_sound_exec())
if (check_collision_delayfunc_exec())
digi_link_sound_to_pos( SOUND_ROBOT_HIT_PLAYER, player->segnum, 0, collision_point, 0, F1_0 );
bump_two_objects(controlcen, player, 1);
@ -1024,7 +1033,7 @@ void collide_hostage_and_player( object * hostage, object * player, vms_vector *
//##}
void collide_player_and_player( object * player1, object * player2, vms_vector *collision_point ) {
if (check_collision_sound_exec())
if (check_collision_delayfunc_exec())
digi_link_sound_to_pos( SOUND_ROBOT_HIT_PLAYER, player1->segnum, 0, collision_point, 0, F1_0 );
bump_two_objects(player1, player2, 1);
@ -1372,7 +1381,7 @@ void collide_player_and_powerup( object * player, object * powerup, vms_vector *
//##}
void collide_player_and_clutter( object * player, object * clutter, vms_vector *collision_point ) {
if (check_collision_sound_exec())
if (check_collision_delayfunc_exec())
digi_link_sound_to_pos( SOUND_ROBOT_HIT_PLAYER, player->segnum, 0, collision_point, 0, F1_0 );
bump_two_objects(clutter, player, 1);