You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(136) |
Dec
(218) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(214) |
Feb
(208) |
Mar
(186) |
Apr
(15) |
May
(3) |
Jun
(35) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2005 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(58) |
Aug
(123) |
Sep
(31) |
Oct
(9) |
Nov
|
Dec
(1) |
| 2006 |
Jan
(25) |
Feb
(10) |
Mar
(25) |
Apr
(61) |
May
|
Jun
(78) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Rob <geo...@us...> - 2005-09-15 09:01:48
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6090/source/sc1ships Modified Files: shpilwav.cpp Log Message: removing a null-pointer crash, the case that control==0, Index: shpilwav.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpilwav.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpilwav.cpp 28 Aug 2005 20:32:37 -0000 1.11 --- shpilwav.cpp 15 Sep 2005 09:01:38 -0000 1.12 *************** *** 99,103 **** else if ((cloak_frame >= 300)) { ! if (!show_red_cloaker || is_bot(control->channel) || !is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[255], space); else --- 99,103 ---- else if ((cloak_frame >= 300)) { ! if (!show_red_cloaker || (control && is_bot(control->channel)) || (control && !is_local(control->channel)) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[255], space); else |
|
From: Rob <geo...@us...> - 2005-09-15 09:01:46
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6090/source/newships Modified Files: shpalckr.cpp shpdeees.cpp shpkorsn.cpp shpktesa.cpp shpmekpi.cpp shpnarlu.cpp shpquasi.cpp shpquawr.cpp shprekas.cpp shpstaba.cpp Log Message: removing a null-pointer crash, the case that control==0, Index: shpktesa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpktesa.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpktesa.cpp 14 Aug 2005 16:14:32 -0000 1.12 --- shpktesa.cpp 15 Sep 2005 09:01:37 -0000 1.13 *************** *** 115,118 **** --- 115,123 ---- if (boostlevel < 3) { boostlevel++; + + if (data->num_extra_samples < 2) + { + tw_error("No extra samples ?!"); + } sound.stop(data->sampleExtra[1]); sound.play(data->sampleExtra[1]); Index: shprekas.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shprekas.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shprekas.cpp 23 Jul 2005 14:08:08 -0000 1.13 --- shprekas.cpp 15 Sep 2005 09:01:37 -0000 1.14 *************** *** 83,87 **** STACKTRACE - Ship::calculate(); if (target && target->exists()) { --- 83,86 ---- *************** *** 90,94 **** specialMatchSpeed = false; ! if (specialMatchSpeed) { control->keys &= ~(keyflag::thrust); recharge_step=0; --- 89,93 ---- specialMatchSpeed = false; ! if (specialMatchSpeed && control) { control->keys &= ~(keyflag::thrust); recharge_step=0; *************** *** 103,107 **** else specialMatchSpeed = false; ! if (batt==0) specialMatchSpeed = false; if (!specialMatchSpeed) { --- 102,108 ---- else specialMatchSpeed = false; ! Ship::calculate(); ! ! if (batt==0) specialMatchSpeed = false; if (!specialMatchSpeed) { Index: shpstaba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpstaba.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpstaba.cpp 28 Aug 2005 20:34:08 -0000 1.11 --- shpstaba.cpp 15 Sep 2005 09:01:37 -0000 1.12 *************** *** 113,118 **** Query a; ! for (a.begin(this, bit(LAYER_SHIPS), HealRange, QUERY_OBJECT); a.current; a.next()) { ! if (!o->isShip()) continue; --- 113,119 ---- Query a; ! for (a.begin(this, bit(LAYER_SHIPS), HealRange, QUERY_OBJECT); a.current; a.next()) ! { ! if (!a.current->isShip()) continue; Index: shpalckr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalckr.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpalckr.cpp 28 Aug 2005 20:34:07 -0000 1.17 --- shpalckr.cpp 15 Sep 2005 09:01:37 -0000 1.18 *************** *** 188,191 **** --- 188,197 ---- dial_angle += turbo_change * frame_time / (1.0 + turbo_change) * PI/180; + + while (dial_angle > PI) + dial_angle -= PI2; + while (dial_angle < -PI) + dial_angle += PI2; + dial_index = get_index(angle + dial_angle); if( weaponObject ){ *************** *** 227,231 **** if ( up ) { sound.stop( data->sampleSpecial[1] ); ! play_sound2( copy_of_sampleSpecial, 255, 1000 ); up = false; } --- 233,237 ---- if ( up ) { sound.stop( data->sampleSpecial[1] ); ! play_sound2( copy_of_sampleSpecial, 255, 1000, true ); up = false; } Index: shpnarlu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpnarlu.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpnarlu.cpp 28 Aug 2005 20:34:08 -0000 1.19 --- shpnarlu.cpp 15 Sep 2005 09:01:37 -0000 1.20 *************** *** 205,209 **** } else if((cloak_frame >= 300)) { ! if (!show_red_cloaker || is_bot(control->channel) || !is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" { sprite->animate_character( pos, sprite_index, pallete_color[0], space); --- 205,209 ---- } else if((cloak_frame >= 300)) { ! if (!show_red_cloaker || (control && is_bot(control->channel)) || (control && !is_local(control->channel)) || (!game_networked && num_network>1)) // bots and remote players are "hidden" { sprite->animate_character( pos, sprite_index, pallete_color[0], space); Index: shpmekpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpmekpi.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpmekpi.cpp 26 Aug 2005 21:55:19 -0000 1.17 --- shpmekpi.cpp 15 Sep 2005 09:01:37 -0000 1.18 *************** *** 223,230 **** { sawangle += PI2 * frame_time*1E-3 / specialTurnperiod; ! if (angle > PI) ! angle -= PI2; ! if (angle < -PI) ! angle += PI2; } --- 223,230 ---- { sawangle += PI2 * frame_time*1E-3 / specialTurnperiod; ! if (sawangle > PI) ! sawangle -= PI2; ! if (sawangle < -PI) ! sawangle += PI2; } Index: shpkorsn.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkorsn.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** shpkorsn.cpp 1 Aug 2005 10:46:34 -0000 1.2 --- shpkorsn.cpp 15 Sep 2005 09:01:37 -0000 1.3 *************** *** 139,143 **** } else */ ! if (!show_red_cloaker || is_bot(control->channel) || !is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[255], space); else --- 139,143 ---- } else */ ! if (!show_red_cloaker || (control && is_bot(control->channel)) || (control && !is_local(control->channel)) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[255], space); else Index: shpquawr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpquawr.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpquawr.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpquawr.cpp 15 Sep 2005 09:01:37 -0000 1.19 *************** *** 162,166 **** if((cloak_frame >= 300)) { ! if (!show_red_cloaker || is_bot(control->channel) || !is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[0], space); else --- 162,166 ---- if((cloak_frame >= 300)) { ! if (!show_red_cloaker || (control && is_bot(control->channel)) || (control && !is_local(control->channel)) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[0], space); else Index: shpquasi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpquasi.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpquasi.cpp 23 Aug 2005 22:18:11 -0000 1.17 --- shpquasi.cpp 15 Sep 2005 09:01:37 -0000 1.18 *************** *** 310,314 **** void Quai::animate(Frame *space) { ! if (!show_red_cloaker || isInvisible() && !is_bot(control->channel) && is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[4], space); else --- 310,314 ---- void Quai::animate(Frame *space) { ! if (!show_red_cloaker || isInvisible() || (control && !is_bot(control->channel)) || is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[4], space); else Index: shpdeees.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdeees.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpdeees.cpp 28 Aug 2005 20:34:07 -0000 1.9 --- shpdeees.cpp 15 Sep 2005 09:01:37 -0000 1.10 *************** *** 180,184 **** crew--; game->add( new DeepSpaceWarrior( this, Vector2(0.0, -size.y * 0.8), ! (120.0 + tw_random(120*PI/180)) + angle, weaponVelocity, weaponRange, weaponArmour, weaponTurnRate, this, weaponDrainRate, data->spriteWeapon, target )); --- 180,184 ---- crew--; game->add( new DeepSpaceWarrior( this, Vector2(0.0, -size.y * 0.8), ! (120.0 + tw_random(120))*ANGLE_RATIO + angle, weaponVelocity, weaponRange, weaponArmour, weaponTurnRate, this, weaponDrainRate, data->spriteWeapon, target )); |
|
From: Rob <geo...@us...> - 2005-09-15 09:01:45
|
Update of /cvsroot/timewarp/source/sc3ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6090/source/sc3ships Modified Files: shpherex.cpp Log Message: removing a null-pointer crash, the case that control==0, Index: shpherex.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpherex.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpherex.cpp 1 Aug 2005 10:46:35 -0000 1.8 --- shpherex.cpp 15 Sep 2005 09:01:38 -0000 1.9 *************** *** 109,113 **** } else if ((cloak_frame >= 300)) { ! if (!show_red_cloaker || is_bot(control->channel) || !is_local(control->channel) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[0], space); else --- 109,113 ---- } else if ((cloak_frame >= 300)) { ! if (!show_red_cloaker || (control && is_bot(control->channel)) || (control && !is_local(control->channel)) || (!game_networked && num_network>1)) // bots and remote players are "hidden" sprite->animate_character( pos, sprite_index, pallete_color[0], space); else |
|
From: Rob <geo...@us...> - 2005-09-15 09:00:52
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5762/source/melee Modified Files: mgame.cpp mshpdata.cpp msprite.cpp Log Message: some debug stuff added Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** msprite.cpp 28 Aug 2005 20:31:32 -0000 1.26 --- msprite.cpp 15 Sep 2005 09:00:44 -0000 1.27 *************** *** 242,245 **** --- 242,252 ---- void color_correct_bitmap(BITMAP *bmp, int masked) {STACKTRACE //return;//remove me!!! + + int bpp = bitmap_color_depth(bmp); + if (bpp != 16 && bpp != 32 && bpp != 24) + { + tw_error("invalid target bitmap depth in color-correct"); + } + int x, y, w, h; w = bmp->w; *************** *** 253,257 **** c = getpixel(bmp, x, y); if ((c == bmc) && masked) continue; ! switch (bitmap_color_depth(bmp)) { case 8:{ a.r = getr8(c); --- 260,264 ---- c = getpixel(bmp, x, y); if ((c == bmc) && masked) continue; ! switch (bpp) { case 8:{ a.r = getr8(c); *************** *** 529,533 **** --- 536,547 ---- for(i = 0; i < sprite_count; i += 1) { + // error intercept? perhaps if memory is overwritten or so? + if (bpp != 16 && bpp != 32 && bpp != 24) + { + tw_error("invalid target bitmap depth"); + } + bmp = create_bitmap_ex(bpp, w, h); + if (general_attributes & MASKED) Index: mshpdata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshpdata.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mshpdata.cpp 28 Aug 2005 20:31:32 -0000 1.13 --- mshpdata.cpp 15 Sep 2005 09:00:44 -0000 1.14 *************** *** 29,32 **** --- 29,35 ---- void test_pointers() { + //xxx test + return; + #ifdef _DEBUG if (!physics) *************** *** 482,486 **** // copy the sample data (and set the pointer to the sample data) ! dest->data = copy_data(source->data, (source->len * source->bits) / 8); return dest; --- 485,495 ---- // copy the sample data (and set the pointer to the sample data) ! int mult; ! if (source->stereo != 0) ! mult = 2; ! else ! mult = 1; ! ! dest->data = copy_data(source->data, (source->len * (source->bits/8) * mult)); return dest; *************** *** 522,526 **** s_src = source->s + i; ! int L = s->len * s->bits / 8; s->data = malloc (L); memcpy(s->data, s_src->data, L); --- 531,541 ---- s_src = source->s + i; ! int mult; ! if (s->stereo != 0) ! mult = 2; ! else ! mult = 1; ! ! int L = mult * s->len * s->bits / 8; s->data = malloc (L); memcpy(s->data, s_src->data, L); Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** mgame.cpp 3 Sep 2005 19:49:45 -0000 1.56 --- mgame.cpp 15 Sep 2005 09:00:44 -0000 1.57 *************** *** 432,435 **** --- 432,437 ---- void Game::set_focus(Control *c) { + focus_index = -1; + int i; for ( i = 0; i < num_focuses; ++i ) *************** *** 1370,1377 **** iteration_histogram_init(time_start); - // only for debugging/testing purpose. - int debug_idle_time_animate = 50 + rand()%50; - debug_idle_time_animate = 0; - // if you increase lag, iterations can be skipped... --- 1372,1375 ---- *************** *** 1585,1591 **** - - - // approve of the next iteration, after ALL possible event thingies are done. if (lag_decrease == 0) --- 1583,1586 ---- *************** *** 1743,1747 **** #ifdef _DEBUG ! idle(debug_idle_time_animate); #endif --- 1738,1742 ---- #ifdef _DEBUG ! //idle(debug_idle_time_animate); #endif *************** *** 1891,1895 **** message.print((int)msecs_per_fps, 12, "render time: %.3fms (that's %s)", rt, tmp); message.print((int)msecs_per_fps, 12, "debug: %d", debug_value); ! message.print((int)msecs_per_fps, 12, "shipdatas loaded: [%d] num_items: [%i]", shipdatas_loaded, physics->num_items); } --- 1886,1891 ---- message.print((int)msecs_per_fps, 12, "render time: %.3fms (that's %s)", rt, tmp); message.print((int)msecs_per_fps, 12, "debug: %d", debug_value); ! message.print((int)msecs_per_fps, 12, "shipdatas: [%i] items: [%i] deadites: [%i] collisions: [%i] quadrants: [%i]", ! shipdatas_loaded, num_items, num_dead_presences, num_collisions, num_quadrant); } *************** *** 2721,2727 **** for ( i = 0; i < num_items; ++i ) { ! SpaceLocation *o = item[i]; ! sumpos += iround(o->pos.x + o->pos.y); ! sumvel += iround(o->vel.x + o->vel.y); } --- 2717,2726 ---- for ( i = 0; i < num_items; ++i ) { ! if (item[i]->exists()) ! { ! SpaceLocation *o = item[i]; ! sumpos += iround(o->pos.x + o->pos.y); ! sumvel += iround(o->vel.x + o->vel.y); ! } } |
|
From: Rob <geo...@us...> - 2005-09-15 09:00:20
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5374/source/melee Modified Files: mframe.cpp mframe.h Log Message: efficiency improvement: added a separate list for dead items. I do not know why the usuall way of keeping a long list containing both live and dead items slows down a game so much if there are many dead items. Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** mframe.h 3 Sep 2005 19:49:45 -0000 1.29 --- mframe.h 15 Sep 2005 09:00:11 -0000 1.30 *************** *** 123,126 **** --- 123,129 ---- public: + int num_collisions; // just for debugging display. + int num_quadrant; // just for debugging display. + SpaceLocation **quadrant; friend struct Query; *************** *** 141,146 **** void add(SpaceLocation *p); void add(Presence *p); ! bool remove(SpaceLocation *o); ! bool remove(Presence *p) ; TeamCode last_team; --- 144,155 ---- void add(SpaceLocation *p); void add(Presence *p); ! // bool remove(SpaceLocation *o); ! // bool remove(Presence *p) ; ! ! int num_dead_presences; ! int max_dead_presences; ! Presence **dead_presences; ! void add2deathlist(Presence *p); ! void check_deathlist(); TeamCode last_team; *************** *** 173,178 **** int _find_serial(int serial);*/ ! virtual void play_sound (SAMPLE *sample, SpaceLocation *source, int vol = 255, int freq = 1000); ! virtual void play_sound2 (SAMPLE *sample, SpaceLocation *source, int vol = 255, int freq = 1000); virtual void preinit(); --- 182,187 ---- int _find_serial(int serial);*/ ! virtual void play_sound (SAMPLE *sample, SpaceLocation *source, int vol = 255, int freq = 1000, bool noerrorcheck = false); ! virtual void play_sound2 (SAMPLE *sample, SpaceLocation *source, int vol = 255, int freq = 1000, bool noerrorcheck = false); virtual void preinit(); *************** *** 363,367 **** void play_sound (SAMPLE *sample, int vol = 256, int freq = 1000); //plays a sound ! void play_sound2 (SAMPLE *sample, int vol = 256, int freq = 1000);//like play_sound, only stops the previous sound int debug_id; // for debugging purpose --- 372,376 ---- void play_sound (SAMPLE *sample, int vol = 256, int freq = 1000); //plays a sound ! void play_sound2 (SAMPLE *sample, int vol = 256, int freq = 1000, bool noerrorcheck = false);//like play_sound, only stops the previous sound int debug_id; // for debugging purpose Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** mframe.cpp 3 Sep 2005 19:49:45 -0000 1.44 --- mframe.cpp 15 Sep 2005 09:00:10 -0000 1.45 *************** *** 60,63 **** --- 60,65 ---- void check_physics_correctness_item(int i) { + //xxx test + return; #ifdef _DEBUG if (physics) *************** *** 83,86 **** --- 85,90 ---- void check_physics_correctness() { + //xxx test + return; #ifdef _DEBUG int i; *************** *** 94,97 **** --- 98,103 ---- void check_physics_presence(Presence *p) { + //xxx test + return; #ifdef _DEBUG if (!physics) *************** *** 808,813 **** return; } ! void SpaceLocation::play_sound2 (SAMPLE *sample, int vol, int freq) {STACKTRACE ! physics->play_sound2(sample, this, vol, freq); return; } --- 814,819 ---- return; } ! void SpaceLocation::play_sound2 (SAMPLE *sample, int vol, int freq, bool noerrorcheck) {STACKTRACE ! physics->play_sound2(sample, this, vol, freq, noerrorcheck); return; } *************** *** 870,874 **** } ! int SpaceLocation::accelerate_gravwhip(SpaceLocation *source, double angle, double velocity, double max_speed) {STACKTRACE Planet *p = nearest_planet(); if (!p) return SpaceLocation::accelerate(source, angle, velocity, max_speed); --- 876,883 ---- } ! int SpaceLocation::accelerate_gravwhip(SpaceLocation *source, double angle, double velocity, double max_speed) ! { ! STACKTRACE; ! Planet *p = nearest_planet(); if (!p) return SpaceLocation::accelerate(source, angle, velocity, max_speed); *************** *** 1285,1288 **** --- 1294,1298 ---- num_presences = 0; max_presences = 0; + for (i = 0; i < num_items; i += 1) { SpaceLocation *tmp = item[i]; *************** *** 1294,1297 **** --- 1304,1317 ---- num_items = 0; max_items = 0; + + for (i = 0; i < num_dead_presences; i += 1) { + Presence *tmp = dead_presences[i]; + dead_presences[i] = 0; + delete tmp; + } + if (dead_presences) free(dead_presences); + dead_presences = 0; + num_dead_presences = 0; + max_dead_presences = 0; } *************** *** 1304,1313 **** void Physics::preinit() {STACKTRACE quadrant = NULL; num_items = max_items = 0; ! item = NULL; num_presences = max_presences = 0; ! presence = NULL; last_ship = 0; last_team = 0; return; } --- 1324,1345 ---- void Physics::preinit() {STACKTRACE quadrant = NULL; + + // spacelocations listing num_items = max_items = 0; ! item = 0; ! ! // presences listing num_presences = max_presences = 0; ! presence = 0; ! ! // death listing ! num_dead_presences = 0; ! max_dead_presences = 0; ! dead_presences = 0; ! last_ship = 0; last_team = 0; + + return; } *************** *** 1392,1395 **** --- 1424,1428 ---- } + /* bool Physics::remove(SpaceLocation *o) { STACKTRACE; *************** *** 1412,1415 **** --- 1445,1449 ---- return false; } + */ void Physics::add(Presence *p) { *************** *** 1429,1433 **** return; } ! bool Physics::remove(Presence *o) { STACKTRACE; --- 1463,1467 ---- return; } ! /* bool Physics::remove(Presence *o) { STACKTRACE; *************** *** 1445,1448 **** --- 1479,1483 ---- return false; } + */ extern void test_pointers(); *************** *** 1460,1463 **** --- 1495,1532 ---- + // move dead items to a death presence list ... + + void Physics::add2deathlist(Presence *p) + { + if (num_dead_presences >= max_dead_presences) + { + max_dead_presences += 1024; + dead_presences = (Presence**) realloc(dead_presences, sizeof(Presence*) * max_dead_presences); + } + + dead_presences[num_dead_presences] = p; + ++ num_dead_presences; + } + + void Physics::check_deathlist() + { + // normally this shouldn't happen, but you never know ... + int i; + for ( i = 0; i < num_dead_presences; ++i ) + { + if (dead_presences[i]->exists()) + { + //xxx test + // tw_error("Reviving a dead object is illegal."); + + physics->add(dead_presences[i]); + dead_presences[i] = dead_presences[num_dead_presences-1]; + --num_dead_presences; + --i; + } + + } + } + void Physics::calculate() {_STACKTRACE("Physics::calculate()") *************** *** 1528,1535 **** } - if (dt_longest > 1) - { - message.print(100, 14, "longest duration = item [%s]", item[i_longest]->get_identity()); - } // try to intercept a couple of errors that are possible here ... --- 1597,1600 ---- *************** *** 1557,1565 **** } ! if (dt_longest > 1) ! { ! message.print(100, 14, "longest duration = item [%s]", item[i_longest]->get_identity()); ! } for(i = 0; i < QUADS_TOTAL; i += 1) { quadrant[i] = NULL; --- 1622,1631 ---- } ! // if (dt_longest > 1) ! // { ! // message.print(100, 14, "longest duration = item [%s]", item[i_longest]->get_identity()); ! // } + num_quadrant = 0; for(i = 0; i < QUADS_TOTAL; i += 1) { quadrant[i] = NULL; *************** *** 1573,1576 **** --- 1639,1644 ---- item[i]->qnext = quadrant[q]; quadrant[q] = item[i]; + + ++ num_quadrant; } else item[i]->qnext = NULL; *************** *** 1582,1585 **** --- 1650,1712 ---- collide(); + + + check_deathlist(); + + int count_undead = 0; + for ( i = 0; i < num_presences; i ++ ) + { + if (!presence[i]->exists()) + { + add2deathlist(presence[i]); + + } else { + // removes from the list, while preserving list ordering + presence[count_undead] = presence[i]; + ++count_undead; + } + } + num_presences = count_undead; + + count_undead = 0; + for ( i = 0; i < num_items; i ++ ) + { + if (!item[i]->exists()) + { + item[i]->death(); + add2deathlist(item[i]); + + } else { + // removes from the list, while preserving list ordering + item[count_undead] = item[i]; + ++count_undead; + } + } + num_items = count_undead; + + + //remove presences that have been dead long enough + + for(i = 0; i < num_dead_presences; i ++) + { + if (dead_presences[i]->state == -DEATH_FRAMES) + { + delete dead_presences[i]; + + dead_presences[i] = dead_presences[num_dead_presences-1]; + --num_dead_presences; + --i; + } + else { + dead_presences[i]->state -= 1; + + } + + + } + + + + /* //remove presences that have been dead long enough int count_undead = 0; *************** *** 1628,1636 **** //i -= 1; ! const char *name = tmp->get_identity(); ! char str[128]; ! strcpy(str, tmp->get_identity()); // remember the name ! delete_location(tmp); } else { --- 1755,1764 ---- //i -= 1; ! //const char *name = tmp->get_identity(); ! //char str[128]; ! //strcpy(str, tmp->get_identity()); // remember the name ! //delete_location(tmp); ! delete tmp; } else { *************** *** 1665,1668 **** --- 1793,1797 ---- } } + */ test_pointers(); *************** *** 1887,1902 **** l->inflict_damage(o); } - } #include "../util/pmask.h" ! void Physics::collide() {_STACKTRACE("Physics::collide()") int i; - PMASKDATA_FLOAT *tmp; int l = 0; ! tmp = new PMASKDATA_FLOAT[num_items]; ! for (i = 0; i < num_items; i += 1) { ! if (item[i] && item[i]->exists() && item[i]->isObject() ! && item[i]->detectable() ) { SpaceObject *o = (SpaceObject *) item[i]; Vector2 p = o->pos - o->size / 2; --- 2016,2038 ---- l->inflict_damage(o); } } + + + #include "../util/pmask.h" ! void Physics::collide() ! { ! _STACKTRACE("Physics::collide()"); ! ! int tmp_size = 0; ! PMASKDATA_FLOAT *tmp = new PMASKDATA_FLOAT [num_items]; ! int i; int l = 0; ! for (i = 0; i < num_items; i += 1) ! { ! if (item[i] && item[i]->exists() && item[i]->isObject() && item[i]->detectable() ) ! { SpaceObject *o = (SpaceObject *) item[i]; Vector2 p = o->pos - o->size / 2; *************** *** 1920,1923 **** --- 2056,2060 ---- } } + num_collisions = l; SpaceObject *col[128 * 2 + 1]; int nc = check_pmask_collision_list_float_wrap(size.x, size.y, tmp, l, (const void**)&col[0], 128); *************** *** 1941,1944 **** --- 2078,2083 ---- #endif }//*/ + + Query q; for (i = 0; i < num_items; i += 1) { *************** *** 2005,2015 **** //unimplemented } ! void Physics::play_sound (SAMPLE *sample, SpaceLocation *source, int vol, int freq) {STACKTRACE ! sound.play(sample, vol, 128, iround(freq * turbo)); return; } ! void Physics::play_sound2 (SAMPLE *sample, SpaceLocation *source, int vol, int freq) {STACKTRACE sound.stop(sample); ! play_sound(sample, source, vol, freq); return; } --- 2144,2154 ---- //unimplemented } ! void Physics::play_sound (SAMPLE *sample, SpaceLocation *source, int vol, int freq, bool noerrorcheck) {STACKTRACE ! sound.play(sample, vol, 128, iround(freq * turbo), false, noerrorcheck); return; } ! void Physics::play_sound2 (SAMPLE *sample, SpaceLocation *source, int vol, int freq, bool noerrorcheck) {STACKTRACE sound.stop(sample); ! play_sound(sample, source, vol, freq, noerrorcheck); return; } |
|
From: Rob <geo...@us...> - 2005-09-04 09:37:11
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28589/ships Modified Files: shpneccr.dat Log Message: new ship graphics Index: shpneccr.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpneccr.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs1ftKpz and /tmp/cvsvujbyO differ |
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2689/ships Modified Files: shpartem.dat shpdajem.dat shpdjila.dat shpfresc.dat shpjnkla.dat shpquawr.dat shpsefn2.dat shptauto.dat shpwistr.dat Log Message: updated graphics, by Darryl and Shadow Index: shptauto.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shptauto.dat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsRNmDX4 and /tmp/cvsQz7ElF differ Index: shpquawr.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpquawr.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsBBxCD7 and /tmp/cvs5WVq6H differ Index: shpjnkla.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpjnkla.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsKQRd19 and /tmp/cvsGFCnDK differ Index: shpsefn2.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpsefn2.dat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs0wRF2a and /tmp/cvs2usrNL differ Index: shpwistr.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpwistr.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs5PvPAB and /tmp/cvsckgYmd differ Index: shpfresc.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpfresc.dat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsLbQJuF and /tmp/cvsZyUIkh differ Index: shpdajem.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpdajem.dat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvssJKFQL and /tmp/cvsrXQC4n differ Index: shpdjila.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpdjila.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvseLv71N and /tmp/cvsvPnfkq differ Index: shpartem.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpartem.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsa9neWR and /tmp/cvsJAXBhu differ |
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2402/source/melee Modified Files: mcontrol.cpp mframe.cpp mframe.h mgame.cpp mmain.cpp mship.cpp mshppan.cpp mshppan.h Log Message: some minor bugfixes Index: mshppan.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshppan.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** mshppan.cpp 8 Aug 2005 14:36:03 -0000 1.20 --- mshppan.cpp 3 Sep 2005 19:49:45 -0000 1.21 *************** *** 11,24 **** #include "../util/aastr.h" ! int PANEL_WIDTH = 64; ! int PANEL_HEIGHT = 100; ! int CAPTAIN_X = 4; ! int CAPTAIN_Y = 65; ! int PANEL_DEATH_FRAMES = 2500; ! int crew_x = 8; ! int crew_y = 53; ! int batt_x = 56; ! int batt_y = 53; --- 11,24 ---- #include "../util/aastr.h" ! const int PANEL_WIDTH = 64; ! const int PANEL_HEIGHT = 100; ! const int CAPTAIN_X = 4; ! const int CAPTAIN_Y = 65; ! const int PANEL_DEATH_FRAMES = 2500; ! const int crew_x = 8; ! const int crew_y = 53; ! const int batt_x = 56; ! const int batt_y = 53; *************** *** 73,77 **** } ! void ShipPanel::calculate() {STACKTRACE if (!ship) { deathframe -= frame_time; --- 73,85 ---- } ! void ShipPanel::calculate() ! { ! STACKTRACE; ! ! if (!exists()) ! { ! tw_error("should not occur"); ! } ! if (!ship) { deathframe -= frame_time; *************** *** 82,86 **** ship->spritePanel->draw(0, 0, 0, panel); panel_needs_update = true; ! ship = NULL; deathframe = PANEL_DEATH_FRAMES; return; --- 90,94 ---- ship->spritePanel->draw(0, 0, 0, panel); panel_needs_update = true; ! ship = 0; deathframe = PANEL_DEATH_FRAMES; return; *************** *** 104,107 **** --- 112,120 ---- STACKTRACE; + if (!(state > 0)) + { + tw_error("should not occur"); + } + BITMAP *screen = window->surface; if (!screen) return; Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** mmain.cpp 28 Aug 2005 20:31:32 -0000 1.45 --- mmain.cpp 3 Sep 2005 19:49:45 -0000 1.46 *************** *** 521,524 **** --- 521,526 ---- { choose_new_ships(); + + // disable ship selection... next_choose_new_ships_time = game_time + 24*60*60*1000; } *************** *** 976,981 **** --- 978,988 ---- // log_test(); + int crc_test1 = 0; + int crc_test2 = 0; + for (i = 0; i < num_players; i += 1) { + slot[i] = -2; + NPI* p = player[i]; *************** *** 983,988 **** continue; ! slot[i] = -2; ! if (p->control->ship) { } else { --- 990,999 ---- continue; ! if (p->control->ship) ! { ! if (!p->control->ship->exists()) ! { ! tw_error("Ship under control does not exist !?!?"); ! } } else { *************** *** 991,1013 **** sprintf (tmp, "Player%d", i+1); Fleet *fleet = p->fleet; - if (fleet->getSize() == 0) continue; - char buffy[512]; - - if (strlen(fleet->getTitle()) != 0) - sprintf(buffy, "%s\n%s\n", p->name, fleet->getTitle()); - else - sprintf(buffy, "%s\n", p->name); ! // humans can choose ships ! if (p->channel != channel_none) ! slot[i] = p->control->choose_ship(window, buffy, fleet); ! else ! // bots choose "randomly" (but synched randomly so don't use rand() !!). ! // this is needed, otherwise a bot would need its own channel, while this way, ! // they can use channel_none. ! slot[i] = tw_random(fleet->getSize()); share(i, &slot[i]); } } --- 1002,1029 ---- sprintf (tmp, "Player%d", i+1); Fleet *fleet = p->fleet; ! if (fleet->getSize() != 0) ! { ! char buffy[512]; ! ! if (strlen(fleet->getTitle()) != 0) ! sprintf(buffy, "%s\n%s\n", p->name, fleet->getTitle()); ! else ! sprintf(buffy, "%s\n", p->name); ! ! // humans can choose ships ! if (p->channel != channel_none) ! slot[i] = p->control->choose_ship(window, buffy, fleet); ! else ! // bots choose "randomly" (but synched randomly so don't use rand() !!). ! // this is needed, otherwise a bot would need its own channel, while this way, ! // they can use channel_none. ! slot[i] = tw_random(fleet->getSize()); ! } share(i, &slot[i]); } + + crc_test1 = num_players * crc_test1 + slot[i]; } *************** *** 1033,1042 **** for (i = 0; i < num_players; i += 1) { ! NPI* p = (NPI*)player[i]; if (!p) continue; ! if (slot[i] == -2) continue; sprintf (tmp, "Player%d", i+1); //fleet->load("./fleets.tmp", tmp); --- 1049,1062 ---- for (i = 0; i < num_players; i += 1) { ! NPI* p = player[i]; if (!p) continue; ! crc_test2 = num_players * crc_test2 + slot[i]; ! ! if (slot[i] == -2) ! continue; ! sprintf (tmp, "Player%d", i+1); //fleet->load("./fleets.tmp", tmp); *************** *** 1076,1079 **** --- 1096,1100 ---- ); add(panel); + add(s->get_ship_phaser()); *************** *** 1082,1088 **** --- 1103,1122 ---- add(new TeamIndicator(s, &indteamtoggle)); + //message.print(1500, 9, "Adding ship [%s] at time [%i]", s->get_identity(), game_time); } + #ifdef _DEBUG + if (num_network == 1) + { + //message.print(1500, 9, "crc1 = [%i] crc2 = [%i]", crc_test1, crc_test2); + if (crc_test1 != crc_test2) + { + // this is only useful for a local game. + tw_error("CRC test goes wrong!!"); + } + } + #endif + // log_test(); Index: mshppan.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshppan.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mshppan.h 8 Aug 2005 14:33:57 -0000 1.11 --- mshppan.h 3 Sep 2005 19:49:45 -0000 1.12 *************** *** 5,19 **** #include "../melee.h" ! extern int PANEL_WIDTH; ! extern int PANEL_HEIGHT; ! extern int CAPTAIN_X; ! extern int CAPTAIN_Y; ! extern int PANEL_DEATH_FRAMES; ! extern int crew_x; ! extern int crew_y; ! extern int batt_x; ! extern int batt_y; --- 5,19 ---- #include "../melee.h" ! extern const int PANEL_WIDTH; ! extern const int PANEL_HEIGHT; ! extern const int CAPTAIN_X; ! extern const int CAPTAIN_Y; ! extern const int PANEL_DEATH_FRAMES; ! extern const int crew_x; ! extern const int crew_y; ! extern const int batt_x; ! extern const int batt_y; Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** mgame.cpp 16 Aug 2005 18:17:29 -0000 1.55 --- mgame.cpp 3 Sep 2005 19:49:45 -0000 1.56 *************** *** 1812,1816 **** //if (source && source->ship && source->ship->data) tmp = source->ship->data->moduleVictory; // note: it's not guaranteed that a ship exists longer than its weapon, while data keep existing, right ? ! if (source && source->exists()) tmp = source->data->moduleVictory; if (tmp) sound.play_music(tmp); } --- 1812,1820 ---- //if (source && source->ship && source->ship->data) tmp = source->ship->data->moduleVictory; // note: it's not guaranteed that a ship exists longer than its weapon, while data keep existing, right ? ! //if (source && source->exists()) ! // better NOT check for "exists", cause usually weapons die on impact. The fact that they're ! // used by physics is enough guarantee that they are alive... ! if (source) ! tmp = source->data->moduleVictory; if (tmp) sound.play_music(tmp); } *************** *** 1887,1891 **** message.print((int)msecs_per_fps, 12, "render time: %.3fms (that's %s)", rt, tmp); message.print((int)msecs_per_fps, 12, "debug: %d", debug_value); ! message.print((int)msecs_per_fps, 12, "shipdatas loaded: %d", shipdatas_loaded); } --- 1891,1895 ---- message.print((int)msecs_per_fps, 12, "render time: %.3fms (that's %s)", rt, tmp); message.print((int)msecs_per_fps, 12, "debug: %d", debug_value); ! message.print((int)msecs_per_fps, 12, "shipdatas loaded: [%d] num_items: [%i]", shipdatas_loaded, physics->num_items); } Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** mcontrol.cpp 23 Aug 2005 22:20:16 -0000 1.29 --- mcontrol.cpp 3 Sep 2005 19:49:45 -0000 1.30 *************** *** 507,513 **** STACKTRACE; if (_prediction_keys) delete[] _prediction_keys; - - if (ship) - ship->control = 0; } --- 507,510 ---- Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mframe.h 28 Aug 2005 20:31:32 -0000 1.28 --- mframe.h 3 Sep 2005 19:49:45 -0000 1.29 *************** *** 27,36 **** ! //#define DEATH_FRAMES 4 ! //setting this too low will cause crashes ! //setting it too high will waste CPU power and RAM ! //the recommended value is 4 ! #define DEATH_FRAMES 64 // ALSO NOTE THE PHASERS... struct Query; --- 27,36 ---- ! // default frame size is 25 ms, i.e., 0.025 s. You have 40 frames per second. ! // there are 800 frames in 20 seconds... so, a safe margin to also include mod music would be... ! const int DEATH_FRAMES = 1024; // ALSO NOTE THE PHASERS... + // AND ALSO THE GAME MUSIC... or is that copied by the play-sound algorithm? + // so... make it long enough ?!?! struct Query; *************** *** 211,215 **** int id; // id code, indicates what type it is int attributes; // describes it ! signed char state; // may be set to any positive value if alive, or 0 to kill it //private: int _serial; // unique reference number private: int _depth; // determines rendering order ; read/write with set_depth, get_depth --- 211,216 ---- int id; // id code, indicates what type it is int attributes; // describes it ! //signed char state; // may be set to any positive value if alive, or 0 to kill it ! int state; // a char is too small, because objects need to be kept in memory for a while until sound/graphics access is guaranteed to end //private: int _serial; // unique reference number private: int _depth; // determines rendering order ; read/write with set_depth, get_depth Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** mframe.cpp 28 Aug 2005 20:31:32 -0000 1.43 --- mframe.cpp 3 Sep 2005 19:49:45 -0000 1.44 *************** *** 27,31 **** int total_presences; ! #define ANIMATE_BUFFER_SIZE 2048 //setting this too low can cause things to not get drawn //setting it too high will waste RAM --- 27,31 ---- int total_presences; ! #define ANIMATE_BUFFER_SIZE 4096 //setting this too low can cause things to not get drawn //setting it too high will waste RAM *************** *** 117,120 **** --- 117,139 ---- + int get_index(double angle, double o, int n) + { + if (angle < -100 || angle > 100) + { + tw_error("index: excessive angle"); + } + + int i = iround((o + angle) * n / PI2); + + while (i < 0) + i += n; + + while (i >= n) + i -= n; + + return i; + } + + bool Query::current_invalid() { *************** *** 552,591 **** data->unlock(); - #ifdef _DEBUG - int i; - - if (physics) - { - // also check the target list - for ( i = 0; i < targets->N; ++i) - { - if (targets->item[i] == this) - { - tw_error("Trying to remove a ship that is still in the target list! Should not happen."); - } - } - - // check if it's still in the physics list... which shouldn't be the case - for ( i = 0; i < physics->num_items; ++i) - { - if (physics->item[i]->exists()) - { - if (physics->item[i] == this) - { - tw_error("Trying to remove a ship that is still in the physics list! Should not happen."); - } - if (physics->item[i]->target == this) - { - tw_error("Trying to remove a possible target [%s] for [%s]! Should not happen.", - get_identity(), physics->item[i]->get_identity()); - } - } - } - } - - - - #endif - } --- 571,574 ---- *************** *** 1470,1484 **** return; - int i; - for (i = 0; i < physics->num_items; i += 1) - { - // check if this object still exists in the physics list... if it does, you're going to create a problem! - if (physics->item[i] == tmp) - { - tw_error("Problem, trying to delete an item that is still in the physics (locations) list"); - } - } - - // otherwise, it's ok to remove it. const char *name = 0; if (tmp->data) --- 1453,1456 ---- *************** *** 1503,1511 **** debug_value = num_items + num_presences; - //test_pointers(); - //check_physics_correctness(); ! checksync(); ! {_STACKTRACE("Physics::calculate() - item movement") //move objects for (i = 0; i < num_items; i += 1) --- 1475,1480 ---- debug_value = num_items + num_presences; ! //move objects for (i = 0; i < num_items; i += 1) *************** *** 1520,1543 **** } item[i]->pos = normalize(item[i]->pos + item[i]->vel * frame_time, map_size); ! } ! } ! checksync(); - //test_pointers(); - //check_physics_correctness(); - {_STACKTRACE("Physics::calculate() - presence calculation") //call Presence calculate functions ! for (i = 0; i < num_presences; i += 1) { if (presence[i]->exists()) presence[i]->calculate(); ! checksync(); ! } ! } ! //test_pointers(); ! //check_physics_correctness(); //call objects calculate functions ! {_STACKTRACE("Physics::calculate() - item calculation") for (i = 0; i < num_items; i += 1) { --- 1489,1511 ---- } item[i]->pos = normalize(item[i]->pos + item[i]->vel * frame_time, map_size); ! } ! ! //call Presence calculate functions ! for (i = 0; i < num_presences; i += 1) ! { if (presence[i]->exists()) presence[i]->calculate(); ! ! } ! //call objects calculate functions ! int time = 0; ! int dt_longest = 0; ! int i_longest = 0; ! for (i = 0; i < num_items; i += 1) { *************** *** 1549,1557 **** } item[i]->calculate(); ! //xxx costly check... ! //check_physics_correctness(); ! // try to intercept a couple of errors that are possible here ... --- 1517,1535 ---- } + time = get_time(); + item[i]->calculate(); + + int dt = get_time() - time; + if (dt > dt_longest) + { + dt_longest = dt; + i_longest = i; + } ! if (dt_longest > 1) ! { ! message.print(100, 14, "longest duration = item [%s]", item[i_longest]->get_identity()); ! } // try to intercept a couple of errors that are possible here ... *************** *** 1568,1582 **** tw_error("Ship pointer isn't cleaned up in [%s]", item[i]->get_identity()); } } - checksync(); - } - } - //test_pointers(); - check_physics_correctness(); ! //prepare quadrants stuff ! {_STACKTRACE("Physics::calculate() - quadrants stuff") for(i = 0; i < QUADS_TOTAL; i += 1) { quadrant[i] = NULL; --- 1546,1565 ---- tw_error("Ship pointer isn't cleaned up in [%s]", item[i]->get_identity()); } + + if (!(item[i]->attributes & ATTRIB_INGAME)) + { + tw_error("This item [%s] is not in-game", item[i]->get_identity()); + } } ! } ! ! if (dt_longest > 1) ! { ! message.print(100, 14, "longest duration = item [%s]", item[i_longest]->get_identity()); ! } ! for(i = 0; i < QUADS_TOTAL; i += 1) { quadrant[i] = NULL; *************** *** 1593,1619 **** else item[i]->qnext = NULL; } - } - checksync(); //check for collisions - {_STACKTRACE("Physics::calculate() - collisions") - collide(); - } - //test_pointers(); - //check_physics_correctness(); - checksync(); ! {_STACKTRACE("Physics::calculate() - presence destruction") //remove presences that have been dead long enough ! for(i = 0; i < num_presences; i ++) { if (presence[i]->state == -DEATH_FRAMES) { Presence *tmp = presence[i]; ! num_presences -= 1; ! if (num_presences > i) ! memmove(&presence[i], &presence[i+1], sizeof(Presence*) * (num_presences-i)); - i -= 1; delete tmp; } --- 1576,1597 ---- else item[i]->qnext = NULL; } //check for collisions ! collide(); ! //remove presences that have been dead long enough ! int count_undead = 0; ! for(i = 0; i < num_presences; i ++) ! { if (presence[i]->state == -DEATH_FRAMES) { Presence *tmp = presence[i]; ! //num_presences -= 1; ! //if (num_presences > i) ! // memmove(&presence[i], &presence[i+1], sizeof(Presence*) * (num_presences-i)); ! //i -= 1; delete tmp; } *************** *** 1622,1655 **** //if (presence[i]->state == 0) presence[i]->death(); presence[i]->state -= 1; } } - } - } - //test_pointers(); - //check_physics_correctness(); ! checksync(); //remove objects that have been dead long enough ! {_STACKTRACE("Physics::calculate() - item destruction") ! for(i = 0; i < num_items; i ++) { if (item[i]->state == -DEATH_FRAMES) { SpaceLocation *tmp = item[i]; ! num_items -= 1; ! ! if (num_items > i) ! memmove(&item[i], &item[i+1], (num_items-i) * sizeof(SpaceLocation*)); ! i -= 1; const char *name = tmp->get_identity(); ! //delete tmp; delete_location(tmp); ! //xxx despite that TEST, it's still going wrong here !! So, something gets deleted outside of this physics, after being added to the physics... nasty!. ! // it's the CHORALI EXTRACTOR !!!! But, why ???? } } for(i = 0; i < num_items; i ++) --- 1600,1647 ---- //if (presence[i]->state == 0) presence[i]->death(); presence[i]->state -= 1; + } + + presence[count_undead] = presence[i]; + ++count_undead; } ! ! } ! ! num_presences = count_undead; //remove objects that have been dead long enough ! ! count_undead = 0; ! ! for(i = 0; i < num_items; i ++) ! { if (item[i]->state == -DEATH_FRAMES) { SpaceLocation *tmp = item[i]; ! //num_items -= 1; ! //if (num_items > i) ! // memmove(&item[i], &item[i+1], (num_items-i) * sizeof(SpaceLocation*)); ! //i -= 1; ! const char *name = tmp->get_identity(); ! char str[128]; ! strcpy(str, tmp->get_identity()); // remember the name ! delete_location(tmp); ! ! } else { ! ! item[count_undead] = item[i]; ! ++count_undead; } + } + num_items = count_undead; + for(i = 0; i < num_items; i ++) *************** *** 1667,1688 **** item[i]->state -= 1; } - } - } - checksync(); - test_pointers(); - check_physics_correctness(); ! //remove dead listings ! /*{STACKTRACE ! int deleted = 0; ! for (i = 0; i + deleted < num_listed; i += 1) { ! if (listed[i].serial == 0) deleted += 1; ! if (deleted) listed[i] = listed[i+deleted]; } - num_listed -= deleted; - - }*/ ! checksync(); return; --- 1659,1671 ---- item[i]->state -= 1; } ! if (item[i]->state > 1) ! { ! tw_error("State is higher than 1"); ! } } ! test_pointers(); ! check_physics_correctness(); return; *************** *** 1709,1713 **** // message.print(1, 15, "frame rate = %i ms", int(game_frame_rate)); - //check_physics_correctness(); #endif --- 1692,1695 ---- *************** *** 1715,1718 **** --- 1697,1701 ---- ::render_time = this->game_time; + /* //add presences to list j = num_presences; *************** *** 1726,1729 **** --- 1709,1738 ---- j += i; + */ + + j = 0; + + for ( i = 0; i < num_presences; ++i ) + { + if (presence[i]->exists()) + { + animate_buffer[j] = presence[i]; + ++j; + if (j >= ANIMATE_BUFFER_SIZE) + break; + } + } + + for ( i = 0; i < num_items; ++i ) + { + if (item[i]->exists()) + { + animate_buffer[j] = item[i]; + ++j; + if (j >= ANIMATE_BUFFER_SIZE) + break; + } + } + qsort(animate_buffer, j, sizeof(SpaceLocation*), compare_depth); prepare(); *************** *** 1731,1734 **** --- 1740,1750 ---- aa_set_background ( back ); + if (j >= ANIMATE_BUFFER_SIZE) + { + tw_error("reaching animation buffer ... should not happen"); + } + + int animate_buffersize = j; + // timing, for networking flushes int time = get_time(); *************** *** 1757,1763 **** tw_error("Objects are not allowed to die during animation()"); } - physics_allowed = false; animate_buffer[i]->animate(frame); physics_allowed = true; } --- 1773,1780 ---- tw_error("Objects are not allowed to die during animation()"); } physics_allowed = false; + animate_buffer[i]->animate(frame); + physics_allowed = true; } *************** *** 1792,1799 **** - //check_physics_correctness(); } - //check_physics_correctness(); return; --- 1809,1814 ---- *************** *** 1928,1932 **** Query q; for (i = 0; i < num_items; i += 1) { ! if (item[i]->exists() && item[i]->detectable() && (item[i]->collide_flag_sameship | item[i]->collide_flag_sameteam | item[i]->collide_flag_anyone) && !(item[i]->attributes & ATTRIB_COLLIDE_STATIC)) { --- 1943,1947 ---- Query q; for (i = 0; i < num_items; i += 1) { ! if (item[i] && item[i]->exists() && item[i]->detectable() && (item[i]->collide_flag_sameship | item[i]->collide_flag_sameteam | item[i]->collide_flag_anyone) && !(item[i]->attributes & ATTRIB_COLLIDE_STATIC)) { Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** mship.cpp 28 Aug 2005 20:31:32 -0000 1.43 --- mship.cpp 3 Sep 2005 19:49:45 -0000 1.44 *************** *** 504,522 **** last_override_control = 0; } - - #ifdef _DEBUG - // error check: - if (physics) - { - if (control && control->exists() && (control->ship == this) ) - { - tw_error("Ship is deleted, but the control owned by the ship still exists!"); - } - - if (control) - control->ship = 0; - } - #endif - } --- 504,507 ---- *************** *** 621,625 **** --- 606,613 ---- death_counter += frame_time; if (death_counter > 700 * (15+mass)/35 || death_counter > 3000) //smaller ships will make smaller explosions ; GEO: but a real upper limit is also good to have + { state = 0; //die already + //message.print(1500, 12, "Ship [%s] is now state=0", get_identity()); + } return; *************** *** 628,634 **** ! if (control) { ! /* #ifdef _DEBUG if (exists() && (control->ship != this) && (control->ship != ship)) --- 616,626 ---- ! if (control && !control->exists()) ! control = 0; ! if (control) ! { ! ! /* this test does not work in case of the teron builder #ifdef _DEBUG if (exists() && (control->ship != this) && (control->ship != ship)) *************** *** 662,666 **** target_closest = 1&&(nextkeys & keyflag::closest); ! if (nextkeys & keyflag::suicide) { crew = 0; play_sound((SAMPLE *)(melee[MELEE_BOOMSHIP].dat)); --- 654,661 ---- target_closest = 1&&(nextkeys & keyflag::closest); ! if (nextkeys & keyflag::suicide) ! { ! handle_damage(this, 999, 999); ! /* crew = 0; play_sound((SAMPLE *)(melee[MELEE_BOOMSHIP].dat)); *************** *** 679,682 **** --- 674,678 ---- attributes &= ~ATTRIB_NOTIFY_ON_DEATH; } + */ } *************** *** 684,688 **** - if (!control->exists()) control = NULL; } --- 680,683 ---- *************** *** 926,929 **** --- 921,942 ---- if (attributes & ATTRIB_NOTIFY_ON_DEATH) { game->ship_died(this, source); + + // problem: + // this resets the counter. This is reset, while the ship is still alive (dying), + // and the control still "owns" the ship. + // IF by some mishap, another ship died just a little earlier, and the counter has already + // been reset ... then, this ship could still be in the dying phase while the moment + // for choosing a new ship has passed (and it'll not be re-set either, cause this own + // moment to reset counter has already passed...)... therefore, remove control. So that + // choose-new-ships will know to choose a new ship. + if (control) + { + control->select_ship(0, 0); + control = 0; + } + // ok, end of the addition (geo). + // ... note that originally, the death_counter check was also included somewhere, but + // I think this is more explicit... + attributes &= ~ATTRIB_NOTIFY_ON_DEATH; } *************** *** 1147,1151 **** // extra check // note that if this happens, there's something wrong in the ships' constructor... ! if (sprite_index >= sprite->frames()) sprite_index = 0; --- 1160,1164 ---- // extra check // note that if this happens, there's something wrong in the ships' constructor... ! if (sprite_index < 0 || sprite_index >= sprite->frames()) sprite_index = 0; *************** *** 1172,1180 **** if (count_delay_iterations >= DEATH_FRAMES-3) // I'm not sure, how many you need. { ! // this is needed, because often ships have components which are created on the spot... // these are vulnerable, and can die. Then, ship-specific pointers get invalid (objects // are removed from memory). Thus, we need need (hackish) some time before objects are removed. ! // What we really need, is a Ship::add2game() function, which creates the components when ! // it's time. tw_error("Phasing takes too long; need more time for pointer-checks!"); } --- 1185,1192 ---- if (count_delay_iterations >= DEATH_FRAMES-3) // I'm not sure, how many you need. { ! // this is needed, because sometimes ships have components which are created on the spot... // these are vulnerable, and can die. Then, ship-specific pointers get invalid (objects // are removed from memory). Thus, we need need (hackish) some time before objects are removed. ! // notice that this can be avoided by the ... "materialize" function. tw_error("Phasing takes too long; need more time for pointer-checks!"); } *************** *** 1201,1204 **** --- 1213,1221 ---- } + if (exists() && (color_index < 0 || color_index >= num_colors)) + { + tw_error("phaser index mismatch: should not occur"); + } + if (phaser_step_position < phaser_step_size) { if (ship && !ship->exists()) *************** *** 1209,1217 **** Vector2 d = rel_pos / phaser_steps; game->add(new Phaser(this, pos + d, rel_pos-d, ship, sprite, sprite_index, colors, num_colors, frame_size, phaser_steps-1, phaser_step_size)); } else if (ship) { game->add(ship); ship->materialize(); ! ship = NULL; } } --- 1226,1235 ---- Vector2 d = rel_pos / phaser_steps; game->add(new Phaser(this, pos + d, rel_pos-d, ship, sprite, sprite_index, colors, num_colors, frame_size, phaser_steps-1, phaser_step_size)); + ship = 0; } else if (ship) { game->add(ship); ship->materialize(); ! ship = 0; } } |
|
From: Rob <geo...@us...> - 2005-09-03 19:49:54
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2402/source Modified Files: melee.h Log Message: some minor bugfixes Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** melee.h 21 Aug 2005 13:55:29 -0000 1.26 --- melee.h 3 Sep 2005 19:49:45 -0000 1.27 *************** *** 405,409 **** int sign(double a); ! inline int get_index(double angle, double o=PI/2, int n=64) {int i = iround((o + angle) * n / PI2); while (i < 0) i += n; while (i >= n) i -= n; return i;} --- 405,409 ---- int sign(double a); ! int get_index(double angle, double o=PI/2, int n=64);// {int i = iround((o + angle) * n / PI2); while (i < 0) i += n; while (i >= n) i -= n; return i;} |
|
From: Rob <geo...@us...> - 2005-09-03 19:49:53
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2402/source/util Modified Files: errors.cpp sounds.cpp Log Message: some minor bugfixes Index: errors.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/errors.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** errors.cpp 28 Aug 2005 20:33:17 -0000 1.13 --- errors.cpp 3 Sep 2005 19:49:45 -0000 1.14 *************** *** 25,28 **** --- 25,29 ---- return; + /* int i; for ( i = 0; i < physics->num_items; ++i ) *************** *** 37,40 **** --- 38,42 ---- o->vel.x, o->vel.y); } + */ } Index: sounds.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/sounds.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sounds.cpp 24 Mar 2004 23:51:45 -0000 1.6 --- sounds.cpp 3 Sep 2005 19:49:45 -0000 1.7 *************** *** 9,12 **** --- 9,15 ---- #include "errors.h" //only used for log_debug() function + //#include "../melee.h" + #include "../melee/mframe.h" + //#if defined DIGI_DIRECTAMX //# define DIGI_TW DIGI_DIRECTAMX(0) *************** *** 119,129 **** return; } int SoundSystem::play (SAMPLE *spl, int vol, int pan, int freq, bool loop) { ! if ((state & (ENABLED | SOUND_ON)) == (ENABLED | SOUND_ON)) { //if (freq > 4535) freq = 4535; //I THINK that the 4536 bug is specific to my sound hardware, so that's commented out return ::play_sample (spl, (vol * sound_volume) >> 8, pan, freq, loop); ! } ! else return -1; } void SoundSystem::stop (SAMPLE *spl) { --- 122,162 ---- return; } + + void check_sample_duration(SAMPLE *spl, int freq, bool loop) + { + if (!physics) + return; + + if (loop) + { + tw_error("a looped option for a temporary SAMPLE is not allowed"); + } else { + + // frequency modifier. + double factor = double(freq) / 1000.0; + + // duration in seconds. + double duration = double(spl->len) / (double(spl->freq) * factor); + + // available time in seconds. + double time_available = DEATH_FRAMES * physics->frame_time * 1E-3; + if ( duration > time_available ) + { + tw_error("the sample might disappear too soon; increase DEATH_FRAMES"); + } + } + + } + int SoundSystem::play (SAMPLE *spl, int vol, int pan, int freq, bool loop) { ! if ((state & (ENABLED | SOUND_ON)) == (ENABLED | SOUND_ON)) ! { //if (freq > 4535) freq = 4535; //I THINK that the 4536 bug is specific to my sound hardware, so that's commented out + check_sample_duration(spl, freq, loop); return ::play_sample (spl, (vol * sound_volume) >> 8, pan, freq, loop); ! } else { ! return -1; ! } } void SoundSystem::stop (SAMPLE *spl) { *************** *** 142,149 **** else return; } void SoundSystem::play_music (Music *music, int loop) { ! if ((state & (MOD_ENABLED | MUSIC_ON)) == (MOD_ENABLED | MUSIC_ON)) { ::play_mod(music, loop); ! } fake_mod_playing = loop; if (fake_mod_playing) --- 175,208 ---- else return; } + + + void check_music_duration(JGMOD *music, bool loop) + { + if (!physics) + return; + + if (loop) + { + tw_error("a looped option for a temporary JGMOD is not allowed"); + } else { + double time_available = DEATH_FRAMES * physics->frame_time * 1E-3; + + // I do not know how to calculate the duration of a mod... + // so I'll just be on the safe side, with 20 seconds or so. + if (time_available < 20.0) + { + tw_error("the mod music might disappear too soon; increase DEATH_FRAMES"); + } + } + + } + void SoundSystem::play_music (Music *music, int loop) { ! if ((state & (MOD_ENABLED | MUSIC_ON)) == (MOD_ENABLED | MUSIC_ON)) ! { ! check_music_duration(music, loop); ::play_mod(music, loop); ! } ! fake_mod_playing = loop; if (fake_mod_playing) |
|
From: Rob <geo...@us...> - 2005-09-03 19:49:53
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2402/source/games Modified Files: gflmelee.cpp Log Message: some minor bugfixes Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** gflmelee.cpp 28 Aug 2005 20:31:00 -0000 1.30 --- gflmelee.cpp 3 Sep 2005 19:49:44 -0000 1.31 *************** *** 87,103 **** - - extern int PANEL_WIDTH; - extern int PANEL_HEIGHT; - extern int CAPTAIN_X; - extern int CAPTAIN_Y; - extern int PANEL_DEATH_FRAMES; - extern int crew_x; - extern int crew_y; - extern int batt_x; - extern int batt_y; - - - // most of this is copied from ZRadar. class YRadar : public Presence --- 87,90 ---- |
|
From: Rob <geo...@us...> - 2005-09-03 19:49:04
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2269/source/newships Modified Files: shpclofl.cpp shpgarty.cpp Log Message: bugfix Index: shpclofl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpclofl.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpclofl.cpp 28 Aug 2005 20:34:07 -0000 1.16 --- shpclofl.cpp 3 Sep 2005 19:48:56 -0000 1.17 *************** *** 212,216 **** } ! if ( mother && mother->exists() ) tracepos[Npos-1] = mother->normal_pos(); else --- 212,216 ---- } ! if ( mother ) tracepos[Npos-1] = mother->normal_pos(); else *************** *** 218,222 **** double v; ! if ( mother && mother->exists() ) v = mother->vel.magnitude(); else --- 218,222 ---- double v; ! if ( mother ) v = mother->vel.magnitude(); else Index: shpgarty.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgarty.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpgarty.cpp 28 Aug 2005 20:34:08 -0000 1.18 --- shpgarty.cpp 3 Sep 2005 19:48:56 -0000 1.19 *************** *** 428,433 **** STACKTRACE ! if(released) Shot::calculate(); ! else SpaceObject::calculate(); if (!exists()) return; --- 428,435 ---- STACKTRACE ! if(released) ! Shot::calculate(); ! else ! SpaceObject::calculate(); if (!exists()) return; |
|
From: Rob <geo...@us...> - 2005-08-28 20:43:03
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6782/source/gamex Modified Files: gamegeneral.cpp Log Message: debugging Index: gamegeneral.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamegeneral.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** gamegeneral.cpp 24 Mar 2004 23:51:36 -0000 1.18 --- gamegeneral.cpp 28 Aug 2005 20:42:55 -0000 1.19 *************** *** 416,420 **** Query a; ! for (a.begin(this, OBJECT_LAYERS, range2); a.current; a.next() ) { double d; --- 416,420 ---- Query a; ! for (a.begin(this, OBJECT_LAYERS, range2, QUERY_OBJECT); a.current; a.next() ) { double d; |
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5054/source/newships Modified Files: shpaktgu.cpp shpalabc.cpp shpalckr.cpp shpalhdr.cpp shpalhha.cpp shparkpi.cpp shpastba.cpp shpayrbs.cpp shpbahbu.cpp shpbatde.cpp shpbogce.cpp shpbubbo.cpp shpchoex.cpp shpclofl.cpp shpconca.cpp shpcrapl.cpp shpcrore.cpp shpdajem.cpp shpdeees.cpp shpdjila.cpp shpdragr.cpp shpducla.cpp shpdyzha.cpp shpearc2.cpp shpearc3.cpp shpfiear.cpp shpfopsl.cpp shpforsh.cpp shpgahmo.cpp shpgarty.cpp shpgerhe.cpp shpgeror.cpp shpglads.cpp shphotsp.cpp shphubde.cpp shphydcr.cpp shpilwsp.cpp shpimpka.cpp shpjnkla.cpp shpjurcu.cpp shpjygst.cpp shpkabwe.cpp shpkatpo.cpp shpklidr.cpp shpkolfl.cpp shpkorsi.cpp shplyrwa.cpp shpmoisp.cpp shpmontr.cpp shpnarlu.cpp shpoliha.cpp shpplane.cpp shpqlore.cpp shpraame.cpp shprogsq.cpp shpsamat.cpp shpsclfr.cpp shpsefn2.cpp shpstaba.cpp shptauar.cpp shptaubo.cpp shptauem.cpp shptaule.cpp shptaumc.cpp shptautu.cpp shpterbi.cpp shptrige.cpp shptulra.cpp shpulzin.cpp shpvelcr.cpp shpvenke.cpp shpvezba.cpp shpvirli.cpp shpwassu.cpp shpxilcr.cpp shpyevme.cpp shpyurpa.cpp Log Message: debugging Index: shphotsp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphotsp.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shphotsp.cpp 23 Aug 2005 22:18:11 -0000 1.14 --- shphotsp.cpp 28 Aug 2005 20:34:08 -0000 1.15 *************** *** 442,446 **** Query q; ! for (q.begin(this, layers, passiveRange); q.current; q.next()) { SpaceObject *o = q.currento; --- 442,446 ---- Query q; ! for (q.begin(this, layers, passiveRange, QUERY_OBJECT); q.current; q.next()) { SpaceObject *o = q.currento; Index: shpglads.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpglads.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpglads.cpp 14 Aug 2005 16:14:32 -0000 1.12 --- shpglads.cpp 28 Aug 2005 20:34:08 -0000 1.13 *************** *** 132,136 **** double a; Query q; ! for (q.begin(this, bit(LAYER_SHIPS),(laser_range *.80)); q.current; q.next()) { o = q.currento; a = normalize(trajectory_angle(o)-angle,360); --- 132,136 ---- double a; Query q; ! for (q.begin(this, bit(LAYER_SHIPS),(laser_range *.80), QUERY_OBJECT); q.current; q.next()) { o = q.currento; a = normalize(trajectory_angle(o)-angle,360); Index: shptautu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptautu.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shptautu.cpp 14 Aug 2005 16:14:32 -0000 1.11 --- shptautu.cpp 28 Aug 2005 20:34:08 -0000 1.12 *************** *** 282,286 **** Query q; double aa, bb; ! for (q.begin(this, bit(LAYER_SHOTS), 30); q.currento; q.next()) if (q.currento->getID() == id) { aa = (trajectory_angle(q.currento)+PI); --- 282,286 ---- Query q; double aa, bb; ! for (q.begin(this, bit(LAYER_SHOTS), 30, QUERY_OBJECT); q.currento; q.next()) if (q.currento->getID() == id) { aa = (trajectory_angle(q.currento)+PI); Index: shprogsq.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shprogsq.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shprogsq.cpp 16 Aug 2005 23:21:02 -0000 1.18 --- shprogsq.cpp 28 Aug 2005 20:34:08 -0000 1.19 *************** *** 232,236 **** fighter[i]->pos = fighter[i]->idealpos; fighter[i]->angle = player_angle; ! fighter[i]->vel = 0; } --- 232,236 ---- fighter[i]->pos = fighter[i]->idealpos; fighter[i]->angle = player_angle; ! fighter[i]->set_vel ( 0 ); } *************** *** 411,415 **** SpaceObject *o; Query a; ! for (a.begin(this, bit(LAYER_SHIPS), 999999.0); a.current; a.next()) { o = a.currento; --- 411,415 ---- SpaceObject *o; Query a; ! for (a.begin(this, bit(LAYER_SHIPS), 999999.0, QUERY_OBJECT); a.current; a.next()) { o = a.currento; Index: shpdjila.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdjila.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpdjila.cpp 11 Jul 2005 00:25:30 -0000 1.10 --- shpdjila.cpp 28 Aug 2005 20:34:07 -0000 1.11 *************** *** 241,245 **** Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { --- 241,245 ---- Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { Index: shpdajem.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdajem.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpdajem.cpp 26 Aug 2005 21:55:19 -0000 1.16 --- shpdajem.cpp 28 Aug 2005 20:34:07 -0000 1.17 *************** *** 41,45 **** DajielkaTendril* tendril[30]; DajielkaSanctuary(DajielkaCruiser* ocreator); ! ~DajielkaSanctuary(void); DajielkaTendril* RecreateTendril(DajielkaTendril* DT); virtual void calculate(); --- 41,45 ---- DajielkaTendril* tendril[30]; DajielkaSanctuary(DajielkaCruiser* ocreator); ! virtual void death(); DajielkaTendril* RecreateTendril(DajielkaTendril* DT); virtual void calculate(); *************** *** 92,99 **** DajielkaTendril(DajielkaSanctuary* osanctuary, int odamage, int orange, double ostartingAngle, double orotation); ! ~DajielkaTendril(void); virtual void animate(Frame* space); virtual void calculate(void); virtual void inflict_damage(SpaceObject *other); }; --- 92,101 ---- DajielkaTendril(DajielkaSanctuary* osanctuary, int odamage, int orange, double ostartingAngle, double orotation); ! virtual ~DajielkaTendril(void); virtual void animate(Frame* space); virtual void calculate(void); virtual void inflict_damage(SpaceObject *other); + virtual int handle_damage(SpaceLocation *source, double normal, double direct); + virtual bool DajielkaTendril::die(); }; *************** *** 163,167 **** public: DajielkaCruiser(Vector2 opos, double angle, ShipData *data, unsigned int code); ! ~DajielkaCruiser(void); DajielkaSanctuary* sanctuary; protected: --- 165,169 ---- public: DajielkaCruiser(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual void death(); DajielkaSanctuary* sanctuary; protected: *************** *** 236,241 **** } ! DajielkaCruiser::~DajielkaCruiser(void) { ! STACKTRACE if(sanctuary!=NULL) { sanctuary->state = 0; --- 238,247 ---- } ! void DajielkaCruiser::death() ! { ! STACKTRACE; ! ! Ship::death(); ! if(sanctuary!=NULL) { sanctuary->state = 0; *************** *** 266,296 **** } ! void DajielkaCruiser::calculate(void) { ! STACKTRACE ! if(!fire_special) redeployTime=0; ! if(accumulatedCharge>shipChargeThreshhold) { ! if(batt<batt_max) { ! batt++; ! update_panel = TRUE; ! accumulatedCharge -= shipChargeThreshhold; ! if(batt>batt_max) ! batt=batt_max; ! } ! else ! accumulatedCharge = shipChargeThreshhold; ! } ! if(accumulatedRegeneration>shipRegenerationThreshhold) { ! if(crew<crew_max) { ! crew++; ! update_panel = TRUE; ! accumulatedRegeneration -= shipRegenerationThreshhold; ! if(crew>crew_max) ! crew=crew_max; ! } ! else ! accumulatedRegeneration = shipRegenerationThreshhold; ! } - Ship::calculate(); } --- 272,312 ---- } ! void DajielkaCruiser::calculate(void) ! { ! STACKTRACE; ! ! Ship::calculate(); ! ! if (sanctuary && !sanctuary->exists()) ! sanctuary = 0; ! ! if(!fire_special) ! redeployTime=0; ! ! if(accumulatedCharge>shipChargeThreshhold) ! { ! if(batt<batt_max) { ! batt++; ! update_panel = TRUE; ! accumulatedCharge -= shipChargeThreshhold; ! if(batt>batt_max) ! batt=batt_max; ! } ! else ! accumulatedCharge = shipChargeThreshhold; ! } ! if(accumulatedRegeneration>shipRegenerationThreshhold) ! { ! if(crew<crew_max) { ! crew++; ! update_panel = TRUE; ! accumulatedRegeneration -= shipRegenerationThreshhold; ! if(crew>crew_max) ! crew=crew_max; ! } ! else ! accumulatedRegeneration = shipRegenerationThreshhold; ! } } *************** *** 344,348 **** void DajielkaCrTorpedo::calculate() { ! STACKTRACE AnimatedShot::calculate(); } --- 360,368 ---- void DajielkaCrTorpedo::calculate() { ! STACKTRACE; ! ! if (creator && !creator->exists()) ! creator = 0; ! AnimatedShot::calculate(); } *************** *** 432,437 **** } ! DajielkaSanctuary::~DajielkaSanctuary(void) { ! STACKTRACE int i; for(i=0; i<30; i++) { --- 452,460 ---- } ! void DajielkaSanctuary::death() ! { ! STACKTRACE; ! SpaceObject::death(); ! int i; for(i=0; i<30; i++) { *************** *** 443,449 **** } ! void DajielkaSanctuary::calculate(void) { STACKTRACE; if (creator && !creator->exists()) { --- 466,475 ---- } ! void DajielkaSanctuary::calculate(void) ! { STACKTRACE; + SpaceObject::calculate(); + if (creator && !creator->exists()) { *************** *** 455,466 **** int regenMultiplier; DajielkaSanctuary::addEnergy( iround(energyPerFrame*frame_time/25.0) ); //corrected for click-dependant regeneration. Tau. ! for(i=0;i<30;i++) ! if(tendril[i]!=NULL) ! if(tendril[i]->recreateMe == TRUE) { //tw_error("Want to recreate!"); //tendril[i] = this->RecreateTendril(tendril[i]); } vel = 0; ! SpaceObject::calculate(); regenMultiplier=1; for(j=0;j<regenerationExponent;j++) --- 481,505 ---- int regenMultiplier; DajielkaSanctuary::addEnergy( iround(energyPerFrame*frame_time/25.0) ); //corrected for click-dependant regeneration. Tau. ! ! for ( i = 0; i < 30; i++) ! { ! if (tendril[i]) ! { ! if (!tendril[i]->exists()) ! { ! tw_error("a dead tendril? this should not happen"); ! tendril[i] = 0; ! } ! ! ! if(tendril[i]->recreateMe == TRUE) { //tw_error("Want to recreate!"); //tendril[i] = this->RecreateTendril(tendril[i]); } + } + } + vel = 0; ! regenMultiplier=1; for(j=0;j<regenerationExponent;j++) *************** *** 505,539 **** ! void DajielkaSanctuary::addEnergy(int energy) { ! STACKTRACE ! int i, j; ! int damageBefore, damageAfter; ! for(j=1;j<10 && energy>0;j++) ! { ! for(i=0;i<30 && energy>0;i++) { ! if (tendril[i]->energyLevelPerDamagePoint) ! damageBefore = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageBefore = 0; ! ! if(tendril[i]!=NULL && tendril[i]->state !=0) ! if(tendril[i]->energyLevelPerDamagePoint * j > tendril[i]->energyLevel ! && tendril[i]->energyLevel < tendril[i]->energyLevelMax) { ! tendril[i]->energyLevel += energy; ! energy = 0; ! } ! ! if (tendril[i]->energyLevelPerDamagePoint) ! damageAfter = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageAfter = 0; ! ! if(damageBefore!=damageAfter && tendril[i]->get_length()==0) { ! //tendril[i]=this->RecreateTendril(tendril[i]); ! tendril[i]->isActive = TRUE; ! } ! } ! } } --- 544,586 ---- ! void DajielkaSanctuary::addEnergy(int energy) ! { ! STACKTRACE; ! int i, j; ! int damageBefore, damageAfter; ! for(j=1;j<10 && energy>0;j++) { ! for(i=0;i<30 && energy>0;i++) ! { ! if (tendril[i]) ! { ! if (tendril[i]->energyLevelPerDamagePoint) ! damageBefore = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageBefore = 0; ! ! if (tendril[i]->state !=0) ! { ! if(tendril[i]->energyLevelPerDamagePoint * j > tendril[i]->energyLevel ! && tendril[i]->energyLevel < tendril[i]->energyLevelMax) ! { ! tendril[i]->energyLevel += energy; ! energy = 0; ! } ! } ! ! if (tendril[i]->energyLevelPerDamagePoint) ! damageAfter = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageAfter = 0; ! ! if(damageBefore!=damageAfter && tendril[i]->get_length()==0) ! { ! //tendril[i]=this->RecreateTendril(tendril[i]); ! tendril[i]->isActive = TRUE; ! } ! } ! } ! } } *************** *** 586,624 **** } ! void DajielkaTendril::calculate(void) { STACKTRACE; - if(energyLevel<energyLevelPerDamagePoint) { - isActive = FALSE; - length = 0; - damage_factor = 0; - collide_flag_anyone = 0; - collide_flag_sameteam = 0; - collide_flag_sameship = 0; - } - else { - isActive = TRUE; - length = originalLength; - damage_factor = 1; - collide_flag_anyone = ALL_LAYERS; - collide_flag_sameteam = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); - collide_flag_sameship = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); - } - angle = angle + frame_time / 1000.0 * rotation; - while(angle<0) angle+=PI2; - while(angle>PI2) angle-=PI2; ! if (creator && !creator->exists()) ! { ! creator = 0; ! state = 0; ! } ! ! SpaceLine::calculate(); ! color=palette_color[(int)(energyLevel/energyLevelPerDamagePoint)+7]; ! if(creator!=NULL) ! if(isActive) ! if(regenerationIsTendrilBased==1) ! sanctuary->regenerationCount += frame_time; } --- 633,685 ---- } ! void DajielkaTendril::calculate(void) ! { STACKTRACE; ! SpaceLine::calculate(); ! ! if (creator && !creator->exists()) ! { ! creator = 0; ! //state = 0; ! } ! if (sanctuary && !sanctuary->exists()) ! { ! sanctuary = 0; ! state = 0; ! } ! ! ! if(energyLevel<energyLevelPerDamagePoint) { ! isActive = FALSE; ! length = 0; ! damage_factor = 0; ! collide_flag_anyone = 0; ! collide_flag_sameteam = 0; ! collide_flag_sameship = 0; ! } ! else { ! isActive = TRUE; ! length = originalLength; ! damage_factor = 1; ! collide_flag_anyone = ALL_LAYERS; ! collide_flag_sameteam = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); ! collide_flag_sameship = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); ! } ! angle = angle + frame_time / 1000.0 * rotation; ! while(angle<0) angle+=PI2; ! while(angle>PI2) angle-=PI2; ! ! ! color=palette_color[(int)(energyLevel/energyLevelPerDamagePoint)+7]; ! if (creator && sanctuary) ! { ! if(isActive) ! { ! if(regenerationIsTendrilBased==1) ! sanctuary->regenerationCount += frame_time; ! } ! } } *************** *** 630,633 **** --- 691,701 ---- } + int DajielkaTendril::handle_damage(SpaceLocation *source, double normal, double direct) + { + // don't die. + return 0; + } + + void DajielkaTendril::inflict_damage(SpaceObject *other) { STACKTRACE *************** *** 692,699 **** } ! DajielkaTendril::~DajielkaTendril(void) { ! if(sanctuary!=NULL) ! if(creator!=NULL) *pointerToMe = NULL; } --- 760,777 ---- } ! DajielkaTendril::~DajielkaTendril(void) ! { ! /* //xxx I don't think this is necessary - geo. ! if(sanctuary!=NULL && creator!=NULL) ! { *pointerToMe = NULL; + tw_error("what is this ??"); + } + */ + } + + bool DajielkaTendril::die() + { + return false; // this is not allowed to die !! } Index: shphydcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphydcr.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shphydcr.cpp 26 Aug 2005 21:55:19 -0000 1.16 --- shphydcr.cpp 28 Aug 2005 20:34:08 -0000 1.17 *************** *** 147,151 **** SpaceSprite *osprite, SpaceObject* oTarget); ! ~HydrovarEsFighter(void); virtual void calculate(); --- 147,151 ---- SpaceSprite *osprite, SpaceObject* oTarget); ! virtual ~HydrovarEsFighter(void); virtual void calculate(); *************** *** 558,562 **** if(this->targetsShots) searchLayers += bit(LAYER_SHOTS); if(this->targetsSpecial) searchLayers += bit(LAYER_SPECIAL); ! for (a.begin(this, searchLayers, trackingRange); a.current; a.next()) { // if(a.currento==NULL) // tw_error("Null object during search loop."); --- 558,562 ---- if(this->targetsShots) searchLayers += bit(LAYER_SHOTS); if(this->targetsSpecial) searchLayers += bit(LAYER_SPECIAL); ! for (a.begin(this, searchLayers, trackingRange, QUERY_OBJECT); a.current; a.next()) { // if(a.currento==NULL) // tw_error("Null object during search loop."); Index: shpvenke.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvenke.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpvenke.cpp 14 Aug 2005 16:14:32 -0000 1.15 --- shpvenke.cpp 28 Aug 2005 20:34:08 -0000 1.16 *************** *** 78,82 **** VenKekThrust* Thrust; VenKekFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual ~VenKekFrigate(void); protected: void createThrust(); --- 78,82 ---- VenKekThrust* Thrust; VenKekFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual void death(); protected: void createThrust(); *************** *** 124,128 **** virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! virtual ~VenKekThrust(void); }; --- 124,128 ---- virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! virtual void death(); }; *************** *** 193,198 **** ! VenKekFrigate::~VenKekFrigate(void) { ! STACKTRACE if(Thrust!=NULL && Thrust->exists()) Thrust->state = 0; // possible crash problem. } --- 193,200 ---- ! void VenKekFrigate::death() ! { ! STACKTRACE; ! Ship::death(); if(Thrust!=NULL && Thrust->exists()) Thrust->state = 0; // possible crash problem. } *************** *** 348,352 **** 0, 1, -1, 1, this, data->spriteSpecial, 0); Thrust->creator = this; ! Thrust->vel = this->vel; Thrust->pos = this->pos; Thrust->damage_factor = 1; --- 350,354 ---- 0, 1, -1, 1, this, data->spriteSpecial, 0); Thrust->creator = this; ! Thrust->set_vel( this->vel ); Thrust->pos = this->pos; Thrust->damage_factor = 1; *************** *** 439,443 **** this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! this->vel = creator->vel; } Missile::calculate(); --- 441,445 ---- this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! set_vel( creator->vel ); } Missile::calculate(); *************** *** 483,487 **** } ! VenKekThrust::~VenKekThrust(void) { if(!creator) return; if(!creator->exists()) return; --- 485,491 ---- } ! void VenKekThrust::death() ! { ! Missile::death(); if(!creator) return; if(!creator->exists()) return; Index: shptulra.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptulra.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shptulra.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shptulra.cpp 28 Aug 2005 20:34:08 -0000 1.18 *************** *** 326,331 **** } if( pos != P ) ship->translate( pos - P ); ! if( vel != PV ){ ! ship->vel = PV; } } --- 326,331 ---- } if( pos != P ) ship->translate( pos - P ); ! if( ship && vel != PV ){ ! ship->set_vel( PV ); } } *************** *** 431,435 **** Query q; ! for( q.begin( this, OBJECT_LAYERS, srange ); q.currento; q.next() ){ if( q.currento->isObject() && !q.currento->sameShip(this) ){ damage(this, armour); --- 431,435 ---- Query q; ! for( q.begin( this, OBJECT_LAYERS, srange, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->isObject() && !q.currento->sameShip(this) ){ damage(this, armour); *************** *** 460,464 **** if( s && !exists() ){ Query q; ! for( q.begin( this, OBJECT_LAYERS, drange ); q.currento; q.next() ){ // we could use a distance dependant damage factor // int dmg = (int)ceil((drange - distance(q.currento)) / drange * damage_factor); --- 460,464 ---- if( s && !exists() ){ Query q; ! for( q.begin( this, OBJECT_LAYERS, drange, QUERY_OBJECT ); q.currento; q.next() ){ // we could use a distance dependant damage factor // int dmg = (int)ceil((drange - distance(q.currento)) / drange * damage_factor); Index: shptaumc.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaumc.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shptaumc.cpp 11 Jul 2005 00:25:32 -0000 1.10 --- shptaumc.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 412,416 **** Query q; double a_a, a0 = -1e20; ! for (q.begin(this, OBJECT_LAYERS, range - d); q.currento; q.next()) if ( (!q.currento->sameTeam(this)) && (q.currento->collide_flag_anyone&bit(layer)) && !q.currento->isPlanet() ) { --- 412,416 ---- Query q; double a_a, a0 = -1e20; ! for (q.begin(this, OBJECT_LAYERS, range - d, QUERY_OBJECT); q.currento; q.next()) if ( (!q.currento->sameTeam(this)) && (q.currento->collide_flag_anyone&bit(layer)) && !q.currento->isPlanet() ) { *************** *** 500,504 **** Query q; double r, d; ! for (q.begin(this, OBJECT_LAYERS, blast_range); q.currento; q.next()) { r = distance(q.currento) / blast_range; if (r > 1) --- 500,504 ---- Query q; double r, d; ! for (q.begin(this, OBJECT_LAYERS, blast_range, QUERY_OBJECT); q.currento; q.next()) { r = distance(q.currento) / blast_range; if (r > 1) Index: shpbogce.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbogce.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpbogce.cpp 14 Aug 2005 16:14:32 -0000 1.9 --- shpbogce.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 260,264 **** links_num = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range); q.currento; q.next()) { if (q.currento->getID() == BOGEI_CENTURION_ID) --- 260,264 ---- links_num = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range, QUERY_OBJECT); q.currento; q.next()) { if (q.currento->getID() == BOGEI_CENTURION_ID) *************** *** 377,381 **** int ln = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range); q.currento; q.next()) if (q.currento->getID() == BOGEI_CENTURION_ID) { bro = (BoggCenturion*)q.currento; --- 377,381 ---- int ln = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range, QUERY_OBJECT); q.currento; q.next()) if (q.currento->getID() == BOGEI_CENTURION_ID) { bro = (BoggCenturion*)q.currento; Index: shpkatpo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkatpo.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpkatpo.cpp 23 Jul 2005 14:08:08 -0000 1.19 --- shpkatpo.cpp 28 Aug 2005 20:34:08 -0000 1.20 *************** *** 251,255 **** morph->crew = crew; // set it's attributes morph->batt = batt - special_drain; // [battery has to be decreased now] ! morph->vel = vel; update_panel = true; // maybe the colors changed --- 251,255 ---- morph->crew = crew; // set it's attributes morph->batt = batt - special_drain; // [battery has to be decreased now] ! morph->set_vel ( vel ); update_panel = true; // maybe the colors changed Index: shpnarlu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpnarlu.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpnarlu.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpnarlu.cpp 28 Aug 2005 20:34:08 -0000 1.19 *************** *** 36,40 **** BITMAP *lightningbmp; ! ~NaroolLurker(); --- 36,40 ---- BITMAP *lightningbmp; ! virtual ~NaroolLurker(); Index: shpalhdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalhdr.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpalhdr.cpp 2 Aug 2005 00:23:40 -0000 1.15 --- shpalhdr.cpp 28 Aug 2005 20:34:07 -0000 1.16 *************** *** 56,60 **** public: AlhordianDreadnought(Vector2 opos, double angle, ShipData *data, unsigned int code); - virtual ~AlhordianDreadnought(void); protected: virtual int activate_weapon(); --- 56,59 ---- *************** *** 169,175 **** } ! AlhordianDreadnought::~AlhordianDreadnought(void) { ! ; ! } void AlhordianDreadnought::calculate() --- 168,172 ---- } ! void AlhordianDreadnought::calculate() *************** *** 372,376 **** armour = (1 - fractionDone) * startArmour + fractionDone * endArmour; this->v *= (1 - this->friction * frame_time); ! this->vel = unit_vector(this->angle) * this->v; } --- 369,373 ---- armour = (1 - fractionDone) * startArmour + fractionDone * endArmour; this->v *= (1 - this->friction * frame_time); ! this->set_vel ( unit_vector(this->angle) * this->v ); } Index: shpcrore.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpcrore.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpcrore.cpp 2 Aug 2005 00:23:44 -0000 1.9 --- shpcrore.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 144,148 **** Vector2 nvel, ovel; ! for (q.begin(this, OBJECT_LAYERS, specialRange); q.currento; q.next()) { if (((q.currento->mass <= 0) && !q.currento->isShot()) ) continue; xt = 0; xp = 0; --- 144,148 ---- Vector2 nvel, ovel; ! for (q.begin(this, OBJECT_LAYERS, specialRange, QUERY_OBJECT); q.currento; q.next()) { if (((q.currento->mass <= 0) && !q.currento->isShot()) ) continue; xt = 0; xp = 0; *************** *** 203,207 **** // q.currento->vx = ovx; // q.currento->vy = ovy; ! q.currento->vel = ovel; } } --- 203,207 ---- // q.currento->vx = ovx; // q.currento->vy = ovy; ! q.currento->set_vel ( ovel ); } } *************** *** 267,271 **** ! for (q.begin(this, OBJECT_LAYERS, blast_range); q.currento; q.next()) { if (q.currento != direct_hit) --- 267,271 ---- ! for (q.begin(this, OBJECT_LAYERS, blast_range, QUERY_OBJECT); q.currento; q.next()) { if (q.currento != direct_hit) Index: shpfiear.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpfiear.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpfiear.cpp 21 Aug 2005 12:44:01 -0000 1.16 --- shpfiear.cpp 28 Aug 2005 20:34:08 -0000 1.17 *************** *** 180,184 **** Query q; ! for (q.begin(this, OBJECT_LAYERS, repulsor_radius); q.currento; q.next()) { o = q.currento; if (!o->sameShip(this)){ --- 180,184 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS, repulsor_radius, QUERY_OBJECT); q.currento; q.next()) { o = q.currento; if (!o->sameShip(this)){ Index: shpkabwe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkabwe.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpkabwe.cpp 26 Aug 2005 21:55:19 -0000 1.19 --- shpkabwe.cpp 28 Aug 2005 20:34:08 -0000 1.20 *************** *** 47,51 **** virtual void collide(SpaceObject *other); //virtual void death(); ! ~KaboHaze(); }; --- 47,51 ---- virtual void collide(SpaceObject *other); //virtual void death(); ! virtual ~KaboHaze(); }; Index: shptaule.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaule.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** shptaule.cpp 23 Aug 2005 22:18:11 -0000 1.22 --- shptaule.cpp 28 Aug 2005 20:34:08 -0000 1.23 *************** *** 323,327 **** Query q; ! for (q.begin(this, bit(LAYER_SHOTS), size.y*4.0); q.currento; q.next()) if (q.currento->getID() == LEVIATHAN_SLIME_FOOD) { --- 323,327 ---- Query q; ! for (q.begin(this, bit(LAYER_SHOTS), size.y*4.0, QUERY_OBJECT); q.currento; q.next()) if (q.currento->getID() == LEVIATHAN_SLIME_FOOD) { Index: shpklidr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpklidr.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpklidr.cpp 2 Aug 2005 00:23:46 -0000 1.11 --- shpklidr.cpp 28 Aug 2005 20:34:08 -0000 1.12 *************** *** 171,175 **** Query a; a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), this->specialRange); for (;a.current;a.next()) { o = a.currento; --- 171,175 ---- Query a; a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), this->specialRange, QUERY_OBJECT); for (;a.current;a.next()) { o = a.currento; *************** *** 269,273 **** this->v *= (1 - this->friction * frame_time); ! this->vel = unit_vector(this->angle) * this->v; } --- 269,273 ---- this->v *= (1 - this->friction * frame_time); ! set_vel( unit_vector(this->angle) * this->v ); } Index: shpdyzha.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdyzha.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpdyzha.cpp 2 Aug 2005 00:23:45 -0000 1.14 --- shpdyzha.cpp 28 Aug 2005 20:34:07 -0000 1.15 *************** *** 320,324 **** // check if anything is in range ... which should be maxed speeded ... Query a; ! for (a.begin(this, OBJECT_LAYERS, range); a.currento; a.next()) { SpaceObject *o = a.currento; --- 320,324 ---- // check if anything is in range ... which should be maxed speeded ... Query a; ! for (a.begin(this, OBJECT_LAYERS, range, QUERY_OBJECT); a.currento; a.next()) { SpaceObject *o = a.currento; Index: shpgarty.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgarty.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpgarty.cpp 2 Aug 2005 13:04:08 -0000 1.17 --- shpgarty.cpp 28 Aug 2005 20:34:08 -0000 1.18 *************** *** 191,195 **** Query q; ! for (q.begin(this, OBJECT_LAYERS, specialRange); q.currento; q.next()) { // bugfix Geo --- 191,195 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS, specialRange, QUERY_OBJECT); q.currento; q.next()) { // bugfix Geo *************** *** 241,245 **** game->add(GRS); GRS->pos = other->pos; ! GRS->vel = other->vel; } } --- 241,245 ---- game->add(GRS); GRS->pos = other->pos; ! GRS->set_vel ( other->vel ); } } *************** *** 346,350 **** { this->pos = targetship->pos; ! this->vel = targetship->vel; } --- 346,350 ---- { this->pos = targetship->pos; ! this->set_vel ( targetship->vel ); } Index: shpraame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpraame.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpraame.cpp 23 Aug 2005 22:18:11 -0000 1.20 --- shpraame.cpp 28 Aug 2005 20:34:08 -0000 1.21 *************** *** 306,310 **** collide_flag_anyone = 0; Query q; ! for (q.begin(oship, bit(LAYER_HOTSPOTS), 10); q.current; q.next()) { if ((q.current->getID() == getID()) && (((RaalrithPoison*)q.current)->oship == oship)) { ((RaalrithPoison*)q.current)->duration = duration; --- 306,310 ---- collide_flag_anyone = 0; Query q; ! for (q.begin(oship, bit(LAYER_HOTSPOTS), 10, QUERY_OBJECT); q.current; q.next()) { if ((q.current->getID() == getID()) && (((RaalrithPoison*)q.current)->oship == oship)) { ((RaalrithPoison*)q.current)->duration = duration; Index: shpstaba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpstaba.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpstaba.cpp 14 Aug 2005 16:14:32 -0000 1.10 --- shpstaba.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 90,94 **** Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { --- 90,94 ---- Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { *************** *** 113,117 **** Query a; ! for (a.begin(this, bit(LAYER_SHIPS), HealRange); a.current; a.next()) { o = (Ship *)a.currento; if((!o->isInvisible()) && o->sameTeam(this)) --- 113,120 ---- Query a; ! for (a.begin(this, bit(LAYER_SHIPS), HealRange, QUERY_OBJECT); a.current; a.next()) { ! if (!o->isShip()) ! continue; ! o = (Ship *)a.currento; if((!o->isInvisible()) && o->sameTeam(this)) Index: shpterbi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpterbi.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpterbi.cpp 26 Aug 2005 21:55:19 -0000 1.10 --- shpterbi.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 535,539 **** }else{ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ if( current_option == option_order_assist_building ){ --- 535,539 ---- }else{ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ if( current_option == option_order_assist_building ){ *************** *** 555,559 **** if( select_all ){ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ data->TERON_SELECTION_SPRITE->animate( --- 555,559 ---- if( select_all ){ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ data->TERON_SELECTION_SPRITE->animate( *************** *** 585,589 **** if( collect_step <= 0 && collectRange ){ Query q; ! for( q.begin( this, bit(LAYER_CBODIES), collectRange ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ collecting = q.currento; --- 585,589 ---- if( collect_step <= 0 && collectRange ){ Query q; ! for( q.begin( this, bit(LAYER_CBODIES), collectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ collecting = q.currento; *************** *** 647,651 **** TeronDrone* next_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( !next_drone && sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ next_drone = (TeronDrone*)q.currento; --- 647,651 ---- TeronDrone* next_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( !next_drone && sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ next_drone = (TeronDrone*)q.currento; *************** *** 665,669 **** TeronDrone* prev_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( q.currento == current_drone ){ if( prev_drone ) break; --- 665,669 ---- TeronDrone* prev_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento == current_drone ){ if( prev_drone ) break; *************** *** 792,796 **** c->temporary = true; ((ControlWussie*)c)->option_velocity[0][0] = scale_velocity( 999 ); ! ((ControlWussie*)c)->option_range[0][0] = weaponRange; if (control->ship != this || control != c) --- 792,796 ---- c->temporary = true; ((ControlWussie*)c)->option_velocity[0][0] = scale_velocity( 999 ); ! ((ControlWussie*)c)->option_range[0][0] = 0.8 * weaponRange; if (control->ship != this || control != c) *************** *** 821,825 **** void TeronDrone::assist_building(){ Query q; ! for( q.begin( this, bit(LAYER_SPECIAL), TERON_DRONE_SIGHT_RANGE ); q.currento; q.next() ){ if( sameShip( q.currento )){ TeronBuildPlatform* platform = ((TeronBuildPlatform*)q.currento); --- 821,825 ---- void TeronDrone::assist_building(){ Query q; ! for( q.begin( this, bit(LAYER_SPECIAL), TERON_DRONE_SIGHT_RANGE, QUERY_OBJECT ); q.currento; q.next() ){ if( sameShip( q.currento )){ TeronBuildPlatform* platform = ((TeronBuildPlatform*)q.currento); *************** *** 843,847 **** double d = TERON_DRONE_SIGHT_RANGE; Query q; ! for( q.begin( this, bit(LAYER_CBODIES), TERON_DRONE_SIGHT_RANGE ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ double i = distance( q.currento ); --- 843,847 ---- double d = TERON_DRONE_SIGHT_RANGE; Query q; ! for( q.begin( this, bit(LAYER_CBODIES), TERON_DRONE_SIGHT_RANGE, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ double i = distance( q.currento ); *************** *** 900,903 **** --- 900,904 ---- game->add( new TeronDroneLaser( this, angle, pallete_color[TERON_DRONE_BEAM_COLOR], weaponRange, 0, time_ratio, this, Vector2(size)*Vector2(0,0.5)/*0.0, 0.5 * h*/, true )); + //xxx 0 instead of -1 ? //vx = -vx; //vy = -vy; *************** *** 1236,1240 **** vel = 0; //base->vx = base->vy = 0; ! base->vel = 0; //base->x = x; //base->y = y; --- 1237,1241 ---- vel = 0; //base->vx = base->vy = 0; ! base->set_vel ( 0 ); //base->x = x; //base->y = y; *************** *** 1331,1334 **** --- 1332,1337 ---- mass = creator->mass; layer = LAYER_SHIPS; + + attributes &= ~ATTRIB_STANDARD_INDEX; } *************** *** 1385,1388 **** --- 1388,1399 ---- collide_flag_anyone = collide_flag_sameteam = collide_flag_sameship = ALL_LAYERS; layer = LAYER_SPECIAL; + + int n = sprite->frames(); + if (sprite_index >= n) + { + tw_error("error in sprite index!"); + } + + attributes &= ~ATTRIB_STANDARD_INDEX; } *************** *** 1395,1399 **** tot = normal + direct; ! if( tot > 0 ){ sprite_index--; if( sprite_index < index_zero ){ --- 1406,1411 ---- tot = normal + direct; ! if( tot > 0 ) ! { sprite_index--; if( sprite_index < index_zero ){ *************** *** 1414,1418 **** state = 0; new_ship->pos = pos; ! new_ship->vel = 0; game->add( new_ship ); new_ship->materialize(); --- 1426,1430 ---- state = 0; new_ship->pos = pos; ! new_ship->set_vel( 0 ); game->add( new_ship ); new_ship->materialize(); Index: shpkolfl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkolfl.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpkolfl.cpp 16 Aug 2005 23:21:02 -0000 1.15 --- shpkolfl.cpp 28 Aug 2005 20:34:08 -0000 1.16 *************** *** 165,169 **** Query a; ! for (a.begin(this, layers, passiveRange); a.current; a.next()) { SpaceObject *o = a.currento; --- 165,169 ---- Query a; ! for (a.begin(this, layers, passiveRange, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; Index: shpearc2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpearc2.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpearc2.cpp 2 Aug 2005 00:23:45 -0000 1.10 --- shpearc2.cpp 28 Aug 2005 20:34:07 -0000 1.11 *************** *** 84,88 **** Query q; for (q.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); q.current; q.next()) { o = q.currento; if (!o->isInvisible() && !o->sameTeam(this) && (o->collide_flag_anyone&bit(LAYER_LINES))) { --- 84,88 ---- Query q; for (q.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); q.current; q.next()) { o = q.currento; if (!o->isInvisible() && !o->sameTeam(this) && (o->collide_flag_anyone&bit(LAYER_LINES))) { Index: shpsclfr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsclfr.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpsclfr.cpp 23 Aug 2005 22:18:11 -0000 1.14 --- shpsclfr.cpp 28 Aug 2005 20:34:08 -0000 1.15 *************** *** 35,39 **** ScloreSting* Sting; ScloreFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! ~ScloreFrigate(void); protected: void fireSting(); --- 35,39 ---- ScloreSting* Sting; ScloreFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual void death(); protected: void fireSting(); *************** *** 76,80 **** virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! ~ScloreSting(void); }; --- 76,80 ---- virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! virtual void death(); }; *************** *** 122,126 **** } vr = this->vel * specialRelativity; ! Sting->vel = v + vr; Sting->v = (v + vr).magnitude(); Sting=NULL; //sting is released. --- 122,126 ---- } vr = this->vel * specialRelativity; ! Sting->set_vel( v + vr ); Sting->v = (v + vr).magnitude(); Sting=NULL; //sting is released. *************** *** 146,151 **** } ! ScloreFrigate::~ScloreFrigate(void) { ! STACKTRACE if(Sting!=NULL && Sting->exists()) Sting->state = 0; // possible crash problem. } --- 146,153 ---- } ! void ScloreFrigate::death() ! { ! STACKTRACE; ! Ship::death(); if(Sting!=NULL && Sting->exists()) Sting->state = 0; // possible crash problem. } *************** *** 258,262 **** this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! this->vel = creator->vel; } --- 260,264 ---- this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! set_vel( creator->vel ); } *************** *** 313,318 **** } ! ScloreSting::~ScloreSting(void) { ! STACKTRACE if(!creator) return; if(!creator->exists()) return; --- 315,324 ---- } ! void ScloreSting::death() ! { ! STACKTRACE; ! ! Missile::death(); ! if(!creator) return; if(!creator->exists()) return; Index: shpoliha.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpoliha.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpoliha.cpp 23 Aug 2005 22:18:11 -0000 1.13 --- shpoliha.cpp 28 Aug 2005 20:34:08 -0000 1.14 *************** *** 188,192 **** collide_flag_sameship = 0; ! collide_flag_sameship = bit(LAYER_SPECIAL); relangle = 0; --- 188,192 ---- collide_flag_sameship = 0; ! collide_flag_sameship = 0; relangle = 0; *************** *** 311,315 **** Query a; ! for (a.begin(this, OBJECT_LAYERS, mother->laserRange); a.current; a.next()) { if ((distance(a.current) < r) && !a.current->isInvisible() --- 311,315 ---- Query a; ! for (a.begin(this, OBJECT_LAYERS, mother->laserRange, QUERY_OBJECT); a.current; a.next()) { if ((distance(a.current) < r) && !a.current->isInvisible() Index: shpyurpa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpyurpa.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpyurpa.cpp 11 Jul 2005 00:25:32 -0000 1.15 --- shpyurpa.cpp 28 Aug 2005 20:34:08 -0000 1.16 *************** *** 53,57 **** double oangle, double angleOffset, double ov, double odamage, double orange, double oarmour); ! ~YuryulRam(); virtual void calculate(void); }; --- 53,57 ---- double oangle, double angleOffset, double ov, double odamage, double orange, double oarmour); ! virtual void death(); virtual void calculate(void); }; *************** *** 94,98 **** protected: - ~YuryulPatriot(); virtual void calculate(); virtual int activate_weapon(); --- 94,97 ---- *************** *** 138,152 **** } ! YuryulPatriot::~YuryulPatriot(void) { ! if(Ram1!=NULL) ! Ram1->creator = NULL; ! if(Ram2!=NULL) ! Ram2->creator = NULL; ! } void YuryulPatriot::death(void) { STACKTRACE ! Ship::death(); } --- 137,151 ---- } ! void YuryulPatriot::death(void) { STACKTRACE ! Ship::death(); ! ! if(Ram1!=NULL) ! Ram1->creator = NULL; ! if(Ram2!=NULL) ! Ram2->creator = NULL; } *************** *** 239,243 **** } ! YuryulRam::~YuryulRam(void) { if(creator!=NULL) { if(RamNumber == 1) --- 238,245 ---- } ! void YuryulRam::death() ! { ! Missile::death(); ! if(creator!=NULL) { if(RamNumber == 1) *************** *** 249,252 **** --- 251,255 ---- + void YuryulRam::calculate(void) { STACKTRACE *************** *** 260,264 **** this->changeDirection(creator->angle + this->angleOffset); this->pos = creator->pos; ! this->vel = creator->vel; pos = normalize(pos + rotate(relativePosition, -PI/2+creator->get_angle())); Missile::calculate(); --- 263,267 ---- this->changeDirection(creator->angle + this->angleOffset); this->pos = creator->pos; ! set_vel(creator->vel); pos = normalize(pos + rotate(relativePosition, -PI/2+creator->get_angle())); Missile::calculate(); Index: shpimpka.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpimpka.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpimpka.cpp 17 Aug 2005 23:52:28 -0000 1.17 --- shpimpka.cpp 28 Aug 2005 20:34:08 -0000 1.18 *************** *** 144,148 **** bool found = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ q.currento->state = 0; --- 144,148 ---- bool found = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ q.currento->state = 0; *************** *** 234,238 **** bool raded = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ raded = true; --- 234,238 ---- bool raded = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ raded = true; *************** *** 354,358 **** Query q; ! for( q.begin( other, OBJECT_LAYERS, size.x ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == other ){ q.end(); --- 354,358 ---- Query q; ! for( q.begin( other, OBJECT_LAYERS, size.x, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == other ){ q.end(); Index: shpastba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpastba.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpastba.cpp 26 Aug 2005 21:55:19 -0000 1.9 --- shpastba.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 849,854 **** vfinal = 0; ! first->vel += (vfinal - v1) * L; ! second->vel += (vfinal - v2) * L; --- 849,854 ---- vfinal = 0; ! first->change_vel ( (vfinal - v1) * L ); ! second->change_vel ( (vfinal - v2) * L ); *************** *** 881,885 **** // apply these accelerations: ! second->vel += 1E-3 * accel * frame_time; --- 881,885 ---- // apply these accelerations: ! second->change_vel ( 1E-3 * accel * frame_time ); *************** *** 887,891 **** // including drag in the rotation direction. ! second->vel -= 0.5 * frame_time*1E-3 * (second->vel - L*second->vel.dot(L)); } --- 887,891 ---- // including drag in the rotation direction. ! second->change_vel (-0.5 * frame_time*1E-3 * (second->vel - L*second->vel.dot(L)) ); } Index: shpgahmo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgahmo.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpgahmo.cpp 2 Aug 2005 00:23:45 -0000 1.10 --- shpgahmo.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 607,611 **** if(tractorTarget->isShot()) { tractorTarget->pos = pos + unit_vector(tractorAngle) * tractorLength; ! tractorTarget->vel = vel; return; } --- 607,611 ---- if(tractorTarget->isShot()) { tractorTarget->pos = pos + unit_vector(tractorAngle) * tractorLength; ! tractorTarget->set_vel ( vel ); return; } *************** *** 621,625 **** vtransfer = (specialVelocityCouplingFactor * frame_time) / (1+(specialVelocityCouplingFactor * frame_time)); vel = vel * (1-vtransfer) + TM * vtransfer; ! tractorTarget->vel = tractorTarget->vel * (1-vtransfer) + TM * vtransfer; return; } --- 621,625 ---- vtransfer = (specialVelocityCouplingFactor * frame_time) / (1+(specialVelocityCouplingFactor * frame_time)); vel = vel * (1-vtransfer) + TM * vtransfer; ! tractorTarget->set_vel(tractorTarget->vel * (1-vtransfer) + TM * vtransfer); return; } Index: shpducla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpducla.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpducla.cpp 26 Aug 2005 21:55:19 -0000 1.20 --- shpducla.cpp 28 Aug 2005 20:34:07 -0000 1.21 *************** *** 83,86 **** --- 83,87 ---- double llength, int lcolor); + virtual void calculate(); void set_props(Vector2 opos, double oangle, double olength); virtual int handle_damage(SpaceLocation *source, double normal, double direct = 0); *************** *** 103,107 **** LaserArc(DuclyLanternjaws *creator, Vector2 lpos, int lcolor, int N); ! ~LaserArc(); virtual void calculate(); --- 104,108 ---- LaserArc(DuclyLanternjaws *creator, Vector2 lpos, int lcolor, int N); ! virtual ~LaserArc(); virtual void calculate(); *************** *** 260,264 **** { mother->pos = oldpos + partlist[i]->change_pos; ! mother->vel = oldvel + partlist[i]->change_vel; } --- 261,265 ---- { mother->pos = oldpos + partlist[i]->change_pos; ! mother->set_vel ( oldvel + partlist[i]->change_vel ); } *************** *** 488,492 **** vel += _dp * tmp / mass; if (other->mass > 1) ! other->vel -= _dp * tmp / other->mass; } --- 489,493 ---- vel += _dp * tmp / mass; if (other->mass > 1) ! other->change_vel (- _dp * tmp / other->mass ); } *************** *** 810,813 **** --- 811,816 ---- LaserArc::~LaserArc() { + /* should not be here! Cause in a physics-delete operation, the objects that we refer to here, + could already be dead! - geo [and gosh, I wrote this myself..] int i; for ( i = 0; i < Nseg; ++i ) *************** *** 816,819 **** --- 819,823 ---- laser_o[i]->state = 0; } + */ delete[] laser_o; *************** *** 831,834 **** --- 835,846 ---- for ( i = 0; i < Nseg; ++i ) { + if ( laser_o[i] && !laser_o[i]->exists() ) + laser_o[i] = 0; + + if (!laser_o[i]) + { + tw_error("LaserArc: laser segment has died."); + } + double a, a1, a2, L; a1 = mother->angle + angle_min + i * angle_step; *************** *** 894,897 **** --- 906,920 ---- } + void SpaceLineArc::calculate() + { + SpaceLine::calculate(); + + if (mother && !mother->exists()) + mother = 0; + + if (!mother) + state = 0; + } + void SpaceLineArc::set_props(Vector2 opos, double oangle, double olength) { *************** *** 909,914 **** void SpaceLineArc::inflict_damage(SpaceObject *other) { ! STACKTRACE ! // copied from space_line: --- 932,936 ---- void SpaceLineArc::inflict_damage(SpaceObject *other) { ! STACKTRACE; // copied from space_line: Index: shptrige.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptrige.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shptrige.cpp 2 Aug 2005 00:23:47 -0000 1.12 --- shptrige.cpp 28 Aug 2005 20:34:08 -0000 1.13 *************** *** 205,209 **** // turret->vx=vx=vfx; // turret->vy=vy=vfy; ! turret->vel = vel = vf; turn_left=FALSE; //Ensure that ship_calculate_turn_xxxx() --- 205,210 ---- // turret->vx=vx=vfx; // turret->vy=vy=vfy; ! turret->set_vel(vf); ! set_vel( vf ); turn_left=FALSE; //Ensure that ship_calculate_turn_xxxx() Index: shpkorsi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkorsi.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** shpkorsi.cpp 21 Jul 2005 14:55:08 -0000 1.2 --- shpkorsi.cpp 28 Aug 2005 20:34:08 -0000 1.3 *************** *** 141,145 **** if(tugger == NULL) { for (a.begin(this, bit(LAYER_SHIPS) | bit(LAYER_SHOTS) | bit(LAYER_SPECIAL) | bit(LAYER_CBODIES), ! tuggerDistance); a.current; a.next()) { o = a.currento; --- 141,145 ---- if(tugger == NULL) { for (a.begin(this, bit(LAYER_SHIPS) | bit(LAYER_SHOTS) | bit(LAYER_SPECIAL) | bit(LAYER_CBODIES), ! tuggerDistance, QUERY_OBJECT); a.current; a.next()) { o = a.currento; Index: shpbatde.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbatde.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpbatde.cpp 2 Aug 2005 00:23:44 -0000 1.20 --- shpbatde.cpp 28 Aug 2005 20:34:07 -0000 1.21 *************** *** 49,53 **** SpriteDrawList(SpaceObject *creator, int N, SpaceSprite **osprites, double odelaytime); ! ~SpriteDrawList(); void calculate(); --- 49,53 ---- SpriteDrawList(SpaceObject *creator, int N, SpaceSprite **osprites, double odelaytime); ! virtual ~SpriteDrawList(); void calculate(); *************** *** 250,254 **** Query a; ! for (a.begin(this, layers, gravRange); a.current; a.next()) { SpaceObject *o = a.currento; --- 250,254 ---- Query a; ! for (a.begin(this, layers, gravRange, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; *************** *** 293,301 **** if (!o->isPlanet()) ! o->vel += Vacc; else ! vel -= Vacc; ! vel -= Vacc; if (vel.length() > speed_max) vel *= speed_max / vel.length(); --- 293,301 ---- if (!o->isPlanet()) ! o->change_vel ( Vacc ); else ! change_vel ( -Vacc ); ! change_vel (-Vacc); if (vel.length() > speed_max) vel *= speed_max / vel.length(); *************** *** 569,573 **** Query a; ! for (a.begin(this, layers, passiveRange); a.current; a.next()) { SpaceObject *o = a.currento; --- 569,573 ---- Query a; ! for (a.begin(this, layers, passiveRange, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; Index: shpaktgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpaktgu.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpaktgu.cpp 2 Aug 2005 00:23:40 -0000 1.9 --- shpaktgu.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 233,237 **** Query q; ! for (q.begin(this, OBJECT_LAYERS &~ bit(LAYER_CBODIES), lRange); q.currento; q.next()) { if (!q.currento->isInvisible() && !q.currento->sameTeam(this)) { SpaceLocation *l; --- 233,237 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS &~ bit(LAYER_CBODIES), lRange, QUERY_OBJECT); q.currento; q.next()) { if (!q.currento->isInvisible() && !q.currento->sameTeam(this)) { SpaceLocation *l; Index: shparkpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparkpi.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shparkpi.cpp 23 Aug 2005 22:18:11 -0000 1.19 --- shparkpi.cpp 28 Aug 2005 20:34:07 -0000 1.20 *************** *** 26,30 **** ArkanoidPincer(ArkanoidPincerShip* ocreator, Vector2 opos, double oangle, SpaceSprite *osprite); - virtual ~ArkanoidPincer(void); virtual void calculate(); virtual void collide(SpaceObject *other); --- 26,29 ---- *************** *** 97,101 **** public: ArkanoidPincerShip(Vector2 opos, double angl... [truncated message content] |
|
From: Rob <geo...@us...> - 2005-08-28 20:33:25
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4987/source/util Modified Files: errors.cpp Log Message: debugging Index: errors.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/errors.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** errors.cpp 1 Aug 2005 10:46:35 -0000 1.12 --- errors.cpp 28 Aug 2005 20:33:17 -0000 1.13 *************** *** 30,34 **** SpaceLocation *o = physics->item[i]; // write: address, parent, target pointer, identity, pos, angle, and vel ! fprintf(f, "0x%08p p:0x%08p t:0x%08p id:%s\n\t\tx:%9.3f y:%9.3f a:%6.3f vx:%6.4f vy:%6.4f\n", o, o->parent, o->target, o->get_identity(), --- 30,34 ---- SpaceLocation *o = physics->item[i]; // write: address, parent, target pointer, identity, pos, angle, and vel ! fprintf(f, "0x%08p p:0x%08p t:0x%08p id:%s x:%9.3f y:%9.3f a:%6.3f vx:%6.4f vy:%6.4f\n", o, o->parent, o->target, o->get_identity(), |
|
From: Rob <geo...@us...> - 2005-08-28 20:33:17
|
Update of /cvsroot/timewarp/source/sc3ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4947/source/sc3ships Modified Files: shpdakvi.cpp shpexqen.cpp shpktacr.cpp shpowavo.cpp shpplopl.cpp shpvyrin.cpp shpxchex.cpp Log Message: debugging Index: shpowavo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpowavo.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpowavo.cpp 2 Aug 2005 00:23:49 -0000 1.13 --- shpowavo.cpp 28 Aug 2005 20:33:07 -0000 1.14 *************** *** 298,301 **** --- 298,303 ---- void OwaDisable::calculate() { + SpaceObject::calculate(); + if (!(ship && ship->exists())) { *************** *** 311,326 **** } ! if (!lowerindex) { ! pos = target->normal_pos(); ! //((Ship*)target)->nextkeys &= ~(keyflag::left | keyflag::right | keyflag::thrust); } ! else { ! pos = target->normal_pos(); } ! disableframe += frame_time; if (disableframe >= disableframe_count) state = 0; ! if (!target->exists()) { state = 0; --- 313,332 ---- } ! ! if (target) ! { ! if (!lowerindex) ! { ! pos = target->normal_pos(); ! //((Ship*)target)->nextkeys &= ~(keyflag::left | keyflag::right | keyflag::thrust); } ! else { ! pos = target->normal_pos(); } ! } disableframe += frame_time; if (disableframe >= disableframe_count) state = 0; ! if (!target) { state = 0; *************** *** 333,338 **** } - // the following can set target=0, so must be done last - SpaceObject::calculate(); } --- 339,342 ---- Index: shpxchex.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpxchex.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpxchex.cpp 2 Aug 2005 00:23:49 -0000 1.15 --- shpxchex.cpp 28 Aug 2005 20:33:07 -0000 1.16 *************** *** 146,154 **** void XchaggerDisable::calculate() { ! if (!(ship && ship->exists())) { state = 0; } frame_step+= frame_time; --- 146,163 ---- void XchaggerDisable::calculate() { + SpaceObject::calculate(); ! if (ship && !ship->exists()) { + ship = 0; state = 0; } + + if ( affectship && !affectship->exists() ) + { + // note that target == affectship, so that if target is reset to 0, the affectship is still a valid pointer. + affectship->del_override_control(ocx); + affectship = 0; + } frame_step+= frame_time; *************** *** 177,181 **** else { pos = t->normal_pos() + (frame_time * t->get_vel()); - SpaceObject::calculate(); } disableframe += frame_time; --- 186,189 ---- *************** *** 186,194 **** } - // THIS CHECK IS NEEDED BEFORE RETURNING ... if (!exists()) { ! // note that target == affectship, so that if target is reset to 0, the affectship is still a valid pointer. ! affectship->del_override_control(ocx); } } --- 194,201 ---- } if (!exists()) { ! if (affectship) ! affectship->del_override_control(ocx); } } *************** *** 223,228 **** Query a; int found = FALSE; ! for (a.begin(this, ALL_LAYERS ,distance(other)+ 10); ! a.current; a.next()) { o = a.currento; if ((o->getID()) == XCHAGGERDISABLE_SPEC) --- 230,238 ---- Query a; int found = FALSE; ! ! for (a.begin(this, ALL_LAYERS ,distance(other)+ 10, QUERY_OBJECT); ! a.currento; a.next()) ! { ! o = a.currento; if ((o->getID()) == XCHAGGERDISABLE_SPEC) Index: shpexqen.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpexqen.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpexqen.cpp 26 Aug 2005 21:55:20 -0000 1.12 --- shpexqen.cpp 28 Aug 2005 20:33:07 -0000 1.13 *************** *** 98,102 **** Query a; double multi = ((double)((random () % 20) + 10) / 10); ! for (a.begin(this, bit(LAYER_SHIPS), specialRange); a.current; a.next()) { o = a.currento; if( (!o->sameTeam(this)) && (distance(o) < specialRange) && --- 98,102 ---- Query a; double multi = ((double)((random () % 20) + 10) / 10); ! for (a.begin(this, bit(LAYER_SHIPS), specialRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->sameTeam(this)) && (distance(o) < specialRange) && *************** *** 187,191 **** Query a; for (a.begin(this,bit(LAYER_SHOTS) + bit(LAYER_SPECIAL), ! dist); a.current; a.next()) { o = a.currento; if( (!o->sameTeam(this)) && (distance(o) < oldrange) && --- 187,191 ---- Query a; for (a.begin(this,bit(LAYER_SHOTS) + bit(LAYER_SPECIAL), ! dist, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->sameTeam(this)) && (distance(o) < oldrange) && *************** *** 219,223 **** Query a; for (a.begin(this,bit(LAYER_SHOTS) + bit(LAYER_SPECIAL), ! safedist * 2.5); a.current; a.next()) { o = a.currento; if( (!o->sameTeam(this)) && (distance(o) < oldrange) && --- 219,223 ---- Query a; for (a.begin(this,bit(LAYER_SHOTS) + bit(LAYER_SPECIAL), ! safedist * 2.5, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->sameTeam(this)) && (distance(o) < oldrange) && Index: shpplopl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpplopl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpplopl.cpp 11 Jul 2005 00:25:59 -0000 1.7 --- shpplopl.cpp 28 Aug 2005 20:33:07 -0000 1.8 *************** *** 70,78 **** void PloxisPlunderer::calculate() { if(shieldFrames > 0) { recharge_amount = 0; shieldFrames-= frame_time; Query a; ! for (a.begin(this, bit(LAYER_SHOTS),250); a.current; a.next()) { SpaceObject *o = a.currento; if ((!o->sameShip(this)) && (o->isShot()) && ((distance(o) --- 70,80 ---- void PloxisPlunderer::calculate() { + Ship::calculate(); + if(shieldFrames > 0) { recharge_amount = 0; shieldFrames-= frame_time; Query a; ! for (a.begin(this, bit(LAYER_SHOTS),250, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; if ((!o->sameShip(this)) && (o->isShot()) && ((distance(o) *************** *** 95,99 **** } else recharge_amount = 1; - Ship::calculate(); } --- 97,100 ---- Index: shpdakvi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpdakvi.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpdakvi.cpp 11 Jul 2005 00:25:59 -0000 1.8 --- shpdakvi.cpp 28 Aug 2005 20:33:06 -0000 1.9 *************** *** 125,128 **** --- 125,130 ---- void DaktaklakpakVivisector::calculate() { + Ship::calculate(); + if(drillFrames > 0) { drillFrames-= frame_time; *************** *** 162,166 **** numMines -= j; - Ship::calculate(); } int DaktaklakpakVivisector::canCollide(SpaceObject *other) --- 164,167 ---- *************** *** 241,245 **** double oldrange = 999999; Query a; ! for (a.begin(this, bit(LAYER_SHIPS),(missileRange *.9)); a.current; a.next()) { o = a.currento; --- 242,246 ---- double oldrange = 999999; Query a; ! for (a.begin(this, bit(LAYER_SHIPS),(missileRange *.9), QUERY_OBJECT); a.current; a.next()) { o = a.currento; Index: shpktacr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpktacr.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpktacr.cpp 11 Jul 2005 00:25:59 -0000 1.7 --- shpktacr.cpp 28 Aug 2005 20:33:07 -0000 1.8 *************** *** 119,122 **** --- 119,124 ---- void KtangCrippler::calculate() { + Ship::calculate(); + int j = 0; for (int i = 0; i < numMines; i += 1) { *************** *** 126,130 **** } numMines -= j; - Ship::calculate(); } --- 128,131 ---- *************** *** 160,164 **** double oldrange = 999999; Query a; ! for (a.begin(this, bit(LAYER_SHIPS),(missileRange *.9)); a.current; a.next()) { o = a.currento; --- 161,165 ---- double oldrange = 999999; Query a; ! for (a.begin(this, bit(LAYER_SHIPS),(missileRange *.9), QUERY_OBJECT); a.current; a.next()) { o = a.currento; Index: shpvyrin.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpvyrin.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpvyrin.cpp 2 Aug 2005 00:23:49 -0000 1.12 --- shpvyrin.cpp 28 Aug 2005 20:33:07 -0000 1.13 *************** *** 138,141 **** --- 138,143 ---- { + Ship::calculate(); + if (sheild) if (sheild->exists()) { *************** *** 143,147 **** sheild->state = 0; } else sheild = NULL; - Ship::calculate(); } --- 145,148 ---- *************** *** 165,168 **** --- 166,171 ---- void VyroIngoSheild::calculate() { + SpaceObject::calculate(); + if(!(ship && ship->exists())) { *************** *** 182,186 **** pos = ship->normal_pos(); vel = ship->get_vel(); - SpaceObject::calculate(); } --- 185,188 ---- |
|
From: Rob <geo...@us...> - 2005-08-28 20:33:03
|
Update of /cvsroot/timewarp/source/sc2ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4894/source/sc2ships Modified Files: shpchmav.cpp shpkohma.cpp shpmeltr.cpp shporzne.cpp shpslypr.cpp shpzfpst.cpp Log Message: debugging Index: shpkohma.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpkohma.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpkohma.cpp 2 Aug 2005 00:23:49 -0000 1.10 --- shpkohma.cpp 28 Aug 2005 20:32:55 -0000 1.11 *************** *** 155,159 **** Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SPECIAL), ! passiveRange); a.current; a.next()) { o = a.currento; if (!o->sameTeam(this) && o->canCollide(this) && !(o->isAsteroid() || o->isPlanet()) && (distance(o) < oldrange) && !o->isInvisible() && (distance(o) != 0) ) { --- 155,159 ---- Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SPECIAL), ! passiveRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if (!o->sameTeam(this) && o->canCollide(this) && !(o->isAsteroid() || o->isPlanet()) && (distance(o) < oldrange) && !o->isInvisible() && (distance(o) != 0) ) { Index: shpzfpst.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpzfpst.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpzfpst.cpp 14 Aug 2005 16:14:50 -0000 1.15 --- shpzfpst.cpp 28 Aug 2005 20:32:55 -0000 1.16 *************** *** 117,120 **** --- 117,122 ---- void ZoqFotPikTongue::calculate() { + SpaceObject::calculate(); + int current_frame = frame; *************** *** 148,152 **** sprite_index += (64 * frame); - SpaceObject::calculate(); } --- 150,153 ---- Index: shpmeltr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpmeltr.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpmeltr.cpp 2 Aug 2005 00:23:49 -0000 1.15 --- shpmeltr.cpp 28 Aug 2005 20:32:55 -0000 1.16 *************** *** 255,258 **** --- 255,260 ---- void MelnormeDisable::calculate() { + SpaceObject::calculate(); + frame_step+= frame_time; while (frame_step >= frame_size) { *************** *** 279,283 **** } - SpaceObject::calculate(); if (!exists()) --- 281,284 ---- Index: shporzne.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shporzne.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shporzne.cpp 16 Aug 2005 23:21:02 -0000 1.19 --- shporzne.cpp 28 Aug 2005 20:32:55 -0000 1.20 *************** *** 145,155 **** int i; for(i = 0; i < MAX_MARINES; i++) if((marine[i]) && (!marine[i]->exists())) marine[i] = NULL; recoil -= frame_time; ! if (recoil < 0) recoil = 0; ! Ship::calculate(); } --- 145,159 ---- int i; + Ship::calculate(); + for(i = 0; i < MAX_MARINES; i++) + { if((marine[i]) && (!marine[i]->exists())) marine[i] = NULL; + } recoil -= frame_time; ! if (recoil < 0) ! recoil = 0; } *************** *** 225,228 **** --- 229,235 ---- int chance; + SpaceObject::calculate(); + // should be first, it must be guaranteed that it's done every iteration! To handle pointer references. + if (!(orzship && orzship->exists())) { *************** *** 342,346 **** } - SpaceObject::calculate(); } --- 349,352 ---- Index: shpchmav.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpchmav.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpchmav.cpp 16 Aug 2005 23:21:02 -0000 1.18 --- shpchmav.cpp 28 Aug 2005 20:32:55 -0000 1.19 *************** *** 283,287 **** Query q; ! for (q.begin(this, OBJECT_LAYERS &~ bit(LAYER_CBODIES), lRange); q.currento; q.next()) { if (!q.currento->isInvisible() && !q.currento->sameTeam(this) && (q.currento->collide_flag_anyone&bit(LAYER_LINES))) { add(new PointLaser(this, pallete_color[lColor], 1, lFrames, --- 283,287 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS &~ bit(LAYER_CBODIES), lRange, QUERY_OBJECT); q.currento; q.next()) { if (!q.currento->isInvisible() && !q.currento->sameTeam(this) && (q.currento->collide_flag_anyone&bit(LAYER_LINES))) { add(new PointLaser(this, pallete_color[lColor], 1, lFrames, Index: shpslypr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpslypr.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpslypr.cpp 26 Aug 2005 21:55:19 -0000 1.19 --- shpslypr.cpp 28 Aug 2005 20:32:55 -0000 1.20 *************** *** 170,174 **** if (fire_special) { Query q; ! for (q.begin(this, bit(LAYER_CBODIES), 100);q.current;q.next()) { if (q.current->isAsteroid() && q.current->canCollide(this)) { if (damage(q.current, 1)) { --- 170,174 ---- if (fire_special) { Query q; ! for (q.begin(this, bit(LAYER_CBODIES), 100, QUERY_OBJECT);q.current;q.next()) { if (q.current->isAsteroid() && q.current->canCollide(this)) { if (damage(q.current, 1)) { *************** *** 277,280 **** --- 277,282 ---- void SlylandroLaserNew::calculate() { + Presence::calculate(); + lifetime += frame_time; *************** *** 286,290 **** } - Presence::calculate(); double relativelifetime = lifetime / existtime; // a value increasing from 0 to 1 --- 288,291 ---- *************** *** 425,430 **** double range = magnitude(lights[i].pos2) * 1.1; Query q; ! for (q.begin(mother, bit(LAYER_CBODIES)+bit(LAYER_SHOTS)+bit(LAYER_SHIPS), range); q.currento; q.next()) { tsprite = q.currento->get_sprite(); int indexnum = q.currento->get_sprite_index(); --- 426,436 ---- double range = magnitude(lights[i].pos2) * 1.1; Query q; ! for (q.begin(mother, bit(LAYER_CBODIES)+bit(LAYER_SHOTS)+bit(LAYER_SHIPS), range, QUERY_OBJECT); q.currento; q.next()) { + if (!q.currento->isObject()) + { + tw_error("wrong grid search ..."); + } + tsprite = q.currento->get_sprite(); int indexnum = q.currento->get_sprite_index(); |
|
From: Rob <geo...@us...> - 2005-08-28 20:32:46
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4837/source/sc1ships Modified Files: shpandgu.cpp shparisk.cpp shpearcr.cpp shpilwav.cpp shpkzedr.cpp shpmmrxf.cpp shpshosc.cpp shpsyrpe.cpp shpumgdr.cpp shpvuxin.cpp shpyehte.cpp Log Message: debugging Index: shpandgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpandgu.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpandgu.cpp 14 Aug 2005 16:14:50 -0000 1.15 --- shpandgu.cpp 28 Aug 2005 20:32:37 -0000 1.16 *************** *** 155,158 **** --- 155,160 ---- void AndrosynthBubble::calculate() { + AnimatedShot::calculate(); + if (!(ship && ship->exists())) { *************** *** 163,167 **** double newAngle; - AnimatedShot::calculate(); courseFrames += frame_time; if(courseFrames >= 150) { --- 165,168 ---- Index: shpearcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpearcr.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpearcr.cpp 11 Jul 2005 00:25:58 -0000 1.8 --- shpearcr.cpp 28 Aug 2005 20:32:37 -0000 1.9 *************** *** 47,51 **** Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { --- 47,51 ---- Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { Index: shpmmrxf.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpmmrxf.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpmmrxf.cpp 24 Mar 2004 23:51:44 -0000 1.9 --- shpmmrxf.cpp 28 Aug 2005 20:32:37 -0000 1.10 *************** *** 65,68 **** --- 65,70 ---- void MmrnmhrmXForm::calculate() { + Ship::calculate(); + if(laserSpark > 0) { laserSpark-= frame_time; *************** *** 77,81 **** } - Ship::calculate(); } --- 79,82 ---- Index: shpumgdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpumgdr.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpumgdr.cpp 23 Aug 2005 22:18:11 -0000 1.20 --- shpumgdr.cpp 28 Aug 2005 20:32:37 -0000 1.21 *************** *** 64,67 **** --- 64,69 ---- void UmgahDrone::calculate() { + Ship::calculate(); + if (fire_weapon) recharge_step = recharge_rate; *************** *** 69,73 **** firing = false; - Ship::calculate(); } --- 71,74 ---- Index: shparisk.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shparisk.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shparisk.cpp 14 Aug 2005 16:14:50 -0000 1.9 --- shparisk.cpp 28 Aug 2005 20:32:37 -0000 1.10 *************** *** 36,40 **** Query a; ! for (a.begin(this, bit(LAYER_SHIPS), weaponRange + 200); a.current; a.next()) { if ((distance(a.current) < r) && !a.current->isInvisible()) { o = a.currento; --- 36,40 ---- Query a; ! for (a.begin(this, bit(LAYER_SHIPS), weaponRange + 200, QUERY_OBJECT); a.current; a.next()) { if ((distance(a.current) < r) && !a.current->isInvisible()) { o = a.currento; Index: shpyehte.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpyehte.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpyehte.cpp 24 Mar 2004 23:51:44 -0000 1.7 --- shpyehte.cpp 28 Aug 2005 20:32:37 -0000 1.8 *************** *** 41,47 **** void YehatTerminator::calculate() { if(shieldFrames > 0) shieldFrames-= frame_time; - Ship::calculate(); } --- 41,48 ---- void YehatTerminator::calculate() { + Ship::calculate(); + if(shieldFrames > 0) shieldFrames-= frame_time; } Index: shpshosc.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpshosc.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpshosc.cpp 24 Mar 2004 23:51:44 -0000 1.7 --- shpshosc.cpp 28 Aug 2005 20:32:37 -0000 1.8 *************** *** 40,44 **** if(glory == 3) { Query q; ! for (q.begin(this, OBJECT_LAYERS, specialRange); q.currento; q.next()) { if (q.currento->canCollide(this)) { gloryDamage = (int)ceil((specialRange - distance(q.currento)) / specialRange * specialDamage); --- 40,44 ---- if(glory == 3) { Query q; ! for (q.begin(this, OBJECT_LAYERS, specialRange, QUERY_OBJECT); q.currento; q.next()) { if (q.currento->canCollide(this)) { gloryDamage = (int)ceil((specialRange - distance(q.currento)) / specialRange * specialDamage); Index: shpsyrpe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpsyrpe.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpsyrpe.cpp 14 Aug 2005 16:14:50 -0000 1.15 --- shpsyrpe.cpp 28 Aug 2005 20:32:37 -0000 1.16 *************** *** 115,119 **** } ! void CrewPod::calculate() { frame_step += frame_time; while (frame_step >= frame_size) { --- 115,122 ---- } ! void CrewPod::calculate() ! { ! SpaceObject::calculate(); ! frame_step += frame_time; while (frame_step >= frame_size) { *************** *** 134,138 **** else ship = NULL; - SpaceObject::calculate(); } --- 137,140 ---- Index: shpilwav.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpilwav.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpilwav.cpp 1 Aug 2005 10:46:34 -0000 1.10 --- shpilwav.cpp 28 Aug 2005 20:32:37 -0000 1.11 *************** *** 81,84 **** --- 81,86 ---- void IlwrathAvenger::calculate() { + Ship::calculate(); + if((cloak) && (cloak_frame < 300)) cloak_frame += frame_time; *************** *** 86,90 **** cloak_frame -= frame_time; - Ship::calculate(); } --- 88,91 ---- Index: shpvuxin.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpvuxin.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpvuxin.cpp 11 Jul 2005 00:25:58 -0000 1.12 --- shpvuxin.cpp 28 Aug 2005 20:32:37 -0000 1.13 *************** *** 75,78 **** --- 75,80 ---- void VuxLimpet::calculate() { + AnimatedShot::calculate(); + if(!(ship && ship->exists())) { state = 0; *************** *** 80,88 **** } ! if((ship->target) && (!ship->target->isInvisible())) { angle = trajectory_angle(ship->target); vel = v * unit_vector(angle); } - AnimatedShot::calculate(); } --- 82,89 ---- } ! if((ship && ship->target) && (!ship->target->isInvisible())) { angle = trajectory_angle(ship->target); vel = v * unit_vector(angle); } } Index: shpkzedr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpkzedr.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpkzedr.cpp 23 Aug 2005 22:18:11 -0000 1.14 --- shpkzedr.cpp 28 Aug 2005 20:32:37 -0000 1.15 *************** *** 141,152 **** target = ship->target; if((target == NULL) || (air_frames < (max_air_frames / 2)) || target->isInvisible()) { ! collide_flag_sameship |= bit(LAYER_SHIPS); changeDirection(trajectory_angle(ship)); return; } ! collide_flag_sameship &= ~bit(LAYER_SHIPS); if ((distance(target) < laser_range) && (batt <= 0)) { ! collide_flag_sameship = 0; vel = 0; play_sound2(data->sampleExtra[0]); --- 141,152 ---- target = ship->target; if((target == NULL) || (air_frames < (max_air_frames / 2)) || target->isInvisible()) { ! collide_flag_sameship = ~bit(LAYER_SPECIAL); changeDirection(trajectory_angle(ship)); return; } ! collide_flag_sameship = 0; if ((distance(target) < laser_range) && (batt <= 0)) { ! //collide_flag_sameship = 0; vel = 0; play_sound2(data->sampleExtra[0]); *************** *** 198,202 **** damage(ship, 0, -1); } ! if (!other->isPlanet()) { state = 0; --- 198,203 ---- damage(ship, 0, -1); } ! ! if (!other->isPlanet() && !(other->parent == parent)) // don't collide with a planet or other fighters. { state = 0; |
|
From: Rob <geo...@us...> - 2005-08-28 20:32:24
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4784/source/other Modified Files: gconfig.cpp orbit.cpp shippart.cpp vbodies.cpp Log Message: debugging Index: vbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/vbodies.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** vbodies.cpp 14 Aug 2005 16:14:50 -0000 1.14 --- vbodies.cpp 28 Aug 2005 20:32:16 -0000 1.15 *************** *** 437,441 **** double r = 99999; Query a; ! for (a.begin(this->location, bit(LAYER_SHIPS)|bit(LAYER_SHOTS)|bit(LAYER_SPECIAL), weaponRange + 200); a.current; a.next()) { if ((this->location->distance(a.current) < r) && !a.current->isInvisible()) { if(a.current) { --- 437,441 ---- double r = 99999; Query a; ! for (a.begin(this->location, bit(LAYER_SHIPS)|bit(LAYER_SHOTS)|bit(LAYER_SPECIAL), weaponRange + 200, QUERY_OBJECT); a.current; a.next()) { if ((this->location->distance(a.current) < r) && !a.current->isInvisible()) { if(a.current) { *************** *** 492,496 **** double r = 99999; Query a; ! for (a.begin(this->location, bit(LAYER_SHIPS), weaponRange + 200); a.current; a.next()) { if ((this->location->distance(a.current) < r) && !a.current->isInvisible()) { o = a.currento; --- 492,496 ---- double r = 99999; Query a; ! for (a.begin(this->location, bit(LAYER_SHIPS), weaponRange + 200, QUERY_OBJECT); a.current; a.next()) { if ((this->location->distance(a.current) < r) && !a.current->isInvisible()) { o = a.currento; *************** *** 538,542 **** double r = 99999; Query a; ! for (a.begin(this->location, bit(LAYER_SHIPS), weaponRange + 200); a.current; a.next()) { if ((this->location->distance(a.current) < r) && !a.current->isInvisible()) { o = a.currento; --- 538,542 ---- double r = 99999; Query a; ! for (a.begin(this->location, bit(LAYER_SHIPS), weaponRange + 200, QUERY_OBJECT); a.current; a.next()) { if ((this->location->distance(a.current) < r) && !a.current->isInvisible()) { o = a.currento; *************** *** 979,983 **** SpaceObject *o; Query a; ! a.begin(this, bit(LAYER_LINES)|bit(LAYER_SHOTS)|bit(LAYER_SPECIAL), gravity_range); for (;a.currento;a.next()) { o = a.currento; --- 979,983 ---- SpaceObject *o; Query a; ! a.begin(this, bit(LAYER_LINES)|bit(LAYER_SHOTS)|bit(LAYER_SPECIAL), gravity_range, QUERY_OBJECT); for (;a.currento;a.next()) { o = a.currento; *************** *** 1063,1067 **** SpaceObject *o; Query a; ! a.begin(this, OBJECT_LAYERS, this->frictionRadius); for (;a.currento;a.next()) { o = a.currento; --- 1063,1067 ---- SpaceObject *o; Query a; ! a.begin(this, OBJECT_LAYERS, this->frictionRadius, QUERY_OBJECT); for (;a.currento;a.next()) { o = a.currento; *************** *** 1812,1816 **** calcVelocity = amountToFly * originalVelocity + amountFlown * finalVelocity; this->v = calcVelocity; ! this->vel = unit_vector(currentAngle) * calcVelocity; Missile::calculate(); } --- 1812,1816 ---- calcVelocity = amountToFly * originalVelocity + amountFlown * finalVelocity; this->v = calcVelocity; ! set_vel(unit_vector(currentAngle) * calcVelocity); Missile::calculate(); } Index: shippart.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/shippart.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shippart.cpp 26 Aug 2005 21:59:17 -0000 1.14 --- shippart.cpp 28 Aug 2005 20:32:16 -0000 1.15 *************** *** 32,36 **** void BigShip::calculate() { ! STACKTRACE // make sure the "ship" is not a real target --- 32,38 ---- void BigShip::calculate() { ! STACKTRACE; ! ! Ship::calculate(); // make sure the "ship" is not a real target *************** *** 39,43 **** targets->rem(this); - Ship::calculate(); // check if all the parts are still alive. --- 41,44 ---- *************** *** 57,65 **** void BigShip::change_vel(Vector2 dvel) { ! STACKTRACE int i; ! vel += dvel; for ( i = 0; i < Nparts; ++i ) --- 58,67 ---- void BigShip::change_vel(Vector2 dvel) { ! STACKTRACE; int i; ! ! SpaceLocation::change_vel( dvel ); // adds dvel, and checks the size. for ( i = 0; i < Nparts; ++i ) *************** *** 177,180 **** --- 179,184 ---- STACKTRACE + Ship::calculate(); + if ( !(owner && owner->exists()) ) { *************** *** 214,218 **** - Ship::calculate(); } --- 218,221 ---- Index: gconfig.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gconfig.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gconfig.cpp 24 Mar 2004 23:51:43 -0000 1.5 --- gconfig.cpp 28 Aug 2005 20:32:16 -0000 1.6 *************** *** 55,59 **** Planet *p = NULL; Query q; ! q.begin(game->item[0], bit(LAYER_CBODIES), 99999999); // if first object is planet --- 55,59 ---- Planet *p = NULL; Query q; ! q.begin(game->item[0], bit(LAYER_CBODIES), 99999999, QUERY_OBJECT); // if first object is planet Index: orbit.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/orbit.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** orbit.cpp 24 Mar 2004 23:51:43 -0000 1.9 --- orbit.cpp 28 Aug 2005 20:32:16 -0000 1.10 *************** *** 46,50 **** Query a; SpaceObject *o; ! for (a.begin(this, bit(LAYER_SHIPS), 200.); a.current; a.next()) { o = a.currento; --- 46,50 ---- Query a; SpaceObject *o; ! for (a.begin(this, bit(LAYER_SHIPS), 200., QUERY_OBJECT); a.current; a.next()) { o = a.currento; *************** *** 89,93 **** void OrbitHandler::calculate() { ! STACKTRACE if((sun==NULL)||(plan==NULL)) --- 89,95 ---- void OrbitHandler::calculate() { ! STACKTRACE; ! ! SpaceLocation::calculate(); if((sun==NULL)||(plan==NULL)) *************** *** 123,127 **** plan->vel=sun->vel+theta*unit_vector(angle+PI/2); - SpaceLocation::calculate(); } --- 125,128 ---- *************** *** 186,190 **** SpaceObject *o; Query a; ! a.begin(this, OBJECT_LAYERS, gravity_range); for (;a.currento;a.next()) { o = a.currento; --- 187,191 ---- SpaceObject *o; Query a; ! a.begin(this, OBJECT_LAYERS, gravity_range, QUERY_OBJECT); for (;a.currento;a.next()) { o = a.currento; |
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4583/source/melee Modified Files: mcbodies.cpp mcbodies.h mframe.cpp mframe.h mhelpers.cpp mmain.cpp mmain.h mship.cpp mshpdata.cpp msprite.cpp Log Message: debugging Index: mshpdata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshpdata.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mshpdata.cpp 23 Aug 2005 22:19:09 -0000 1.12 --- mshpdata.cpp 28 Aug 2005 20:31:32 -0000 1.13 *************** *** 29,32 **** --- 29,36 ---- void test_pointers() { + #ifdef _DEBUG + if (!physics) + return; + // also check the target list int i; *************** *** 48,51 **** --- 52,56 ---- } } + #endif } *************** *** 423,427 **** } // end of the test. ! */ --- 428,432 ---- } // end of the test. ! //*/ Index: mcbodies.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mcbodies.h 11 Jul 2005 00:25:13 -0000 1.11 --- mcbodies.h 28 Aug 2005 20:31:32 -0000 1.12 *************** *** 59,63 **** static SpaceSprite *starpics; Stars2(); ! ~Stars2(); int num_layers; StarLayer *layer; --- 59,63 ---- static SpaceSprite *starpics; Stars2(); ! virtual ~Stars2(); int num_layers; StarLayer *layer; *************** *** 70,74 **** public: Stars(); ! ~Stars(); SpaceSprite **pic; double width; --- 70,74 ---- public: Stars(); ! virtual ~Stars(); SpaceSprite **pic; double width; Index: mmain.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mmain.h 11 Jul 2005 00:25:28 -0000 1.17 --- mmain.h 28 Aug 2005 20:31:32 -0000 1.18 *************** *** 45,49 **** }; ! ~NormalGame(); virtual void calculate(); --- 45,49 ---- }; ! virtual ~NormalGame(); virtual void calculate(); Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** mmain.cpp 21 Aug 2005 12:43:31 -0000 1.44 --- mmain.cpp 28 Aug 2005 20:31:32 -0000 1.45 *************** *** 1068,1072 **** add ( new WedgeIndicator ( s, 30, p->color ) ); ShipPanel *panel = new ShipPanel(s); ! panel->window->init(window); panel->window->locate( 0, 0.9, --- 1068,1072 ---- add ( new WedgeIndicator ( s, 30, p->color ) ); ShipPanel *panel = new ShipPanel(s); ! panel->window->init(window); //xxx this causes the flicker in the screen. panel->window->locate( 0, 0.9, Index: mcbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mcbodies.cpp 26 Aug 2005 21:54:30 -0000 1.18 --- mcbodies.cpp 28 Aug 2005 20:31:32 -0000 1.19 *************** *** 125,129 **** SpaceObject *o; Query a; ! a.begin(this, OBJECT_LAYERS, gravity_range); for (;a.currento;a.next()) { o = a.currento; --- 125,129 ---- SpaceObject *o; Query a; ! a.begin(this, OBJECT_LAYERS, gravity_range, QUERY_OBJECT); for (;a.currento;a.next()) { o = a.currento; Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** msprite.cpp 23 Aug 2005 22:19:09 -0000 1.25 --- msprite.cpp 28 Aug 2005 20:31:32 -0000 1.26 *************** *** 309,312 **** --- 309,317 ---- BITMAP *src = get_bitmap(i, 0);//b[0][i]; + if ( level < 0 || level > highest_mip || level > MAX_MIP_LEVELS) + { + tw_error("Illegal mipmap used..."); + } + sbitmap[level][i] = create_bitmap_ex(bpp, lw, lh); *************** *** 341,350 **** lw = iround(w * pow(0.5, level)); lh = iround(h * pow(0.5, level)); - if ((lw < 8) || (lh < 8)) break; - this->highest_mip = level; - this->sbitmap[level] = new BITMAP*[count]; ! this->highest_mip = level; ! this->sbitmap[level] = new BITMAP*[count]; for (i = 0; i < count; i += 1) --- 346,360 ---- lw = iround(w * pow(0.5, level)); lh = iround(h * pow(0.5, level)); ! if ((lw < 8) || (lh < 8)) ! break; ! ! if (sbitmap[level]) ! { ! tw_error("new mipmap level: already defined!"); ! } ! ! highest_mip = level; ! sbitmap[level] = new BITMAP*[count]; for (i = 0; i < count; i += 1) *************** *** 447,451 **** highest_mip = 0; for (i = 1; i < MAX_MIP_LEVELS; i += 1) { ! sbitmap[i] = NULL; } --- 457,461 ---- highest_mip = 0; for (i = 1; i < MAX_MIP_LEVELS; i += 1) { ! sbitmap[i] = 0; } *************** *** 752,757 **** if (smask) delete[] smask; ! ! smask = NULL; for (l = 0; l <= highest_mip; l += 1) --- 762,766 ---- if (smask) delete[] smask; ! smask = 0; for (l = 0; l <= highest_mip; l += 1) *************** *** 765,775 **** destroy_bitmap(sbitmap[l][i]); } delete[] sbitmap[l]; ! sbitmap[l] = NULL; } } delete[] attributes; ! attributes = NULL; return; } --- 774,785 ---- destroy_bitmap(sbitmap[l][i]); } + delete[] sbitmap[l]; ! sbitmap[l] = 0; } } delete[] attributes; ! attributes = 0; return; } Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** mship.cpp 26 Aug 2005 21:59:16 -0000 1.42 --- mship.cpp 28 Aug 2005 20:31:32 -0000 1.43 *************** *** 332,337 **** id = SPACE_SHIP; ! type = NULL; ! code = NULL; // modified otherwise the kat poly crashes --- 332,338 ---- id = SPACE_SHIP; ! type = 0; ! code = 0; ! // data is initialized in SpaceLocation constructor // modified otherwise the kat poly crashes *************** *** 366,370 **** control(NULL) {STACKTRACE - shipData->lock(); attributes |= ATTRIB_SHIP; layer = LAYER_SHIPS; --- 367,370 ---- *************** *** 379,383 **** --- 379,394 ---- captain_name[0] = '\0'; ship = this; + + if (data) + { + tw_error("ship with data out of nowhere? Shouldn't be possible."); + } data = shipData; + if (!data) + { + tw_error("A ship without data."); + } + data->lock(); + this->ally_flag = ally_flag; *************** *** 472,475 **** --- 483,487 ---- delete spritePanel; + spritePanel = 0; //f (override_control) Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mframe.h 26 Aug 2005 21:54:30 -0000 1.27 --- mframe.h 28 Aug 2005 20:31:32 -0000 1.28 *************** *** 20,24 **** class Presence; ! void delete_location(void *tmp); void check_physics_correctness(); void check_physics_correctness_item(int i); --- 20,24 ---- class Presence; ! void delete_location(SpaceLocation *tmp); void check_physics_correctness(); void check_physics_correctness_item(int i); *************** *** 315,318 **** --- 315,319 ---- virtual void change_vel(Vector2 dvel); + virtual void set_vel(Vector2 newvel); virtual void scale_vel(double scale); virtual void change_pos(Vector2 dpos); *************** *** 427,430 **** --- 428,439 ---- }; + enum query_type { QUERY_LOC = 1, QUERY_OBJECT, QUERY_LINE }; + + /** searching a grid. + You can specify layers which space locations and objects are in. Those are not a guarantee for + the correct type. + If you make use of currento, then specify QUERY_OBJECT + If you make use of currentl, then specify QUERY_LINE + */ struct Query { private: *************** *** 436,439 **** --- 445,449 ---- Vector2 target_pos; double range_sqr; + query_type qtype; void next_quadrant (); public: *************** *** 443,456 **** SpaceLocation *current; }; ! void begin (SpaceLocation *target, int layers, double range); ! void begin (SpaceLocation *target, Vector2 center, int layers, double range); void next (); void end(); private: ! bool current_invalid() { ! if (!(bit(current->layer) & layers) || (current == target) || !current->exists()) return true; ! if (magnitude_sqr(min_delta(target_pos, current->normal_pos())) > range_sqr) return true; ! return false; ! } }; --- 453,462 ---- SpaceLocation *current; }; ! void begin (SpaceLocation *target, int layers, double range, query_type qqtype = QUERY_LOC); ! void begin (SpaceLocation *target, Vector2 center, int layers, double range, query_type qqtype = QUERY_LOC); void next (); void end(); private: ! bool current_invalid(); }; Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** mframe.cpp 26 Aug 2005 21:54:30 -0000 1.42 --- mframe.cpp 28 Aug 2005 20:31:32 -0000 1.43 *************** *** 60,63 **** --- 60,64 ---- void check_physics_correctness_item(int i) { + #ifdef _DEBUG if (physics) { *************** *** 72,84 **** } ! if (fabs(l->pos.x) > 1E6 || fabs(l->pos.y) > 1E6 || fabs(l->vel.x) > 1E6 || fabs(l->vel.x) > 1E6) { tw_error("error in item [%i] [%s]", i, l->get_identity()); } } } void check_physics_correctness() { int i; for ( i = 0; i < physics->num_items; ++i ) --- 73,87 ---- } ! if (fabs(l->pos.x) > 1E6 || fabs(l->pos.y) > 1E6 || fabs(l->vel.x) > 1E6 || fabs(l->vel.y) > 1E6) { tw_error("error in item [%i] [%s]", i, l->get_identity()); } } + #endif } void check_physics_correctness() { + #ifdef _DEBUG int i; for ( i = 0; i < physics->num_items; ++i ) *************** *** 86,93 **** --- 89,98 ---- check_physics_correctness_item(i); } + #endif } void check_physics_presence(Presence *p) { + #ifdef _DEBUG if (!physics) return; *************** *** 108,118 **** } } } ! void Query::begin (SpaceLocation *qtarget, int qlayers, double qrange) {STACKTRACE bool old_physics_allows = physics_allowed; physics_allowed = true; if (qrange < 0) {tw_error("Query::begin - negative range");} --- 113,160 ---- } } + #endif } ! bool Query::current_invalid() ! { ! if (!(bit(current->layer) & layers) || (current == target) || !current->exists()) ! return true; ! ! if (magnitude_sqr(min_delta(target_pos, current->normal_pos())) > range_sqr) ! return true; ! ! switch (qtype) ! { ! case QUERY_LOC: ! { ! if (!current->isLocation()) ! return true; ! break; ! } ! case QUERY_OBJECT: ! { ! if (!current->isObject()) ! return true; ! break; ! } ! case QUERY_LINE: ! { ! tw_error("query_line, is this ever used?"); ! if (!current->isLine()) ! return true; ! break; ! } ! } ! ! return false; ! } ! ! ! void Query::begin (SpaceLocation *qtarget, int qlayers, double qrange, query_type qqtype) {STACKTRACE bool old_physics_allows = physics_allowed; physics_allowed = true; + qtype = qqtype; if (qrange < 0) {tw_error("Query::begin - negative range");} *************** *** 153,157 **** } ! void Query::begin (SpaceLocation *qtarget, Vector2 center, int qlayers, double qrange) { STACKTRACE; --- 195,199 ---- } ! void Query::begin (SpaceLocation *qtarget, Vector2 center, int qlayers, double qrange, query_type qqtype) { STACKTRACE; *************** *** 159,162 **** --- 201,205 ---- bool old_physics_allows = physics_allowed; physics_allowed = true; + qtype = qqtype; layers = qlayers; *************** *** 418,422 **** // the "left-over" data that still remain in memory (for a while). attributes &= ~ATTRIB_INGAME; ! check_physics_presence(this); #endif } --- 461,465 ---- // the "left-over" data that still remain in memory (for a while). attributes &= ~ATTRIB_INGAME; ! //check_physics_presence(this); #endif } *************** *** 467,471 **** angle(langle), damage_factor(0), ! collide_flag_anyone(ALL_LAYERS), collide_flag_sameteam(0), collide_flag_sameship(0) --- 510,515 ---- angle(langle), damage_factor(0), ! //collide_flag_anyone(ALL_LAYERS), ! collide_flag_anyone(0), // a location shouldn't collide... collide_flag_sameteam(0), collide_flag_sameship(0) *************** *** 483,487 **** data = creator->data; ! if (data) data->lock(); target = creator->target; --- 527,532 ---- data = creator->data; ! if (data) ! data->lock(); target = creator->target; *************** *** 493,500 **** else { ally_flag = 0; ! ship = NULL; ! parent = NULL; ! data = NULL; ! target = NULL; } } --- 538,545 ---- else { ally_flag = 0; ! ship = 0; ! parent = 0; ! data = 0; ! target = 0; } } *************** *** 504,508 **** { STACKTRACE ! if (data) data->unlock(); #ifdef _DEBUG --- 549,554 ---- { STACKTRACE ! if (data) ! data->unlock(); #ifdef _DEBUG *************** *** 609,615 **** --- 655,678 ---- } + inline void check_vector_sanity(Vector2 &v) + { + #ifdef _DEBUG + if (fabs(v.x) > 1E6 || fabs(v.y) > 1E6 ) + { + tw_error("invalid velocity change"); + } + #endif + } + void SpaceLocation::change_vel(Vector2 dvel) { vel += dvel; + check_vector_sanity(vel); + } + + void SpaceLocation::set_vel(Vector2 newvel) + { + vel = newvel; + check_vector_sanity(vel); } *************** *** 617,620 **** --- 680,684 ---- { vel *= scale; + check_vector_sanity(vel); } *************** *** 624,627 **** --- 688,692 ---- { pos = normalize(pos + dpos); + check_vector_sanity(pos); } *************** *** 631,634 **** --- 696,700 ---- { pos *= scale; + check_vector_sanity(pos); } *************** *** 658,666 **** ! int SpaceLocation::canCollide(SpaceLocation *other) { ! if (!detectable()) return 0; ! if (sameShip(other)) return ((1 << other->layer) & collide_flag_sameship); ! else if (sameTeam(other)) return ((1 << other->layer) & collide_flag_sameteam); ! return ((1 << other->layer) & collide_flag_anyone); } --- 724,774 ---- ! int SpaceLocation::canCollide(SpaceLocation *other) ! { ! if (!other) ! return 0; ! ! int result; ! ! result = 1; ! ! // if it's not part of the physics ! if (!detectable()) ! result = 0; ! ! // if you are only allowed to collide with other ships ! //if ( collide_flag_sameship == 0) ! if ( (collide_flag_sameship & bit(other->layer) ) == 0) ! { ! if (sameShip(other)) ! result = 0; ! } ! ! // if you should not collide with objects from the same ship ! //if (collide_flag_sameship == 0) ! if ( (collide_flag_sameship & bit(other->layer) ) == 0) ! { ! // but they share the same parent ! if ( other->parent == parent ) ! result = 0; // then set to zero, because they're brothers ! } ! ! // if you are only allowed to collide with ships from other teams ! //if (collide_flag_sameteam == 0) ! if ( (collide_flag_sameteam & bit(other->layer) ) == 0) ! { ! // but the other happens to be in the same team ! if (sameTeam(other)) ! result = 0; // then set it to 0 ! } ! ! // if you are not allowed to collide with *anyone* ... ! //if (collide_flag_anyone == 0) ! if ( (collide_flag_anyone & bit(other->layer) ) == 0) ! { ! result = 0; ! } ! ! return result; } *************** *** 748,764 **** nvm = magnitude_sqr(nv); if ((nvm <= max_speed * max_speed) || (nvm <= ovm)) { ! vel = nv; } else { if (ovm <= max_speed * max_speed) ovm = max_speed; else ovm = sqrt(ovm); ! vel = nv * ovm / (ovm + velocity); ! } ! #ifdef _DEBUG ! if (fabs(vel.x) > 1E6 || fabs(vel.y) > 1E6) ! { ! tw_error("accelerate: velocity overflow..."); } - #endif return; } --- 856,866 ---- nvm = magnitude_sqr(nv); if ((nvm <= max_speed * max_speed) || (nvm <= ovm)) { ! set_vel( nv ); } else { if (ovm <= max_speed * max_speed) ovm = max_speed; else ovm = sqrt(ovm); ! set_vel( nv * ovm / (ovm + velocity) ); } return; } *************** *** 773,777 **** //if new velocity is slow, handle normally //if new velocity is fast, but we're decelerating, still handle normally ! vel = nv; } else { --- 875,879 ---- //if new velocity is slow, handle normally //if new velocity is fast, but we're decelerating, still handle normally ! set_vel( nv ); } else { *************** *** 780,791 **** //otherwise, slow down closer to the maximum speed //but only when turning, particularly turning fast ! vel = nv * ovm / (ovm + magnitude(delta_v)); ! } ! #ifdef _DEBUG ! if (fabs(vel.x) > 1E6 || fabs(vel.y) > 1E6) ! { ! tw_error("accelerate: velocity overflow..."); } - #endif return; } --- 882,887 ---- //otherwise, slow down closer to the maximum speed //but only when turning, particularly turning fast ! set_vel ( nv * ovm / (ovm + magnitude(delta_v)) ); } return; } *************** *** 812,816 **** } ! void SpaceLocation::calculate() {STACKTRACE if (target && !target->exists()) { target_died(); --- 908,915 ---- } ! void SpaceLocation::calculate() ! { ! STACKTRACE; ! if (target && !target->exists()) { target_died(); *************** *** 874,878 **** {STACKTRACE attributes |= ATTRIB_OBJECT; ! if (game && game->friendly_fire) collide_flag_sameteam = ALL_LAYERS; collide_flag_sameship = 0; collide_flag_anyone = ALL_LAYERS; --- 973,978 ---- {STACKTRACE attributes |= ATTRIB_OBJECT; ! //if (game && game->friendly_fire) ! collide_flag_sameteam = ALL_LAYERS; collide_flag_sameship = 0; collide_flag_anyone = ALL_LAYERS; *************** *** 900,904 **** if (this == other) {tw_error("SpaceObject::collide - self!");} ! if((!canCollide(other)) || (!other->canCollide(this))) return; if (!exists() || !other->exists()) return; --- 1000,1010 ---- if (this == other) {tw_error("SpaceObject::collide - self!");} ! ! // BOTH need to be able to collide to each other ! // in order to get a well-defined result. If one of them can't collide, and its code ! // assumes that it will not collide, a forced collision can introduce an error. ! if( (this->canCollide(other) & other->canCollide(this)) == 0 ) ! return; ! if (!exists() || !other->exists()) return; *************** *** 976,985 **** } - #ifdef _DEBUG - if (fabs(vel.x) > 1E6 || fabs(vel.y) > 1E6 || fabs(other->vel.x) > 1E6 || fabs(other->vel.y) > 1E6 ) - { - tw_error("velocity error involving objects [%s] and [%s]", get_identity(), other->get_identity()); - } - #endif return; --- 1082,1085 ---- *************** *** 988,1013 **** double SpaceObject::collide_ray(Vector2 lp1, Vector2 lp2, double llength) {STACKTRACE - int collide_x = (int)(lp2.x); - int collide_y = (int)(lp2.y); - Vector2 d; double old_length = llength; double magn = 0; if (sprite->collide_ray( ! (int)(lp1.x), (int)(lp1.y), &collide_x, &collide_y, ! (int)(lp1.x - min_delta(lp1.x, pos.x, map_size.x)), ! (int)(lp1.y - min_delta(lp1.y, pos.y, map_size.y)), ! sprite_index)) { ! d = lp2 - Vector2(collide_x, collide_y); ! magn = magnitude(d); ! llength = llength - magn; } ! if (llength < -2) { ! tw_error("negative length!"); ! } else { llength = 0; } --- 1088,1127 ---- double SpaceObject::collide_ray(Vector2 lp1, Vector2 lp2, double llength) {STACKTRACE double old_length = llength; double magn = 0; + // line origin (position) + int x1 = (int)(lp1.x); + int y1 = (int)(lp1.y); + + // line end (position) ; this is subject to change + int collide_x = (int)(lp2.x); + int collide_y = (int)(lp2.y); + + // object position (unwrapped w.r.t. the line origin). + int sx = (int)(lp1.x + min_delta(pos.x, lp1.x, map_size.x)); + int sy = (int)(lp1.y + min_delta(pos.y, lp1.y, map_size.y)); + if (sprite->collide_ray( ! x1, y1, ! &collide_x, &collide_y, ! sx, sy, ! sprite_index)) ! { ! //Vector2 d; ! //d = lp2 - Vector2(collide_x, collide_y); ! //magn = magnitude(d); ! //llength = llength - magn; ! llength = magnitude( Vector2(collide_x, collide_y) - lp1 ); } ! if (llength < 0) { ! if (llength < -2) ! { ! tw_error("negative length!"); ! } llength = 0; } *************** *** 1066,1072 **** layer = LAYER_LINES; set_depth(DEPTH_LINES); ! collide_flag_anyone &= OBJECT_LAYERS; ! collide_flag_sameteam &= OBJECT_LAYERS; ! collide_flag_sameship &= OBJECT_LAYERS; if (length < 0) --- 1180,1186 ---- layer = LAYER_LINES; set_depth(DEPTH_LINES); ! collide_flag_anyone = OBJECT_LAYERS; ! collide_flag_sameteam = OBJECT_LAYERS; ! collide_flag_sameship = 0; if (length < 0) *************** *** 1351,1355 **** extern void test_pointers(); ! void delete_location(void *tmp) { if (!physics) --- 1465,1469 ---- extern void test_pointers(); ! void delete_location(SpaceLocation *tmp) { if (!physics) *************** *** 1367,1376 **** // otherwise, it's ok to remove it. delete tmp; } ! static const int max_physics_pointer_test = 1024; ! static int num_physics_pointer_test = 0; ! static SpaceLocation *physics_pointer_test[max_physics_pointer_test]; void Physics::calculate() {_STACKTRACE("Physics::calculate()") --- 1481,1491 ---- // otherwise, it's ok to remove it. + const char *name = 0; + if (tmp->data) + name = tmp->data->file; delete tmp; } ! void Physics::calculate() {_STACKTRACE("Physics::calculate()") *************** *** 1388,1393 **** debug_value = num_items + num_presences; ! test_pointers(); ! check_physics_correctness(); checksync(); --- 1503,1508 ---- debug_value = num_items + num_presences; ! //test_pointers(); ! //check_physics_correctness(); checksync(); *************** *** 1409,1414 **** checksync(); ! test_pointers(); ! check_physics_correctness(); {_STACKTRACE("Physics::calculate() - presence calculation") --- 1524,1529 ---- checksync(); ! //test_pointers(); ! //check_physics_correctness(); {_STACKTRACE("Physics::calculate() - presence calculation") *************** *** 1420,1425 **** } } ! test_pointers(); ! check_physics_correctness(); //call objects calculate functions --- 1535,1540 ---- } } ! //test_pointers(); ! //check_physics_correctness(); //call objects calculate functions *************** *** 1433,1441 **** tw_error("Pointer error, overwritten data ??"); } - //test_pointers(); item[i]->calculate(); ! //test_pointers(); // try to intercept a couple of errors that are possible here ... --- 1548,1557 ---- tw_error("Pointer error, overwritten data ??"); } item[i]->calculate(); ! //xxx costly check... ! //check_physics_correctness(); ! // try to intercept a couple of errors that are possible here ... *************** *** 1458,1462 **** } } ! test_pointers(); check_physics_correctness(); --- 1574,1578 ---- } } ! //test_pointers(); check_physics_correctness(); *************** *** 1484,1489 **** collide(); } ! test_pointers(); ! check_physics_correctness(); checksync(); --- 1600,1605 ---- collide(); } ! //test_pointers(); ! //check_physics_correctness(); checksync(); *************** *** 1510,1527 **** } } ! test_pointers(); ! check_physics_correctness(); checksync(); - // checking for mem-overwrite - for(i = 0; i < num_physics_pointer_test; i ++) - { - if (physics_pointer_test[i] != item[i]) - { - tw_error("Physics memory array has been changed !!"); - } - } - // end of test //remove objects that have been dead long enough --- 1626,1634 ---- } } ! //test_pointers(); ! //check_physics_correctness(); checksync(); //remove objects that have been dead long enough *************** *** 1538,1545 **** i -= 1; const char *name = tmp->get_identity(); ! if (strcmp(name, "AsteroidCenter") == 0) ! { ! int k = 0; ! } delete_location(tmp); //xxx despite that TEST, it's still going wrong here !! So, something gets deleted outside of this physics, after being added to the physics... nasty!. --- 1645,1649 ---- i -= 1; const char *name = tmp->get_identity(); ! //delete tmp; delete_location(tmp); //xxx despite that TEST, it's still going wrong here !! So, something gets deleted outside of this physics, after being added to the physics... nasty!. *************** *** 1548,1557 **** } - // copying info for mem-overwrite test - num_physics_pointer_test = max_physics_pointer_test; - if (num_physics_pointer_test > num_items) - num_physics_pointer_test = num_items; - memcpy(physics_pointer_test, item, num_physics_pointer_test * sizeof(SpaceLocation*)); - // end of copy for(i = 0; i < num_items; i ++) --- 1652,1655 ---- *************** *** 1609,1615 **** game_frame_rate = 0.1 * game_frame_rate + 0.9 * (get_time() - game_animation_time); game_animation_time = get_time(); ! message.print(1, 15, "frame rate = %i ms", int(game_frame_rate)); ! check_physics_correctness(); #endif --- 1707,1713 ---- game_frame_rate = 0.1 * game_frame_rate + 0.9 * (get_time() - game_animation_time); game_animation_time = get_time(); ! // message.print(1, 15, "frame rate = %i ms", int(game_frame_rate)); ! //check_physics_correctness(); #endif *************** *** 1694,1701 **** ! check_physics_correctness(); } ! check_physics_correctness(); return; --- 1792,1799 ---- ! //check_physics_correctness(); } ! //check_physics_correctness(); return; *************** *** 1745,1750 **** SpaceObject *o = 0; Query q; ! for (q.begin(l, normalize(l->pos+l->edge()/2, map_size), OBJECT_LAYERS, 96 + l->get_length()/2); q.current && l->exists(); q.next()) { double d; --- 1843,1853 ---- SpaceObject *o = 0; + Vector2 lineorigin = l->pos; + Vector2 offset = l->edge()/2; + Vector2 center = normalize(lineorigin + offset, map_size); + Query q; ! for (q.begin(l, center, OBJECT_LAYERS, 96 + distance/2, QUERY_OBJECT); ! q.currento && l->exists(); q.next()) { double d; *************** *** 1786,1791 **** tmp[l].y = p.y; if (tmp[l].y < 0) tmp[l].y += size.y; ! //xxx goes wrong in case of Androsynth Guardian (=o) ; m=0x00003c. ! tmp[l].pmask = o->get_sprite()->get_pmask(o->get_sprite_index()); #ifdef _DEBUG --- 1889,1896 ---- tmp[l].y = p.y; if (tmp[l].y < 0) tmp[l].y += size.y; ! ! SpaceSprite *spr = o->get_sprite(); ! int index = o->get_sprite_index(); ! tmp[l].pmask = spr->get_pmask(index); #ifdef _DEBUG *************** *** 1804,1809 **** delete[] tmp; // return; ! for (i = 0; i < nc; i += 1) { col[i*2]->collide(col[i*2+1]); }//*/ Query q; --- 1909,1928 ---- delete[] tmp; // return; ! ! for (i = 0; i < nc; i += 1) ! { col[i*2]->collide(col[i*2+1]); + + #ifdef _DEBUG + SpaceObject *c1 = col[i*2]; + SpaceObject *c2 = col[i*2+1]; + if (fabs(c1->vel.x) > 1E6 || fabs(c1->vel.y) > 1E6 || fabs(c2->vel.x) > 1E6 || fabs(c2->vel.y) > 1E6 ) + { + int a1 = c1->canCollide(c2); + int a2 = c2->canCollide(c1); + bool b = ((c1->canCollide(c2) & c2->canCollide(c1)) == 0 ); + tw_error("velocity error in collision involving objects [%s] and [%s]", c1->get_identity(), c2->get_identity()); + } + #endif }//*/ Query q; Index: mhelpers.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mhelpers.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mhelpers.cpp 16 Aug 2005 18:17:29 -0000 1.10 --- mhelpers.cpp 28 Aug 2005 20:31:32 -0000 1.11 *************** *** 573,576 **** --- 573,577 ---- if (parent && (parent != this)) parent->add_callback ( this ); update_pos(); + event(VideoEvent::RESIZE); event(VideoEvent::REDRAW); |
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4452/source/games Modified Files: gamehierarchy.h gflmelee.cpp ggob.cpp ghyper.cpp gmissions.cpp gplanets.cpp gplexplr.cpp gplexplr.h Log Message: debugging Index: gamehierarchy.h =================================================================== RCS file: /cvsroot/timewarp/source/games/gamehierarchy.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gamehierarchy.h 24 Mar 2004 23:51:34 -0000 1.7 --- gamehierarchy.h 28 Aug 2005 20:31:00 -0000 1.8 *************** *** 41,45 **** SubGame(); ! ~SubGame(); virtual void init(Log *_log); --- 41,45 ---- SubGame(); ! virtual ~SubGame(); virtual void init(Log *_log); Index: gplexplr.h =================================================================== RCS file: /cvsroot/timewarp/source/games/gplexplr.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gplexplr.h 11 Jul 2005 00:25:12 -0000 1.6 --- gplexplr.h 28 Aug 2005 20:31:01 -0000 1.7 *************** *** 153,157 **** Plsurface(char *datafilename, char *subdatafilename); ! ~Plsurface(); void calculate(); void animate(Frame *frame); --- 153,157 ---- Plsurface(char *datafilename, char *subdatafilename); ! virtual ~Plsurface(); void calculate(); void animate(Frame *frame); Index: gplanets.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gplanets.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gplanets.cpp 14 Aug 2005 16:14:32 -0000 1.15 --- gplanets.cpp 28 Aug 2005 20:31:01 -0000 1.16 *************** *** 280,284 **** SpaceObject *o; for (a.begin(NULL, Vector2(x0, y0), bit(LAYER_SHIPS) + bit(LAYER_CBODIES) + bit(LAYER_SHOTS), ! scandist); a.current; a.next()) { o = a.currento; --- 280,284 ---- SpaceObject *o; for (a.begin(NULL, Vector2(x0, y0), bit(LAYER_SHIPS) + bit(LAYER_CBODIES) + bit(LAYER_SHOTS), ! scandist, QUERY_OBJECT); a.current; a.next()) { o = a.currento; *************** *** 355,359 **** SpaceSprite **backgrimages; ! ~Planets(); virtual void init_objects(); --- 355,359 ---- SpaceSprite **backgrimages; ! virtual ~Planets(); virtual void init_objects(); Index: gplexplr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gplexplr.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gplexplr.cpp 14 Aug 2005 16:14:32 -0000 1.15 --- gplexplr.cpp 28 Aug 2005 20:31:01 -0000 1.16 *************** *** 105,109 **** // check for neighbouring (small) objects ! for (q.begin(s, ALL_LAYERS, R); q.current; q.next()) { SpaceObject *o; --- 105,109 ---- // check for neighbouring (small) objects ! for (q.begin(s, ALL_LAYERS, R, QUERY_OBJECT); q.current; q.next()) { SpaceObject *o; *************** *** 1025,1029 **** // check for neighbouring (small) objects ! for (q.begin(o, OBJECT_LAYERS, (192 + o->get_size().x + o->get_size().y)/2); q.current; q.next()) { o->collide(q.currento); --- 1025,1029 ---- // check for neighbouring (small) objects ! for (q.begin(o, OBJECT_LAYERS, (192 + o->get_size().x + o->get_size().y)/2, QUERY_OBJECT); q.current; q.next()) { o->collide(q.currento); Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** gflmelee.cpp 14 Aug 2005 16:14:32 -0000 1.29 --- gflmelee.cpp 28 Aug 2005 20:31:00 -0000 1.30 *************** *** 112,116 **** YRadar(Control *ocontroller, double Size, TeamCode hteam, char *datafilename, bool rel, int shape); ! ~YRadar(); // the code for painting on the radar screen is in here. --- 112,116 ---- YRadar(Control *ocontroller, double Size, TeamCode hteam, char *datafilename, bool rel, int shape); ! virtual ~YRadar(); // the code for painting on the radar screen is in here. *************** *** 225,229 **** int radar_pos_id; ! ~FlMelee(); SpaceSprite *HugePics[Num_Planet_Pics]; --- 225,229 ---- int radar_pos_id; ! virtual ~FlMelee(); SpaceSprite *HugePics[Num_Planet_Pics]; Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ggob.cpp 14 Aug 2005 16:14:32 -0000 1.41 --- ggob.cpp 28 Aug 2005 20:31:00 -0000 1.42 *************** *** 856,860 **** SpaceObject *target = NULL; Query q; ! q.begin(this, OBJECT_LAYERS &~ bit(LAYER_SHIPS), 300); while (q.currento && !target) { if (!q.currento->sameTeam(ship)) { --- 856,860 ---- SpaceObject *target = NULL; Query q; ! q.begin(this, OBJECT_LAYERS &~ bit(LAYER_SHIPS), 300, QUERY_OBJECT); while (q.currento && !target) { if (!q.currento->sameTeam(ship)) { *************** *** 949,953 **** next_time2 += random(10000); Query q; ! for (q.begin(this, bit(LAYER_SHIPS), 40); q.current; q.next()) { GobPlayer *p = gobgame->get_player(q.currento); if (q.currento == p->ship) { --- 949,953 ---- next_time2 += random(10000); Query q; ! for (q.begin(this, bit(LAYER_SHIPS), 40, QUERY_OBJECT); q.current; q.next()) { GobPlayer *p = gobgame->get_player(q.currento); if (q.currento == p->ship) { Index: gmissions.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** gmissions.cpp 14 Aug 2005 16:14:32 -0000 1.29 --- gmissions.cpp 28 Aug 2005 20:31:00 -0000 1.30 *************** *** 213,217 **** PopupYN *alertlose; // accept and retry option ! ~gmissions(); int Nmissions, chosenmission; --- 213,217 ---- PopupYN *alertlose; // accept and retry option ! virtual ~gmissions(); int Nmissions, chosenmission; *************** *** 2888,2892 **** // check for neighbouring (small) objects ! for (q.begin(s, ALL_LAYERS, R); q.current; q.next()) { SpaceObject *o; --- 2888,2892 ---- // check for neighbouring (small) objects ! for (q.begin(s, ALL_LAYERS, R, QUERY_OBJECT); q.current; q.next()) { SpaceObject *o; Index: ghyper.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ghyper.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ghyper.cpp 14 Aug 2005 16:14:32 -0000 1.12 --- ghyper.cpp 28 Aug 2005 20:31:00 -0000 1.13 *************** *** 28,32 **** virtual void set_resolution (int screen_x, int screen_y); virtual void init_objects(); ! ~HyperMelee(); }; --- 28,32 ---- virtual void set_resolution (int screen_x, int screen_y); virtual void init_objects(); ! virtual ~HyperMelee(); }; |
|
From: Rob <geo...@us...> - 2005-08-28 20:30:35
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4343/source/ais Modified Files: c_wussie.cpp Log Message: debugging Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** c_wussie.cpp 23 Aug 2005 22:21:16 -0000 1.25 --- c_wussie.cpp 28 Aug 2005 20:30:28 -0000 1.26 *************** *** 19,22 **** --- 19,23 ---- OPTION_LAST // this must be the last in the line }; + /* #define OPTION_UNKNOWN 0 *************** *** 68,72 **** double d = 0; Query q; ! q.begin (ship, OBJECT_LAYERS, ship->size.x + ship->size.y + 200); for (; q.currento; q.next ()) { --- 69,73 ---- double d = 0; Query q; ! q.begin (ship, OBJECT_LAYERS, ship->size.x + ship->size.y + 200, QUERY_OBJECT); for (; q.currento; q.next ()) { *************** *** 147,151 **** double collider_t = 1E6; ! for ( b.begin (¢er_check, OBJECT_LAYERS & ~bit (LAYER_CBODIES) & ~bit (LAYER_SHIPS), check_range); b.current; b.next() ) { shot = b.currento; --- 148,152 ---- double collider_t = 1E6; ! for ( b.begin (¢er_check, OBJECT_LAYERS & ~bit (LAYER_CBODIES) & ~bit (LAYER_SHIPS), check_range, QUERY_OBJECT); b.current; b.next() ) { shot = b.currento; *************** *** 314,318 **** } ! for (ap.begin (ship, bit (LAYER_CBODIES), planet_safe[state]); ap.current; ap.next ()) { --- 315,319 ---- } ! for (ap.begin (ship, bit (LAYER_CBODIES), planet_safe[state], QUERY_OBJECT); ap.current; ap.next ()) { |
|
From: Rob <geo...@us...> - 2005-08-28 20:30:05
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4097/ships Modified Files: shpterbi.ini Log Message: weapon range increase Index: shpterbi.ini =================================================================== RCS file: /cvsroot/timewarp/ships/shpterbi.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** shpterbi.ini 8 Jan 2004 22:21:42 -0000 1.1 --- shpterbi.ini 28 Aug 2005 20:29:57 -0000 1.2 *************** *** 47,51 **** Mass = 4 ! WeaponRange = 1 [Fighter] --- 47,51 ---- Mass = 4 ! WeaponRange = 3 [Fighter] |
|
From: Rob <geo...@us...> - 2005-08-28 20:29:20
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3963/ships Modified Files: shpaktgu.dat shpconca.dat Log Message: new ship graphics Index: shpaktgu.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpaktgu.dat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsaDRgqY and /tmp/cvseFFoQs differ Index: shpconca.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpconca.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs3p7mZZ and /tmp/cvsHLNXuu differ |
|
From: Rob <geo...@us...> - 2005-08-26 21:59:25
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29900/source/melee Modified Files: mship.cpp Log Message: Aaahh... the chorali ship... it has a bug and I cannot find it ! Maybe later. Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** mship.cpp 23 Aug 2005 22:21:16 -0000 1.41 --- mship.cpp 26 Aug 2005 21:59:16 -0000 1.42 *************** *** 1207,1211 **** // needed to keep track of important pointers... which need to be checked each game iteration ! // to see if they are still valid or not... if (ship) ship->handle_phasing(); --- 1207,1212 ---- // needed to keep track of important pointers... which need to be checked each game iteration ! // to see if they are still valid or not... hmm.. in principle at least. For now, DEATH_COUNTER ! // is set to a high value so that objects aren't deleted while the ship is still phasing in. if (ship) ship->handle_phasing(); |