From 6038280726167c9bcd24d08bb0ac5d405dd1506f Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Tue, 13 Jan 2009 16:53:10 +0000 Subject: [PATCH] Added some randomness to collision sound delays and synced robot-player collision sprites to same steps --- CHANGELOG.txt | 1 + arch/ogl/ogl.c | 2 +- main/collide.c | 21 +++++++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 0e66e9042..3c4cc199b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/arch/ogl/ogl.c b/arch/ogl/ogl.c index 5f53bc763..4ff6f3bfc 100644 --- a/arch/ogl/ogl.c +++ b/arch/ogl/ogl.c @@ -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 diff --git a/main/collide.c b/main/collide.c index 33d8ffc08..ba176eaf3 100644 --- a/main/collide.c +++ b/main/collide.c @@ -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);