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-08-21 09:48:45
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21456/ships Modified Files: shpiceco.txt shpquasi.dat shprogsq.txt shptauda.dat Log Message: updated ship graphics and descriptions Index: shpquasi.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpquasi.dat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsRFSEAF and /tmp/cvs9xK8VE differ Index: shprogsq.txt =================================================================== RCS file: /cvsroot/timewarp/ships/shprogsq.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shprogsq.txt 8 Jun 2003 17:55:17 -0000 1.3 --- shprogsq.txt 21 Aug 2005 09:48:37 -0000 1.4 *************** *** 4,8 **** background: ! A rogue squadron of former UQ crew, now lawless scavengers of the universe, a curious mixture of different races in a simple general ship design which is harmless on its own, but can be dangerous in large numbers. How to use this ship: --- 4,8 ---- background: ! A rogue squadron of human renegades, now lawless scavengers of the universe, piloting a simple general ship design which is weak on its own, but can be dangerous in large numbers. How to use this ship: Index: shpiceco.txt =================================================================== RCS file: /cvsroot/timewarp/ships/shpiceco.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shpiceco.txt 8 Jun 2003 17:55:03 -0000 1.3 --- shpiceco.txt 21 Aug 2005 09:48:36 -0000 1.4 *************** *** 4,9 **** This ship is poor in regular combat, but can gain an advantage by firing its special. ! Weapon: a pair of powerful shots from the sides. They are difficult to aim, have very short range, and gobble up fuel. ! Special: a short range homing sphere which, when it hits the enemy, mixes up all controls of the opponent for about 5 seconds. --- 4,9 ---- This ship is poor in regular combat, but can gain an advantage by firing its special. ! Weapon: Short range, low damage, pellet gun, with slight homing capability. ! Special: a pair of shots from the sides; when they hit the enemy, it mixes up all controls of the opponent for a few seconds. Index: shptauda.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shptauda.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsBDZtnH and /tmp/cvsCwl9VG differ |
From: Rob <geo...@us...> - 2005-08-19 00:27:10
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23516/source/melee Modified Files: mmain.cpp msprite.cpp Log Message: sprite caching is extended to the rotations Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** msprite.cpp 16 Aug 2005 19:01:33 -0000 1.21 --- msprite.cpp 17 Aug 2005 23:51:59 -0000 1.22 *************** *** 17,455 **** #include "mview.h" - BITMAP *bmp_rot(BITMAP *ref, double a); - - bool showshademaps = false; - - const int RotAngles = 64; // number of rotation-angles - const int RotSize = 128; // max size of the image, should be a power of 2 ? - int xy_rotation_table[2*RotAngles*RotSize*RotSize]; - [...1057 lines suppressed...] + + BITMAP *bmp = b[0][ipic]; + if (!bmp) + { + tw_error("Basic sprite shape doesn't exist, cannot rotate"); + } + BITMAP *tmp = create_bitmap_ex(bpp, w, h); + clear_to_color(tmp, bitmap_mask_color(tmp)); + rotate_sprite(tmp, bmp, 0, 0, irot * ((1<<24)/count_rotations)); + + b[0][index] = tmp; + + } + + if (miplevel > 0) + generate_mipmap(miplevel, index, bpp); + } + + return b[miplevel][index]; + } Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** mmain.cpp 14 Aug 2005 16:14:32 -0000 1.42 --- mmain.cpp 17 Aug 2005 23:51:59 -0000 1.43 *************** *** 969,974 **** pause(); - showshademaps = true; - message.out("Selecting ships...", 1000); --- 969,972 ---- |
From: Rob <geo...@us...> - 2005-08-19 00:25:59
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23516/source Modified Files: melee.h Log Message: sprite caching is extended to the rotations Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** melee.h 16 Aug 2005 19:01:33 -0000 1.23 --- melee.h 17 Aug 2005 23:51:58 -0000 1.24 *************** *** 424,435 **** void animate_bmp(BITMAP *bmp, Vector2 pos, Frame *space); - struct Light - { - double r, g, b; - double intensity; - double angle; - }; - - extern bool showshademaps; class SpaceSprite { --- 424,427 ---- *************** *** 438,442 **** protected: enum { MAX_MIP_LEVELS = 8 }; ! int count; char bpp; char highest_mip; --- 430,434 ---- protected: enum { MAX_MIP_LEVELS = 8 }; ! int count, count_base, count_rotations; char bpp; char highest_mip; *************** *** 479,485 **** //methods for direct access: Surface *get_bitmap(int index, int miplevel = 0); ! Surface *get_bitmap_readonly(int index); PMASK *get_pmask(int index); void lock(); //make surface writable --- 471,479 ---- + void generate_mipmap(int level, int index, int bpp); + //methods for direct access: Surface *get_bitmap(int index, int miplevel = 0); ! // Surface *get_bitmap_readonly(int index); PMASK *get_pmask(int index); void lock(); //make surface writable *************** *** 521,533 **** INLINE int frames() const {return count;} // changed Rob. ! Vector2 size(int i = 0) const;// const {return Vector2(b[0][i]->w, b[0][i]->h);} int width() const {return w;} int height() const {return h;} - double *shademap; - double *rmap, *gmap, *bmap; - void init_shademaps(); - void destroy_shademaps(); - BITMAP *SpaceSprite::add_shades(BITMAP *ref, double amb, Light *lights, int Nlights, double ref_angle); }; --- 515,522 ---- INLINE int frames() const {return count;} // changed Rob. ! Vector2 size(int i = 0);// const {return Vector2(b[0][i]->w, b[0][i]->h);} int width() const {return w;} int height() const {return h;} }; |
From: Rob <geo...@us...> - 2005-08-19 00:09:32
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27789/source/newships Modified Files: shpalabc.cpp shpconca.cpp Log Message: fixed two mistakes that I made in an if-statement. Index: shpalabc.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalabc.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpalabc.cpp 14 Aug 2005 16:14:32 -0000 1.20 --- shpalabc.cpp 18 Aug 2005 00:06:42 -0000 1.21 *************** *** 227,231 **** aaa = tw_random(PI2); rrr = 66 * sqrt(tw_random(1.0)); ! if (tw_random()&1 == 0) { SpaceLocation *ani = new Animation(this, pos+rrr*unit_vector(aaa), data->spriteSpecialExplosion, 0, 10, 50, DEPTH_EXPLOSIONS); game->add(ani); } --- 227,231 ---- aaa = tw_random(PI2); rrr = 66 * sqrt(tw_random(1.0)); ! if ( (tw_random()&1) == 0) { SpaceLocation *ani = new Animation(this, pos+rrr*unit_vector(aaa), data->spriteSpecialExplosion, 0, 10, 50, DEPTH_EXPLOSIONS); game->add(ani); } Index: shpconca.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpconca.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpconca.cpp 14 Aug 2005 16:14:32 -0000 1.19 --- shpconca.cpp 18 Aug 2005 00:06:42 -0000 1.20 *************** *** 143,147 **** // (later changed into a big chance) ! if ( tw_random()&1 == 0 ) { --- 143,147 ---- // (later changed into a big chance) ! if ( (tw_random()&1) == 0 ) { |
From: Rob <geo...@us...> - 2005-08-18 23:29:35
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23652/source/newships Modified Files: shpimpka.cpp shptauar.cpp Log Message: uhm... Index: shpimpka.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpimpka.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpimpka.cpp 14 Aug 2005 16:14:32 -0000 1.16 --- shpimpka.cpp 17 Aug 2005 23:52:28 -0000 1.17 *************** *** 421,425 **** int si = other->get_sprite_index(); ! BITMAP* bmp = other->get_sprite()->get_bitmap_readonly( si ); BITMAP* tmp; int mcol = bitmap_mask_color( bmp ); --- 421,425 ---- int si = other->get_sprite_index(); ! BITMAP* bmp = other->get_sprite()->get_bitmap( si ); BITMAP* tmp; int mcol = bitmap_mask_color( bmp ); Index: shptauar.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptauar.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shptauar.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shptauar.cpp 17 Aug 2005 23:52:28 -0000 1.18 *************** *** 459,463 **** if (freeze) { ! BITMAP* bmp = other->get_sprite()->get_bitmap_readonly( other->get_sprite_index() ); BITMAP* tmp; --- 459,463 ---- if (freeze) { ! BITMAP* bmp = other->get_sprite()->get_bitmap( other->get_sprite_index() ); BITMAP* tmp; |
From: Rob <geo...@us...> - 2005-08-18 23:05:16
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31315/ships Modified Files: shpiceco.dat shprekas.dat Log Message: updated graphics (by Shadow) Index: shprekas.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shprekas.dat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvskjkptp and /tmp/cvs7F4YEC differ Index: shpiceco.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpiceco.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs3ikYPt and /tmp/cvsZ5anuH differ |
From: Rob <geo...@us...> - 2005-08-18 22:55:59
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23260/source/melee Modified Files: mshpdata.cpp Log Message: shipdata: datafile content is copied, datafile is then discarded. Added a routine to copy a jgmod structure, and a sample structure. Index: mshpdata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshpdata.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mshpdata.cpp 16 Aug 2005 18:17:29 -0000 1.10 --- mshpdata.cpp 17 Aug 2005 23:50:54 -0000 1.11 *************** *** 259,267 **** // clean up these pointer arrays ... // these were created with the "new" command --> use delete delete [] sampleWeapon; delete [] sampleSpecial; delete [] sampleExtra; ! unload_datafile(data); shipdatas_loaded -= 1; --- 259,291 ---- // clean up these pointer arrays ... // these were created with the "new" command --> use delete + // also, the wave data are kept in memory... you've to remove those data + int i; + for( i = 0; i < num_weapon_samples; ++i ) + { + if (sampleWeapon[i]) + destroy_sample(sampleWeapon[i]); + } delete [] sampleWeapon; + + for( i = 0; i < num_special_samples; ++i ) + { + if (sampleSpecial[i]) + destroy_sample(sampleSpecial[i]); + } delete [] sampleSpecial; + + for( i = 0; i < num_extra_samples; ++i ) + { + if (sampleExtra[i]) + destroy_sample(sampleExtra[i]); + } delete [] sampleExtra; ! ! if (moduleVictory) ! { ! destroy_mod(moduleVictory); ! moduleVictory = 0; ! } shipdatas_loaded -= 1; *************** *** 363,367 **** } ! void ShipData::load() { int i, index = 0, count; --- 387,492 ---- } ! ! void *copy_data(void *data, int N) ! { ! if (!data) ! { ! tw_error("Unable to copy data."); ! } ! ! if (N < 0 || N > 1E7) ! { ! tw_error("Invalid data size"); ! } ! ! void *d; ! if (N > 0) ! { ! //d = new unsigned char [N]; ! d = malloc(N); ! memcpy(d, data, N); ! } else { ! d = 0; ! } ! ! return d; ! } ! ! ! SAMPLE *copy_sample(SAMPLE *source) ! { ! SAMPLE *dest = (SAMPLE*) malloc(sizeof(SAMPLE)); ! ! // copy the sample info ! memcpy(dest, source, sizeof(SAMPLE)); ! ! // 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; ! } ! ! //void *jgmod_calloc (int size); ! ! #define INIT_MEM(TYPE, NUM, DEST, SRC) \ ! DEST = (TYPE*) malloc(NUM*sizeof(TYPE)); \ ! memcpy(DEST, SRC, NUM*sizeof(TYPE)); ! ! // geo- I had to look into the JGMOD *load_jgm (JGMOD_FILE *f) function to understand ! // how the data structures are organized and created... in the file load_jgm.c ! JGMOD *copy_jgmod(JGMOD *source) ! { ! ! JGMOD *dest; ! INIT_MEM(JGMOD, 1, dest, source); ! ! ! ! // certain number of instruments ! ! INIT_MEM(INSTRUMENT_INFO, dest->no_instrument, dest->ii, source->ii); ! ! // certain number of samples ! ! INIT_MEM(SAMPLE_INFO, dest->no_sample, dest->si, source->si); ! ! // allocate memory for the SAMPLE headers ! INIT_MEM(SAMPLE, dest->no_sample, dest->s, source->s); ! ! // initialize the SAMPLE data pointers (and the sample data). ! int i; ! for ( i = 0; i < dest->no_sample; ++i ) ! { ! SAMPLE *s, *s_src; ! s = dest->s + i; // the i-th sample. ! s_src = source->s + i; ! ! int L = s->len * s->bits / 8; ! s->data = malloc (L); ! memcpy(s->data, s_src->data, L); ! ! } ! ! ! INIT_MEM(PATTERN_INFO, dest->no_pat, dest->pi, source->pi); ! ! for ( i = 0; i < dest->no_pat; ++i ) ! { ! PATTERN_INFO *pi, *pi_src; ! pi = dest->pi + i; ! pi_src = source->pi + i; ! ! int L = sizeof(NOTE_INFO) * dest->no_chn * pi->no_pos; ! pi->ni = (NOTE_INFO*) malloc(L); ! memcpy(pi->ni, pi_src->ni, L); ! } ! ! ! return dest; ! } ! ! void ShipData::load() ! { ! int i, index = 0, count; *************** *** 373,376 **** --- 498,502 ---- tw_error("Error loading '%s'", file); + push_config_state(); set_config_data((char *)(data[index].dat), data[index].size); *************** *** 420,424 **** // initialize ship victory ditty ! moduleVictory = (Music *)(data[index].dat); index++; --- 546,550 ---- // initialize ship victory ditty ! moduleVictory = copy_jgmod((JGMOD*)data[index].dat);//(Music *) copy_data(data[index].dat, data[index].size); index++; *************** *** 429,433 **** sampleWeapon = new SAMPLE*[count]; for(i = 0; i < count; i++) { ! sampleWeapon[i] = (SAMPLE *)(data[index].dat); index++; } --- 555,561 ---- sampleWeapon = new SAMPLE*[count]; for(i = 0; i < count; i++) { ! //sampleWeapon[i] = (SAMPLE *)copy_data(data[index].dat, data[index].size + min_sample_amount);//(data[index].dat); ! //sampleWeapon[i] = (SAMPLE *)(data[index].dat); ! sampleWeapon[i] = copy_sample( (SAMPLE *)data[index].dat ); index++; } *************** *** 435,438 **** --- 563,567 ---- else sampleWeapon = NULL; + // load special ability samples count = get_config_int("Objects", "SpecialSamples", 0); *************** *** 441,445 **** sampleSpecial = new SAMPLE*[count]; for(i = 0; i < count; i++) { ! sampleSpecial[i] = (SAMPLE *)(data[index].dat); index++; } --- 570,576 ---- sampleSpecial = new SAMPLE*[count]; for(i = 0; i < count; i++) { ! //sampleSpecial[i] = (SAMPLE *)copy_data(data[index].dat, data[index].size + min_sample_amount);//(data[index].dat); ! //sampleSpecial[i] = (SAMPLE *)data[index].dat; ! sampleSpecial[i] = copy_sample( (SAMPLE *)data[index].dat ); index++; } *************** *** 453,457 **** sampleExtra = new SAMPLE*[count]; for(i = 0; i < count; i++) { ! sampleExtra[i] = (SAMPLE *)(data[index].dat); index++; } --- 584,590 ---- sampleExtra = new SAMPLE*[count]; for(i = 0; i < count; i++) { ! //sampleExtra[i] = (SAMPLE *)copy_data(data[index].dat, data[index].size + min_sample_amount); ! //sampleExtra[i] = (SAMPLE *)data[index].dat; ! sampleExtra[i] = copy_sample( (SAMPLE *)data[index].dat ); index++; } *************** *** 462,465 **** --- 595,608 ---- status = LOADED_FULL; + // all data is copied, so now, you can discard the original data file ! + pop_config_state(); + unload_datafile(data); + data = 0; + + // hmmm... in SAMPLE, there's a pointer to "data" + //sound.play(sampleSpecial[0], 32, 128, 1024); + + //sound.play_music(moduleVictory); + return; |
From: Rob <geo...@us...> - 2005-08-17 14:17:21
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26037/source/newships Modified Files: shpconho.cpp Log Message: fixed crew damage handling Index: shpconho.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpconho.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpconho.cpp 16 Aug 2005 23:21:02 -0000 1.14 --- shpconho.cpp 17 Aug 2005 14:17:11 -0000 1.15 *************** *** 13,16 **** --- 13,19 ---- public: IDENTITY(ConfederationHornet); + + double crew_real; + int regenrateFrames; int regenrateCount; *************** *** 99,102 **** --- 102,106 ---- */ + crew_real = 1; crew_max = 1 + shield_max; } *************** *** 168,172 **** Ship::calculate(); ! crew = 1 + shield; } --- 172,176 ---- Ship::calculate(); ! crew = crew_real + shield; } *************** *** 181,190 **** } ! crew = 1; Ship::handle_damage(source, normal, direct); if (crew <= 0) shield = 0; ! else ! crew = 1 + shield; return 0; --- 185,198 ---- } ! //crew = 1; this is bad ... ! crew = crew_real; Ship::handle_damage(source, normal, direct); + if (crew <= 0) shield = 0; ! ! ! crew_real = crew; ! crew = crew_real + shield; return 0; |
From: Rob <geo...@us...> - 2005-08-17 14:16:55
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25915/source/newships Modified Files: shpsefn2.cpp Log Message: fixed an invalid pointer mistake Index: shpsefn2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsefn2.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpsefn2.cpp 2 Aug 2005 00:23:47 -0000 1.11 --- shpsefn2.cpp 17 Aug 2005 14:16:47 -0000 1.12 *************** *** 1101,1105 **** if(src->isShip()) { ! src->ship->turn_rate *= 0.80; damage(src, 1.0, 0.0); } --- 1101,1106 ---- if(src->isShip()) { ! //src->ship->turn_rate *= 0.80; ! ((Ship*)src)->turn_rate *= 0.80; damage(src, 1.0, 0.0); } |
From: Rob <geo...@us...> - 2005-08-16 23:22:36
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv462/source/newships Modified Files: shparkpi.cpp Log Message: planet damage sets state=0, which can be an undesirable override of some objects; uses a call to die() instead. Needed for the arkanoid pincer... Index: shparkpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparkpi.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shparkpi.cpp 16 Aug 2005 18:17:30 -0000 1.17 --- shparkpi.cpp 16 Aug 2005 23:22:27 -0000 1.18 *************** *** 414,418 **** //message.print(1500,6,"ArkanoidPincerShipHandleDamage1"); x = Ship::handle_damage(source, normal, direct); ! if(state==0) { if(pincerL)pincerL->state = 0; if(pincerR)pincerR->state = 0; --- 414,419 ---- //message.print(1500,6,"ArkanoidPincerShipHandleDamage1"); x = Ship::handle_damage(source, normal, direct); ! if (!exists())//(state==0) { ! { if(pincerL)pincerL->state = 0; if(pincerR)pincerR->state = 0; *************** *** 573,576 **** --- 574,581 ---- // x = SpaceObject::die(); //message.print(1500,14,"ArkanoidPincerDie2"); + if (!exists()) + { + tw_error("The pincer must not die!!"); + } return true; } *************** *** 623,628 **** --- 628,641 ---- if(sprite_index>127) sprite_index=127; //sprite_index = spriteIndexSkew; + if (!exists()) + { + tw_error("The pincer must not die!!"); + } SpaceObject::calculate(); //message.print(1500,15,"ArkanoidPincerCalculate2"); + if (!exists()) + { + tw_error("The pincer must not die!!"); + } } *************** *** 725,728 **** --- 738,745 ---- collide_flag_sameteam = 0; } + if (!exists()) + { + tw_error("The pincer must not die!!"); + } //message.print(1500,15,"ArkanoidPincerHandleDamage2 armour=%d normal=%d", armour, normal); return iround(normal + direct); |
From: Rob <geo...@us...> - 2005-08-16 23:22:36
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv462/source/melee Modified Files: mcbodies.cpp Log Message: planet damage sets state=0, which can be an undesirable override of some objects; uses a call to die() instead. Needed for the arkanoid pincer... Index: mcbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mcbodies.cpp 14 Aug 2005 16:14:32 -0000 1.16 --- mcbodies.cpp 16 Aug 2005 23:22:27 -0000 1.17 *************** *** 104,111 **** i = (int) ceil(((Ship*)other)->crew / 3.0); } ! if (other->mass == 0) other->state = 0; damage(other, 0, i); i /= 2; if (i >= BOOM_SAMPLES) i = BOOM_SAMPLES - 1; if (!other->isShot()) play_sound((SAMPLE *)(melee[MELEE_BOOM + i].dat)); --- 104,119 ---- i = (int) ceil(((Ship*)other)->crew / 3.0); } ! if (other->mass == 0) ! { ! //other->state = 0; // you shouldn't "delete" something like this, because sometimes, an object must not die.. ! other->die(); ! } ! damage(other, 0, i); + i /= 2; + if (i >= BOOM_SAMPLES) i = BOOM_SAMPLES - 1; + if (!other->isShot()) play_sound((SAMPLE *)(melee[MELEE_BOOM + i].dat)); |
From: Rob <geo...@us...> - 2005-08-16 23:21:14
|
Update of /cvsroot/timewarp/source/sc2ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32526/source/sc2ships Modified Files: shpchmav.cpp shporzne.cpp shppkufu.cpp shpthrto.cpp Log Message: armour (iround) corrected to handle doubles, because otherwise fractional damage doesn't work Index: shpthrto.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpthrto.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpthrto.cpp 11 Jul 2005 00:25:59 -0000 1.14 --- shpthrto.cpp 16 Aug 2005 23:21:02 -0000 1.15 *************** *** 8,12 **** public: IDENTITY(ThraddashFlame); ! int armour; public: --- 8,12 ---- public: IDENTITY(ThraddashFlame); ! double armour; public: *************** *** 83,87 **** int ThraddashFlame::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = iround(normal + direct); armour -= total; --- 83,87 ---- int ThraddashFlame::handle_damage(SpaceLocation *source, double normal, double direct) { ! double total = normal + direct;//iround(normal + direct); armour -= total; Index: shppkufu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shppkufu.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shppkufu.cpp 14 Aug 2005 16:14:50 -0000 1.16 --- shppkufu.cpp 16 Aug 2005 23:21:02 -0000 1.17 *************** *** 35,39 **** return 0; ! int r = iround(normal + direct); crew -= r; if (crew > 0) return r; --- 35,39 ---- return 0; ! double r = normal + direct;//iround(normal + direct); crew -= r; if (crew > 0) return r; Index: shporzne.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shporzne.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shporzne.cpp 14 Aug 2005 16:14:50 -0000 1.18 --- shporzne.cpp 16 Aug 2005 23:21:02 -0000 1.19 *************** *** 23,27 **** int hotspot_rate; int hotspot_frame; ! int armour; Ship *invading; int returning; --- 23,27 ---- int hotspot_rate; int hotspot_frame; ! double armour; Ship *invading; int returning; *************** *** 376,380 **** int OrzMarine::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = iround(normal + direct); armour -= total; if(armour <= 0) --- 376,380 ---- int OrzMarine::handle_damage(SpaceLocation *source, double normal, double direct) { ! double total = normal + direct;//iround(normal + direct); armour -= total; if(armour <= 0) Index: shpchmav.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpchmav.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpchmav.cpp 14 Aug 2005 16:14:50 -0000 1.17 --- shpchmav.cpp 16 Aug 2005 23:21:02 -0000 1.18 *************** *** 41,45 **** int lRecharge; int lColor; ! int armour; public: --- 41,45 ---- int lRecharge; int lColor; ! double armour; public: *************** *** 300,304 **** int ChmmrZapSat::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = iround(normal + direct); if (total) { armour -= total; --- 300,304 ---- int ChmmrZapSat::handle_damage(SpaceLocation *source, double normal, double direct) { ! double total = normal + direct;//iround(normal + direct); if (total) { armour -= total; |
From: Rob <geo...@us...> - 2005-08-16 23:21:14
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32526/source/newships Modified Files: shpconho.cpp shpdajem.cpp shpestgu.cpp shpkolfl.cpp shpplane.cpp shprogsq.cpp Log Message: armour (iround) corrected to handle doubles, because otherwise fractional damage doesn't work Index: shprogsq.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shprogsq.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shprogsq.cpp 11 Jul 2005 00:25:32 -0000 1.17 --- shprogsq.cpp 16 Aug 2005 23:21:02 -0000 1.18 *************** *** 636,640 **** return 0; // to avoid an infinite feedback with enemy rogue. ! int total = iround(normal + direct); if (source->sameTeam(this)) --- 636,640 ---- return 0; // to avoid an infinite feedback with enemy rogue. ! double total = normal + direct;//iround(normal + direct); if (source->sameTeam(this)) Index: shpdajem.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdajem.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpdajem.cpp 2 Aug 2005 00:23:44 -0000 1.14 --- shpdajem.cpp 16 Aug 2005 23:21:02 -0000 1.15 *************** *** 34,39 **** int absorbtionEnergyIsEnabled; int absorbtionRegenerationIsEnabled; ! int armour; ! int maxArmour; int regenerationThreshhold; int regenerationCount; --- 34,39 ---- int absorbtionEnergyIsEnabled; int absorbtionRegenerationIsEnabled; ! double armour; ! double maxArmour; int regenerationThreshhold; int regenerationCount; *************** *** 491,496 **** int DajielkaSanctuary::handle_damage(SpaceLocation *source, double normal, double direct){ ! STACKTRACE ! armour -= iround(normal + direct); if(armour<=0) state=0; if(normal+direct>0) regenerationCount /= 2; --- 491,496 ---- int DajielkaSanctuary::handle_damage(SpaceLocation *source, double normal, double direct){ ! STACKTRACE; ! armour -= normal + direct;//iround(normal + direct); if(armour<=0) state=0; if(normal+direct>0) regenerationCount /= 2; Index: shpkolfl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkolfl.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpkolfl.cpp 2 Aug 2005 00:23:46 -0000 1.14 --- shpkolfl.cpp 16 Aug 2005 23:21:02 -0000 1.15 *************** *** 306,313 **** STACKTRACE ! int totdamage = iround(normal + direct); if (source->isShip()) ! totdamage = iround(armour); armour -= totdamage; --- 306,313 ---- STACKTRACE ! double totdamage = normal + direct;//iround(normal + direct); if (source->isShip()) ! totdamage = armour;//iround(armour); armour -= totdamage; Index: shpconho.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpconho.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpconho.cpp 6 Aug 2005 23:27:24 -0000 1.13 --- shpconho.cpp 16 Aug 2005 23:21:02 -0000 1.14 *************** *** 174,178 **** STACKTRACE if ((normal - shield) <= 0) { ! shield -= iround(normal); normal = 0; } else { --- 174,178 ---- STACKTRACE if ((normal - shield) <= 0) { ! shield -= normal;//iround(normal); DO NOT ROUND !! normal = 0; } else { Index: shpestgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpestgu.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpestgu.cpp 14 Aug 2005 16:14:32 -0000 1.16 --- shpestgu.cpp 16 Aug 2005 23:21:02 -0000 1.17 *************** *** 52,56 **** public: IDENTITY(EstionPlatform); ! int health; int rotate_time; int rotate_direction; --- 52,56 ---- public: IDENTITY(EstionPlatform); ! double health; int rotate_time; int rotate_direction; *************** *** 72,77 **** int EstionPlatform::handle_damage (SpaceLocation *source, double normal, double direct) { ! STACKTRACE ! health -= iround(normal + direct * 2); if (health < 0){ state = 0; --- 72,77 ---- int EstionPlatform::handle_damage (SpaceLocation *source, double normal, double direct) { ! STACKTRACE; ! health -= normal + direct * 2;//iround(normal + direct * 2); if (health < 0){ state = 0; Index: shpplane.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpplane.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpplane.cpp 14 Aug 2005 16:14:32 -0000 1.13 --- shpplane.cpp 16 Aug 2005 23:21:02 -0000 1.14 *************** *** 195,199 **** i = (int) ceil(((Ship*)other)->crew / 3.0); } ! if (other->mass == 0) other->state = 0; damage(other, 0, i); i /= 2; --- 195,200 ---- i = (int) ceil(((Ship*)other)->crew / 3.0); } ! if (other->mass == 0) ! i = 99999.0;//other->state = 0; damage(other, 0, i); i /= 2; |
From: Rob <geo...@us...> - 2005-08-16 19:01:42
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3821/source Modified Files: melee.h Log Message: additional lines needed for pmask-generation "on the fly" instead of at load Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** melee.h 16 Aug 2005 18:17:29 -0000 1.22 --- melee.h 16 Aug 2005 19:01:33 -0000 1.23 *************** *** 482,486 **** Surface *get_bitmap(int index, int miplevel = 0); Surface *get_bitmap_readonly(int index); ! const struct PMASK *get_pmask(int index); void lock(); //make surface writable void unlock(); --- 482,486 ---- Surface *get_bitmap(int index, int miplevel = 0); Surface *get_bitmap_readonly(int index); ! PMASK *get_pmask(int index); void lock(); //make surface writable void unlock(); |
From: Rob <geo...@us...> - 2005-08-16 19:01:42
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3821/source/melee Modified Files: msprite.cpp Log Message: additional lines needed for pmask-generation "on the fly" instead of at load Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** msprite.cpp 16 Aug 2005 18:17:29 -0000 1.20 --- msprite.cpp 16 Aug 2005 19:01:33 -0000 1.21 *************** *** 797,801 **** for (mip = 0; mip <= highest_mip; mip += 1) { for (i = 0; i < count; i += 1) { ! tmp2[i] = m[(i + phase) % count]; } for (i = 0; i < count; i += 1) { --- 797,801 ---- for (mip = 0; mip <= highest_mip; mip += 1) { for (i = 0; i < count; i += 1) { ! tmp2[i] = get_pmask((i + phase) % count); } for (i = 0; i < count; i += 1) { *************** *** 818,822 **** ! const struct PMASK *SpaceSprite::get_pmask(int index) { if (!m[index]) --- 818,822 ---- ! PMASK *SpaceSprite::get_pmask(int index) { if (!m[index]) *************** *** 1054,1058 **** } color_correct_bitmap(bmp, general_attributes & MASKED); ! m[(i * rotations)] = create_allegro_pmask(bmp); b[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; --- 1054,1058 ---- } color_correct_bitmap(bmp, general_attributes & MASKED); ! m[(i * rotations)] = 0;//create_allegro_pmask(bmp); b[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; *************** *** 1089,1093 **** bmp = create_bitmap(old.b[0][i]->w, old.b[0][i]->h); blit(old.b[0][i], bmp, 0, 0, 0, 0, old.b[0][i]->w, old.b[0][i]->h); ! m[i] = create_allegro_pmask(bmp); b[0][i] = bmp; attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; --- 1089,1093 ---- bmp = create_bitmap(old.b[0][i]->w, old.b[0][i]->h); blit(old.b[0][i], bmp, 0, 0, 0, 0, old.b[0][i]->w, old.b[0][i]->h); ! m[i] = 0;//create_allegro_pmask(bmp); b[0][i] = bmp; attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; *************** *** 1515,1519 **** if (i < 0) { tw_error("SpaceSprite::collide - index1 %d < count1 %d", i, count); } if (oi < 0) { tw_error("SpaceSprite::collide - index2 %d < count2 %d", oi, other->count); } ! return (check_pmask_collision(m[i], other->m[oi], x, y, ox, oy)); } --- 1515,1519 ---- if (i < 0) { tw_error("SpaceSprite::collide - index1 %d < count1 %d", i, count); } if (oi < 0) { tw_error("SpaceSprite::collide - index2 %d < count2 %d", oi, other->count); } ! return (check_pmask_collision(get_pmask(i), other->get_pmask(oi), x, y, ox, oy)); } *************** *** 1561,1565 **** if ((rect_y > ly1) && (rect_y > *ly2)) return FALSE; if ((rect_y+h < ly1) && (rect_y+h < *ly2)) return FALSE; ! rect_mask = m[sindex]; do_line(NULL, lx1, ly1, *lx2, *ly2, 0, check_line_collision); if(line_collide) { --- 1561,1565 ---- if ((rect_y > ly1) && (rect_y > *ly2)) return FALSE; if ((rect_y+h < ly1) && (rect_y+h < *ly2)) return FALSE; ! rect_mask = get_pmask(sindex); do_line(NULL, lx1, ly1, *lx2, *ly2, 0, check_line_collision); if(line_collide) { |
From: Rob <geo...@us...> - 2005-08-16 18:17:38
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24324/source Modified Files: melee.h Log Message: 1. spacesprite memory leaks fixed. 2. pmask-generation "on the fly" instead of at load Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** melee.h 11 Jul 2005 00:25:10 -0000 1.21 --- melee.h 16 Aug 2005 18:17:29 -0000 1.22 *************** *** 466,469 **** --- 466,470 ---- }; //sprite_count * rotation new images based upon sprite_count RLE_SPRITES, with gamma correction + //xxx spacesprite test SpaceSprite(const DATAFILE *sprites, int sprite_count, int attributes = -1, int rotations = 1); SpaceSprite(BITMAP *image, int _attributes = -1); *************** *** 481,485 **** Surface *get_bitmap(int index, int miplevel = 0); Surface *get_bitmap_readonly(int index); ! const struct PMASK *get_pmask(int index) {return m[index];} void lock(); //make surface writable void unlock(); --- 482,486 ---- Surface *get_bitmap(int index, int miplevel = 0); Surface *get_bitmap_readonly(int index); ! const struct PMASK *get_pmask(int index); void lock(); //make surface writable void unlock(); |
From: Rob <geo...@us...> - 2005-08-16 18:17:38
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24324/source/melee Modified Files: mcontrol.cpp mgame.cpp mhelpers.cpp mshpdata.cpp msprite.cpp Log Message: 1. spacesprite memory leaks fixed. 2. pmask-generation "on the fly" instead of at load Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** msprite.cpp 11 Jul 2005 00:25:28 -0000 1.19 --- msprite.cpp 16 Aug 2005 18:17:29 -0000 1.20 *************** *** 732,736 **** } ! void SpaceSprite::generate_mipmaps() {STACKTRACE int bpp, level, i; if (general_attributes & MIPMAPED) { --- 732,739 ---- } ! void SpaceSprite::generate_mipmaps() ! { ! STACKTRACE; ! int bpp, level, i; if (general_attributes & MIPMAPED) { *************** *** 813,816 **** --- 816,830 ---- } + + + const struct PMASK *SpaceSprite::get_pmask(int index) + { + if (!m[index]) + m[index] = create_allegro_pmask(b[0][index]); + + return m[index]; + } + + SpaceSprite::SpaceSprite(const DATAFILE *images, int sprite_count, int _attributes, int rotations) { STACKTRACE *************** *** 863,867 **** if (bpp == 0) bpp = obpp; ! if (obpp != bpp) tmp = create_bitmap_ex(obpp, w, h); if (general_attributes & ALPHA) { if (bpp <= 16) bpp = 16; --- 877,884 ---- if (bpp == 0) bpp = obpp; ! ! if (obpp != bpp) ! tmp = create_bitmap_ex(obpp, w, h); ! if (general_attributes & ALPHA) { if (bpp <= 16) bpp = 16; *************** *** 870,874 **** ! if (general_attributes & IRREGULAR) goto irregular; for(i = 1; i < sprite_count; i++) { if (images[i].type != originaltype) {tw_error ("SpaceSprite - bad data file");} --- 887,893 ---- ! if (general_attributes & IRREGULAR) ! goto irregular; ! for(i = 1; i < sprite_count; i++) { if (images[i].type != originaltype) {tw_error ("SpaceSprite - bad data file");} *************** *** 893,912 **** attributes = new char [count]; ! for(i = 0; i < sprite_count; i += 1) { bmp = create_bitmap_ex(bpp, w, h); ! if (!tmp) tmp = bmp; ! if (general_attributes & MASKED) clear_to_color(bmp, bitmap_mask_color(bmp)); ! /* if (general_attributes & MASKED) { ! if (general_attributes & ALPHA) { ! if (bpp == 16) clear_to_color(bmp, ); ! } clear_to_color(bmp, bitmap_mask_color(bmp)); ! }*/ ! if (tmp != bmp) clear_to_color(tmp, bitmap_mask_color(tmp)); switch (originaltype) { ! case DAT_RLE_SPRITE: { draw_rle_sprite(tmp, (RLE_SPRITE *)(images[i].dat), 0, 0); ! if (general_attributes & ALPHA) handle_alpha_load(tmp); ! if (tmp != bmp) convert_bitmap(tmp, bmp, (general_attributes & MASKED) ? AA_MASKED : 0); } break; --- 912,938 ---- attributes = new char [count]; ! for(i = 0; i < sprite_count; i += 1) ! { bmp = create_bitmap_ex(bpp, w, h); ! ! if (general_attributes & MASKED) clear_to_color(bmp, bitmap_mask_color(bmp)); ! ! if (!tmp) ! tmp = bmp; ! ! if (tmp != bmp) ! clear_to_color(tmp, bitmap_mask_color(tmp)); ! switch (originaltype) { ! case DAT_RLE_SPRITE: ! { draw_rle_sprite(tmp, (RLE_SPRITE *)(images[i].dat), 0, 0); ! ! if (general_attributes & ALPHA) ! handle_alpha_load(tmp); ! ! if (tmp != bmp) ! convert_bitmap(tmp, bmp, (general_attributes & MASKED) ? AA_MASKED : 0); } break; *************** *** 924,943 **** } color_correct_bitmap(bmp, general_attributes & MASKED); ! // make_alpha(bmp); ! if (tmp == bmp) tmp = NULL; ! for (j = 1; j < rotations; j += 1) { BITMAP *tmp = create_bitmap_ex(bpp, w, h); clear_to_color(tmp, bitmap_mask_color(tmp)); rotate_sprite(tmp, bmp, 0, 0, j * ((1<<24)/rotations)); ! m[j + (i * rotations)] = create_allegro_pmask(tmp); b[0][j + (i * rotations)] = tmp; attributes[j + (i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! m[(i * rotations)] = create_allegro_pmask(bmp); b[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! if (general_attributes & MIPMAPED) { generate_mipmaps(); /* for (int level = 1; level < MAX_MIP_LEVELS; level += 1) { int lw, lh; --- 950,986 ---- } color_correct_bitmap(bmp, general_attributes & MASKED); ! ! if (tmp == bmp) ! tmp = NULL; ! ! for (j = 1; j < rotations; j += 1) ! { BITMAP *tmp = create_bitmap_ex(bpp, w, h); clear_to_color(tmp, bitmap_mask_color(tmp)); rotate_sprite(tmp, bmp, 0, 0, j * ((1<<24)/rotations)); ! ! m[j + (i * rotations)] = 0; ! // m[j + (i * rotations)] = create_allegro_pmask(tmp); ! b[0][j + (i * rotations)] = tmp; attributes[j + (i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! m[(i * rotations)] = 0; ! // m[(i * rotations)] = create_allegro_pmask(bmp); b[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! ! if (tmp) ! { ! destroy_bitmap(tmp); ! tmp = 0; ! } ! ! if (general_attributes & MIPMAPED) ! { ! generate_mipmaps(); + /* for (int level = 1; level < MAX_MIP_LEVELS; level += 1) { int lw, lh; *************** *** 960,965 **** ! if (use_shademaps) ! init_shademaps(); return;//end of normal/masked/autorotated --- 1003,1008 ---- ! // if (use_shademaps) ! // init_shademaps(); return;//end of normal/masked/autorotated *************** *** 1015,1021 **** attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! return;//end of irregular/masked } SpaceSprite::SpaceSprite(SpaceSprite &old) { STACKTRACE --- 1058,1072 ---- attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! ! if (tmp) ! { ! destroy_bitmap(tmp); ! tmp = 0; } + return;//end of irregular/masked + + } + SpaceSprite::SpaceSprite(SpaceSprite &old) { STACKTRACE *************** *** 1207,1211 **** for(i = 0; i < count; i++) { ! if (attributes[i] & DEALLOCATE_MASK) destroy_pmask(m[i]); } delete[] m; --- 1258,1265 ---- for(i = 0; i < count; i++) { ! //xxx why is this conditional ?? It never borrows, that's too messy... ! //if (attributes[i] & DEALLOCATE_MASK) ! if (m[i]) ! destroy_pmask(m[i]); } delete[] m; *************** *** 1214,1218 **** for (l = 0; l <= highest_mip; l += 1) { for(i = 0; i < count; i++) { ! if (attributes[i] & DEALLOCATE_IMAGE) destroy_bitmap(b[l][i]); } delete b[l]; --- 1268,1275 ---- for (l = 0; l <= highest_mip; l += 1) { for(i = 0; i < count; i++) { ! //xxx why is this conditional ?? It never borrows, that's too messy... ! //if (attributes[i] & DEALLOCATE_IMAGE) ! if (b[l][i]) ! destroy_bitmap(b[l][i]); } delete b[l]; *************** *** 1426,1430 **** if (index >= count) {tw_error("SpaceSprite::draw_character - index %d >= count %d", index, count); index = 0;} if (index < 0) {tw_error("SpaceSprite::get_bitmap - index %d < 0 (count %d)", index, count); index = 0;} ! draw_allegro_pmask ( m[index], bmp, x, y, color ); return; } --- 1483,1487 ---- if (index >= count) {tw_error("SpaceSprite::draw_character - index %d >= count %d", index, count); index = 0;} if (index < 0) {tw_error("SpaceSprite::get_bitmap - index %d < 0 (count %d)", index, count); index = 0;} ! draw_allegro_pmask ( get_pmask(index), bmp, x, y, color ); return; } *************** *** 1446,1450 **** if (index >= count) {tw_error("SpaceSprite::draw_character_stretch - index %d >= count %d", index, count); index = 0;} if (index < 0) {tw_error("SpaceSprite::get_bitmap - index %d < 0 (count %d)", index, count); index = 0;} ! draw_allegro_pmask_stretch(m[index], bmp, x, y, w, h, color) ; return; } --- 1503,1507 ---- if (index >= count) {tw_error("SpaceSprite::draw_character_stretch - index %d >= count %d", index, count); index = 0;} if (index < 0) {tw_error("SpaceSprite::get_bitmap - index %d < 0 (count %d)", index, count); index = 0;} ! draw_allegro_pmask_stretch(get_pmask(index), bmp, x, y, w, h, color) ; return; } Index: mshpdata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshpdata.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mshpdata.cpp 24 Mar 2004 23:51:39 -0000 1.9 --- mshpdata.cpp 16 Aug 2005 18:17:29 -0000 1.10 *************** *** 204,211 **** } ! void ShipData::unload() { if (status != LOADED_FULL) return; if (spriteShip) { delete spriteShip; --- 204,217 ---- } ! void ShipData::unload() ! { if (status != LOADED_FULL) return; + if (spritePanel) { + delete spritePanel; + spritePanel = NULL; + } + if (spriteShip) { delete spriteShip; *************** *** 232,249 **** spriteExtra = NULL; } ! ! if (spritePanel) { ! delete spritePanel; ! spritePanel = NULL; } if (num_more_sprites) { int i; ! for (i = 0; i < num_more_sprites; i += 1) delete more_sprites[i]; ! delete[] more_sprites; more_sprites = NULL; num_more_sprites = 0; } unload_datafile(data); --- 238,266 ---- spriteExtra = NULL; } ! if (spriteExtraExplosion) { ! delete spriteExtraExplosion; ! spriteExtraExplosion = NULL; } if (num_more_sprites) { int i; ! ! for (i = 0; i < num_more_sprites; i += 1) ! delete more_sprites[i]; ! ! //delete[] more_sprites; ! // this was created with the "realloc" command --> use free ! free( more_sprites ); ! more_sprites = NULL; num_more_sprites = 0; } + // clean up these pointer arrays ... + // these were created with the "new" command --> use delete + delete [] sampleWeapon; + delete [] sampleSpecial; + delete [] sampleExtra; + unload_datafile(data); *************** *** 282,286 **** } ! SpaceSprite *load_sprite(const char *string, DATAFILE *data, int *index) { --- 299,303 ---- } ! #include "mview.h" SpaceSprite *load_sprite(const char *string, DATAFILE *data, int *index) { *************** *** 310,319 **** int attrib = string_to_sprite_attributes(buffy); sprite = new SpaceSprite(&data[*index], count, attrib, rotations); for (i = 0; i < count; i += 1) { ! destroy_rle_sprite((RLE_SPRITE*)data[(*index)+i].dat); ! data[(*index)+i].dat = NULL; // brutal hack to free up the memory } *index += count; return sprite; } --- 327,363 ---- int attrib = string_to_sprite_attributes(buffy); sprite = new SpaceSprite(&data[*index], count, attrib, rotations); + + /* + // a sprite load/destroy-test (can be used to test memory-leaks: + i = 0; + for (;;) + { + ++i; + sprite = new SpaceSprite(&data[*index], count, attrib, rotations); + delete sprite; + if (i % 100 == 0) + { + message.print(100, 15, "load/destroy test: %i", i); + message.animate(0); + readkey(); + } + } + // end of the test. + */ + + for (i = 0; i < count; i += 1) { ! ! //xxx Geo - I don't think there is much to gain by doing this. ! // and why is it by default an RLE_SPRITE ????? ! // destroy_rle_sprite((RLE_SPRITE*)data[(*index)+i].dat); ! // data[(*index)+i].dat = NULL; // brutal hack to free up the memory } *index += count; + + + + return sprite; } Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** mgame.cpp 14 Aug 2005 16:14:32 -0000 1.54 --- mgame.cpp 16 Aug 2005 18:17:29 -0000 1.55 *************** *** 232,245 **** meleedata.panelSprite = new SpaceSprite(&melee[MELEE_PANEL], PANEL_FRAMES, SpaceSprite::IRREGULAR); meleedata.kaboomSprite = new SpaceSprite(&melee[MELEE_KABOOM], KABOOM_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED | SpaceSprite::MIPMAPED); meleedata.hotspotSprite = new SpaceSprite(&melee[MELEE_HOTSPOT], HOTSPOT_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED | SpaceSprite::MIPMAPED); meleedata.sparkSprite = new SpaceSprite(&melee[MELEE_SPARK], SPARK_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED | SpaceSprite::MIPMAPED | SpaceSprite::MATCH_SCREEN_FORMAT); meleedata.asteroidExplosionSprite = new SpaceSprite(&melee[MELEE_ASTEROIDEXPLOSION], ASTEROIDEXPLOSION_FRAMES); meleedata.asteroidSprite = new SpaceSprite(&melee[MELEE_ASTEROID], ASTEROID_FRAMES); meleedata.planetSprite = new SpaceSprite(&melee[MELEE_PLANET], PLANET_FRAMES); meleedata.xpl1Sprite = new SpaceSprite(&melee[MELEE_XPL1], XPL1_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED | SpaceSprite::MIPMAPED); planet_victory = (Music*) (melee[MELEE_PLANET+PLANET_FRAMES].dat); --- 232,245 ---- meleedata.panelSprite = new SpaceSprite(&melee[MELEE_PANEL], PANEL_FRAMES, SpaceSprite::IRREGULAR); meleedata.kaboomSprite = new SpaceSprite(&melee[MELEE_KABOOM], KABOOM_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED);// | SpaceSprite::MIPMAPED); meleedata.hotspotSprite = new SpaceSprite(&melee[MELEE_HOTSPOT], HOTSPOT_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED);// | SpaceSprite::MIPMAPED); meleedata.sparkSprite = new SpaceSprite(&melee[MELEE_SPARK], SPARK_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED /*| SpaceSprite::MIPMAPED*/ | SpaceSprite::MATCH_SCREEN_FORMAT); meleedata.asteroidExplosionSprite = new SpaceSprite(&melee[MELEE_ASTEROIDEXPLOSION], ASTEROIDEXPLOSION_FRAMES); meleedata.asteroidSprite = new SpaceSprite(&melee[MELEE_ASTEROID], ASTEROID_FRAMES); meleedata.planetSprite = new SpaceSprite(&melee[MELEE_PLANET], PLANET_FRAMES); meleedata.xpl1Sprite = new SpaceSprite(&melee[MELEE_XPL1], XPL1_FRAMES, ! SpaceSprite::ALPHA | SpaceSprite::MASKED);// | SpaceSprite::MIPMAPED); planet_victory = (Music*) (melee[MELEE_PLANET+PLANET_FRAMES].dat); Index: mhelpers.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mhelpers.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mhelpers.cpp 11 Jul 2005 00:25:28 -0000 1.9 --- mhelpers.cpp 16 Aug 2005 18:17:29 -0000 1.10 *************** *** 132,135 **** --- 132,137 ---- int alpha = (c->filler ^ 255) + 1; int r, g, b; + //xxx geo: I don't think this is correct... + /* r = (c->r << 8) / alpha; g = (c->g << 8) / alpha; *************** *** 138,141 **** --- 140,147 ---- tw_error("gamma_color_effects : premultiplied alpha color invalid"); } + */ + r = c->r; + g = c->g; + b = c->b; r = _gamma_map[r]; g = _gamma_map[g]; Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mcontrol.cpp 14 Aug 2005 16:14:32 -0000 1.27 --- mcontrol.cpp 16 Aug 2005 18:17:29 -0000 1.28 *************** *** 182,197 **** BITMAP* panel = NULL; ! DATAFILE* data = load_datafile_object( type->data->file, "SHIP_P00_PCX" ); if( data ){ ! BITMAP* bmp = (BITMAP*)data->dat; panel = create_bitmap_ex( bitmap_color_depth(screen), bmp->w, bmp->h ); blit( bmp, panel, 0, 0, 0, 0, bmp->w, bmp->h ); ! unload_datafile_object( data ); ! data = load_datafile_object( type->data->file, "SHIP_P01_PCX" ); ! bmp = (BITMAP*)data->dat; blit( bmp, panel, 0, 0, 4, 65, bmp->w, bmp->h ); ! unload_datafile_object( data ); color_correct_bitmap( panel, 0 ); } --- 182,205 ---- BITMAP* panel = NULL; ! //DATAFILE* data = load_datafile_object( type->data->file, "SHIP_P00_PCX" ); ! // load the whole datafile. ! DATAFILE* data = load_datafile( type->data->file ); ! // record 0 = text file ! // record 1 = general panel ! // record 2 = neutral captain picture ! // etc. if( data ){ ! BITMAP* bmp = (BITMAP*)data [1].dat; panel = create_bitmap_ex( bitmap_color_depth(screen), bmp->w, bmp->h ); blit( bmp, panel, 0, 0, 0, 0, bmp->w, bmp->h ); ! //unload_datafile_object( data ); ! //data = load_datafile_object( type->data->file, "SHIP_P01_PCX" ); ! bmp = (BITMAP*)data [2].dat; blit( bmp, panel, 0, 0, 4, 65, bmp->w, bmp->h ); ! //unload_datafile_object( data ); color_correct_bitmap( panel, 0 ); + + unload_datafile( data ); } |
From: Rob <geo...@us...> - 2005-08-16 18:17:38
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24324/source/newships Modified Files: shparkpi.cpp Log Message: 1. spacesprite memory leaks fixed. 2. pmask-generation "on the fly" instead of at load Index: shparkpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparkpi.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shparkpi.cpp 2 Aug 2005 13:04:07 -0000 1.16 --- shparkpi.cpp 16 Aug 2005 18:17:30 -0000 1.17 *************** *** 203,206 **** --- 203,211 ---- // for debugging purpose debug_id = 90; + + if (!pincerL->exists() || !pincerR->exists()) + { + tw_error("The pincer must not die!!"); + } } *************** *** 226,232 **** ! void ArkanoidPincerShip::calculate(void) { ! STACKTRACE ! //message.print(1500,9,"angle = %f turn_step = %f",this->angle, this->turn_step); Ship::calculate(); isScuttlingOld = isScuttling; --- 231,242 ---- ! void ArkanoidPincerShip::calculate(void) ! { ! STACKTRACE; ! if (!pincerL->exists() || !pincerR->exists()) ! { ! tw_error("The pincer must not die!!"); ! } ! //message.print(1500,9,"angle = %f turn_step = %f",this->angle, this->turn_step); Ship::calculate(); isScuttlingOld = isScuttling; |
From: Rob <geo...@us...> - 2005-08-16 18:17:38
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24324/source/util Modified Files: pmask.c Log Message: 1. spacesprite memory leaks fixed. 2. pmask-generation "on the fly" instead of at load Index: pmask.c =================================================================== RCS file: /cvsroot/timewarp/source/util/pmask.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pmask.c 24 Mar 2004 23:51:45 -0000 1.8 --- pmask.c 16 Aug 2005 18:17:30 -0000 1.9 *************** *** 696,699 **** --- 696,701 ---- int check_pmask_collision_list_float_wrap ( float maxx, float maxy, PMASKDATA_FLOAT *input, int num, CONST void **output, int max_collisions ) { + + int i, j, ret = 0; float maxxh = maxx / 2; *************** *** 702,706 **** if (maxy <= 0) return 0; qsort ( input, num, sizeof(PMASKDATA_FLOAT), pmaskdata_float_sort); ! for (i = 0; i < num; i += 1) { float h = input[i].y + input[i].pmask->h; for (j = i+1; (j < num) && (input[j].y < h); j += 1) { --- 704,710 ---- if (maxy <= 0) return 0; qsort ( input, num, sizeof(PMASKDATA_FLOAT), pmaskdata_float_sort); ! ! for (i = 0; i < num; i += 1) ! { float h = input[i].y + input[i].pmask->h; for (j = i+1; (j < num) && (input[j].y < h); j += 1) { |
From: Rob <geo...@us...> - 2005-08-14 16:19:18
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5195 Modified Files: gsidescroll.ini Log Message: updated sub-game settings Index: gsidescroll.ini =================================================================== RCS file: /cvsroot/timewarp/gsidescroll.ini,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gsidescroll.ini 11 Jul 2005 18:31:00 -0000 1.1 --- gsidescroll.ini 14 Aug 2005 16:19:08 -0000 1.2 *************** *** 32,37 **** ; There can be at most 32 timers. ; ship is cleaned up when last timer expires ! ; spawnpos num interval shipid xrel yrel angle keys timer keys timer ! enemy1 = 1000 3 500 kzedr -100 100 90 11010 1000 02000 10000 ! enemy2 = 1200 3 500 kzedr 100 100 -90 11000 1000 10110 10000 ! enemy3 = 1400 3 500 kzedr 100 100 -90 11000 1000 10110 10000 --- 32,37 ---- ; There can be at most 32 timers. ; ship is cleaned up when last timer expires ! ; spawnpos num interval shipid xrel yrel angle keys timer keys timer ! enemy1 = 1000 3 500 kzedr -100 100 90 11010 1000 01000 10000 ! enemy2 = 1200 3 500 kzedr 100 100 -90 11000 1000 10110 10000 ! enemy3 = 1400 3 500 kzedr 100 100 -90 11000 1000 10110 10000 |
From: Rob <geo...@us...> - 2005-08-14 16:18:37
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5048 Modified Files: grabber.exe Log Message: updated grabber Index: grabber.exe =================================================================== RCS file: /cvsroot/timewarp/grabber.exe,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsugPPp5 and /tmp/cvsT15Yem differ |
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/newships Modified Files: shpalabc.cpp shpalckr.cpp shpastba.cpp shpayrbs.cpp shpbipka.cpp shpbogce.cpp shpbubbo.cpp shpchoex.cpp shpconca.cpp shpdeees.cpp shpducla.cpp shpearc3.cpp shpestgu.cpp shpfiear.cpp shpforsh.cpp shpgerhe.cpp shpgeror.cpp shpglads.cpp shphubde.cpp shphydcr.cpp shpiceco.cpp shpilwsp.cpp shpimpka.cpp shpjnkla.cpp shpjurcu.cpp shpjygst.cpp shpkahbo.cpp shpkoaja.cpp shpktesa.cpp shpmoisp.cpp shpnarlu.cpp shpostdi.cpp shpphepa.cpp shpplane.cpp shpquawr.cpp shpraame.cpp shpsamat.cpp shpsclfr.cpp shpstaba.cpp shptauar.cpp shptaubo.cpp shptauda.cpp shptauem.cpp shptaufi.cpp shptauhu.cpp shptaule.cpp shptaume.cpp shptaust.cpp shptautu.cpp shptulra.cpp shpuxjba.cpp shpvelcr.cpp shpvenke.cpp shpvezba.cpp shpvioge.cpp shpvuvji.cpp shpwassu.cpp shpwistr.cpp shpxxxas.cpp shpxxxma.cpp shpyusra.cpp Log Message: fixed/updates for the use of random() Index: shpglads.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpglads.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpglads.cpp 11 Jul 2005 00:25:31 -0000 1.11 --- shpglads.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 108,112 **** for (i=0; i<specialNumber; i++) add(new GlathrielMiniMissile( ! 0.0, 26, angle + specialSweep * (1-(random() % 201)/100.0), specialVelocity, specialDamage, specialRange, specialArmour, this, data->spriteSpecial)); return true; --- 108,112 ---- for (i=0; i<specialNumber; i++) add(new GlathrielMiniMissile( ! 0.0, 26, angle + tw_random(-specialSweep, specialSweep), specialVelocity, specialDamage, specialRange, specialArmour, this, data->spriteSpecial)); return true; Index: shptautu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptautu.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shptautu.cpp 11 Jul 2005 00:25:32 -0000 1.10 --- shptautu.cpp 14 Aug 2005 16:14:32 -0000 1.11 *************** *** 238,242 **** accel = oaccel; ! fire_index = random() % 20; fire_frame = 50; --- 238,242 ---- accel = oaccel; ! fire_index = tw_random(20); fire_frame = 50; Index: shptaume.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaume.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shptaume.cpp 1 Aug 2005 10:46:34 -0000 1.15 --- shptaume.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 104,108 **** { STACKTRACE ! double da = (1-0.002*(random()%1001)); if (da >= 0) da *= da; --- 104,108 ---- { STACKTRACE ! double da = tw_random(-1.0, 1.0); if (da >= 0) da *= da; *************** *** 110,114 **** da *= -da; game->add(new TauMercuryShot(this, 0, 8, angle + weaponAngle*da, ! weaponVelocity, weaponDamage, weaponRange*(1-weaponSpread*(random()%1001)/1000.0), weaponArmour, data->spriteWeapon, weaponRelativity, weaponSparks, weaponFrags)); --- 110,114 ---- da *= -da; game->add(new TauMercuryShot(this, 0, 8, angle + weaponAngle*da, ! weaponVelocity, weaponDamage, weaponRange*(1-random(weaponSpread)), weaponArmour, data->spriteWeapon, weaponRelativity, weaponSparks, weaponFrags)); *************** *** 269,297 **** special_recharge += special_rate; ! // int i; ! ! // for (i=0; i<1; i++) { ! game->add(new TauMercurySpark(this, -26, -3.5, PI2*(random(1000))/1000.0, ! scale_velocity(2)*(random(101))/100.0, ! iround(800*(1-0.5*(random(101))/100.0)), ! 190+random(50), 190+random(50), 200+random()%55, DEPTH_EXPLOSIONS, 1.0, 1)); ! game->add(new TauMercurySpark(this, 26, -3.5, PI2*(random()%1000)/1000.0, ! scale_velocity(2)*(random(101))/100.0, ! iround(800*(1-0.5*(random(101))/100.0)), 190+random(50), 190+random(50), 200+random(55), DEPTH_EXPLOSIONS, 1.0, 1)); //} - /* for (i=0; i<1; i++) { - game->add(new TauMercurySpark(this, -26, -3.5, PI2*(random()%1000)/1000.0, - scale_velocity(5)*(random()%101)/100.0, - 800*(1-0.5*(random()%101)/100.0), - 190+random()%50, 190+random()%50, 200+random()%55, - DEPTH_EXPLOSIONS, 0.0)); - game->add(new TauMercurySpark(this, 26, -3.5, PI2*(random()%1000)/1000.0, - scale_velocity(5)*(random()%101)/100.0, - 800*(1-0.5*(random()%101)/100.0), - 190+random()%50, 190+random()%50, 200+random()%55, - DEPTH_EXPLOSIONS, 0.0)); } - */ } } --- 269,282 ---- special_recharge += special_rate; ! game->add(new TauMercurySpark(this, -26, -3.5, random(PI2), ! scale_velocity(2)*(random(1.0)), ! iround(800*(1-random(0.5))), ! 190+random(50), 190+random(50), 200+random(55), DEPTH_EXPLOSIONS, 1.0, 1)); ! game->add(new TauMercurySpark(this, 26, -3.5, random(PI2), ! scale_velocity(2)*(random(1.0)), ! iround(800*(1-random(0.5))), 190+random(50), 190+random(50), 200+random(55), DEPTH_EXPLOSIONS, 1.0, 1)); //} } } *************** *** 356,365 **** double vv = magnitude_sqr(vel); for (i=0; i<6; i++) { ! ff = random()%10; a = new Animation(this, pos, data->spriteWeaponExplosion, ff, 20-ff, 25, DEPTH_EXPLOSIONS); game->add(a); a->accelerate(this, angle, vv*0, MAX_SPEED); ! a->accelerate(this, PI2*(random()%1000)/1000.0, 0.01*(random()%101)*scale_velocity(25), MAX_SPEED); a->collide_flag_anyone = 0; } --- 341,350 ---- double vv = magnitude_sqr(vel); for (i=0; i<6; i++) { ! ff = random(10); a = new Animation(this, pos, data->spriteWeaponExplosion, ff, 20-ff, 25, DEPTH_EXPLOSIONS); game->add(a); a->accelerate(this, angle, vv*0, MAX_SPEED); ! a->accelerate(this, random(PI2), random(scale_velocity(25)), MAX_SPEED); a->collide_flag_anyone = 0; } Index: shpostdi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpostdi.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpostdi.cpp 11 Jul 2005 00:25:32 -0000 1.11 --- shpostdi.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 75,81 **** if (target && target->exists() && (!target->isInvisible()) && (target->mass > 0)) { ! //from Arilou code ! //dx = (double)(random() % (int)(3000)) - 1500; ! //dy = (double)(random() % (int)(3000)) - 1500; Vector2 ss = pos; --- 75,79 ---- if (target && target->exists() && (!target->isInvisible()) && (target->mass > 0)) { ! Vector2 ss = pos; Index: shpvenke.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvenke.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpvenke.cpp 2 Aug 2005 00:23:47 -0000 1.14 --- shpvenke.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 319,323 **** int i; for(i=0;i<weaponMultiplicity;i++) { ! deflection = (random() % (weaponAngleVariance * 2 + 1))-weaponAngleVariance; deflectionRad = (double)deflection * ANGLE_RATIO; launchPoint = -launchPoint; --- 319,323 ---- int i; for(i=0;i<weaponMultiplicity;i++) { ! deflection = (tw_random(weaponAngleVariance * 2 + 1))-weaponAngleVariance; deflectionRad = (double)deflection * ANGLE_RATIO; launchPoint = -launchPoint; *************** *** 509,515 **** for(i=0; i<n; i++) { if(afterburner) ! dAngle = random()%(2 * sparksAngleVarianceAfterburner + 1) - sparksAngleVarianceAfterburner; else ! dAngle = random()%(2 * sparksAngleVarianceNormal + 1) - sparksAngleVarianceNormal; dAngleRad = (double)dAngle * ANGLE_RATIO; if(afterburner) --- 509,515 ---- for(i=0; i<n; i++) { if(afterburner) ! dAngle = random(2 * sparksAngleVarianceAfterburner + 1) - sparksAngleVarianceAfterburner; else ! dAngle = random(2 * sparksAngleVarianceNormal + 1) - sparksAngleVarianceNormal; dAngleRad = (double)dAngle * ANGLE_RATIO; if(afterburner) Index: shptulra.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptulra.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shptulra.cpp 2 Aug 2005 00:23:47 -0000 1.16 --- shptulra.cpp 14 Aug 2005 16:14:32 -0000 1.17 *************** *** 161,165 **** numBombs++; ! special_sample = random() % 3; return TRUE; } --- 161,165 ---- numBombs++; ! special_sample = tw_random(3); return TRUE; } *************** *** 412,416 **** explosionFrameCount = 12; ! sprite_index = random() % 64; } --- 412,416 ---- explosionFrameCount = 12; ! sprite_index = random(64); } Index: shpalckr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalckr.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpalckr.cpp 1 Aug 2005 10:46:34 -0000 1.15 --- shpalckr.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 421,433 **** int l = (int)(1 + sparkNfactor * length/min_length); for( int i = 0; i < l; i++ ){ ! double alpha = random(PI2); Animation *anim = new Animation( this, pos + 0.5 * ship->size.x *unit_vector(alpha), // x + 0.5*ship->width()*cos( alpha ), y + 0.5*ship->width()*sin( alpha ), ! data->spriteExtra, 0, data->spriteExtra->frames(), 50+(random()%160), LAYER_HOTSPOTS ); ! // anim->vx = vx - 0.2*cos( alpha ) - (100+random()%100)*0.0005*sin( alpha ); ! // anim->vy = vy - 0.2*sin( alpha ) + (100+random()%100)*0.0005*cos( alpha ), ! anim->vel = vel + Vector2(- 0.2*cos( alpha ) - (100+random()%100)*0.0005*sin( alpha ), ! - 0.2*sin( alpha ) + (100+random()%100)*0.0005*cos( alpha )); game->add( anim ); } --- 421,431 ---- int l = (int)(1 + sparkNfactor * length/min_length); for( int i = 0; i < l; i++ ){ ! double alpha = tw_random(PI2); Animation *anim = new Animation( this, pos + 0.5 * ship->size.x *unit_vector(alpha), // x + 0.5*ship->width()*cos( alpha ), y + 0.5*ship->width()*sin( alpha ), ! data->spriteExtra, 0, data->spriteExtra->frames(), 50+(random(160)), LAYER_HOTSPOTS ); ! anim->vel = vel + Vector2(- 0.2*cos( alpha ) - (100+random(100))*0.0005*sin( alpha ), ! - 0.2*sin( alpha ) + (100+random(100))*0.0005*cos( alpha )); game->add( anim ); } Index: shptauhu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptauhu.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shptauhu.cpp 2 Aug 2005 00:23:47 -0000 1.12 --- shptauhu.cpp 14 Aug 2005 16:14:32 -0000 1.13 *************** *** 132,137 **** extraFrameTime = get_config_int("Extra", "FrameTime", 50); ! weapon_side = random()%3; ! weapon_angle = random()%6; in_jump = false; ship_recharge_amount = recharge_amount; --- 132,137 ---- extraFrameTime = get_config_int("Extra", "FrameTime", 50); ! weapon_side = tw_random(3); ! weapon_angle = tw_random(6); in_jump = false; ship_recharge_amount = recharge_amount; *************** *** 160,166 **** wx = R1 * cos((angle + weapon_side*PI2/3)) + -R2 * sin((weapon_angle + i) * PI/3); ! a = (1 - (random()%201)/100.0); ! b = (1 - 0.1*(random()%201)/100.0); ! c = (1 - 0.1*(random()%201)/100.0); SpaceLocation* s = new TauHunterLaser(wx, wy, angle + weaponSpread * a, weaponVelocity * c, weaponRange * (1 - 0.2*fabs(a)) * b, --- 160,166 ---- wx = R1 * cos((angle + weapon_side*PI2/3)) + -R2 * sin((weapon_angle + i) * PI/3); ! a = (1 - (random(2.0))/100.0); ! b = (1 - 0.1*(random(2.0))/100.0); ! c = (1 - 0.1*(random(2.0))/100.0); SpaceLocation* s = new TauHunterLaser(wx, wy, angle + weaponSpread * a, weaponVelocity * c, weaponRange * (1 - 0.2*fabs(a)) * b, Index: shpbogce.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbogce.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpbogce.cpp 2 Aug 2005 00:23:44 -0000 1.8 --- shpbogce.cpp 14 Aug 2005 16:14:32 -0000 1.9 *************** *** 175,184 **** return false; ! double r = 1 - random(2.0); ! // r *= r; ! // double l = sqrt(1 - r*r) * (1 - (random()%101)/50.0); ! // l *= l * sin(weaponSpread*ANGLE_RATIO) * weaponRange; ! double l = sqrt(random(1.0)); game->add(new BoggCenturionShot(this, Vector2(+8 + 8*r, 21), angle + r*weaponSpread, weaponDamage, weaponRange * l, data->spriteWeapon, data->sampleWeapon[1])); --- 175,181 ---- return false; ! double r = tw_random(-1.0, 1.0); ! double l = sqrt(tw_random(1.0)); game->add(new BoggCenturionShot(this, Vector2(+8 + 8*r, 21), angle + r*weaponSpread, weaponDamage, weaponRange * l, data->spriteWeapon, data->sampleWeapon[1])); Index: shpbubbo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbubbo.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** shpbubbo.cpp 2 Aug 2005 00:23:44 -0000 1.21 --- shpbubbo.cpp 14 Aug 2005 16:14:32 -0000 1.22 *************** *** 344,348 **** CenterPoint.x = 0; CenterPoint.y = 0; ! if (random() % 100 < explosionPercentChanceBigBoom) { Query q; --- 344,348 ---- CenterPoint.x = 0; CenterPoint.y = 0; ! if (tw_random(100) < explosionPercentChanceBigBoom) { Query q; *************** *** 357,361 **** 50, LAYER_EXPLOSIONS)); } ! if(random()%100 < explosionPercentChanceShrapnel) { radInc = PI2 / explosionShrapnelNumber1; for(i=0; i<explosionShrapnelNumber1; i++) { --- 357,361 ---- 50, LAYER_EXPLOSIONS)); } ! if(random(100) < explosionPercentChanceShrapnel) { radInc = PI2 / explosionShrapnelNumber1; for(i=0; i<explosionShrapnelNumber1; i++) { *************** *** 518,522 **** PositionedAnimation(creator, creator, Vector2(ox,oy), osprite, 0, 1, 100, LAYER_SHOTS) { ! base_frame = 64*(random()%4); sprite_index = base_frame + get_index(follow->get_angle()); attributes &= ~ATTRIB_STANDARD_INDEX; --- 518,522 ---- PositionedAnimation(creator, creator, Vector2(ox,oy), osprite, 0, 1, 100, LAYER_SHOTS) { ! base_frame = 64*(random(4)); sprite_index = base_frame + get_index(follow->get_angle()); attributes &= ~ATTRIB_STANDARD_INDEX; Index: shpfiear.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpfiear.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpfiear.cpp 2 Aug 2005 00:23:45 -0000 1.14 --- shpfiear.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 282,289 **** while (spark_counter <= 0) { spark_counter += 25; ! game->add(new FierasShotSpark(this, PI2*(random()%1000)/1000.0, ! scale_velocity(5)*(random()%101)/100.0, ! iround(4800*(1-0.5*(random()%101)/100.0)), ! 160+random()%50, 160+random()%50, 230+random()%25)); } spark_counter -= frame_time; --- 282,289 ---- while (spark_counter <= 0) { spark_counter += 25; ! game->add(new FierasShotSpark(this, tw_random(PI2), ! scale_velocity(5)*tw_random(1.0), ! iround(4800*(1-0.5*(tw_random(1.0)))), ! 160+tw_random(50), 160+tw_random(50), 230+tw_random(25) )); } spark_counter -= frame_time; Index: shpphepa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpphepa.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpphepa.cpp 2 Aug 2005 00:23:46 -0000 1.20 --- shpphepa.cpp 14 Aug 2005 16:14:32 -0000 1.21 *************** *** 183,187 **** crewinspace[i] = new CrewPodPP( this->normal_pos() + (unit_vector(trajectory_angle(this) - PI) * ! this->size.x) + random(Vector2(50,50)) - Vector2(25,25), specialFrames, this, data->spriteSpecial, 32, specialFrames); --- 183,187 ---- crewinspace[i] = new CrewPodPP( this->normal_pos() + (unit_vector(trajectory_angle(this) - PI) * ! this->size.x) + tw_random(Vector2(50,50)) - Vector2(25,25), specialFrames, this, data->spriteSpecial, 32, specialFrames); Index: shptaule.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaule.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shptaule.cpp 6 Aug 2005 23:26:46 -0000 1.20 --- shptaule.cpp 14 Aug 2005 16:14:32 -0000 1.21 *************** *** 267,271 **** ! missile_side = 1 - 2 * (tw_random()%2); } --- 267,271 ---- ! missile_side = 1 - (tw_random() & 2); } *************** *** 276,289 **** { ! STACKTRACE ! ! add(new LeviathanSlimeBall(0.0, size.y/2.6, normalize(angle + weaponSpread*(1.0-(random() % 2001)/1000.0), PI2), ! weaponVelocity, weaponDamage, extraTime, extraSpeed, weaponRange, - weaponArmour, this, this, data->spriteWeapon, 10, 70, extraGreen, weaponRelativity)); - return true; - } --- 276,284 ---- { ! STACKTRACE; ! add(new LeviathanSlimeBall(0.0, size.y/2.6, normalize(angle + tw_random(-weaponSpread, weaponSpread), PI2), weaponVelocity, weaponDamage, extraTime, extraSpeed, weaponRange, weaponArmour, this, this, data->spriteWeapon, 10, 70, extraGreen, weaponRelativity)); return true; } *************** *** 291,310 **** int TauLeviathan::activate_special() - { ! STACKTRACE add(new LeviathanMissile(22*missile_side, 5, angle + (PI/12)*missile_side, - specialVelocity, specialDamage, specialRange, specialArmour, - specialTurnRate, this, data->spriteSpecial, data->spriteSpecialExplosion, - target)); - missile_side *= -1; return true; - } --- 286,299 ---- int TauLeviathan::activate_special() { ! STACKTRACE; add(new LeviathanMissile(22*missile_side, 5, angle + (PI/12)*missile_side, specialVelocity, specialDamage, specialRange, specialArmour, specialTurnRate, this, data->spriteSpecial, data->spriteSpecialExplosion, target)); missile_side *= -1; return true; } *************** *** 432,463 **** void LeviathanSlimeBall::inflict_damage(SpaceObject *other) - { STACKTRACE - if (other->isShip()) { - int c = iround(((Ship*)other)->getCrew()); - AnimatedShot::inflict_damage(other); - c -= iround(((Ship*)other)->getCrew()); - ///RGB col = ((Ship*)other)->crewPanelColor(); - int i; - for (i=0; i<c; i++) ! ! add(new LeviathanSlimeFood(random()%361, food_velocity*(1-0.90*(random()%101)/100.0), ! ! (int)(l_time * (1-0.00*(random()%101)/100.0)), this, this, data->spriteExtra, 10, 70)); ! } - else - AnimatedShot::inflict_damage(other); - }; --- 421,438 ---- void LeviathanSlimeBall::inflict_damage(SpaceObject *other) { STACKTRACE if (other->isShip()) { int c = iround(((Ship*)other)->getCrew()); AnimatedShot::inflict_damage(other); c -= iround(((Ship*)other)->getCrew()); ///RGB col = ((Ship*)other)->crewPanelColor(); int i; for (i=0; i<c; i++) ! add(new LeviathanSlimeFood(random(361), food_velocity*(1-0.90*random(1.01)), ! (int)(l_time * (1-0.00*(random(1.0)))), this, this, data->spriteExtra, 10, 70)); } else AnimatedShot::inflict_damage(other); }; *************** *** 483,511 **** void LeviathanSlimeFood::inflict_damage(SpaceObject *other) - { STACKTRACE - other->handle_damage(this, 0); - }; - void LeviathanSlimeFood::calculate() - { STACKTRACE AnimatedShot::calculate(); - vel *= exp(-0.0018*frame_time); - d = 0; - lifetime -= frame_time; if (lifetime <= 0) state = 0; - } --- 458,477 ---- *************** *** 515,523 **** int LeviathanSlimeFood::isAlly(SpaceLocation *other) - { - return true; - } --- 481,486 ---- Index: shptaufi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaufi.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shptaufi.cpp 2 Aug 2005 00:23:47 -0000 1.6 --- shptaufi.cpp 14 Aug 2005 16:14:32 -0000 1.7 *************** *** 158,162 **** alpha *= alpha; alpha *= alpha; ! alpha = normal * (alpha + (1-alpha)*(random()%101)/100.0); int d = normal; normal = (int)floor(alpha); --- 158,162 ---- alpha *= alpha; alpha *= alpha; ! alpha = normal * (alpha + (1-alpha)*(tw_random(1.0)) ); int d = normal; normal = (int)floor(alpha); *************** *** 164,168 **** d -= normal; if (d > 0) ! play_sound(data->sampleExtra[random() % 8]); return Ship::handle_damage(source, normal, direct); } --- 164,168 ---- d -= normal; if (d > 0) ! play_sound(data->sampleExtra[random(8)]); return Ship::handle_damage(source, normal, direct); } *************** *** 273,277 **** TauFiendPEffect::TauFiendPEffect(SpaceLocation *creator, Ship *tgt, SpaceSprite *osprite, int ofs, int oduration) : ! Animation(creator, 0, osprite, 0, oduration, 50, LAYER_EXPLOSIONS) { target = tgt; --- 273,278 ---- TauFiendPEffect::TauFiendPEffect(SpaceLocation *creator, Ship *tgt, SpaceSprite *osprite, int ofs, int oduration) : ! Animation(creator, 0, osprite, 0, osprite->frames(), oduration/*, 50*/, LAYER_EXPLOSIONS) ! //xxx I inserted the sprite->frames() part, and removed the 50 part... dunno if it's correct though. { target = tgt; *************** *** 285,303 **** target = 0; ! if (target) { //x = target->normal_x(); //y = target->normal_y(); pos = target->normal_pos(); ! frame_step -= frame_time; ! while (frame_step < 0) { ! frame_step += frame_size; ! sprite_index ++; ! if (sprite_index < frame_count) { ! target->handle_fuel_sap(this, fs); } ! if ((sprite_index >= 10) && (sprite_index >= frame_count)) ! state = 0; ! } ! SpaceObject::calculate(); ! } else state = 0; } --- 286,308 ---- target = 0; ! if (target) ! { //x = target->normal_x(); //y = target->normal_y(); pos = target->normal_pos(); ! frame_step -= frame_time; ! while (frame_step < 0) ! { ! frame_step += frame_size; ! sprite_index ++; ! if (sprite_index < frame_count) { ! target->handle_fuel_sap(this, fs); } ! if ((sprite_index >= 10) && (sprite_index >= frame_count)) ! state = 0; ! } ! ! if (exists()) ! SpaceObject::calculate(); ! } else state = 0; } Index: shptauda.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptauda.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shptauda.cpp 1 Aug 2005 10:46:34 -0000 1.14 --- shptauda.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 112,117 **** damage_factor = ldamage; ! int rrr = tw_random()%85; ! color = makecol(100+rrr,100+rrr+tw_random()%55,205+tw_random()%51); relative_angle = angle - lpos->get_angle(); --- 112,117 ---- damage_factor = ldamage; ! int rrr = tw_random(85); ! color = makecol(100+rrr,100+rrr+tw_random(55),205+tw_random(51)); relative_angle = angle - lpos->get_angle(); *************** *** 134,139 **** state = 0; ! int rrr = tw_random()%85; ! color = makecol(100+rrr,100+rrr+tw_random()%55,205+tw_random()%51); } --- 134,139 ---- state = 0; ! int rrr = tw_random(85); ! color = makecol(100+rrr,100+rrr+tw_random(55),205+tw_random(51)); } Index: shpvioge.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvioge.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpvioge.cpp 2 Aug 2005 00:23:47 -0000 1.9 --- shpvioge.cpp 14 Aug 2005 16:14:32 -0000 1.10 *************** *** 176,180 **** Vector2 relpos; ! relpos = Vector2( random(10.0)-5.0, -40.0 + random(10.0) ); Animation *anim; anim = new Animation(this, pos + rotate(relpos, angle-0.5*PI), --- 176,180 ---- Vector2 relpos; ! relpos = Vector2( tw_random(10.0)-5.0, -40.0 + tw_random(10.0) ); Animation *anim; anim = new Animation(this, pos + rotate(relpos, angle-0.5*PI), Index: shpstaba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpstaba.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpstaba.cpp 11 Jul 2005 00:25:32 -0000 1.9 --- shpstaba.cpp 14 Aug 2005 16:14:32 -0000 1.10 *************** *** 117,121 **** if((!o->isInvisible()) && o->sameTeam(this)) { ! if((random()%HealRate)!=0) continue; if(batt<HealCost) continue; if(o->crew==o->crew_max) continue; --- 117,121 ---- if((!o->isInvisible()) && o->sameTeam(this)) { ! if((tw_random(HealRate))!=0) continue; if(batt<HealCost) continue; if(o->crew==o->crew_max) continue; Index: shphydcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphydcr.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shphydcr.cpp 11 Jul 2005 00:25:31 -0000 1.13 --- shphydcr.cpp 14 Aug 2005 16:14:32 -0000 1.14 *************** *** 381,385 **** //FIXME: need 'planet_radius' above - WHEN IMPLEMENTED changeDirection(trajectory_angle(p)+PI); ! retreat_frames = random()%200+75; //CHECK TIMES (in ms) Missile::calculate(); return; --- 381,385 ---- //FIXME: need 'planet_radius' above - WHEN IMPLEMENTED changeDirection(trajectory_angle(p)+PI); ! retreat_frames = tw_random(200)+75; //CHECK TIMES (in ms) Missile::calculate(); return; *************** *** 528,532 **** angle = angle + PI; vel *= -1; ! retreat_frames = (random() % r) + m; } --- 528,532 ---- angle = angle + PI; vel *= -1; ! retreat_frames = random(r) + m; } *************** *** 536,540 **** if(L==NULL || (!L->exists())) return; this->changeDirection(L->trajectory_angle(this)); ! retreat_frames = (random() % r) + m; } --- 536,540 ---- if(L==NULL || (!L->exists())) return; this->changeDirection(L->trajectory_angle(this)); ! retreat_frames = random(r) + m; } Index: shpsclfr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsclfr.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpsclfr.cpp 2 Aug 2005 00:23:47 -0000 1.12 --- shpsclfr.cpp 14 Aug 2005 16:14:32 -0000 1.13 *************** *** 164,168 **** } for(i=0;i<weaponMultiplicity;i++) { ! deflection = (random() % (weaponAngleVariance * 2 + 1))-weaponAngleVariance; deflectionRad = (double)deflection * ANGLE_RATIO; launchPoint = -launchPoint; --- 164,168 ---- } for(i=0;i<weaponMultiplicity;i++) { ! deflection = (tw_random(weaponAngleVariance * 2 + 1))-weaponAngleVariance; deflectionRad = (double)deflection * ANGLE_RATIO; launchPoint = -launchPoint; Index: shpayrbs.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpayrbs.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** shpayrbs.cpp 2 Aug 2005 00:23:40 -0000 1.22 --- shpayrbs.cpp 14 Aug 2005 16:14:32 -0000 1.23 *************** *** 660,664 **** int k; ! k = random(Ndead) + 1; for ( i = 0; i < Nparts; ++i ) --- 660,664 ---- int k; ! k = tw_random(Ndead) + 1; for ( i = 0; i < Nparts; ++i ) Index: shpimpka.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpimpka.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpimpka.cpp 2 Aug 2005 00:23:46 -0000 1.15 --- shpimpka.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 535,539 **** other->get_vel().y - tx * IMPERIAL_DEBRIS_SPEED, other->get_angle(), iround(other->mass), spriteLeft, ! iround(IMPERIAL_MIN_DEBRIS_LIFE + random(IMPERIAL_MAX_DEBRIS_LIFE - IMPERIAL_MIN_DEBRIS_LIFE)) ); game->add( left ); --- 535,539 ---- other->get_vel().y - tx * IMPERIAL_DEBRIS_SPEED, other->get_angle(), iround(other->mass), spriteLeft, ! iround(IMPERIAL_MIN_DEBRIS_LIFE + tw_random(IMPERIAL_MAX_DEBRIS_LIFE - IMPERIAL_MIN_DEBRIS_LIFE)) ); game->add( left ); Index: shpastba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpastba.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpastba.cpp 2 Aug 2005 00:23:40 -0000 1.7 --- shpastba.cpp 14 Aug 2005 16:14:32 -0000 1.8 *************** *** 1212,1216 **** { xp[i] = opos; ! xv[i] = ov * (0.5+sqrt(sqrt((random()%1000000001)/1000000000.0))) * unit_vector(PI2 * (random()%1000000)/1000000.0); } } --- 1212,1216 ---- { xp[i] = opos; ! xv[i] = ov * (0.5+sqrt(sqrt(tw_random(1.0)))) * unit_vector(tw_random(PI2)); } } Index: shpkoaja.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkoaja.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpkoaja.cpp 2 Aug 2005 00:23:46 -0000 1.9 --- shpkoaja.cpp 14 Aug 2005 16:14:32 -0000 1.10 *************** *** 122,128 **** Shot* S; for(i=0; i<8; i++) { ! angleShift = random(-this->specialAngleSpread, this->specialAngleSpread) * PI / 180; ! velocityShift = (random(-this->specialVelocitySpread, this->specialVelocitySpread)); ! rangeShift = (random(-this->specialRangeSpread, this->specialRangeSpread)); //angleShift = 0; velocityShift = 0; rangeShift = 0; S = new Shot(this, Vector2(0.3 * this->size.x * specialOriginShift, 0.4 * this->size.y), --- 122,128 ---- Shot* S; for(i=0; i<8; i++) { ! angleShift = tw_random(-this->specialAngleSpread, this->specialAngleSpread) * PI / 180; ! velocityShift = (tw_random(-this->specialVelocitySpread, this->specialVelocitySpread)); ! rangeShift = (tw_random(-this->specialRangeSpread, this->specialRangeSpread)); //angleShift = 0; velocityShift = 0; rangeShift = 0; S = new Shot(this, Vector2(0.3 * this->size.x * specialOriginShift, 0.4 * this->size.y), Index: shpducla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpducla.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpducla.cpp 2 Aug 2005 00:23:45 -0000 1.17 --- shpducla.cpp 14 Aug 2005 16:14:32 -0000 1.18 *************** *** 995,999 **** int col; int i, r, g, b; ! i = tw_random()%mother->lanternColorRandomAdd; r = mother->lanternColorR + i; if ( r > 255) r = 255; g = mother->lanternColorG + i; if ( g > 255) g = 255; --- 995,999 ---- int col; int i, r, g, b; ! i = tw_random(mother->lanternColorRandomAdd); r = mother->lanternColorR + i; if ( r > 255) r = 255; g = mother->lanternColorG + i; if ( g > 255) g = 255; Index: shpiceco.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpiceco.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpiceco.cpp 21 Jul 2005 00:43:59 -0000 1.14 --- shpiceco.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 188,192 **** for ( i = 0; i < 5; ++i ) { ! k = random() % (5-i); key_order[i] = key_available[k]; key_available[k] = key_available[5-i-1]; --- 188,192 ---- for ( i = 0; i < 5; ++i ) { ! k = tw_random(5-i); key_order[i] = key_available[k]; key_available[k] = key_available[5-i-1]; Index: shpxxxas.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpxxxas.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpxxxas.cpp 12 Jul 2005 22:26:04 -0000 1.15 --- shpxxxas.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 220,322 **** void XXXAssimilator::calculate() - { ! STACKTRACE Ship::calculate(); - - TheSpotDelayTimer++; - - - if (TheSpotDelayTimer > TheSpotDelay) - { - TheSpotDelayTimer = 0; - TheSpotAngle += TheSpotAngleDelta; - TheSpotAngle = normalize(TheSpotAngle,PI2); - RelX = iround(cos(-TheSpotAngle+PI/2) * TheSpotRadius); - RelY = iround(sin(-TheSpotAngle+PI/2) * TheSpotRadius); - - } - - add(new PositionedAnimation(this, this, Vector2(RelX, RelY), - data->spriteExtra, 0, 1, 25, LAYER_EXPLOSIONS)); - - - } - void XXXAssimilator::collide(SpaceObject *other) - { ! STACKTRACE ! ! ! Ship::collide(other); ! ! ! if (other->isShip()) ! ! { ! crew += 2; if (crew >= crew_max) crew = crew_max; ! if (other->ship->speed_max > speed_max) ! ! { ! ! speed_max = other->ship->speed_max; ! ! reload_panel(); ! ! play_sound(data->sampleExtra[0]); ! ! ! ! } ! ! ! if (other->ship->accel_rate > accel_rate) ! ! { ! ! accel_rate = other->ship->accel_rate; ! ! hotspot_rate = other->ship->hotspot_rate; ! ! reload_panel(); ! ! play_sound(data->sampleExtra[0]); ! ! } ! } ! ! ! } --- 220,277 ---- void XXXAssimilator::calculate() { ! STACKTRACE; Ship::calculate(); TheSpotDelayTimer++; if (TheSpotDelayTimer > TheSpotDelay) { TheSpotDelayTimer = 0; TheSpotAngle += TheSpotAngleDelta; TheSpotAngle = normalize(TheSpotAngle,PI2); RelX = iround(cos(-TheSpotAngle+PI/2) * TheSpotRadius); RelY = iround(sin(-TheSpotAngle+PI/2) * TheSpotRadius); } add(new PositionedAnimation(this, this, Vector2(RelX, RelY), data->spriteExtra, 0, 1, 25, LAYER_EXPLOSIONS)); } void XXXAssimilator::collide(SpaceObject *other) { ! STACKTRACE; ! Ship::collide(other); ! if (other->isShip()) ! { crew += 2; if (crew >= crew_max) crew = crew_max; ! if (other->ship->speed_max > speed_max) ! { ! speed_max = other->ship->speed_max; ! reload_panel(); ! play_sound(data->sampleExtra[0]); ! ! } ! if (other->ship->accel_rate > accel_rate) ! { ! accel_rate = other->ship->accel_rate; ! hotspot_rate = other->ship->hotspot_rate; ! reload_panel(); ! play_sound(data->sampleExtra[0]); } ! } ! } *************** *** 324,384 **** void XXXAssimilator::animate(Frame *space) - { ! STACKTRACE ! ! BodyFrames -= frame_time * 5; ! ! ! ! if (BodyFrames <= 0) ! ! { ! ! if (!( (CurrBodyFrame > 0) && (CurrBodyFrame < 2) )) ! ! ToggleDirection = !ToggleDirection; ! ! ! if (ToggleDirection) ++CurrBodyFrame; ! ! else --CurrBodyFrame; ! ! ! ! BodyFrames = weaponFrames; ! ! } ! ! sprite->animate(pos, sprite_index + (64 * CurrBodyFrame) , space); ! ! } - int XXXAssimilator::handle_damage(SpaceLocation *source, double normal, double direct) - { ! STACKTRACE if (source->damage_factor > weaponDamage) - { - weaponDamage = iround(source->damage_factor); - weapon_drain = weaponDamage; - play_sound(data->sampleExtra[0]); - } - - return Ship::handle_damage(source, normal, direct); - } --- 279,314 ---- void XXXAssimilator::animate(Frame *space) { ! STACKTRACE; ! BodyFrames -= frame_time * 5; ! ! if (BodyFrames <= 0) ! { ! if (!( (CurrBodyFrame > 0) && (CurrBodyFrame < 2) )) ! ToggleDirection = !ToggleDirection; ! if (ToggleDirection) ++CurrBodyFrame; ! else --CurrBodyFrame; ! ! BodyFrames = weaponFrames; ! ! } ! sprite->animate(pos, sprite_index + (64 * CurrBodyFrame) , space); } int XXXAssimilator::handle_damage(SpaceLocation *source, double normal, double direct) { ! STACKTRACE; if (source->damage_factor > weaponDamage) { weaponDamage = iround(source->damage_factor); weapon_drain = weaponDamage; play_sound(data->sampleExtra[0]); } return Ship::handle_damage(source, normal, direct); } *************** *** 386,415 **** void XXXAssimilator::calculate_hotspots() - { ! STACKTRACE ! ! if((thrust) && (hotspot_frame <= 0)) { add(new Animation(this, - normal_pos() - 11*unit_vector(angle), - meleedata.hotspotSprite, 0, HOTSPOT_FRAMES, time_ratio, LAYER_HOTSPOTS)); - - add(new PositionedAnimation(this, this, Vector2(0, -10), ! ! data->spriteExtraExplosion ,0, random()%2, 5, LAYER_SHOTS)); ! hotspot_frame += hotspot_rate; - } if (hotspot_frame > 0) hotspot_frame -= frame_time; - - - } --- 316,334 ---- void XXXAssimilator::calculate_hotspots() { ! STACKTRACE; + if((thrust) && (hotspot_frame <= 0)) + { add(new Animation(this, normal_pos() - 11*unit_vector(angle), meleedata.hotspotSprite, 0, HOTSPOT_FRAMES, time_ratio, LAYER_HOTSPOTS)); add(new PositionedAnimation(this, this, Vector2(0, -10), ! data->spriteExtraExplosion ,0, tw_random(2), 5, LAYER_SHOTS)); hotspot_frame += hotspot_rate; } if (hotspot_frame > 0) hotspot_frame -= frame_time; } Index: shpxxxma.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpxxxma.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpxxxma.cpp 23 Jul 2005 14:08:08 -0000 1.20 --- shpxxxma.cpp 14 Aug 2005 16:14:32 -0000 1.21 *************** *** 220,224 **** double alpha = specialSpread / specialNumber; ! double beta = normalize( angle + PI - 0.5 * specialSpread + random(alpha), PI2 ); double tx = cos( angle ); double ty = sin( angle ); --- 220,224 ---- double alpha = specialSpread / specialNumber; ! double beta = normalize( angle + PI - 0.5 * specialSpread + tw_random(alpha), PI2 ); double tx = cos( angle ); double ty = sin( angle ); Index: shpbipka.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbipka.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpbipka.cpp 23 Jul 2005 14:08:03 -0000 1.15 --- shpbipka.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 149,153 **** STACKTRACE if( !left || !right ) return FALSE; ! weapon_sample = random(11); int left_w = left->activate_weapon(); int right_w = right->activate_weapon(); --- 149,153 ---- STACKTRACE if( !left || !right ) return FALSE; ! weapon_sample = tw_random(11); int left_w = left->activate_weapon(); int right_w = right->activate_weapon(); Index: shpuxjba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpuxjba.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpuxjba.cpp 11 Jul 2005 00:25:32 -0000 1.8 --- shpuxjba.cpp 14 Aug 2005 16:14:32 -0000 1.9 *************** *** 55,59 **** // shaky double a = 0.04 * PI; ! turn_step += random(2*a) - a; Shot *s; --- 55,59 ---- // shaky double a = 0.04 * PI; ! turn_step += tw_random(2*a) - a; Shot *s; Index: shpjurcu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpjurcu.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpjurcu.cpp 12 Jul 2005 22:26:03 -0000 1.7 --- shpjurcu.cpp 14 Aug 2005 16:14:32 -0000 1.8 *************** *** 78,87 **** int JurgathaCutter::activate_weapon() { ! int random_number = random()%10; game->add(new Laser(this, angle, pallete_color[weaponColor], weaponRange, weaponDamage, weapon_rate, this, Vector2(-(double)(random_number), 2.0), true)); ! random_number = random()%10; game->add(new Laser(this, angle, pallete_color[weaponColor], weaponRange, --- 78,87 ---- int JurgathaCutter::activate_weapon() { ! int random_number = tw_random(10); game->add(new Laser(this, angle, pallete_color[weaponColor], weaponRange, weaponDamage, weapon_rate, this, Vector2(-(double)(random_number), 2.0), true)); ! random_number = random(10); game->add(new Laser(this, angle, pallete_color[weaponColor], weaponRange, Index: shpvezba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvezba.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpvezba.cpp 2 Aug 2005 00:23:47 -0000 1.16 --- shpvezba.cpp 14 Aug 2005 16:14:32 -0000 1.17 *************** *** 248,266 **** int i; for(i=0; i<iterations; i++) { ! R = (double)(random() % 2001 - 1000) / 1000.0; Turn1 += R / 30; ! R = (double)(random() % 2001 - 1000) / 1000.0; Turn2 += R / 10; ! R = (double)(random() % 2001 - 1000) / 1000.0; Turn3 += R / 5; ! R = (double)(random() % 2001 - 1000) / 1000.0; Turn4 += R / 2; ! R = (double)(random() % 2001 - 1000) / 1000.0; Range1 += R / 500; ! R = (double)(random() % 2001 - 1000) / 1000.0; Range2 += R / 8; ! R = (double)(random() % 2001 - 1000) / 1000.0; Range3 += R / 8; ! R = (double)(random() % 2001 - 1000) / 1000.0; Range4 += R / 8; } --- 248,266 ---- int i; for(i=0; i<iterations; i++) { ! R = tw_random(-1.0, 1.0); Turn1 += R / 30; ! R = tw_random(-1.0, 1.0); Turn2 += R / 10; ! R = tw_random(-1.0, 1.0); Turn3 += R / 5; ! R = tw_random(-1.0, 1.0); Turn4 += R / 2; ! R = tw_random(-1.0, 1.0); Range1 += R / 500; ! R = tw_random(-1.0, 1.0); Range2 += R / 8; ! R = tw_random(-1.0, 1.0); Range3 += R / 8; ! R = tw_random(-1.0, 1.0); Range4 += R / 8; } Index: shpvelcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvelcr.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpvelcr.cpp 2 Aug 2005 00:23:47 -0000 1.11 --- shpvelcr.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 294,298 **** double firingAngle = defaultAngle; ! angleShift = ((double)(random()%2001-1000)/1000.0) * specialLaunchAngleDeflectionRange; Query a; --- 294,299 ---- double firingAngle = defaultAngle; ! double r = tw_random(-1.0, 1.0); ! angleShift = r * specialLaunchAngleDeflectionRange; Query a; Index: shpgeror.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgeror.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shpgeror.cpp 2 Aug 2005 00:23:46 -0000 1.6 --- shpgeror.cpp 14 Aug 2005 16:14:32 -0000 1.7 *************** *** 312,316 **** //stuff = q.currento->normal_pos()/* + (unit_vector(q.currento->trajectory_angle(this)) * q.currento->get_size()/2.5)*/; ! add(new JadWarheadExplosion2(stuff, scale_velocity(tw_random()%2+5), 100, 600, makecol(255,128,0), this)); damage(q.currento, (int)ceil(r * blast_damage) - d, d); --- 312,316 ---- //stuff = q.currento->normal_pos()/* + (unit_vector(q.currento->trajectory_angle(this)) * q.currento->get_size()/2.5)*/; ! add(new JadWarheadExplosion2(stuff, scale_velocity(tw_random(2)+5), 100, 600, makecol(255,128,0), this)); damage(q.currento, (int)ceil(r * blast_damage) - d, d); *************** *** 324,328 **** /* + (unit_vector(q.currento->trajectory_angle(this)) * q.currento->get_size()/4)*/; ! add(new JadWarheadExplosion(stuff, scale_velocity(tw_random()%2+5), 100, 1000, makecol(128,128,255))); } --- 324,328 ---- /* + (unit_vector(q.currento->trajectory_angle(this)) * q.currento->get_size()/4)*/; ! add(new JadWarheadExplosion(stuff, scale_velocity(tw_random(2)+5), 100, 1000, makecol(128,128,255))); } *************** *** 331,335 **** q.currento->accelerate(this, trajectory_angle(q.currento), kick * r / ((q.currento->mass > 1)?sqrt(q.currento->mass):1), boost_max); } ! add(new JadWarheadExplosion(pos, scale_velocity(tw_random()%20+25), 150, 450, makecol(255,128,0))); Missile::animateExplosion(); --- 331,335 ---- q.currento->accelerate(this, trajectory_angle(q.currento), kick * r / ((q.currento->mass > 1)?sqrt(q.currento->mass):1), boost_max); } ! add(new JadWarheadExplosion(pos, scale_velocity(tw_random(20)+25), 150, 450, makecol(255,128,0))); Missile::animateExplosion(); *************** *** 358,362 **** { xp[i] = opos; ! xv[i] = ov * (0.5+sqrt(sqrt((random()%1000000001)/1000000000.0))) * unit_vector(PI2 * (random()%1000000)/1000000.0); } } --- 358,362 ---- { xp[i] = opos; ! xv[i] = ov * (0.5+sqrt(sqrt(tw_random(1.0)))) * unit_vector(tw_random(PI2)); } } *************** *** 445,449 **** { xp[i] = opos; ! xv[i] = ov * ((0.5+sqrt(sqrt((random()%1000000001)/1000000000.0))) * unit_vector(trajectory_angle(opos, otarg->pos) - PI/2 + (PI * (random()%1000000)/1000000.0))); } } --- 445,449 ---- { xp[i] = opos; ! xv[i] = ov * ((0.5+sqrt(sqrt(random(1.0)))) * unit_vector(trajectory_angle(opos, otarg->pos) - PI/2 + (random(PI)))); } } Index: shpwistr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpwistr.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpwistr.cpp 2 Aug 2005 00:23:47 -0000 1.14 --- shpwistr.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 265,312 **** { - - /* removed, cause the bombs sucked. - TripodBomb *t; - - int testfired; - - int ilast = ifiregun; - - testfired = 0; - for (;;) - { - - ++ifiregun; - if ( ifiregun > 2 ) - ifiregun = 0; - - if ( !engineactive[ifiregun] ) - { - - t = new TripodBomb(this, rotate(Vector2(0, 15),moveangles[ifiregun]-PI/2), - moveangles[ifiregun]-angle, data->spriteSpecial); - add(t); - - - testfired = 1; - - break; - } - - if ( ifiregun == ilast ) // in case none is active .... - break; - } - - - if ( testfired ) - { - int k = random() % data->num_special_samples; - // play_sound(data->sampleSpecial[k]); - return TRUE; - } - else - return FALSE; - - */ fire_guns(2); --- 265,268 ---- Index: shpilwsp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpilwsp.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpilwsp.cpp 2 Aug 2005 00:23:46 -0000 1.15 --- shpilwsp.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 105,109 **** STACKTRACE; double alpha = specialSpread / specialNumber; ! double beta = normalize( angle + PI - 0.5 * specialSpread + random(alpha), PI2 ); double tx = cos( angle ); double ty = sin( angle ); --- 105,109 ---- STACKTRACE; double alpha = specialSpread / specialNumber; ! double beta = normalize( angle + PI - 0.5 * specialSpread + tw_random(alpha), PI2 ); double tx = cos( angle ); double ty = sin( angle ); Index: shpforsh.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpforsh.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpforsh.cpp 11 Jul 2005 00:25:31 -0000 1.11 --- shpforsh.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 86,94 **** play_sound2(data->sampleWeapon[0]); if (weapon_type == 0) { ! if(random()%2) tmp_s = data->spriteExtra; add(new AnimatedShot(this, Vector2(27.0,20.0), angle , weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, tmp_s, 32, weapon_frame_size, 1.0)); if (weapon_type == 0) { ! if(random()%2) tmp_s = data->spriteExtra; else tmp_s = data->spriteWeapon; } } add(new AnimatedShot(this, Vector2(-27.0,20.0), angle , weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, tmp_s, 32, weapon_frame_size, 1.0)); return(TRUE); --- 86,94 ---- play_sound2(data->sampleWeapon[0]); if (weapon_type == 0) { ! if(tw_random(2)) tmp_s = data->spriteExtra; add(new AnimatedShot(this, Vector2(27.0,20.0), angle , weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, tmp_s, 32, weapon_frame_size, 1.0)); if (weapon_type == 0) { ! if(random(2)) tmp_s = data->spriteExtra; else tmp_s = data->spriteWeapon; } } add(new AnimatedShot(this, Vector2(-27.0,20.0), angle , weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, tmp_s, 32, weapon_frame_size, 1.0)); return(TRUE); Index: shpkahbo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkahbo.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpkahbo.cpp 11 Jul 2005 00:25:31 -0000 1.12 --- shpkahbo.cpp 14 Aug 2005 16:14:32 -0000 1.13 *************** *** 188,192 **** } if (weaponChoice == LARGE_BOOMERANG) { ! chance = random() % 2; if (chance) weapon3Turn = weapon3Turn * -1; if (boomerangL == NULL) { --- 188,192 ---- } if (weaponChoice == LARGE_BOOMERANG) { ! chance = tw_random(2); if (chance) weapon3Turn = weapon3Turn * -1; if (boomerangL == NULL) { Index: shpvuvji.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvuvji.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shpvuvji.cpp 11 Jul 2005 00:25:32 -0000 1.6 --- shpvuvji.cpp 14 Aug 2005 16:14:32 -0000 1.7 *************** *** 148,155 **** double vv; for (int i=0; i < 15; i++) { ! vv = random(1.0); vv = 0.0+sqrt(vv); game->add(new VuvJinxExplosion(this, pos, ! random(360.0), scale_velocity(40)*vv)); } } --- 148,155 ---- double vv; for (int i=0; i < 15; i++) { ! vv = tw_random(1.0); vv = 0.0+sqrt(vv); game->add(new VuvJinxExplosion(this, pos, ! tw_random(360.0), scale_velocity(40)*vv)); } } Index: shpjygst.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpjygst.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpjygst.cpp 2 Aug 2005 00:23:46 -0000 1.17 --- shpjygst.cpp 14 Aug 2005 16:14:32 -0000 1.18 *************** *** 111,130 **** SpaceLocation* beacon = new SpaceLocation( this, pos + unit_vector(angle) * weaponRange / 3, angle ); ! if( random() % 100 < weaponStray ){ game->add( shot = new JyglarStrayShot( this, ! Vector2(-2.0 + 0.5 * (double)(random() % 5), size.y * 0.6), angle +(- 2.0 + (double)(random() % 5))*ANGLE_RATIO, ! weaponVelocity, random() % (weaponDamage + 1), random() % ((int)weaponRange + 1), weaponArmour, this, data->spriteSpecial, weaponPull, beacon )); ! weapon_sample = 7 + random() % 3; }else{ ! int shot_damage = random() % (weaponDamage + 1); game->add( shot = new JyglarShot( this, ! Vector2(-2.0 + 0.5 * (double)(random() % 5), size.y * 0.5), angle +(- 2.0 + (double)(random() % 5))*ANGLE_RATIO, ! weaponVelocity, shot_damage, random() % ((int)weaponRange + 1), weaponArmour, this, data->spriteSpecial, weaponPull, beacon )); if( shot_damage == 0 ){ weapon_sample = 10; }else{ ! melody += -1 + random() % 3; weapon_sample = abs( melody ) % 7; } --- 111,130 ---- SpaceLocation* beacon = new SpaceLocation( this, pos + unit_vector(angle) * weaponRange / 3, angle ); ! if( tw_random(100) < weaponStray ){ game->add( shot = new JyglarStrayShot( this, ! Vector2(-2.0 + 0.5 * (double)(random(5)), size.y * 0.6), angle +(- 2.0 + (double)(random(5)))*ANGLE_RATIO, ! weaponVelocity, random(weaponDamage + 1), random((int)weaponRange + 1), weaponArmour, this, data->spriteSpecial, weaponPull, beacon )); ! weapon_sample = 7 + random(3); }else{ ! int shot_damage = random(weaponDamage + 1); game->add( shot = new JyglarShot( this, ! Vector2(-2.0 + 0.5 * (double)(random(5)), size.y * 0.5), angle +(- 2.0 + (double)(random(5)))*ANGLE_RATIO, ! weaponVelocity, shot_damage, random(int(weaponRange + 1)), weaponArmour, this, data->spriteSpecial, weaponPull, beacon )); if( shot_damage == 0 ){ weapon_sample = 10; }else{ ! melody += -1 + random(3); weapon_sample = abs( melody ) % 7; } *************** *** 132,136 **** shot->explosionSprite = data->spriteSpecialExplosion; shot->explosionFrameCount = 6; ! shot->explosionSample = data->sampleSpecial[1 + random() % (data->num_special_samples - 1)]; return TRUE; } --- 132,136 ---- shot->explosionSprite = data->spriteSpecialExplosion; shot->explosionFrameCount = 6; ! shot->explosionSample = data->sampleSpecial[1 + random(data->num_special_samples - 1)]; return TRUE; } *************** *** 139,143 **** STACKTRACE if( numBubbles >= maxBubbles ) return FALSE; ! bubbles[numBubbles] = new JyglarBubble( this, size.x / 5 + random() % (int)(size.x / 3), random(PI2), data->spriteWeapon, specialMass); game->add( bubbles[numBubbles] ); --- 139,143 ---- STACKTRACE if( numBubbles >= maxBubbles ) return FALSE; ! bubbles[numBubbles] = new JyglarBubble( this, size.x / 5 + random(size.x / 3), random(PI2), data->spriteWeapon, specialMass); game->add( bubbles[numBubbles] ); *************** *** 203,214 **** { // collide_flag_sameteam = collide_flag_sameship = ALL_LAYERS; ! minturn = -(random() % 2); ! maxturn = random() % 2; } ! void JyglarStrayShot::calculate(){ ! STACKTRACE ! Shot::calculate(); ! changeDirection( angle + (minturn + random() % (maxturn - minturn + 1)) * frame_time ); } --- 203,216 ---- { // collide_flag_sameteam = collide_flag_sameship = ALL_LAYERS; ! minturn = -(random(2)); ! maxturn = random(2); } ! void JyglarStrayShot::calculate() ! { ! STACKTRACE; ! Shot::calculate(); ! double r = random(minturn* ANGLE_RATIO, maxturn* ANGLE_RATIO); ! changeDirection( angle + r * frame_time ); } *************** *** 225,229 **** vel = ship->get_vel(); sprite_index = get_index(angle); ! countdown = 1000 + random() % 2000; isblockingweapons = true; --- 227,231 ---- vel = ship->get_vel(); sprite_index = get_index(angle); ! countdown = 1000 + random(2000); isblockingweapons = true; *************** *** 238,242 **** if( countdown <= 0 ){ state = 0; ! play_sound( data->sampleExtra[random() % data->num_extra_samples] ); } return; --- 240,244 ---- if( countdown <= 0 ){ state = 0; ! play_sound( data->sampleExtra[random(data->num_extra_samples)] ); } return; *************** *** 257,261 **** if( normal + direct ){ state = 0; ! play_sound( data->sampleExtra[random() % data->num_extra_samples], 1000 ); } return iround(normal + direct); --- 259,263 ---- if( normal + direct ){ state = 0; ! play_sound( data->sampleExtra[random(data->num_extra_samples)], 1000 ); } return iround(normal + direct); Index: shpquawr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpquawr.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpquawr.cpp 1 Aug 2005 10:46:34 -0000 1.17 --- shpquawr.cpp 14 Aug 2005 16:14:32 -0000 1.18 *************** *** 150,163 **** { STACKTRACE - /* GEO: removes partial damage - int randomNumber = random() % 100; - if (cloak) { - if (other->isShot()) { - // message.print(100,5,"(%6.2d)",randomNumber); - if (randomNumber <= extraChanceToHit) return true; - return false; - } else return false; - } - else */ return Ship::canCollide(other); } --- 150,153 ---- *************** *** 291,300 **** aiming(oaiming), dispersion(odispersion) { ! base_length = (random()%(2*r_length+1) - r_length) + b_length; // x = pos->normal_x(); // y = pos->normal_y(); pos = lpos->normal_pos(); // lpos is of class Laser ! if (target) angle = trajectory_angle(target); ! else angle = random(PI2); if (ship != lpos) { // x += ((QuarKathLightning *)(pos))->edge_x(); --- 281,294 ---- aiming(oaiming), dispersion(odispersion) { ! base_length = (tw_random(2*r_length+1) - r_length) + b_length; // x = pos->normal_x(); // y = pos->normal_y(); pos = lpos->normal_pos(); // lpos is of class Laser ! ! if (target) ! angle = trajectory_angle(target); ! else ! angle = random(PI2); ! if (ship != lpos) { // x += ((QuarKathLightning *)(pos))->edge_x(); *************** *** 302,306 **** pos += ((QuarKathLightning *)(lpos))->edge(); } ! angle += (random(r_angle*2+1)) - r_angle; color = pallete_color[179 - level * 2 - (random(8))]; if (level) add(new QuarKathLightning(ship, this, target, level-1, b_length, --- 296,301 ---- pos += ((QuarKathLightning *)(lpos))->edge(); } ! int r = random(r_angle*2+1); ! angle += r - r_angle; color = pallete_color[179 - level * 2 - (random(8))]; if (level) add(new QuarKathLightning(ship, this, target, level-1, b_length, *************** *** 327,333 **** if (d_a > PI) d_a -= PI2; if (d_a > 0) ! angle += (ANGLE_RATIO * aiming + ANGLE_RATIO * dispersion*(-50+random()%101) / sqrt((double)frame_time)) * frame_time / 100.0; else ! angle -= (ANGLE_RATIO * aiming + ANGLE_RATIO * dispersion*(-50+random()%101) / sqrt((double)frame_time)) * frame_time / 100.0; if (!target->exists()) target = NULL; return; --- 322,328 ---- if (d_a > PI) d_a -= PI2; if (d_a > 0) ! angle += (ANGLE_RATIO * aiming + ANGLE_RATIO * dispersion*(random(-50.0, 50.0)) / sqrt((double)frame_time)) * frame_time / 100.0; else ! angle -= (ANGLE_RATIO * aiming + ANGLE_RATIO * dispersion*(random(-50.0, 50.0)) / sqrt((double)frame_time)) * frame_time / 100.0; if (!target->exists()) target = NULL; return; Index: shpearc3.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpearc3.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpearc3.cpp 2 Aug 2005 00:23:45 -0000 1.16 --- shpearc3.cpp 14 Aug 2005 16:14:32 -0000 1.17 *************** *** 243,247 **** } ! color = makecol(100+tw_random()%105,100+tw_random()%105,255); got_spark = false; switch_counter = 0; --- 243,247 ---- } ! color = makecol(100+tw_random(105),100+tw_random(105),255); got_spark = false; switch_counter = 0; *************** *** 299,303 **** ! color = makecol(100+tw_random()%105,... [truncated message content] |
From: Rob <geo...@us...> - 2005-08-14 16:15:20
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/games Modified Files: gflmelee.cpp ggob.cpp ggob_new.cpp ghyper.cpp gmissions.cpp gmissions_objects.cpp gplanets.cpp gplexplr.cpp gplhuge.cpp gsamp2.cpp gsample.cpp gsarena.cpp gsolar.cpp gtrug.cpp vanguard.cpp Log Message: fixed/updates for the use of random() Index: gplhuge.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gplhuge.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gplhuge.cpp 24 Mar 2004 23:51:35 -0000 1.10 --- gplhuge.cpp 14 Aug 2005 16:14:32 -0000 1.11 *************** *** 129,133 **** Planet *Centre; if (PlanetType == -1) { ! PlanetType = random()%Num_Planet_Pics; iMessage("PlanetType= %d *RANDOM*",PlanetType); } --- 129,133 ---- Planet *Centre; if (PlanetType == -1) { ! PlanetType = tw_random(Num_Planet_Pics); iMessage("PlanetType= %d *RANDOM*",PlanetType); } Index: gsample.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsample.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** gsample.cpp 11 Jul 2005 00:25:12 -0000 1.16 --- gsample.cpp 14 Aug 2005 16:14:32 -0000 1.17 *************** *** 96,100 **** Ship *e; ! e = create_ship(channel_none, "kzedr", "WussieBot", Vector2(size.x/4,size.y/4), random(PI2), enemies); //This is a different syntax for create_ship //It creates a ship and an AI for it at the same time. --- 96,100 ---- Ship *e; ! e = create_ship(channel_none, "kzedr", "WussieBot", Vector2(size.x/4,size.y/4), tw_random(PI2), enemies); //This is a different syntax for create_ship //It creates a ship and an AI for it at the same time. *************** *** 276,308 **** enemies = new_team(); - - - // no need here: is already called by Game::init. - //init_players(); - - - /* - if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { - //if we're in a network game... - //then do the same thing, only for the other player - Control *c = create_control(channel_client, "Human"); - //we can re-use the same fleet, since we never modified it and both players use the same fleet - i = c->choose_ship(window, "Hey You!\nPick a ship!", &fleet); - log_int(channel_client, i); - if (i == -1) i = random() % fleet.getSize(); - Ship *s = create_ship(fleet.getShipType(i)->id, c, size/2+Vector2(100,0), PI, humans); - add(s->get_ship_phaser()); - add_focus(s, channel_client); - ShipPanel *sp = new ShipPanel(s); - sp->window->locate( - -PANEL_WIDTH, 1, - PANEL_HEIGHT, 0, - PANEL_WIDTH, 0, - PANEL_HEIGHT, 0 - ); - add(sp); - } - */ - //now, we need some enemies to fight --- 276,279 ---- *************** *** 436,440 **** if (i == -1) ! i = random() % reference_fleet->getSize(); Ship *s = create_ship(reference_fleet->getShipType(i)->id, player[p]->control, size/2 + Vector2(100, 0), 0, humans); --- 407,411 ---- if (i == -1) ! i = random(reference_fleet->getSize()); Ship *s = create_ship(reference_fleet->getShipType(i)->id, player[p]->control, size/2 + Vector2(100, 0), 0, humans); *************** *** 454,477 **** } - /* outdated, stemming from 2-player era: - if (glog->type == Log::log_net) { - log_file("fleets/all.scf"); - i = human_control[1]->choose_ship(window, "Hey You!\nPick a ship!", reference_fleet); - log_int(i, channel_network[1]); - if (i == -1) i = random() % reference_fleet->getSize(); - Ship *s = create_ship(reference_fleet->getShipType(i)->id, human_control[1], size/2 + Vector2(100, 0), 180, humans); - add(s->get_ship_phaser()); - ShipPanel *sp = new ShipPanel(s); - sp->window->init(window); - sp->window->locate( - 0, 0.8, - 0, 100.0/240, - 0, 0.2, - 0, 100.0/240 - ); - add(sp); - } - */ - Ship *e; --- 425,428 ---- Index: gsarena.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsarena.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gsarena.cpp 11 Jul 2005 00:25:12 -0000 1.14 --- gsarena.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 164,172 **** for ( i = 0; i < num_players; ++i ) { ! Pl = new Planet(random(size), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); add(Pl); ! s[i] = create_ship(channel_none, "staba", "WussieBot", random(size), 1, player[i]->team); add ( new BlinkyIndicator(s[i], player[i]->color) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),random(PI2), (SpaceLocation *)Pl, (SpaceLocation *)s[i], 400, 10.0*ANGLE_RATIO,0); add(s[i]); --- 164,172 ---- for ( i = 0; i < num_players; ++i ) { ! Pl = new Planet(random(size), meleedata.planetSprite, tw_random(meleedata.planetSprite->frames()) ); add(Pl); ! s[i] = create_ship(channel_none, "staba", "WussieBot", tw_random(size), 1, player[i]->team); add ( new BlinkyIndicator(s[i], player[i]->color) ); ! handler = new OrbitHandler(Pl,Vector2(size.x/2,size.y/2),tw_random(PI2), (SpaceLocation *)Pl, (SpaceLocation *)s[i], 400, 10.0*ANGLE_RATIO,0); add(s[i]); *************** *** 184,188 **** g = get_config_int(NULL, "Planet", 0); if (g > 0) { ! Pl = new Planet(Vector2(size.x/2, size.y/2), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); add(Pl); s = get_config_int(NULL, "Station", 0); --- 184,188 ---- g = get_config_int(NULL, "Planet", 0); if (g > 0) { ! Pl = new Planet(Vector2(size.x/2, size.y/2), meleedata.planetSprite, random(meleedata.planetSprite->frames()) ); add(Pl); s = get_config_int(NULL, "Station", 0); *************** *** 200,204 **** s = get_config_int(NULL, "Ostations", 0); for (m = 0; m < g; m += 1) { ! Pl = new Planet(Vector2(random() % (int)size.x, random() % (int)size.y), meleedata.planetSprite, random()%meleedata.planetSprite->frames()); add(Pl); if (s>0) { --- 200,204 ---- s = get_config_int(NULL, "Ostations", 0); for (m = 0; m < g; m += 1) { ! Pl = new Planet(Vector2(random(size.x), random(size.y)), meleedata.planetSprite, random(meleedata.planetSprite->frames()) ); add(Pl); if (s>0) { *************** *** 217,221 **** m = get_config_int(NULL, "Comets", 2); for (g = 1; g < m; g += 1) { ! c = new Planet (Vector2(random()%int(size.x), random()%int(size.y)), meleedata.kaboomSprite, 1); c->mass = get_config_int(NULL, "Comet_mass", 2); c->gravity_force *= 0; --- 217,221 ---- m = get_config_int(NULL, "Comets", 2); for (g = 1; g < m; g += 1) { ! c = new Planet (Vector2(random(size.x), random(size.y)), meleedata.kaboomSprite, 1); c->mass = get_config_int(NULL, "Comet_mass", 2); c->gravity_force *= 0; Index: vanguard.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/vanguard.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** vanguard.cpp 11 Jul 2005 00:25:12 -0000 1.16 --- vanguard.cpp 14 Aug 2005 16:14:32 -0000 1.17 *************** *** 617,714 **** item_sum("2"); - /* - //player 1 selects a new ship - Fleet fleet; - - #define LOAD_FLEET log_file("fleets/all.scf"); fleet.load(NULL, "Fleet"); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // HumanPlayer1 = create_ship(fleet.getShipType(i)->id, human_control[0], tw_random(Vector2(width, height)));rand()%(int)width, rand()%(int)height, 0, human_team); - HumanPlayer1 = create_ship(fleet.getShipType(i)->id, human_control[0], tw_random(size), 0, human_team); - add(HumanPlayer1->get_ship_phaser()); - human_panel[0] = new ShipPanel(HumanPlayer1); - human_panel[0]->window->init(window); - human_panel[0]->window->locate(0,0.9, 0,0, 0,0.1, 0,0.25); - - add(human_panel[0]); - add_focus(HumanPlayer1, channel_server); - - if ((glog->type == Log::log_net1server) || (glog->type == Log::log_net1client)) { - LOAD_FLEET - i = human_control[1]->choose_ship(window, "Hey You Player!\nPick a ship!", &fleet); - log_int(i, channel_network[1]); - if (i == -1) i = random() % fleet.getSize(); - // Ship *s = create_ship(fleet.getShipType(i)->id, human_control[1], width/2 + 100, height/2, PI, human_team); - Ship *s = create_ship(fleet.getShipType(i)->id, human_control[1], size/2 + Vector2(100,0), PI, human_team); - add(s->get_ship_phaser()); - add_focus(s, channel_network[1]); - human_panel[1] = new ShipPanel(s); - human_panel[1]->window->init(window); - human_panel[1]->window->locate(0,0.9, 0,0.25, 0,0.1, 0,0.25); - add(human_panel[1]); - } - else human_panel[1] = NULL; - - - Ship *e; - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI1!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width/4, height/4, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", size/4, random(PI2), enemy_team); - add(e->get_ship_phaser()); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI2!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width*3/4, height/4, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", size*Vector2(3.0,1.0)/4.0, random(PI2), enemy_team); - add(e->get_ship_phaser()); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI3!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width*3/4, height*3/4, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", size*3.0/4.0, random(PI2), enemy_team); - add(e->get_ship_phaser()); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI4!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", width/4, height*3/4, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", size*Vector2(1.0,3.0)/4.0, random(PI2), enemy_team); - add(e->get_ship_phaser()); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI5!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", rand()%(int)width, rand()%(int)height, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", tw_random(size), random(PI2), enemy_team); - add(e->get_ship_phaser()); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI6!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", random()%(int)width, random()%(int)height, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", tw_random(size), random(PI2), enemy_team); - add(e->get_ship_phaser()); - - LOAD_FLEET - i = human_control[0]->choose_ship(window, "Hey You AI7!\nPick a ship!", &fleet); - log_int(i, channel_server); - if (i == -1) i = random() % fleet.getSize(); - // e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", random()%(int)width, random()%(int)height, random(PI2), enemy_team); - e = create_ship(channel_none, fleet.getShipType(i)->id, "WussieBot", tw_random(size), random(PI2), enemy_team); - add(e->get_ship_phaser()); - */ //Solar system object code --- 617,620 ---- *************** *** 731,735 **** ok = 0; int n=0; ! int Dir = ((random()%2)*2)-1; while (ok!=1) --- 637,641 ---- ok = 0; int n=0; ! int Dir = (tw_random() & 2) - 1; while (ok!=1) *************** *** 758,776 **** ! add(Centre[iSuns] = new Sun(Vector2(w, h), StarPics[random()%Num_Star_Pics],0)); Centre[iSuns]->id=SUN_ID; // planets creating loop ! NumPlanets=MinPlanets+random()%(MaxPlanets-MinPlanets); for(int num=0; num<NumPlanets; num++) { ! kind = random()%3; ! moons = random()%(NumMoons+1); if ((kind == 0) && (((num+1)*Radius)> 1600)) { // gas giant // Satellite = new Planet(width/2,height/2,GiantPics[rand()%Num_Giant_Pics],0); ! Satellite = new Planet(size/2, GiantPics[random()%Num_Giant_Pics],0); Satellite->gravity_force *= GasGrav; --- 664,682 ---- ! add(Centre[iSuns] = new Sun(Vector2(w, h), StarPics[random(Num_Star_Pics)],0)); Centre[iSuns]->id=SUN_ID; // planets creating loop ! NumPlanets=MinPlanets+random(MaxPlanets-MinPlanets); for(int num=0; num<NumPlanets; num++) { ! kind = random(3); ! moons = random(NumMoons+1); if ((kind == 0) && (((num+1)*Radius)> 1600)) { // gas giant // Satellite = new Planet(width/2,height/2,GiantPics[rand()%Num_Giant_Pics],0); ! Satellite = new Planet(size/2, GiantPics[random(Num_Giant_Pics)],0); Satellite->gravity_force *= GasGrav; *************** *** 783,787 **** { // normal planet // Satellite = new Planet(width/2,height/2,PlanetPics[rand()%Num_Planet_Pics],0); ! Satellite = new Planet(size/2,PlanetPics[random()%Num_Planet_Pics],0); // handler = new OrbitHandler(Centre[j],width/2,height/2,random(PI2), (SpaceLocation *)Centre[j], --- 689,693 ---- { // normal planet // Satellite = new Planet(width/2,height/2,PlanetPics[rand()%Num_Planet_Pics],0); ! Satellite = new Planet(size/2,PlanetPics[random(Num_Planet_Pics)],0); // handler = new OrbitHandler(Centre[j],width/2,height/2,random(PI2), (SpaceLocation *)Centre[j], *************** *** 797,801 **** { // Moon = new Planet(width/2,height/2,MoonPics[rand()%Num_Moon_Pics],0); ! Moon = new Planet(size/2,MoonPics[random()%Num_Moon_Pics],0); Moon->gravity_force *= MoonGrav; Moon->gravity_range = 8; --- 703,707 ---- { // Moon = new Planet(width/2,height/2,MoonPics[rand()%Num_Moon_Pics],0); ! Moon = new Planet(size/2,MoonPics[random(Num_Moon_Pics)],0); Moon->gravity_force *= MoonGrav; Moon->gravity_range = 8; *************** *** 823,827 **** { Planet *c; - // c = new Planet (random()%int(width), random()%int(height), kaboomSprite, 1); c = new Planet (tw_random(size), meleedata.kaboomSprite, 1); c->id=COMET_ID; --- 729,732 ---- Index: gmissions_objects.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions_objects.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gmissions_objects.cpp 24 Mar 2004 23:51:35 -0000 1.11 --- gmissions_objects.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 72,76 **** MissionObject::MissionObject(Vector2 opos, char *datafilename, char *dataobjectname) : ! SpaceObject(0, opos, random(PI2), gensprite(datafilename, dataobjectname, "object") ) --- 72,76 ---- MissionObject::MissionObject(Vector2 opos, char *datafilename, char *dataobjectname) : ! SpaceObject(0, opos, tw_random(PI2), gensprite(datafilename, dataobjectname, "object") ) Index: gplanets.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gplanets.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gplanets.cpp 11 Jul 2005 00:25:12 -0000 1.14 --- gplanets.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 674,678 **** double drand() { ! return (random() % 1000) / 1000.0; } --- 674,678 ---- double drand() { ! return tw_random(1.0); } *************** *** 727,731 **** if ( iplanetpic == -1 ) { ! iplanetpic = random() % Num_Planet_Pics; } --- 727,731 ---- if ( iplanetpic == -1 ) { ! iplanetpic = random(Num_Planet_Pics); } *************** *** 735,739 **** { if ( MinMoonsInSystem != MaxMoonsInSystem) ! NumMoons = MinMoonsInSystem + random() % (MaxMoonsInSystem-MinMoonsInSystem); else NumMoons = MinMoonsInSystem; --- 735,739 ---- { if ( MinMoonsInSystem != MaxMoonsInSystem) ! NumMoons = MinMoonsInSystem + random(MaxMoonsInSystem-MinMoonsInSystem); else NumMoons = MinMoonsInSystem; *************** *** 803,807 **** // choose a random moon picture ! k = random() % (Num_Moon_Pics - i); // choose the k-th available (free) picture: --- 803,807 ---- // choose a random moon picture ! k = random(Num_Moon_Pics - i); // choose the k-th available (free) picture: *************** *** 819,823 **** ichosen[j] = 1; } else { // oh my! there are not enough unique moons. Just choose any of them then ! PlanetMoonPic[i] = random() % Num_Moon_Pics; } --- 819,823 ---- ichosen[j] = 1; } else { // oh my! there are not enough unique moons. Just choose any of them then ! PlanetMoonPic[i] = random(Num_Moon_Pics); } *************** *** 860,864 **** for ( j = i; j <= k; ++j ) // note, j <= k, we take one more range than the number of moons { ! z[j] = random() % 1000; } --- 860,864 ---- for ( j = i; j <= k; ++j ) // note, j <= k, we take one more range than the number of moons { ! z[j] = random(1000); } *************** *** 1520,1526 **** // choose one of these planet systems: - //i = random() % NPlanets; if (iDefaultPlanet == -1 ){ ! i = random() % NPlanets; iMessage("i = %d *RANDOM*", i); } --- 1520,1525 ---- // choose one of these planet systems: if (iDefaultPlanet == -1 ){ ! i = random(NPlanets); iMessage("i = %d *RANDOM*", i); } *************** *** 1529,1533 **** iMessage("i = %d *Preset*", i); } ! // required information: int iplanetpic, NumMoons, NumStarbases; --- 1528,1532 ---- iMessage("i = %d *Preset*", i); } ! // required information: int iplanetpic, NumMoons, NumStarbases; *************** *** 1635,1643 **** { //iMessage("treating num = %d *PRESET*",num); ! kind = random()%2; int k = PlanetMoonPic[num]; if (k == -1) // this should not occur ! k = random() % Num_Moon_Pics; //iMessage("k=%i", k); --- 1634,1642 ---- { //iMessage("treating num = %d *PRESET*",num); ! kind = random(2); int k = PlanetMoonPic[num]; if (k == -1) // this should not occur ! k = random(Num_Moon_Pics); //iMessage("k=%i", k); Index: gplexplr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gplexplr.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gplexplr.cpp 11 Jul 2005 00:25:12 -0000 1.14 --- gplexplr.cpp 14 Aug 2005 16:14:32 -0000 1.15 *************** *** 333,337 **** { time -= turntime; ! angle = random(PI2); vel = v * unit_vector(angle); --- 333,337 ---- { time -= turntime; ! angle = tw_random(PI2); vel = v * unit_vector(angle); Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** gflmelee.cpp 11 Jul 2005 00:25:11 -0000 1.28 --- gflmelee.cpp 14 Aug 2005 16:14:32 -0000 1.29 *************** *** 427,431 **** Planet *Centre; if (rememberPlanetType == -1) { ! PlanetType = random()%Num_Planet_Pics; iMessage("PlanetType= %d *RANDOM*",PlanetType); } --- 427,431 ---- Planet *Centre; if (rememberPlanetType == -1) { ! PlanetType = tw_random(Num_Planet_Pics); iMessage("PlanetType= %d *RANDOM*",PlanetType); } *************** *** 488,509 **** // initialize the teams and the fleets :) - // int Nfleets; int allyfleet[2], ifleet; // there are 2 player fleets (can each fleet have >1 humans inside??) - // Nfleets = get_config_int("FleetInit", "Nalliances", 0); - - /* - allyfleet[0] = get_config_int("FleetInit", "PlayerAlliance", 0); - if ( allyfleet[0] == -1 ) - allyfleet[0] = tw_random()%Nfleets + 1; - - allyfleet[1] = get_config_int("FleetInit", "EnemyAlliance", 0); - if ( allyfleet[1] == -1 ) - { - allyfleet[1] = allyfleet[0] + tw_random()%(Nfleets-1) + 1; - if ( allyfleet[1] > Nfleets ) - allyfleet[1] -= Nfleets; - } - */ set_config_file("gflmelee.ini"); --- 488,493 ---- Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** ggob.cpp 11 Jul 2005 00:25:11 -0000 1.40 --- ggob.cpp 14 Aug 2005 16:14:32 -0000 1.41 *************** *** 113,117 **** } void GobPlayer::died(SpaceLocation *killer) { ! if (upgrade_list[UpgradeIndex::divinefavor]->num && (random()&1)) { //divine favor ship->crew = ship->crew_max; ship->batt = ship->batt_max; --- 113,117 ---- } void GobPlayer::died(SpaceLocation *killer) { ! if (upgrade_list[UpgradeIndex::divinefavor]->num && (tw_random()&1)) { //divine favor ship->crew = ship->crew_max; ship->batt = ship->batt_max; *************** *** 194,198 **** i = 2; add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], station_build_name[i], station_pic_name[i]); ! i = random() % 3; add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], "utwju", station_pic_name[i]); --- 194,198 ---- i = 2; add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], station_build_name[i], station_pic_name[i]); ! i = random(3); add_planet_and_station(meleedata.planetSprite, i, stationSprite[i], "utwju", station_pic_name[i]); *************** *** 333,339 **** next_add_new_enemy_time = game_time; int t = 28; ! if ((random() % t) < 4) add_new_enemy(); int e = gobenemies; ! e -= random() % (1 + game_time / (250 * 1000)); if (0) ; else if (e >=12) next_add_new_enemy_time += 15000 / difficulty; --- 333,339 ---- next_add_new_enemy_time = game_time; int t = 28; ! if ((random(t)) < 4) add_new_enemy(); int e = gobenemies; ! e -= random(1 + game_time / (250 * 1000)); if (0) ; else if (e >=12) next_add_new_enemy_time += 15000 / difficulty; *************** *** 432,442 **** */ e = base; ! e = random() % (e + 2); ! e = random() % (e + 3); if (e < pow(2.5*base,0.4) - 1) ! e = random() % num_enemy_types; if (e > sqrt(3*base) + 2) ! e = random() % (e + 1); ! //if (e > num_enemy_types * 2) e = e % num_enemy_types; e = e; } --- 432,441 ---- */ e = base; ! e = random(e + 2); ! e = random(e + 3); if (e < pow(2.5*base,0.4) - 1) ! e = random(num_enemy_types); if (e > sqrt(3*base) + 2) ! e = random(e + 1); e = e; } *************** *** 658,662 **** GobStation::GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, const char *ship, const char *background) : ! Orbiter(pic, orbit_me, random() % 200 + 500) { build_type = ship; --- 657,661 ---- GobStation::GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, const char *ship, const char *background) : ! Orbiter(pic, orbit_me, random(200) + 500) { build_type = ship; *************** *** 948,952 **** } while (game->game_time > next_time2) { ! next_time2 += random() % 10000; Query q; for (q.begin(this, bit(LAYER_SHIPS), 40); q.current; q.next()) { --- 947,951 ---- } while (game->game_time > next_time2) { ! next_time2 += random(10000); Query q; for (q.begin(this, bit(LAYER_SHIPS), 40); q.current; q.next()) { *************** *** 959,969 **** game->redraw(); if (reference_fleet->getShipType(i) == p->ship->type) { ! p->starbucks += random() % 80; ! p->buckazoids += random() % 80; game->add(new RainbowRift()); } else { ! p->starbucks += random() % (1+p->value_starbucks); ! p->buckazoids += random() % (1+p->value_buckazoids); p->new_ship(reference_fleet->getShipType(i)); } --- 958,968 ---- game->redraw(); if (reference_fleet->getShipType(i) == p->ship->type) { ! p->starbucks += random(80); ! p->buckazoids += random(80); game->add(new RainbowRift()); } else { ! p->starbucks += random(1+p->value_starbucks); ! p->buckazoids += random(1+p->value_buckazoids); p->new_ship(reference_fleet->getShipType(i)); } Index: gsamp2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsamp2.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gsamp2.cpp 24 Mar 2004 23:51:35 -0000 1.10 --- gsamp2.cpp 14 Aug 2005 16:14:32 -0000 1.11 *************** *** 148,152 **** } else if (game_time >= time_for_next_attack) { ! time_for_next_attack += time_between_attacks + (random(10000)) - 4000; time_between_attacks -= 10; time_between_attacks = iround(time_between_attacks * 0.975); --- 148,152 ---- } else if (game_time >= time_for_next_attack) { ! time_for_next_attack += time_between_attacks + (tw_random(10000)) - 4000; time_between_attacks -= 10; time_between_attacks = iround(time_between_attacks * 0.975); Index: gmissions.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** gmissions.cpp 11 Jul 2005 00:25:12 -0000 1.28 --- gmissions.cpp 14 Aug 2005 16:14:32 -0000 1.29 *************** *** 1099,1103 **** { Ship *s; ! s = Game::create_ship(shpid, c, map_size*Vector2(relx, rely), random(2*PI), team); add(s->get_ship_phaser()); add(new HealthBar(s, &healthtoggle)); --- 1099,1103 ---- { Ship *s; ! s = Game::create_ship(shpid, c, map_size*Vector2(relx, rely), tw_random(PI2), team); add(s->get_ship_phaser()); add(new HealthBar(s, &healthtoggle)); Index: gsolar.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsolar.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gsolar.cpp 24 Mar 2004 23:51:35 -0000 1.11 --- gsolar.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 99,103 **** for ( i = 0; i < N; ++i ) ! x[i] = random() % imax; for ( i = 1; i < N; ++i ) --- 99,103 ---- for ( i = 0; i < N; ++i ) ! x[i] = tw_random(imax); for ( i = 1; i < N; ++i ) *************** *** 135,139 **** ! total_time_existence = 1500 + random() % 500; distribute_time_ran(time_existence, Nframes, total_time_existence); --- 135,139 ---- ! total_time_existence = 1500 + random(500); distribute_time_ran(time_existence, Nframes, total_time_existence); *************** *** 432,436 **** error("File error, moon pics. Bailing out..."); ! sprintf(starName,"Star%03d",random()%Num_Star_Pics); StarPic=GetSprite("solar.dat",starName); --- 432,436 ---- error("File error, moon pics. Bailing out..."); ! sprintf(starName,"Star%03d",random(Num_Star_Pics)); StarPic=GetSprite("solar.dat",starName); *************** *** 478,485 **** for(num=0; num<NumPlanets; num++) { ! kind = random()%2; ! moons = random()%(NumMoons+1); if ((kind == 0) && (((num+1)*Radius)> 1600)) { // gas giant ! Satellite = new Planet(size/2,GiantPics[random()%Num_Giant_Pics],0); Satellite->gravity_force *= GasGrav; --- 478,485 ---- for(num=0; num<NumPlanets; num++) { ! kind = random(2); ! moons = random(NumMoons+1); if ((kind == 0) && (((num+1)*Radius)> 1600)) { // gas giant ! Satellite = new Planet(size/2,GiantPics[random(Num_Giant_Pics)],0); Satellite->gravity_force *= GasGrav; *************** *** 489,493 **** } else { // normal planet ! Satellite = new Planet(size/2,PlanetPics[random()%Num_Planet_Pics],0); handler = new OrbitHandler(Centre,size/2,random(PI2), (SpaceLocation *)Centre, --- 489,493 ---- } else { // normal planet ! Satellite = new Planet(size/2,PlanetPics[random(Num_Planet_Pics)],0); handler = new OrbitHandler(Centre,size/2,random(PI2), (SpaceLocation *)Centre, *************** *** 502,506 **** for (i=0; i<moons; i+=1) { ! Moon = new Planet(size/2,MoonPics[random()%Num_Moon_Pics],0); Moon->gravity_force *= MoonGrav; Moon->gravity_range = 8; --- 502,506 ---- for (i=0; i<moons; i+=1) { ! Moon = new Planet(size/2,MoonPics[random(Num_Moon_Pics)],0); Moon->gravity_force *= MoonGrav; Moon->gravity_range = 8; *************** *** 519,539 **** ! /* ! //comet code ! for (num = 0; num < Comets; num++) ! { ! Planet *c; ! c = new Planet (random()%int(width), random()%int(height), kaboomSprite, 1); ! c->id=COMET_ID; ! c->mass = CoMass; ! c->gravity_force *= 0; ! c->gravity_whip = 0; ! //double a=(random(PI2)).; ! // c->vx=(ComMax/CoMass)*cos(a); ! // c->vy=(ComMax/CoMass)*sin(a); ! c->accelerate(NULL, random(PI2), get_config_int(NULL, "Comet_acc", 2), get_config_int(NULL, "Comet_max", 2)); ! add (c); ! } ! */ --- 519,523 ---- ! Index: gtrug.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gtrug.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gtrug.cpp 11 Jul 2005 00:25:12 -0000 1.15 --- gtrug.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 230,235 **** TrugPlayer *cp = add_player ( channel_network[1] ); ! add(create_ship("kzedr", sp, random(size), random(PI2))); ! add(create_ship("chebr", cp, random(size), random(PI2))); if (!hostcomputer()) --- 230,235 ---- TrugPlayer *cp = add_player ( channel_network[1] ); ! add(create_ship("kzedr", sp, tw_random(size), tw_random(PI2))); ! add(create_ship("chebr", cp, tw_random(size), tw_random(PI2))); if (!hostcomputer()) Index: ggob_new.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob_new.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ggob_new.cpp 11 Jul 2005 18:31:03 -0000 1.1 --- ggob_new.cpp 14 Aug 2005 16:14:32 -0000 1.2 *************** *** 473,479 **** next_add_new_enemy_time = game_time; int t = 28; ! if ((random() % t) < 4) add_new_enemy(); int e = gobenemy.size(); ! e -= random() % (1 + game_time / (250 * 1000)); if (0) ; else if (e >=12) next_add_new_enemy_time += 15000; --- 473,479 ---- next_add_new_enemy_time = game_time; int t = 28; ! if ((random(t)) < 4) add_new_enemy(); int e = gobenemy.size(); ! e -= random(1 + game_time / (250 * 1000)); if (0) ; else if (e >=12) next_add_new_enemy_time += 15000; *************** *** 609,618 **** while (e >= num_enemy_types) { e = base; ! e = random() % (e + 2); ! e = random() % (e + 3); if (e < pow(2.5*base,0.4) - 1) ! e = random() % num_enemy_types; if (e > sqrt( 3.0*base) + 2) ! e = random() % (e + 1); e = e; } --- 609,618 ---- while (e >= num_enemy_types) { e = base; ! e = random(e + 2); ! e = random(e + 3); if (e < pow(2.5*base,0.4) - 1) ! e = random(num_enemy_types); if (e > sqrt( 3.0*base) + 2) ! e = random(e + 1); e = e; } *************** *** 869,873 **** GobStation::GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, const char *ship, const char *background, std::string sname ) : ! Orbiter(pic, orbit_me, random() % 200 + 500) { build_type = ship; --- 869,873 ---- GobStation::GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, const char *ship, const char *background, std::string sname ) : ! Orbiter(pic, orbit_me, random(200) + 500) { build_type = ship; *************** *** 1244,1248 **** } while (game->game_time > next_time2) { ! next_time2 += random() % 10000; Query q; for (q.begin(this, bit(LAYER_SHIPS), 40); q.current; q.next()) { --- 1244,1248 ---- } while (game->game_time > next_time2) { ! next_time2 += random(10000); Query q; for (q.begin(this, bit(LAYER_SHIPS), 40); q.current; q.next()) { *************** *** 1255,1265 **** game->redraw(); if (reference_fleet->getShipType(i) == p->ship->type) { ! p->starbucks += random() % 80; ! p->buckazoids += random() % 80; game->add(new RainbowRift()); } else { ! p->starbucks += random() % (1+p->value_starbucks); ! p->buckazoids += random() % (1+p->value_buckazoids); p->new_ship(reference_fleet->getShipType(i)); } --- 1255,1265 ---- game->redraw(); if (reference_fleet->getShipType(i) == p->ship->type) { ! p->starbucks += random(80); ! p->buckazoids += random(80); game->add(new RainbowRift()); } else { ! p->starbucks += random(1+p->value_starbucks); ! p->buckazoids += random(1+p->value_buckazoids); p->new_ship(reference_fleet->getShipType(i)); } Index: ghyper.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ghyper.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ghyper.cpp 24 Mar 2004 23:51:35 -0000 1.11 --- ghyper.cpp 14 Aug 2005 16:14:32 -0000 1.12 *************** *** 40,47 **** m = get_config_int("Hyperspace", "Pholes", 2); for (i = 0; i < m; i += 1) { ! p = new Planet (random(size), meleedata.hotspotSprite, random(meleedata.hotspotSprite->frames())); p->collide_flag_anyone = 0; p->gravity_force *= 0.5; ! p->accelerate(NULL, random(PI2), 0.1 + (random()%36)/100., MAX_SPEED); add (p); } --- 40,47 ---- m = get_config_int("Hyperspace", "Pholes", 2); for (i = 0; i < m; i += 1) { ! p = new Planet (random(size), meleedata.hotspotSprite, tw_random(meleedata.hotspotSprite->frames())); p->collide_flag_anyone = 0; p->gravity_force *= 0.5; ! p->accelerate(NULL, random(PI2), 0.1 + random(0.36), MAX_SPEED); add (p); } *************** *** 51,55 **** p->collide_flag_anyone = 0; p->gravity_force *= -1; ! p->accelerate(NULL, random(PI2), 0.1 + (random()%36)/100., MAX_SPEED); add (p); } --- 51,55 ---- p->collide_flag_anyone = 0; p->gravity_force *= -1; ! p->accelerate(NULL, random(PI2), 0.1 + random(0.36), MAX_SPEED); add (p); } |
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/melee Modified Files: mcbodies.cpp mcontrol.cpp mgame.cpp mitems.cpp mmain.cpp mmath.cpp mship.cpp mshot.cpp Log Message: fixed/updates for the use of random() Index: mcbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mcbodies.cpp 1 Aug 2005 10:46:33 -0000 1.15 --- mcbodies.cpp 14 Aug 2005 16:14:32 -0000 1.16 *************** *** 17,21 **** Asteroid::Asteroid() ! : SpaceObject(NULL, random(map_size), random(PI2), meleedata.asteroidSprite), explosion(meleedata.asteroidExplosionSprite) {STACKTRACE collide_flag_sameteam = ALL_LAYERS; --- 17,21 ---- Asteroid::Asteroid() ! : SpaceObject(NULL, tw_random(map_size), random(PI2), meleedata.asteroidSprite), explosion(meleedata.asteroidExplosionSprite) {STACKTRACE collide_flag_sameteam = ALL_LAYERS; Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** mmain.cpp 8 Aug 2005 19:08:28 -0000 1.41 --- mmain.cpp 14 Aug 2005 16:14:32 -0000 1.42 *************** *** 1008,1012 **** // this is needed, otherwise a bot would need its own channel, while this way, // they can use channel_none. ! slot[i] = random(fleet->getSize()); share(i, &slot[i]); --- 1008,1012 ---- // 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]); *************** *** 1046,1050 **** if (slot[i] == -1) ! slot[i] = random() % fleet->getSize(); if (slot[i] < 0 || slot[i] >= fleet->getSize()) --- 1046,1050 ---- if (slot[i] == -1) ! slot[i] = random(fleet->getSize()); if (slot[i] < 0 || slot[i] >= fleet->getSize()) Index: mitems.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mitems.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mitems.cpp 11 Jul 2005 00:25:28 -0000 1.9 --- mitems.cpp 14 Aug 2005 16:14:32 -0000 1.10 *************** *** 216,220 **** Orbiter::Orbiter ( SpaceSprite *pic, SpaceLocation *orbit_me, double distance) : ! SpaceObject(NULL, orbit_me->normal_pos(), random(PI2), pic) { layer = LAYER_CBODIES; --- 216,220 ---- Orbiter::Orbiter ( SpaceSprite *pic, SpaceLocation *orbit_me, double distance) : ! SpaceObject(NULL, orbit_me->normal_pos(), tw_random(PI2), pic) { layer = LAYER_CBODIES; Index: mshot.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshot.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mshot.cpp 8 Aug 2005 19:08:28 -0000 1.19 --- mshot.cpp 14 Aug 2005 16:14:32 -0000 1.20 *************** *** 283,286 **** --- 283,296 ---- relative_angle = angle - lpos->get_angle(); + if (relative_angle < -2*PI2 || relative_angle > 2*PI2) + { + tw_error("Laser: relative angle is out of bounds"); + } + while (relative_angle < -PI) + relative_angle += PI2; + while (relative_angle > PI) + relative_angle -= PI2; + + /* double alpha; Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** mgame.cpp 10 Aug 2005 21:07:48 -0000 1.53 --- mgame.cpp 14 Aug 2005 16:14:32 -0000 1.54 *************** *** 1658,1673 **** if (next_tic_time + frame_time_length < time_current) { - //message.print(1500, 15, "Catching up [%i]", num_catchups); - - // trying to make the "gaps" not too small, otherwise... it may be... - // too... unstable? Cause iterations might follow to quickly, and then - // each player will generate bursts of information (to send across the net) - // The follow may be a little more stable in time... catching_up = true; ! next_tic_time += frame_time_length; // hmmm... // perhaps this is better... cause you're below "time" anyway... ! // so you will be catching up anyway... - //xxx this might be... conceptual mistake... } else { catching_up = false; --- 1658,1670 ---- if (next_tic_time + frame_time_length < time_current) { catching_up = true; ! next_tic_time += frame_time_length; // perhaps this is better... cause you're below "time" anyway... ! // so you will be catching up anyway... in the loop that follows ! // An immediate catchup will happen, because next_tic_time < time, which ! // is the only constraint to enter this physics calculation immediately ! // again, thus "accelerating" the physics updates, thus making up for ! // time lost in animation or during network delays. } else { catching_up = false; Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mcontrol.cpp 8 Aug 2005 19:08:18 -0000 1.26 --- mcontrol.cpp 14 Aug 2005 16:14:32 -0000 1.27 *************** *** 249,253 **** if (index == -1) { if (targets->N) { ! index = random() % targets->N; target = targets->item[index]; goto validate; --- 249,253 ---- if (index == -1) { if (targets->N) { ! index = tw_random(targets->N); target = targets->item[index]; goto validate; *************** *** 497,528 **** animate_target(space, target, (i%3)*2-2, ((i/3)%3)*2-2, 140 + i, pallete_color[col]); } ! /*void Control::add_target(SpaceObject *killit) { ! if (!killit) return; ! if (!killit->exists()) return; ! for (int i = 0; i < num_targets; i += 1) { ! if (target[i] == killit) return; ! } ! num_targets += 1; ! target = (SpaceObject**) realloc(target, sizeof(SpaceObject *) * num_targets); ! target[num_targets-1] = killit; ! if (active_target == -1) set_target(0); ! return; ! } ! void Control::remove_target(SpaceObject *killit) { ! if (!killit) return; ! for (int i = 0; i < num_targets; i += 1) { ! if (target[i] == killit) { ! num_targets -= 1; ! target[i] = target[num_targets]; ! target = (SpaceObject**)realloc(target, num_targets * sizeof(SpaceObject *)); ! if (active_target == i) { ! if (num_targets) set_target(random() % num_targets); ! else set_target(-1); ! return; ! } ! else if (active_target == num_targets) active_target = i; ! } ! } ! return; ! }*/ --- 497,500 ---- animate_target(space, target, (i%3)*2-2, ((i/3)%3)*2-2, 140 + i, pallete_color[col]); } ! Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** mship.cpp 2 Aug 2005 00:21:31 -0000 1.38 --- mship.cpp 14 Aug 2005 16:14:32 -0000 1.39 *************** *** 523,527 **** double mindist = 1000; while (tries < 15) { ! pos = random(map_size); SpaceLocation *spacePlanet = nearest_planet(); if (!spacePlanet || (distance(spacePlanet) > mindist)) --- 523,527 ---- double mindist = 1000; while (tries < 15) { ! pos = tw_random(map_size); SpaceLocation *spacePlanet = nearest_planet(); if (!spacePlanet || (distance(spacePlanet) > mindist)) Index: mmath.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmath.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mmath.cpp 24 Mar 2004 23:51:38 -0000 1.8 --- mmath.cpp 14 Aug 2005 16:14:32 -0000 1.9 *************** *** 29,33 **** double dy = min_delta(y2, y1, map_size.y); double alpha = atan3(dy, dx); ! if (alpha < 0) alpha += PI2; return(alpha); } --- 29,40 ---- double dy = min_delta(y2, y1, map_size.y); double alpha = atan3(dy, dx); ! ! if (alpha < 0) ! alpha += PI2; ! ! if (alpha < 0 || alpha > PI2) ! { ! tw_error("The trajectory angle makes no sense"); ! } return(alpha); } *************** *** 37,41 **** double dy = min_delta(pos2.y, pos1.y, map_size.y); double alpha = atan3(dy, dx); ! if (alpha < 0) alpha += PI2; return(alpha); } --- 44,55 ---- double dy = min_delta(pos2.y, pos1.y, map_size.y); double alpha = atan3(dy, dx); ! ! if (alpha < 0) ! alpha += PI2; ! ! if (alpha < 0 || alpha > PI2) ! { ! tw_error("The trajectory angle makes no sense"); ! } return(alpha); } |
From: Rob <geo...@us...> - 2005-08-14 16:15:14
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/ais Modified Files: c_wussie.cpp Log Message: fixed/updates for the use of random() Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** c_wussie.cpp 10 Aug 2005 21:07:05 -0000 1.23 --- c_wussie.cpp 14 Aug 2005 16:14:32 -0000 1.24 *************** *** 293,297 **** { last_seen_time = game->game_time; ! } else if ((random () & 32767) < frame_time) { last_seen_time = game->game_time - 1000; --- 293,297 ---- { last_seen_time = game->game_time; ! } else if ((tw_random () & 32767) < frame_time) { last_seen_time = game->game_time - 1000; |