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-26 21:59:25
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29900/source/newships Modified Files: shpchoex.cpp Log Message: Aaahh... the chorali ship... it has a bug and I cannot find it ! Maybe later. Index: shpchoex.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpchoex.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpchoex.cpp 21 Aug 2005 12:44:01 -0000 1.18 --- shpchoex.cpp 26 Aug 2005 21:59:17 -0000 1.19 *************** *** 12,15 **** --- 12,16 ---- }; + #define ASTEROID_CENTER 0x03a8c9f5a *************** *** 41,95 **** public: AsteroidDebris(Ship *creator1, Vector2 new_pos, int tforce ); ! virtual void death(){SpaceObject::death();} virtual int canCollide(SpaceLocation *other); virtual void calculate(); }; AsteroidDebris::AsteroidDebris(Ship *creator1, Vector2 new_pos, int tforce) : Asteroid() { ! creator=creator1; ! translate(new_pos - pos); ! frame_born=(int)(game->frame_number); ! collide_flag=FALSE; ! sprite_index = tw_random(64); ! tractorForce=tforce; - if (mass > 0) - this->accelerate(creator, this->trajectory_angle(creator), tractorForce / (this->mass * 2), 6); attributes &= ~ATTRIB_STANDARD_INDEX; } void AsteroidDebris::calculate() { - STACKTRACE - step-= frame_time; - while(step <= 0) { - step += speed * time_ratio; - sprite_index++; - if(sprite_index == ASTEROID_FRAMES) - sprite_index = 0; - } ! SpaceObject::calculate(); ! if(!collide_flag) ! { ! if (game->frame_number - frame_born >= 40) ! { ! collide_flag=TRUE; } } } int AsteroidDebris::canCollide(SpaceLocation *other) { ! STACKTRACE ! if (collide_flag) { return SpaceObject::canCollide(other); } ! else if(other != creator) { return SpaceObject::canCollide(other); } ! return false; } --- 42,121 ---- public: AsteroidDebris(Ship *creator1, Vector2 new_pos, int tforce ); ! virtual ~AsteroidDebris(); ! virtual void death(); virtual int canCollide(SpaceLocation *other); virtual void calculate(); }; + AsteroidDebris::AsteroidDebris(Ship *creator1, Vector2 new_pos, int tforce) : Asteroid() { ! creator=creator1; ! translate(new_pos - pos); ! frame_born=(int)(game->frame_number); ! collide_flag=FALSE; ! sprite_index = tw_random(sprite->frames()); ! tractorForce=tforce; ! ! if (mass > 0 && creator && tractorForce) ! this->accelerate(creator, this->trajectory_angle(creator), tractorForce / (this->mass * 2), 6); attributes &= ~ATTRIB_STANDARD_INDEX; } + AsteroidDebris::~AsteroidDebris() + { + int i = 0; + } + + void AsteroidDebris::death() + { + SpaceObject::death(); + } + void AsteroidDebris::calculate() { ! if (creator && !creator->exists()) ! creator = 0; + SpaceObject::calculate(); ! //xxx test ! return; ! ! STACKTRACE; ! step-= frame_time; ! while(step <= 0) { ! step += speed * time_ratio; ! sprite_index++; ! if(sprite_index == sprite->frames())//ASTEROID_FRAMES) ! sprite_index = 0; } + + + + if(!collide_flag) + { + if (game->frame_number - frame_born >= 40) + { + collide_flag=TRUE; + } } } + int AsteroidDebris::canCollide(SpaceLocation *other) { ! //xxx test ! return 0; ! ! STACKTRACE; ! if (collide_flag) { return SpaceObject::canCollide(other); } ! else if(other != creator) { return SpaceObject::canCollide(other); } ! return false; } *************** *** 98,102 **** public: IDENTITY(AsteroidCenter); ! Ship *creator; public: AsteroidCenter(Ship *creator, Vector2 new_pos); --- 124,128 ---- public: IDENTITY(AsteroidCenter); ! //Ship *creator; already defined in the asteroidcenter class?! public: AsteroidCenter(Ship *creator, Vector2 new_pos); *************** *** 104,110 **** virtual int canCollide(SpaceLocation *other); virtual int handle_damage(SpaceLocation *source, double normal, double direct); ! virtual int isAsteroid(); }; AsteroidCenter::AsteroidCenter(Ship *creator1, Vector2 new_pos) : AsteroidDebris(creator1, new_pos, 0) --- 130,138 ---- virtual int canCollide(SpaceLocation *other); virtual int handle_damage(SpaceLocation *source, double normal, double direct); ! //virtual bool isAsteroid(); //this is not a virtual routine... ! virtual bool die(); }; + AsteroidCenter::AsteroidCenter(Ship *creator1, Vector2 new_pos) : AsteroidDebris(creator1, new_pos, 0) *************** *** 112,145 **** layer = LAYER_SHOTS; collide_flag_anyone = ALL_LAYERS &~ bit(LAYER_CBODIES); ! creator=creator1; } void AsteroidCenter::calculate() { ! STACKTRACE ! if (creator == NULL) { ! this->~AsteroidCenter(); } ! else { ! // translate(creator->normal_x() - normal_x(), creator->normal_y() - normal_y()); ! pos = creator->normal_pos(); ! AsteroidDebris::calculate(); } } int AsteroidCenter::canCollide(SpaceLocation *other) { ! STACKTRACE if (!other->damage_factor) return false; return SpaceObject::canCollide(other); } int AsteroidCenter::handle_damage(SpaceLocation *source, double normal, double direct) { return iround(normal + direct); } ! int AsteroidCenter::isAsteroid() ! { ! return 0; ! } /*****************************************************************************/ --- 140,200 ---- layer = LAYER_SHOTS; collide_flag_anyone = ALL_LAYERS &~ bit(LAYER_CBODIES); ! // creator=creator1; ! ! // so that it is not recognized as an asteroid anymore... ! id = ASTEROID_CENTER; } + + bool AsteroidCenter::die() + { + // do nothing... + return false; + } + void AsteroidCenter::calculate() { ! ! STACKTRACE; ! AsteroidDebris::calculate(); ! ! //xxx test ! if (!creator) ! state = 0; ! return; ! ! if (creator == NULL) { ! //this->~AsteroidCenter(); //highly illegal because it's also destroyed in a physics list!! ! state = 0; } ! else { ! // translate(creator->normal_x() - normal_x(), creator->normal_y() - normal_y()); ! pos = creator->normal_pos(); } } + int AsteroidCenter::canCollide(SpaceLocation *other) { ! //xxx test ! return 0; ! ! STACKTRACE; ! if (!other) ! return 0; ! if (!other->damage_factor) return false; return SpaceObject::canCollide(other); } + int AsteroidCenter::handle_damage(SpaceLocation *source, double normal, double direct) { return iround(normal + direct); } ! ! //bool AsteroidCenter::isAsteroid() ! //{ ! // return false; ! //} /*****************************************************************************/ *************** *** 173,224 **** void ChoraliTractorBeam::inflict_damage(SpaceObject *other) { ! STACKTRACE ! // SpaceObject::inflict_damage(other); ! if(other != NULL) ! { ! if ((other->mass > 0) && ( other->isShip() || other->isAsteroid() )) ! { ! ! other->accelerate(this, other->trajectory_angle(this), tractorForce / (other->mass * 4), 2); ! ! if(other->isShip()) ! { ! //twist the enemy ! if (other->trajectory_angle(this) <= other->get_angle() ) ! { ! if ((other->get_angle() - other->trajectory_angle(this)) <= PI) ! {((Ship*)other)->turn_step+=CH_TWIST_ANGLE; ! } ! else ! {((Ship*)other)->turn_step-=CH_TWIST_ANGLE; ! } ! } ! else ! { ! if ((other->trajectory_angle(this) - other->get_angle()) <= PI) ! {((Ship*)other)->turn_step-=CH_TWIST_ANGLE; ! } ! else ! {((Ship*)other)->turn_step+=CH_TWIST_ANGLE; ! } ! } ! } ! ! } ! else if (other->isPlanet() && random(100) <= 20) ! { //if it's a planet, make some non-regenerating asteroids ! Vector2 dd = creator->normal_pos() - ( (SpaceLocation *)(creator->nearest_planet()) )->normal_pos(); ! ! dd /= 2; ! add( new AsteroidDebris((Ship *)creator, creator->normal_pos() - dd, tractorForce) ); ! } ! else if (other->isShot()) ! {//if It's a weapon Shot ! if (other->mass > 0) ! other->accelerate(this, (other->trajectory_angle(this) + PI), (tractorPushForce / ((other->mass * 3)+20)), MAX_SPEED); ! ! } ! state = 0; ! } } /*****************************************************************************/ --- 228,283 ---- void ChoraliTractorBeam::inflict_damage(SpaceObject *other) { ! STACKTRACE; ! // SpaceObject::inflict_damage(other); ! if(other != NULL) ! { ! if ((other->mass > 0) && ( other->isShip() || other->isAsteroid() )) ! { ! ! other->accelerate(this, other->trajectory_angle(this), tractorForce / (other->mass * 4), 2); ! ! if(other->isShip()) ! { ! //twist the enemy ! if (other->trajectory_angle(this) <= other->get_angle() ) ! { ! if ((other->get_angle() - other->trajectory_angle(this)) <= PI) ! { ! ((Ship*)other)->turn_step+=CH_TWIST_ANGLE; ! } ! else ! { ! ((Ship*)other)->turn_step-=CH_TWIST_ANGLE; ! } ! } ! else ! { ! if ((other->trajectory_angle(this) - other->get_angle()) <= PI) ! { ! ((Ship*)other)->turn_step-=CH_TWIST_ANGLE; ! } ! else ! { ! ((Ship*)other)->turn_step+=CH_TWIST_ANGLE; ! } ! } ! } ! ! } ! else if (other->isPlanet() && random(100) <= 20) ! { //if it's a planet, make some non-regenerating asteroids ! Vector2 dd = creator->normal_pos() - ( (creator->nearest_planet()) )->normal_pos(); ! ! dd /= 2; ! add( new AsteroidDebris((Ship *)creator, creator->normal_pos() - dd, tractorForce) ); ! } ! else if (other->isShot()) ! {//if It's a weapon Shot ! if (other->mass > 0) ! other->accelerate(this, (other->trajectory_angle(this) + PI), (tractorPushForce / ((other->mass * 3)+20)), MAX_SPEED); ! ! } ! state = 0; ! } } /*****************************************************************************/ *************** *** 462,465 **** --- 521,525 ---- spacePlanet = NULL; + asteroid_center = 0; } *************** *** 472,482 **** // dangerous, this is a memory leak: //game->remove(asteroid_center); ! asteroid_center->state = 0; } void ChoraliExtractor::materialize() { ! STACKTRACE Ship::materialize(); ! add(asteroid_center = new AsteroidCenter(this, this->normal_pos())); } --- 532,550 ---- // dangerous, this is a memory leak: //game->remove(asteroid_center); ! if (asteroid_center && asteroid_center->exists()) ! asteroid_center->die(); } void ChoraliExtractor::materialize() { ! STACKTRACE; Ship::materialize(); ! ! ! if (asteroid_center) ! { ! tw_error("asteroid center already present."); ! } ! asteroid_center = new AsteroidCenter(this, this->normal_pos()); ! add(asteroid_center); } *************** *** 495,526 **** int ChoraliExtractor::activate_weapon() { ! STACKTRACE ! if (drillFrames > 0) { ! count=0; ! if( grabbed != NULL && !(grabbed->isAsteroid()) ) ! { ! drillFrames=0; ! return(TRUE); ! } ! else if(grabbed == NULL) ! { ! drillFrames=0; ! return(TRUE); ! } ! else ! { ! grabbed->die(); ! add(new AsteroidMissile(0.0, (size.y * 1.0), angle, AsteroidMissileVelocity, AsteroidMissileDamage, AsteroidMissileRange, AsteroidMissileArmour, AsteroidMissileTurnRate, this, meleedata.asteroidSprite, 1, ! tractorR, tractorRmin, tractorG, tractorGmin, tractorB, tractorBmin )); ! return(TRUE); ! } } ! else { ! drillFrames = weaponFrames; ! return(TRUE); } ! } --- 563,600 ---- int ChoraliExtractor::activate_weapon() { ! STACKTRACE; ! //xxx test ! return FALSE; ! ! if (drillFrames > 0) { ! count=0; ! ! if (grabbed == NULL) ! { ! drillFrames=0; ! return(TRUE); ! } ! else if( !(grabbed->isAsteroid()) ) ! { ! drillFrames=0; ! return(TRUE); ! } ! else ! { ! grabbed->die(); ! add(new AsteroidMissile(0.0, (size.y * 1.0), angle, AsteroidMissileVelocity, ! AsteroidMissileDamage, AsteroidMissileRange, AsteroidMissileArmour, ! AsteroidMissileTurnRate, this, meleedata.asteroidSprite, 1, ! tractorR, tractorRmin, tractorG, tractorGmin, tractorB, tractorBmin )); ! return(TRUE); ! } } ! else { ! drillFrames = weaponFrames; ! return(TRUE); } ! } *************** *** 528,531 **** --- 602,607 ---- { STACKTRACE; + //xxx test + return FALSE; if(this->nearest_planet() != NULL) *************** *** 570,573 **** --- 646,653 ---- void ChoraliExtractor::calculate() { + //xxx test + Ship::calculate(); + return; + STACKTRACE; if(drillFrames > 0) *************** *** 613,617 **** { // if it does not exist, or the target deals damage, then, release it again. ! // This is because of the following report: // "When a Chorhli grabs a guardian, it still hangs on if it goes into blazer form, // killing it almost instantly. A bit unfair, no. " --- 693,697 ---- { // if it does not exist, or the target deals damage, then, release it again. ! // The latter is because of the following report: // "When a Chorhli grabs a guardian, it still hangs on if it goes into blazer form, // killing it almost instantly. A bit unfair, no. " *************** *** 679,682 **** --- 759,768 ---- } old_angle = angle; + + if (asteroid_center && !asteroid_center->exists()) + { + asteroid_center = 0; + } + Ship::calculate(); } *************** *** 702,705 **** --- 788,794 ---- void ChoraliExtractor::inflict_damage(SpaceObject *other) { + //xxx test + return; + STACKTRACE; if (drillFrames > 0) |
From: Rob <geo...@us...> - 2005-08-26 21:59:25
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29900/source/other Modified Files: shippart.cpp Log Message: Aaahh... the chorali ship... it has a bug and I cannot find it ! Maybe later. Index: shippart.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/shippart.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shippart.cpp 21 Aug 2005 13:57:20 -0000 1.13 --- shippart.cpp 26 Aug 2005 21:59:17 -0000 1.14 *************** *** 295,299 **** void BigShipPartDevice::calculate() { ! STACKTRACE if ( !(ownerpart && ownerpart->exists()) ) --- 295,301 ---- void BigShipPartDevice::calculate() { ! STACKTRACE; ! ! SpaceObject::calculate(); if ( !(ownerpart && ownerpart->exists()) ) *************** *** 310,314 **** vel = ownerpart->vel; - SpaceObject::calculate(); } --- 312,315 ---- |
From: Rob <geo...@us...> - 2005-08-26 21:55:32
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28980/source/newships Modified Files: shpastba.cpp shpayrbs.cpp shpdajem.cpp shpducla.cpp shpfopsl.cpp shpgerhe.cpp shphydcr.cpp shpjnkla.cpp shpjygst.cpp shpkabwe.cpp shpmekpi.cpp shpmontr.cpp shpsamat.cpp shptaume.cpp shpterbi.cpp shptougr.cpp shpvezba.cpp Log Message: some bug fixes (pointer mistakes). Index: shptaume.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaume.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shptaume.cpp 14 Aug 2005 16:14:32 -0000 1.16 --- shptaume.cpp 26 Aug 2005 21:55:19 -0000 1.17 *************** *** 250,254 **** game->add(new Animation( this, normal_pos() - unit_vector(angle) * 14, ! meleedata.hotspotSprite, 0, HOTSPOT_FRAMES, time_ratio, DEPTH_HOTSPOTS)); hotspot_frame += hotspot_rate; } if (hotspot_frame > 0) hotspot_frame -= frame_time; --- 250,254 ---- game->add(new Animation( this, normal_pos() - unit_vector(angle) * 14, ! meleedata.hotspotSprite, 0, meleedata.hotspotSprite->frames(), time_ratio, DEPTH_HOTSPOTS)); hotspot_frame += hotspot_rate; } if (hotspot_frame > 0) hotspot_frame -= frame_time; Index: shpfopsl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpfopsl.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpfopsl.cpp 11 Jul 2005 00:25:31 -0000 1.9 --- shpfopsl.cpp 26 Aug 2005 21:55:19 -0000 1.10 *************** *** 59,63 **** FopVob::~FopVob() { ! delete T0; } --- 59,63 ---- FopVob::~FopVob() { ! delete[] T0; } Index: shpdajem.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdajem.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpdajem.cpp 16 Aug 2005 23:21:02 -0000 1.15 --- shpdajem.cpp 26 Aug 2005 21:55:19 -0000 1.16 *************** *** 444,448 **** void DajielkaSanctuary::calculate(void) { ! STACKTRACE int i,j; int oldSpriteIndex; --- 444,454 ---- void DajielkaSanctuary::calculate(void) { ! STACKTRACE; ! ! if (creator && !creator->exists()) ! { ! creator = 0; ! } ! int i,j; int oldSpriteIndex; *************** *** 474,478 **** if(sprite_index<0) sprite_index=0; if(sprite_index>9) sprite_index=9; ! if(oldSpriteIndex!=sprite_index&&oldSpriteIndex<sprite_index) creator->play_sound2(creator->data->sampleSpecial[creator->special_sample]); --- 480,484 ---- if(sprite_index<0) sprite_index=0; if(sprite_index>9) sprite_index=9; ! if(creator && oldSpriteIndex!=sprite_index&&oldSpriteIndex<sprite_index) creator->play_sound2(creator->data->sampleSpecial[creator->special_sample]); *************** *** 504,509 **** int damageBefore, damageAfter; for(j=1;j<10 && energy>0;j++) ! for(i=0;i<30 && energy>0;i++) { ! damageBefore = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); if(tendril[i]!=NULL && tendril[i]->state !=0) if(tendril[i]->energyLevelPerDamagePoint * j > tendril[i]->energyLevel --- 510,521 ---- int damageBefore, damageAfter; for(j=1;j<10 && energy>0;j++) ! { ! for(i=0;i<30 && energy>0;i++) ! { ! if (tendril[i]->energyLevelPerDamagePoint) ! damageBefore = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageBefore = 0; ! if(tendril[i]!=NULL && tendril[i]->state !=0) if(tendril[i]->energyLevelPerDamagePoint * j > tendril[i]->energyLevel *************** *** 512,516 **** energy = 0; } ! damageAfter = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); if(damageBefore!=damageAfter && tendril[i]->get_length()==0) { //tendril[i]=this->RecreateTendril(tendril[i]); --- 524,533 ---- energy = 0; } ! ! if (tendril[i]->energyLevelPerDamagePoint) ! damageAfter = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageAfter = 0; ! if(damageBefore!=damageAfter && tendril[i]->get_length()==0) { //tendril[i]=this->RecreateTendril(tendril[i]); *************** *** 518,521 **** --- 535,539 ---- } } + } } *************** *** 569,573 **** void DajielkaTendril::calculate(void) { ! STACKTRACE if(energyLevel<energyLevelPerDamagePoint) { isActive = FALSE; --- 587,591 ---- void DajielkaTendril::calculate(void) { ! STACKTRACE; if(energyLevel<energyLevelPerDamagePoint) { isActive = FALSE; *************** *** 589,593 **** --- 607,619 ---- while(angle<0) angle+=PI2; while(angle>PI2) angle-=PI2; + + if (creator && !creator->exists()) + { + creator = 0; + state = 0; + } + SpaceLine::calculate(); + color=palette_color[(int)(energyLevel/energyLevelPerDamagePoint)+7]; if(creator!=NULL) Index: shpterbi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpterbi.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpterbi.cpp 23 Aug 2005 22:18:11 -0000 1.9 --- shpterbi.cpp 26 Aug 2005 21:55:19 -0000 1.10 *************** *** 1402,1406 **** new_ship->control->die(); // the control of the ship was already added to physics ! delete new_ship; // fine, this wasn't added to physics yet. new_ship = NULL; --- 1402,1406 ---- new_ship->control->die(); // the control of the ship was already added to physics ! delete_location(new_ship); // fine, this wasn't added to physics yet. new_ship = NULL; *************** *** 1429,1433 **** new_ship->control->die(); // the control of the ship was already added to physics ! delete new_ship; // fine, this wasn't added to physics yet. new_ship = NULL; --- 1429,1433 ---- new_ship->control->die(); // the control of the ship was already added to physics ! delete_location(new_ship); // fine, this wasn't added to physics yet. new_ship = NULL; Index: shpastba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpastba.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpastba.cpp 14 Aug 2005 16:14:32 -0000 1.8 --- shpastba.cpp 26 Aug 2005 21:55:19 -0000 1.9 *************** *** 1277,1282 **** { if (num > 0) { ! delete xp; ! delete xv; } } --- 1277,1282 ---- { if (num > 0) { ! delete[] xp; ! delete[] xv; } } Index: shphydcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphydcr.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shphydcr.cpp 23 Aug 2005 22:18:11 -0000 1.15 --- shphydcr.cpp 26 Aug 2005 21:55:19 -0000 1.16 *************** *** 160,163 **** --- 160,165 ---- void RetreatFrom(SpaceLocation* L, int r, int m); + virtual void death(); + }; *************** *** 570,574 **** HydrovarEsFighter::~HydrovarEsFighter() { ! STACKTRACE if(creator) { --- 572,590 ---- HydrovarEsFighter::~HydrovarEsFighter() { ! STACKTRACE; ! /* this is rather illegal here !! --> move to the death() function [geo] ! if(creator) ! { ! if(creator->exists()) ! { ! *pointerToMe=NULL; ! creator->fightersOut--; ! } ! } ! */ ! } ! ! void HydrovarEsFighter::death() ! { if(creator) { Index: shpayrbs.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpayrbs.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** shpayrbs.cpp 14 Aug 2005 16:14:32 -0000 1.23 --- shpayrbs.cpp 26 Aug 2005 21:55:19 -0000 1.24 *************** *** 212,223 **** } ! delete itype; ! delete iweapon; ! delete anglecenter; ! delete moveangle; for ( i = 0; i < nBSinfo; ++i ) delete BSinfo[i]; ! delete BSinfo; --- 212,223 ---- } ! delete[] itype; ! delete[] iweapon; ! delete[] anglecenter; ! delete[] moveangle; for ( i = 0; i < nBSinfo; ++i ) delete BSinfo[i]; ! delete[] BSinfo; *************** *** 464,468 **** void AutoGun::calculate() { ! STACKTRACE BigShipPartDevice::calculate(); --- 464,468 ---- void AutoGun::calculate() { ! STACKTRACE; BigShipPartDevice::calculate(); Index: shpmekpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpmekpi.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpmekpi.cpp 2 Aug 2005 00:23:46 -0000 1.16 --- shpmekpi.cpp 26 Aug 2005 21:55:19 -0000 1.17 *************** *** 116,121 **** MeknikPincer::~MeknikPincer() { ! delete saw; ! delete sawrefangle; } --- 116,121 ---- MeknikPincer::~MeknikPincer() { ! delete[] saw; ! delete[] sawrefangle; } Index: shpjygst.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpjygst.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpjygst.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpjygst.cpp 26 Aug 2005 21:55:19 -0000 1.19 *************** *** 136,174 **** } ! int JyglarStarfarer::activate_special(){ ! 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] ); ! numBubbles++; ! return TRUE; } ! void JyglarStarfarer::calculate(){ ! STACKTRACE ! int j = 0; ! for( int i = 0; i < numBubbles; i++ ){ ! bubbles[i - j] = bubbles[i]; ! if( !bubbles[i]->exists() ) j++; ! } ! numBubbles -= j; ! Ship::calculate(); } ! void JyglarStarfarer::calculate_hotspots(){ ! STACKTRACE ! if( thrust && hotspot_frame <= 0 ){ ! game->add( new Animation( this, ! normal_pos() - unit_vector(angle) * size.y / 4, ! data->spriteExtra, 0, 12, time_ratio, LAYER_HOTSPOTS)); ! hotspot_frame += hotspot_rate; ! } ! if( hotspot_frame > 0 ) hotspot_frame -= frame_time; } ! JyglarStarfarer::~JyglarStarfarer(){ ! delete bubbles; } --- 136,187 ---- } ! int JyglarStarfarer::activate_special() ! { ! 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] ); ! numBubbles++; ! return TRUE; } ! void JyglarStarfarer::calculate() ! { ! STACKTRACE; ! int j = 0; ! for( int i = 0; i < numBubbles; i++ ) ! { ! bubbles[i - j] = bubbles[i]; ! if( !bubbles[i]->exists() ) ! j++; ! } ! numBubbles -= j; ! ! Ship::calculate(); } ! void JyglarStarfarer::calculate_hotspots() ! { ! STACKTRACE; ! ! if( thrust && hotspot_frame <= 0 ) ! { ! game->add( new Animation( this, ! normal_pos() - unit_vector(angle) * size.y / 4, ! data->spriteExtra, 0, data->spriteExtra->frames(), time_ratio, LAYER_HOTSPOTS)); ! hotspot_frame += hotspot_rate; ! } ! ! if( hotspot_frame > 0 ) ! hotspot_frame -= frame_time; } ! JyglarStarfarer::~JyglarStarfarer() ! { ! delete[] bubbles; } *************** *** 192,196 **** JyglarShot::~JyglarShot(){ STACKTRACE ! if( beacon ) delete beacon; } --- 205,209 ---- JyglarShot::~JyglarShot(){ STACKTRACE ! if( beacon ) delete_location(beacon); } Index: shpducla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpducla.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpducla.cpp 21 Aug 2005 13:57:20 -0000 1.19 --- shpducla.cpp 26 Aug 2005 21:55:19 -0000 1.20 *************** *** 855,859 **** void LaserArc::calculate() { ! STACKTRACE if ( !(mother && mother->exists()) ) { --- 855,862 ---- void LaserArc::calculate() { ! STACKTRACE; ! ! SpaceLocation::calculate(); ! if ( !(mother && mother->exists()) ) { Index: shpgerhe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgerhe.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** shpgerhe.cpp 23 Aug 2005 22:18:11 -0000 1.22 --- shpgerhe.cpp 26 Aug 2005 21:55:19 -0000 1.23 *************** *** 340,344 **** { STACKTRACE ! if ( hero->attached ) { hero->activateyourweapon = 1; // issue order to the hero that he activates his weapon. --- 340,344 ---- { STACKTRACE ! if ( hero && hero->attached ) { hero->activateyourweapon = 1; // issue order to the hero that he activates his weapon. *************** *** 351,357 **** int GerlVirtualship::activate_special() { ! STACKTRACE ! hero->activateyourspecial = 1; ! batt += special_drain; // prevent fuel drain return true; --- 351,360 ---- int GerlVirtualship::activate_special() { ! STACKTRACE; ! if (hero) ! { ! hero->activateyourspecial = 1; ! batt += special_drain; // prevent fuel drain ! } return true; *************** *** 948,951 **** --- 951,956 ---- if ( a > 1.0 ) a = 0.999; + if (a < 0) + a = 0; vel *= a; Index: shpmontr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpmontr.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpmontr.cpp 2 Aug 2005 13:04:08 -0000 1.13 --- shpmontr.cpp 26 Aug 2005 21:55:19 -0000 1.14 *************** *** 308,312 **** if( distance( from_beacon ) > distance( to_beacon )){ play_sound2( data->sampleWeapon[1] ); ! if( from_beacon ) delete from_beacon; from_beacon = new SpaceLocation( this, pos, 0.0 ); double tangle = trajectory_angle( target ); --- 308,312 ---- if( distance( from_beacon ) > distance( to_beacon )){ play_sound2( data->sampleWeapon[1] ); ! if( from_beacon ) delete_location(from_beacon); from_beacon = new SpaceLocation( this, pos, 0.0 ); double tangle = trajectory_angle( target ); *************** *** 315,322 **** sprite_index = itangle; if( itangle % 2 == 0 ){ ! if( to_beacon ) delete to_beacon; to_beacon = new SpaceLocation( this, Vector2(2*target->normal_pos().x-pos.x, pos.y), 0.0 ); }else if( itangle % 2 == 1 ){ ! if( to_beacon ) delete to_beacon; to_beacon = new SpaceLocation( this, Vector2(pos.x, 2*target->normal_pos().y-pos.y), 0.0 ); } --- 315,322 ---- sprite_index = itangle; if( itangle % 2 == 0 ){ ! if( to_beacon ) delete_location(to_beacon); to_beacon = new SpaceLocation( this, Vector2(2*target->normal_pos().x-pos.x, pos.y), 0.0 ); }else if( itangle % 2 == 1 ){ ! if( to_beacon ) delete_location(to_beacon); to_beacon = new SpaceLocation( this, Vector2(pos.x, 2*target->normal_pos().y-pos.y), 0.0 ); } *************** *** 335,345 **** }else{ int iangle = (int)((angle + PI/4) / (PI/2)) % 4; ! if( from_beacon ) delete from_beacon; from_beacon = new SpaceLocation( this, pos, 0.0 ); if( iangle % 2 == 0 ){ ! if( to_beacon ) delete to_beacon; to_beacon = new SpaceLocation( this, Vector2(2*target->normal_pos().x-pos.x, pos.y), 0.0 ); }else if( iangle % 2 == 1 ){ ! if( to_beacon ) delete to_beacon; to_beacon = new SpaceLocation( this, Vector2(pos.x, 2*target->normal_pos().y-pos.y), 0.0 ); } --- 335,345 ---- }else{ int iangle = (int)((angle + PI/4) / (PI/2)) % 4; ! if( from_beacon ) delete_location(from_beacon); from_beacon = new SpaceLocation( this, pos, 0.0 ); if( iangle % 2 == 0 ){ ! if( to_beacon ) delete_location(to_beacon); to_beacon = new SpaceLocation( this, Vector2(2*target->normal_pos().x-pos.x, pos.y), 0.0 ); }else if( iangle % 2 == 1 ){ ! if( to_beacon ) delete_location(to_beacon); to_beacon = new SpaceLocation( this, Vector2(pos.x, 2*target->normal_pos().y-pos.y), 0.0 ); } *************** *** 348,353 **** MonoMissile::~MonoMissile(){ ! if( from_beacon ) delete from_beacon; ! if( to_beacon ) delete to_beacon; } --- 348,353 ---- MonoMissile::~MonoMissile(){ ! if( from_beacon ) delete_location(from_beacon); ! if( to_beacon ) delete_location(to_beacon); } Index: shpvezba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvezba.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpvezba.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shpvezba.cpp 26 Aug 2005 21:55:19 -0000 1.18 *************** *** 168,172 **** VezlagariMissile::~VezlagariMissile(void) { ! if(Course!=NULL) delete(Course); } --- 168,172 ---- VezlagariMissile::~VezlagariMissile(void) { ! if(Course!=NULL) delete_location(Course); // wasn't added to physics. } Index: shpkabwe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkabwe.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpkabwe.cpp 23 Aug 2005 22:18:11 -0000 1.18 --- shpkabwe.cpp 26 Aug 2005 21:55:19 -0000 1.19 *************** *** 300,311 **** haze = new KaboHaze( this, (Ship*) other, Haze_basepower); - // update the list (insert at the start) - KaboHaze *hazenext = KaboHazeFirst; - if (hazenext) - hazenext->prev = haze; - haze->next = hazenext; - haze->prev = 0; - KaboHazeFirst = haze; - game->add(haze); } --- 300,303 ---- *************** *** 552,555 **** --- 544,558 ---- SpaceLocation(creator, Vector2(0.0, 0.0), 0.0) { + prev = 0; + next = 0; + + // update the list (insert at the start) + if (KaboHazeFirst) + KaboHazeFirst->prev = this; + next = KaboHazeFirst; + prev = 0; + KaboHazeFirst = this; + + //mother = omother; host = ohost; Index: shptougr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptougr.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shptougr.cpp 11 Jul 2005 00:25:32 -0000 1.9 --- shptougr.cpp 26 Aug 2005 21:55:19 -0000 1.10 *************** *** 84,88 **** double L; ! L = specialRange * (0.1 + 0.9 * sin(PI2 * lasertime / laserperiod)); add(new Laser(this, angle + PI/2, --- 84,88 ---- double L; ! L = fabs( specialRange * (0.1 + 0.9 * sin(PI2 * lasertime / laserperiod)) ); add(new Laser(this, angle + PI/2, Index: shpjnkla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpjnkla.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpjnkla.cpp 23 Aug 2005 22:18:11 -0000 1.19 --- shpjnkla.cpp 26 Aug 2005 21:55:19 -0000 1.20 *************** *** 158,162 **** STACKTRACE; ! if (state == 0) return; if (!(ship && ship->exists())) { --- 158,164 ---- STACKTRACE; ! if (state == 0) return; //shouldn't happen ! ! SpaceLocation::calculate(); if (!(ship && ship->exists())) { Index: shpsamat.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsamat.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpsamat.cpp 14 Aug 2005 16:14:32 -0000 1.20 --- shpsamat.cpp 26 Aug 2005 21:55:19 -0000 1.21 *************** *** 622,626 **** SaMatraFlame::~SaMatraFlame() { ! delete trailPos; } --- 622,626 ---- SaMatraFlame::~SaMatraFlame() { ! delete[] trailPos; } |
From: Rob <geo...@us...> - 2005-08-26 21:55:32
|
Update of /cvsroot/timewarp/source/sc2ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28980/source/sc2ships Modified Files: shppkufu.cpp shpslypr.cpp Log Message: some bug fixes (pointer mistakes). Index: shppkufu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shppkufu.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shppkufu.cpp 16 Aug 2005 23:21:02 -0000 1.17 --- shppkufu.cpp 26 Aug 2005 21:55:19 -0000 1.18 *************** *** 40,44 **** play_sound((SAMPLE *)(melee[MELEE_BOOMSHIP].dat)); ! game->add(new Animation(this, pos, meleedata.kaboomSprite, 0, KABOOM_FRAMES, time_ratio, DEPTH_EXPLOSIONS)); --- 40,44 ---- play_sound((SAMPLE *)(melee[MELEE_BOOMSHIP].dat)); ! game->add(new Animation(this, pos, meleedata.kaboomSprite, 0, meleedata.kaboomSprite->frames(), time_ratio, DEPTH_EXPLOSIONS)); Index: shpslypr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpslypr.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpslypr.cpp 14 Aug 2005 16:14:50 -0000 1.18 --- shpslypr.cpp 26 Aug 2005 21:55:19 -0000 1.19 *************** *** 489,493 **** int i, iline; ! if ( !(mother && mother->exists()) ) return; --- 489,493 ---- int i, iline; ! if ( !mother ) return; |
From: Rob <geo...@us...> - 2005-08-26 21:55:32
|
Update of /cvsroot/timewarp/source/sc3ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28980/source/sc3ships Modified Files: shpexqen.cpp Log Message: some bug fixes (pointer mistakes). Index: shpexqen.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpexqen.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpexqen.cpp 14 Aug 2005 16:14:50 -0000 1.11 --- shpexqen.cpp 26 Aug 2005 21:55:20 -0000 1.12 *************** *** 151,155 **** { Missile::calculate(); ! SpaceLocation *R; double final_angle = 0; --- 151,155 ---- { Missile::calculate(); ! SpaceLocation *R = 0; double final_angle = 0; *************** *** 245,249 **** } sprite_index = get_index(angle); ! delete R; } --- 245,251 ---- } sprite_index = get_index(angle); ! ! if (R) ! delete R; } |
From: Rob <geo...@us...> - 2005-08-26 21:54:38
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28818/source/melee Modified Files: manim.cpp mcbodies.cpp mframe.cpp mframe.h Log Message: Some minor changes I made during bug-hunting. Inserted test(s). Index: mcbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcbodies.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mcbodies.cpp 16 Aug 2005 23:22:27 -0000 1.17 --- mcbodies.cpp 26 Aug 2005 21:54:30 -0000 1.18 *************** *** 32,36 **** armour = 0.99;//*tau* ! sprite_index = random(sprite->frames()); attributes &= ~ATTRIB_STANDARD_INDEX; } --- 32,36 ---- armour = 0.99;//*tau* ! sprite_index = tw_random(sprite->frames()); attributes &= ~ATTRIB_STANDARD_INDEX; } Index: manim.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/manim.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** manim.cpp 23 Aug 2005 22:20:16 -0000 1.14 --- manim.cpp 26 Aug 2005 21:54:30 -0000 1.15 *************** *** 64,67 **** --- 64,72 ---- state = 0; } + + if (sprite_index < 0 || sprite_index >= sprite->frames()) + { + tw_error("Animation: sprite index overflow."); + } SpaceObject::calculate(); Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mframe.h 23 Aug 2005 22:21:16 -0000 1.26 --- mframe.h 26 Aug 2005 21:54:30 -0000 1.27 *************** *** 18,21 **** --- 18,30 ---- typedef unsigned int TeamCode; + class Presence; + + void delete_location(void *tmp); + void check_physics_correctness(); + void check_physics_correctness_item(int i); + void check_physics_presence(Presence *p); + + + //#define DEATH_FRAMES 4 //setting this too low will cause crashes *************** *** 413,416 **** --- 422,426 ---- virtual void collide(SpaceObject *o); virtual void inflict_damage(SpaceObject *other); + virtual void calculate(); double collide_testdistance(SpaceObject *o); Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** mframe.cpp 23 Aug 2005 22:21:16 -0000 1.41 --- mframe.cpp 26 Aug 2005 21:54:30 -0000 1.42 *************** *** 57,60 **** --- 57,114 ---- + // for debugging purpose... + void check_physics_correctness_item(int i) + { + if (physics) + { + SpaceLocation *l = physics->item[i]; + bool e = l->exists(); + if (e) + { + if ( (l->attributes & ATTRIB_INGAME) == 0) + { + tw_error("a object that is not ingame? impossible."); + } + } + + if (fabs(l->pos.x) > 1E6 || fabs(l->pos.y) > 1E6 || fabs(l->vel.x) > 1E6 || fabs(l->vel.x) > 1E6) + { + tw_error("error in item [%i] [%s]", i, l->get_identity()); + } + } + } + + void check_physics_correctness() + { + int i; + for ( i = 0; i < physics->num_items; ++i ) + { + check_physics_correctness_item(i); + } + } + + void check_physics_presence(Presence *p) + { + if (!physics) + return; + + int i; + for ( i = 0; i < physics->num_items; ++i ) + { + if (physics->item[i] == p) + { + tw_error("Physics location deleted, but is still in the list."); + } + } + for ( i = 0; i < physics->num_presences; ++i ) + { + if (physics->presence[i] == p) + { + tw_error("Physics presence deleted, but is still in the list."); + } + } + } + + void Query::begin (SpaceLocation *qtarget, int qlayers, double qrange) {STACKTRACE *************** *** 354,360 **** return true; } ! Presence::~Presence() {STACKTRACE total_presences -= 1; ! } bool Presence::isLocation() const { --- 408,424 ---- return true; } ! Presence::~Presence() ! { ! STACKTRACE; ! total_presences -= 1; ! ! #ifdef _DEBUG ! // for debugging purpose: in case an object is deleted, and the physics list refers to ! // the "left-over" data that still remain in memory (for a while). ! attributes &= ~ATTRIB_INGAME; ! check_physics_presence(this); ! #endif ! } bool Presence::isLocation() const { *************** *** 928,931 **** --- 992,998 ---- Vector2 d; + double old_length = llength; + double magn = 0; + if (sprite->collide_ray( (int)(lp1.x), (int)(lp1.y), &collide_x, &collide_y, *************** *** 934,938 **** sprite_index)) { d = lp2 - Vector2(collide_x, collide_y); ! llength = llength - magnitude(d); } --- 1001,1014 ---- sprite_index)) { d = lp2 - Vector2(collide_x, collide_y); ! ! magn = magnitude(d); ! llength = llength - magn; ! } ! ! if (llength < -2) ! { ! tw_error("negative length!"); ! } else { ! llength = 0; } *************** *** 979,989 **** */ ! SpaceLine::SpaceLine(SpaceLocation *creator, Vector2 lpos, double langle, ! double llength, int lcolor) ! : ! SpaceLocation(creator, lpos, langle), ! length(llength), ! color(lcolor) ! {STACKTRACE id = SPACE_LINE; attributes |= ATTRIB_LINE;// | ATTRIB_COLLIDE_STATIC; --- 1055,1065 ---- */ ! SpaceLine::SpaceLine(SpaceLocation *creator, Vector2 lpos, double langle, double llength, int lcolor) ! : ! SpaceLocation(creator, lpos, langle), ! length(llength), ! color(lcolor) ! { ! STACKTRACE; id = SPACE_LINE; attributes |= ATTRIB_LINE;// | ATTRIB_COLLIDE_STATIC; *************** *** 993,998 **** --- 1069,1090 ---- collide_flag_sameteam &= OBJECT_LAYERS; collide_flag_sameship &= OBJECT_LAYERS; + + if (length < 0) + { + tw_error("error in length !"); } + } + + void SpaceLine::calculate() + { + SpaceLocation::calculate(); + + if (length < 0) + { + tw_error("error in length !"); + } + } + double SpaceLine::edge_x() const { *************** *** 1012,1015 **** --- 1104,1112 ---- double SpaceLine::get_length() const { + if (length < 0) + { + tw_error("error in length !"); + } + return(length); } *************** *** 1018,1021 **** --- 1115,1123 ---- { length = d; + + if (length < 0) + { + tw_error("error in length !"); + } } *************** *** 1068,1072 **** length = o->collide_ray(normal_pos(), normal_pos() + edge(), length); */ ! length = collide_testdistance(o); if (length != old_length) inflict_damage(o); --- 1170,1174 ---- length = o->collide_ray(normal_pos(), normal_pos() + edge(), length); */ ! set_length(collide_testdistance(o)); if (length != old_length) inflict_damage(o); *************** *** 1175,1178 **** --- 1277,1285 ---- num_items += 1; + if (num_items > max_items) + { + tw_error("physics array overflow, should not happen."); + } + if (o->detectable()) { *************** *** 1190,1193 **** --- 1297,1303 ---- bool Physics::remove(SpaceLocation *o) { STACKTRACE; + + tw_error("Better leave *remove* to normal physics..."); + int i; if (!(o->attributes & ATTRIB_INGAME)) {tw_error("removeItem - not added");} *************** *** 1241,1244 **** --- 1351,1377 ---- extern void test_pointers(); + void delete_location(void *tmp) + { + if (!physics) + return; + + int i; + for (i = 0; i < physics->num_items; i += 1) + { + // check if this object still exists in the physics list... if it does, you're going to create a problem! + if (physics->item[i] == tmp) + { + tw_error("Problem, trying to delete an item that is still in the physics (locations) list"); + } + } + + // otherwise, it's ok to remove it. + delete tmp; + } + + static const int max_physics_pointer_test = 1024; + static int num_physics_pointer_test = 0; + static SpaceLocation *physics_pointer_test[max_physics_pointer_test]; + void Physics::calculate() {_STACKTRACE("Physics::calculate()") int i; *************** *** 1255,1266 **** debug_value = num_items + num_presences; ! //test_pointers(); checksync(); {_STACKTRACE("Physics::calculate() - item movement") //move objects ! for (i = 0; i < num_items; i += 1) { ! if (!item[i]->exists()) continue; //if (i == 1 && game_time == 100) tw_error("debug me!"); item[i]->pos = normalize(item[i]->pos + item[i]->vel * frame_time, map_size); } --- 1388,1407 ---- debug_value = num_items + num_presences; ! test_pointers(); ! check_physics_correctness(); checksync(); {_STACKTRACE("Physics::calculate() - item movement") //move objects ! for (i = 0; i < num_items; i += 1) ! { ! if (!item[i]->exists()) ! continue; ! //if (i == 1 && game_time == 100) tw_error("debug me!"); + if (fabs(item[i]->vel.x) > 1E6 || fabs(item[i]->vel.y) > 1E6) + { + tw_error("velocity error in %s", item[i]->get_identity()); + } item[i]->pos = normalize(item[i]->pos + item[i]->vel * frame_time, map_size); } *************** *** 1269,1272 **** --- 1410,1414 ---- test_pointers(); + check_physics_correctness(); {_STACKTRACE("Physics::calculate() - presence calculation") *************** *** 1278,1282 **** } } ! //test_pointers(); //call objects calculate functions --- 1420,1425 ---- } } ! test_pointers(); ! check_physics_correctness(); //call objects calculate functions *************** *** 1301,1309 **** tw_error("Pointer error, overwritten data ??"); } ! if (item[i]->target && (item[i]->target->state < -1)) // if it's dead for too long... { tw_error("Target pointer isn't cleaned up in [%s]", item[i]->get_identity()); } ! if (item[i]->ship && item[i]->ship->state < -1) { tw_error("Ship pointer isn't cleaned up in [%s]", item[i]->get_identity()); --- 1444,1452 ---- tw_error("Pointer error, overwritten data ??"); } ! if (item[i]->target && (item[i]->target->state < -2)) // if it's dead for too long... { tw_error("Target pointer isn't cleaned up in [%s]", item[i]->get_identity()); } ! if (item[i]->ship && item[i]->ship->state < -2) { tw_error("Ship pointer isn't cleaned up in [%s]", item[i]->get_identity()); *************** *** 1315,1319 **** } } ! //test_pointers(); //prepare quadrants stuff --- 1458,1463 ---- } } ! test_pointers(); ! check_physics_correctness(); //prepare quadrants stuff *************** *** 1340,1344 **** collide(); } ! //test_pointers(); checksync(); --- 1484,1489 ---- collide(); } ! test_pointers(); ! check_physics_correctness(); checksync(); *************** *** 1365,1372 **** } } ! //test_pointers(); checksync(); //remove objects that have been dead long enough {_STACKTRACE("Physics::calculate() - item destruction") --- 1510,1528 ---- } } ! test_pointers(); ! check_physics_correctness(); checksync(); + // checking for mem-overwrite + for(i = 0; i < num_physics_pointer_test; i ++) + { + if (physics_pointer_test[i] != item[i]) + { + tw_error("Physics memory array has been changed !!"); + } + } + // end of test + //remove objects that have been dead long enough {_STACKTRACE("Physics::calculate() - item destruction") *************** *** 1381,1388 **** i -= 1; ! delete tmp; } } for(i = 0; i < num_items; i ++) { --- 1537,1558 ---- i -= 1; ! const char *name = tmp->get_identity(); ! if (strcmp(name, "AsteroidCenter") == 0) ! { ! int k = 0; ! } ! delete_location(tmp); ! //xxx despite that TEST, it's still going wrong here !! So, something gets deleted outside of this physics, after being added to the physics... nasty!. ! // it's the CHORALI EXTRACTOR !!!! But, why ???? } } + // copying info for mem-overwrite test + num_physics_pointer_test = max_physics_pointer_test; + if (num_physics_pointer_test > num_items) + num_physics_pointer_test = num_items; + memcpy(physics_pointer_test, item, num_physics_pointer_test * sizeof(SpaceLocation*)); + // end of copy + for(i = 0; i < num_items; i ++) { *************** *** 1402,1406 **** } checksync(); ! //test_pointers(); //remove dead listings --- 1572,1577 ---- } checksync(); ! test_pointers(); ! check_physics_correctness(); //remove dead listings *************** *** 1439,1442 **** --- 1610,1615 ---- game_animation_time = get_time(); message.print(1, 15, "frame rate = %i ms", int(game_frame_rate)); + + check_physics_correctness(); #endif *************** *** 1466,1469 **** --- 1639,1644 ---- for (i = 0; i < j; i += 1) { + + // test if the sprite_index doesn't change: that affects physics and can lead to a desynch *************** *** 1480,1483 **** --- 1655,1663 ---- } + if (!animate_buffer[i]->exists()) + { + tw_error("Objects are not allowed to die during animation()"); + } + physics_allowed = false; animate_buffer[i]->animate(frame); *************** *** 1513,1518 **** --- 1693,1702 ---- } + + check_physics_correctness(); } + check_physics_correctness(); + return; } *************** *** 1604,1607 **** --- 1788,1799 ---- //xxx goes wrong in case of Androsynth Guardian (=o) ; m=0x00003c. tmp[l].pmask = o->get_sprite()->get_pmask(o->get_sprite_index()); + + #ifdef _DEBUG + // may help to detect error in pointers + int dummy = tmp[l].pmask->h; + //tmp[l].pmask->h = dummy; + // end of help + #endif + tmp[l].data = o; l += 1; *************** *** 1610,1614 **** SpaceObject *col[128 * 2 + 1]; int nc = check_pmask_collision_list_float_wrap(size.x, size.y, tmp, l, (const void**)&col[0], 128); ! delete tmp; // return; for (i = 0; i < nc; i += 1) { --- 1802,1806 ---- SpaceObject *col[128 * 2 + 1]; int nc = check_pmask_collision_list_float_wrap(size.x, size.y, tmp, l, (const void**)&col[0], 128); ! delete[] tmp; // return; for (i = 0; i < nc; i += 1) { |
From: Rob <geo...@us...> - 2005-08-23 22:21:26
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15131/source/ais Modified Files: c_wussie.cpp Log Message: Some minor changes I made during bug-hunting. Inserted test(s). Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** c_wussie.cpp 14 Aug 2005 16:14:32 -0000 1.24 --- c_wussie.cpp 23 Aug 2005 22:21:16 -0000 1.25 *************** *** 269,274 **** --- 269,290 ---- } + if (ship && ship->control != this) + { + tw_error("error in control reference..."); + } + if (!(ship && ship->exists())) + { + // maybe it's possible that this is called before the calculate() function... by a ship + // calculate function or so. It shouldn't be possible, but I'll place it here anyway + if (ship && temporary) + { + tw_error("think() ship=0, shouldn't be possible"); + state = 0; // this control dies + ship->control = 0; // the ship should know. + } + ship = 0; + } if (!ship) *************** *** 1016,1019 **** --- 1032,1041 ---- int i, j, k; Control::select_ship (ship_pointer, ship_name); + + if (ship && ship->control != this) + { + tw_error("error in control reference..."); + } + if (ship_name) { |
From: Rob <geo...@us...> - 2005-08-23 22:21:26
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15131/source/other Modified Files: nullphas.cpp Log Message: Some minor changes I made during bug-hunting. Inserted test(s). Index: nullphas.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/nullphas.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nullphas.cpp 24 Mar 2004 23:51:43 -0000 1.8 --- nullphas.cpp 23 Aug 2005 22:21:16 -0000 1.9 *************** *** 22,25 **** --- 22,28 ---- state = 0; } + + if (ship) + ship->handle_phasing(); } |
From: Rob <geo...@us...> - 2005-08-23 22:21:26
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15131/source/melee Modified Files: mframe.cpp mframe.h mship.cpp mship.h mshot.cpp mshot.h mtarget.cpp Log Message: Some minor changes I made during bug-hunting. Inserted test(s). Index: mship.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mship.h 21 Aug 2005 13:56:40 -0000 1.24 --- mship.h 23 Aug 2005 22:21:16 -0000 1.25 *************** *** 41,44 **** --- 41,45 ---- int phaser_steps; int phaser_step_size; + int count_delay_iterations; // for debug/error testing public: *************** *** 118,121 **** --- 119,124 ---- virtual void materialize(); + virtual void handle_phasing(); + double crew; double crew_max; Index: mtarget.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mtarget.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mtarget.cpp 24 Mar 2004 23:51:39 -0000 1.2 --- mtarget.cpp 23 Aug 2005 22:21:16 -0000 1.3 *************** *** 71,74 **** --- 71,84 ---- } } + + #ifdef _DEBUG + for (i = 0; i < N; i += 1) + { + if (!item[i]->exists()) + { + tw_error("target item does not exist, should not happen"); + } + } + #endif } Index: mshot.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshot.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** mshot.cpp 14 Aug 2005 16:14:32 -0000 1.20 --- mshot.cpp 23 Aug 2005 22:21:16 -0000 1.21 *************** *** 310,322 **** ! void Laser::calculate() { if((frame < frame_count) && (lpos->exists())) { pos = lpos->normal_pos() + rotate(rel_pos, lpos->get_angle() - PI/2); vel = lpos->get_vel(); if (sinc_angle) angle = normalize(lpos->get_angle() + relative_angle, PI2); ! SpaceLine::calculate(); frame += frame_time; } ! else state = 0; return; } --- 310,327 ---- ! void Laser::calculate() ! { ! SpaceLine::calculate(); ! if((frame < frame_count) && (lpos->exists())) { pos = lpos->normal_pos() + rotate(rel_pos, lpos->get_angle() - PI/2); vel = lpos->get_vel(); if (sinc_angle) angle = normalize(lpos->get_angle() + relative_angle, PI2); ! //SpaceLine::calculate(); frame += frame_time; } ! else ! state = 0; ! return; } *************** *** 345,349 **** double alpha; alpha = (lpos->get_angle()); ! Laser::calculate(); if (target) { if (target->exists() && canCollide(target) && target->canCollide(this)) { --- 350,355 ---- double alpha; alpha = (lpos->get_angle()); ! ! if (target) { if (target->exists() && canCollide(target) && target->canCollide(this)) { *************** *** 354,357 **** --- 360,366 ---- if (!target->exists()) target = NULL; } + + Laser::calculate(); + return; } Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** mship.cpp 21 Aug 2005 13:56:40 -0000 1.40 --- mship.cpp 23 Aug 2005 22:21:16 -0000 1.41 *************** *** 492,495 **** --- 492,510 ---- last_override_control = 0; } + + #ifdef _DEBUG + // error check: + if (physics) + { + if (control && control->exists() && (control->ship == this) ) + { + tw_error("Ship is deleted, but the control owned by the ship still exists!"); + } + + if (control) + control->ship = 0; + } + #endif + } *************** *** 538,541 **** --- 553,557 ---- {STACKTRACE + //added by Tau - start if (exists() && death_counter >= 0) { *************** *** 599,604 **** --- 615,630 ---- //added by Tau - end + if (control) { + /* + #ifdef _DEBUG + if (exists() && (control->ship != this) && (control->ship != ship)) + { + tw_error("Control has the wrong ship..."); + } + #endif + */ + // it makes most sense, to place this in FRONT of these commands here ... nextkeys = control->keys; *************** *** 807,810 **** --- 833,837 ---- calculate_index(); + // hotspots are too much a luxury to include in massive games (lots of objects) if (hashotspots) *************** *** 900,906 **** } ! void Ship::materialize() { } void Ship::assigntarget(SpaceObject *otarget) --- 927,940 ---- } ! void Ship::materialize() ! { ! // nothing } + void Ship::handle_phasing() + { + // keeps track of the default pointers (target) + SpaceObject::calculate(); + } void Ship::assigntarget(SpaceObject *otarget) *************** *** 1079,1083 **** Ship *ship, SpaceSprite *sprite, int osprite_index, int *ocolors, int onum_colors, int ofsize, int steps, int step_size) : ! SpaceObject(creator, opos, 0.0, sprite), rel_pos(_rpos), ship(ship), --- 1113,1117 ---- Ship *ship, SpaceSprite *sprite, int osprite_index, int *ocolors, int onum_colors, int ofsize, int steps, int step_size) : ! SpaceObject(creator, opos, 0.0, sprite), rel_pos(_rpos), ship(ship), *************** *** 1104,1107 **** --- 1138,1146 ---- sprite_index = 0; + // overwrite this... cause it's not really defined... + target = 0; + + count_delay_iterations = 0; + return; } *************** *** 1118,1121 **** --- 1157,1171 ---- STACKTRACE; + ++count_delay_iterations; + if (count_delay_iterations >= DEATH_FRAMES-3) // I'm not sure, how many you need. + { + // this is needed, because often ships have components which are created on the spot... + // these are vulnerable, and can die. Then, ship-specific pointers get invalid (objects + // are removed from memory). Thus, we need need (hackish) some time before objects are removed. + // What we really need, is a Ship::add2game() function, which creates the components when + // it's time. + tw_error("Phasing takes too long; need more time for pointer-checks!"); + } + if (!exists()) return; *************** *** 1155,1158 **** --- 1205,1214 ---- } } + + // needed to keep track of important pointers... which need to be checked each game iteration + // to see if they are still valid or not... + if (ship) + ship->handle_phasing(); + SpaceObject::calculate(); } *************** *** 1254,1257 **** bool Ship::exists() { ! return Presence::exists() && death_counter == -1; ! }; //returns 0 if dead or dying, non-zero if alive --- 1310,1313 ---- bool Ship::exists() { ! return (Presence::exists());// & (death_counter == -1); ! }; //returns 0 if dead, non-zero if alive Index: mshot.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshot.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mshot.h 24 Mar 2004 23:51:39 -0000 1.6 --- mshot.h 23 Aug 2005 22:21:16 -0000 1.7 *************** *** 7,10 **** --- 7,11 ---- class Shot : public SpaceObject { + IDENTITY(Shot); public: double v; *************** *** 41,44 **** --- 42,46 ---- class AnimatedShot : public Shot { + IDENTITY(AnimatedShot); protected: int frame_count; *************** *** 55,58 **** --- 57,61 ---- class Missile : public Shot { + IDENTITY(Missile); public: Missile(SpaceLocation *creator, Vector2 rpos, double oangle, double ov, double odamage, *************** *** 65,68 **** --- 68,72 ---- class HomingMissile : public Missile { + IDENTITY(HomingMissile); protected: double turn_rate; *************** *** 79,82 **** --- 83,87 ---- class Laser : public SpaceLine { + IDENTITY(Laser); protected: double frame; *************** *** 95,99 **** }; ! class PointLaser : public Laser { protected: --- 100,106 ---- }; ! class PointLaser : public Laser ! { ! IDENTITY(PointLaser); protected: Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mframe.h 21 Aug 2005 13:55:58 -0000 1.25 --- mframe.h 23 Aug 2005 22:21:16 -0000 1.26 *************** *** 18,21 **** --- 18,28 ---- typedef unsigned int TeamCode; + //#define DEATH_FRAMES 4 + //setting this too low will cause crashes + //setting it too high will waste CPU power and RAM + //the recommended value is 4 + #define DEATH_FRAMES 64 + // ALSO NOTE THE PHASERS... + struct Query; class Planet; *************** *** 182,188 **** --- 189,201 ---- }; + /** used in debug-mode, to see if physics functions are called outside of physics... */ + extern bool physics_allowed; + + #define IDENTITY(x) virtual const char *get_identity(){return #x;}; class Presence : public BaseClass { friend class Physics; + public: + IDENTITY(Presence); public: *************** *** 203,207 **** virtual void animate_predict(Frame *space, int time); //like animate, but attempts to predict the future virtual void calculate(); //advance the item frame_time milliseconds in time ! virtual bool exists() {return state > 0;}; //returns 0 if dead or dying, non-zero if alive Presence(); virtual ~Presence(); // called when a presence is deallocated --- 216,220 ---- virtual void animate_predict(Frame *space, int time); //like animate, but attempts to predict the future virtual void calculate(); //advance the item frame_time milliseconds in time ! virtual bool exists();// {return state > 0;}; //returns 0 if dead or dying, non-zero if alive Presence(); virtual ~Presence(); // called when a presence is deallocated *************** *** 225,229 **** }; - #define IDENTITY(x) virtual const char *get_identity(){return #x;}; class SpaceLocation : public Presence { // base class for all items in game --- 238,241 ---- Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** mframe.cpp 21 Aug 2005 13:55:58 -0000 1.40 --- mframe.cpp 23 Aug 2005 22:21:16 -0000 1.41 *************** *** 22,25 **** --- 22,28 ---- #include "melee/mnet1.h" + + bool physics_allowed = true; + int total_presences; *************** *** 28,36 **** //setting it too high will waste RAM - #define DEATH_FRAMES 4 - //setting this too low will cause crashes - //setting it too high will waste CPU power and RAM - //the recommended value is 4 - #define QUADS_X 8 #define QUADS_Y 8 --- 31,34 ---- *************** *** 60,63 **** --- 58,65 ---- void Query::begin (SpaceLocation *qtarget, int qlayers, double qrange) {STACKTRACE + + bool old_physics_allows = physics_allowed; + physics_allowed = true; + if (qrange < 0) {tw_error("Query::begin - negative range");} layers = qlayers; *************** *** 86,95 **** current = physics->quadrant[qy * QUADS_X + qx]; if (!current) next_quadrant(); ! if (!current) return; ! if (current_invalid()) next(); return; } ! void Query::begin (SpaceLocation *qtarget, Vector2 center, int qlayers, double qrange) {STACKTRACE layers = qlayers; range_sqr = qrange * qrange; --- 88,109 ---- current = physics->quadrant[qy * QUADS_X + qx]; if (!current) next_quadrant(); ! ! if (current) ! { ! if (current_invalid()) ! next(); ! } ! ! physics_allowed = old_physics_allows; return; } ! void Query::begin (SpaceLocation *qtarget, Vector2 center, int qlayers, double qrange) ! { ! STACKTRACE; ! ! bool old_physics_allows = physics_allowed; ! physics_allowed = true; ! layers = qlayers; range_sqr = qrange * qrange; *************** *** 123,128 **** current = physics->quadrant[qy * QUADS_X + qx]; if (!current) next_quadrant(); ! if (!current) return; ! if (current_invalid()) next(); return; } --- 137,147 ---- current = physics->quadrant[qy * QUADS_X + qx]; if (!current) next_quadrant(); ! ! if (current) ! { ! if (current_invalid()) ! next(); ! } ! physics_allowed = old_physics_allows; return; } *************** *** 151,159 **** current = physics->quadrant[tmp]; if (!current) goto tail_recurse4; return; } ! void Query::next () {STACKTRACE tail_recurse3: if (current == current->qnext) {tw_error ("Query::next - current = next");} current = current->qnext; --- 170,185 ---- current = physics->quadrant[tmp]; if (!current) goto tail_recurse4; + return; } ! void Query::next () ! { ! STACKTRACE; ! bool old_physics_allows = physics_allowed; ! physics_allowed = true; ! tail_recurse3: + if (current == current->qnext) {tw_error ("Query::next - current = next");} current = current->qnext; *************** *** 162,166 **** if (!current) return; } ! if (current_invalid()) goto tail_recurse3; return; } --- 188,195 ---- if (!current) return; } ! if (current_invalid()) ! goto tail_recurse3; ! ! physics_allowed = old_physics_allows; return; } *************** *** 308,311 **** --- 337,351 ---- void Presence::calculate() {STACKTRACE } + bool Presence::exists() + { + #ifdef _DEBUG + if (!physics_allowed) + tw_error("Accessing exists() in [%s] but animations are not allowed to mess with physics!!", + get_identity()); + #endif + //returns 0 if dead or dying, non-zero if alive + return state > 0; + }; + bool Presence::die() {STACKTRACE if (!exists()) *************** *** 380,384 **** --- 420,429 ---- if (data) data->lock(); + target = creator->target; + + if (target && !target->exists()) + target = 0; + } else { *************** *** 392,400 **** ! SpaceLocation::~SpaceLocation() {STACKTRACE if (data) data->unlock(); } bool SpaceLocation::change_owner(SpaceLocation *new_owner) {STACKTRACE if (new_owner) { --- 437,483 ---- ! SpaceLocation::~SpaceLocation() ! { ! STACKTRACE if (data) data->unlock(); + #ifdef _DEBUG + int i; + + if (physics) + { + // also check the target list + for ( i = 0; i < targets->N; ++i) + { + if (targets->item[i] == this) + { + tw_error("Trying to remove a ship that is still in the target list! Should not happen."); + } + } + + // check if it's still in the physics list... which shouldn't be the case + for ( i = 0; i < physics->num_items; ++i) + { + if (physics->item[i]->exists()) + { + if (physics->item[i] == this) + { + tw_error("Trying to remove a ship that is still in the physics list! Should not happen."); + } + if (physics->item[i]->target == this) + { + tw_error("Trying to remove a possible target [%s] for [%s]! Should not happen.", + get_identity(), physics->item[i]->get_identity()); + } + } + } } + + + #endif + + } + bool SpaceLocation::change_owner(SpaceLocation *new_owner) {STACKTRACE if (new_owner) { *************** *** 576,579 **** --- 659,668 ---- int SpaceLocation::translate( Vector2 delta) {STACKTRACE pos = normalize ( pos + delta, map_size ); + #ifdef _DEBUG + if (fabs(pos.x) > 1E9 || fabs(pos.y) > 1E9) + { + tw_error("translate: position overflow..."); + } + #endif return true; } *************** *** 602,605 **** --- 691,700 ---- vel = nv * ovm / (ovm + velocity); } + #ifdef _DEBUG + if (fabs(vel.x) > 1E6 || fabs(vel.y) > 1E6) + { + tw_error("accelerate: velocity overflow..."); + } + #endif return; } *************** *** 623,626 **** --- 718,727 ---- vel = nv * ovm / (ovm + magnitude(delta_v)); } + #ifdef _DEBUG + if (fabs(vel.x) > 1E6 || fabs(vel.y) > 1E6) + { + tw_error("accelerate: velocity overflow..."); + } + #endif return; } *************** *** 1138,1141 **** --- 1239,1244 ---- } + extern void test_pointers(); + void Physics::calculate() {_STACKTRACE("Physics::calculate()") int i; *************** *** 1145,1148 **** --- 1248,1253 ---- game_time += frame_time; + //test_pointers(); + //prepare global variables prepare(); *************** *** 1150,1153 **** --- 1255,1259 ---- debug_value = num_items + num_presences; + //test_pointers(); checksync(); *************** *** 1162,1173 **** checksync(); {_STACKTRACE("Physics::calculate() - presence calculation") //call Presence calculate functions for (i = 0; i < num_presences; i += 1) { ! if (presence[i]->exists()) presence[i]->calculate(); checksync(); } } //call objects calculate functions --- 1268,1282 ---- checksync(); + test_pointers(); {_STACKTRACE("Physics::calculate() - presence calculation") //call Presence calculate functions for (i = 0; i < num_presences; i += 1) { ! if (presence[i]->exists()) ! presence[i]->calculate(); checksync(); } } + //test_pointers(); //call objects calculate functions *************** *** 1181,1218 **** tw_error("Pointer error, overwritten data ??"); } item[i]->calculate(); if (item[i]->ship && item[i]->ship < (void*)0x01000) { tw_error("Pointer error, overwritten data ??"); } ! } ! ! ! /* ! #ifdef _DEBUG ! // check all velocities and such (costly check... only do this in debug mode.) ! int j; ! for (j = 0; j < num_items; j += 1) ! { ! if (fabs(item[j]->vel.x) > 1E6 || fabs(item[j]->vel.y) > 1E6 ) { ! int k; ! if (j > 0) ! k = j-1; ! else ! k = num_items - 1; ! ! tw_error("velocity error in %s, probably due to %s", item[j]->get_identity(), ! item[k]->get_identity()); } } ! #endif ! */ checksync(); } } //prepare quadrants stuff --- 1290,1319 ---- tw_error("Pointer error, overwritten data ??"); } + //test_pointers(); item[i]->calculate(); + //test_pointers(); + // try to intercept a couple of errors that are possible here ... if (item[i]->ship && item[i]->ship < (void*)0x01000) { tw_error("Pointer error, overwritten data ??"); } ! if (item[i]->target && (item[i]->target->state < -1)) // if it's dead for too long... { ! tw_error("Target pointer isn't cleaned up in [%s]", item[i]->get_identity()); ! } ! if (item[i]->ship && item[i]->ship->state < -1) ! { ! tw_error("Ship pointer isn't cleaned up in [%s]", item[i]->get_identity()); } } ! ! checksync(); } } + //test_pointers(); //prepare quadrants stuff *************** *** 1239,1242 **** --- 1340,1344 ---- collide(); } + //test_pointers(); checksync(); *************** *** 1263,1266 **** --- 1365,1369 ---- } } + //test_pointers(); checksync(); *************** *** 1299,1302 **** --- 1402,1406 ---- } checksync(); + //test_pointers(); //remove dead listings *************** *** 1324,1331 **** --- 1428,1445 ---- } static Presence *animate_buffer[ANIMATE_BUFFER_SIZE]; + static double game_frame_rate = 0.0; + static double game_animation_time = 0.0; void Physics::animate (Frame *frame) {STACKTRACE int i, j; + + #ifdef _DEBUG + game_frame_rate = 0.1 * game_frame_rate + 0.9 * (get_time() - game_animation_time); + game_animation_time = get_time(); + message.print(1, 15, "frame rate = %i ms", int(game_frame_rate)); + #endif + + ::render_time = this->game_time; *************** *** 1349,1352 **** --- 1463,1467 ---- int time = get_time(); + for (i = 0; i < j; i += 1) { *************** *** 1365,1369 **** --- 1480,1486 ---- } + physics_allowed = false; animate_buffer[i]->animate(frame); + physics_allowed = true; } *************** *** 1397,1400 **** --- 1514,1518 ---- } + return; } |
From: Rob <geo...@us...> - 2005-08-23 22:20:23
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14894/source/melee Modified Files: manim.cpp mcontrol.cpp mcontrol.h Log Message: control target bug-fix Index: mcontrol.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mcontrol.h 8 Aug 2005 14:33:57 -0000 1.13 --- mcontrol.h 23 Aug 2005 22:20:16 -0000 1.14 *************** *** 31,34 **** --- 31,38 ---- /*! \brief points at the current ship being controlled */ Ship *ship; + + Ship *original_ship; + int lifetime; + /*! \brief keys currently pressed */ KeyCode keys; Index: manim.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/manim.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** manim.cpp 6 Aug 2005 23:31:00 -0000 1.13 --- manim.cpp 23 Aug 2005 22:20:16 -0000 1.14 *************** *** 111,115 **** { pos = follow->normal_pos(); - Animation::calculate(); } else --- 111,114 ---- *************** *** 118,121 **** --- 117,122 ---- follow = NULL; } + + Animation::calculate(); } Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mcontrol.cpp 16 Aug 2005 18:17:29 -0000 1.28 --- mcontrol.cpp 23 Aug 2005 22:20:16 -0000 1.29 *************** *** 113,116 **** --- 113,120 ---- } target_stuff() ; + + original_ship = ship; + lifetime = 0; + return; } *************** *** 308,311 **** --- 312,322 ---- change: done: + if (target) + { + if (index < 0 || index > targets->N) + { + tw_error("Target index is out of range."); + } + } return; } *************** *** 346,366 **** return; ! if (auto_update) ! keys = think(); ! target_stuff(); - if (ship) { - if (!ship->exists() || (ship->death_counter != -1)) { //message.print(5000, 12, "Ship died in frame %d", game->frame_number); ! select_ship( NULL, NULL); } - //else keys = think(); // <--- goes into the gen_buffered_data !! } ! if (!ship) { ! //keys = 0; // <--- goes into the gen_buffered_data !! ! if (temporary) state = 0; ! } if (channel != channel_none) { --- 357,400 ---- return; ! if (ship && ship->control != this) ! { ! tw_error("error in control reference..."); ! } else ! ++ lifetime; ! if (ship) ! { ! if (!ship->exists()) ! { ! ! //keys = 0; // <--- goes into the gen_buffered_data !! ! if (temporary) ! { ! state = 0; // this control dies ! ship->control = 0; // the ship should know. ! select_ship( 0, 0); ! return; ! } //message.print(5000, 12, "Ship died in frame %d", game->frame_number); ! select_ship( 0, 0); ! ! if (ship != 0) ! { ! tw_error("control: ship should be zero now."); } } + //else keys = think(); // <--- goes into the gen_buffered_data !! + } + + if (target && !target->exists()) + { + target = 0; + } ! if (auto_update) ! keys = think(); ! ! target_stuff(); if (channel != channel_none) { *************** *** 463,472 **** cyborg = 0; cyborg_control = false; } ! Control::~Control() { STACKTRACE; if (_prediction_keys) delete[] _prediction_keys; ! } bool Control::die() { --- 497,515 ---- cyborg = 0; cyborg_control = false; + + original_ship = 0; + lifetime = 0; } ! Control::~Control() ! { ! STACKTRACE; if (_prediction_keys) delete[] _prediction_keys; ! ! if (ship) ! ship->control = 0; ! } ! bool Control::die() { |
From: Rob <geo...@us...> - 2005-08-23 22:19:17
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14650/source/melee Modified Files: mshpdata.cpp msprite.cpp Log Message: shipdata / spacesprite upgrades Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** msprite.cpp 21 Aug 2005 13:55:29 -0000 1.24 --- msprite.cpp 23 Aug 2005 22:19:09 -0000 1.25 *************** *** 808,813 **** bmp1 = get_bitmap(index1); bmp2 = get_bitmap(index2); ! for(y = 0; y < h; y += 1) { ! for(x = 0; x < w; x += 1) { if (getpixel(bmp1, x, y) != getpixel(bmp2, x, y)) { putpixel(dest, x, y, getpixel(bmp2, x, y)); --- 808,817 ---- bmp1 = get_bitmap(index1); bmp2 = get_bitmap(index2); ! if ((bmp1->w != bmp2->w) || (bmp1->h != bmp2->h)) ! { ! tw_error("Overlay: trying to match bitmaps of different sizes."); ! } ! for(y = 0; y < bmp1->h; y += 1) { ! for(x = 0; x < bmp1->w; x += 1) { if (getpixel(bmp1, x, y) != getpixel(bmp2, x, y)) { putpixel(dest, x, y, getpixel(bmp2, x, y)); *************** *** 865,870 **** iw = iround_up(size.x); ih = iround_up(size.y); ! aa_stretch_blit(bmp, surface, 0, 0, bmp->w, bmp->h, ! ix, iy, iw, ih); } return; --- 869,880 ---- iw = iround_up(size.x); ih = iround_up(size.y); ! if (tw_aa_mode & AA_NO_AA) ! { ! masked_stretch_blit(bmp, surface, 0, 0, bmp->w, bmp->h, ! ix, iy, iw, ih); ! } else { ! aa_stretch_blit(bmp, surface, 0, 0, bmp->w, bmp->h, ! ix, iy, iw, ih); ! } } return; *************** *** 906,911 **** iw = iround(size.x); ih = iround(size.y); ! aa_stretch_blit(bmp, frame->surface, 0,0,bmp->w,bmp->h, ! ix, iy, iw, ih); } frame->add_box(ix, iy, iw, ih); --- 916,927 ---- iw = iround(size.x); ih = iround(size.y); ! if (tw_aa_mode & AA_NO_AA) ! { ! masked_stretch_blit(bmp, frame->surface, 0,0,bmp->w,bmp->h, ! ix, iy, iw, ih); ! } else { ! aa_stretch_blit(bmp, frame->surface, 0,0,bmp->w,bmp->h, ! ix, iy, iw, ih); ! } } frame->add_box(ix, iy, iw, ih); Index: mshpdata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshpdata.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mshpdata.cpp 17 Aug 2005 23:50:54 -0000 1.11 --- mshpdata.cpp 23 Aug 2005 22:19:09 -0000 1.12 *************** *** 19,22 **** --- 19,24 ---- #include "../util/aastr.h" + #include "mship.h" + #include "mtarget.h" *************** *** 24,27 **** --- 26,54 ---- + // for debugging ... + void test_pointers() + { + // also check the target list + int i; + for ( i = 0; i < targets->N; ++i) + { + targets->item[i]->exists(); + } + + // check if it's still in the physics list... which shouldn't be the case + for ( i = 0; i < physics->num_items; ++i) + { + if (physics->item[i]->exists()) + { + if (physics->item[i]->target) + physics->item[i]->target->exists(); + + if (physics->item[i]->ship) + physics->item[i]->ship->exists(); + } + } + } + + /*------------------------------* * Ship Data Registration * *************** *** 206,209 **** --- 233,237 ---- void ShipData::unload() { + //test_pointers(); if (status != LOADED_FULL) return; *************** *** 211,244 **** if (spritePanel) { delete spritePanel; ! spritePanel = NULL; } if (spriteShip) { delete spriteShip; ! spriteShip = NULL; } if (spriteWeapon) { delete spriteWeapon; ! spriteWeapon = NULL; } if (spriteWeaponExplosion) { delete spriteWeaponExplosion; ! spriteWeaponExplosion = NULL; } if (spriteSpecial) { delete spriteSpecial; ! spriteSpecial = NULL; } if (spriteSpecialExplosion) { delete spriteSpecialExplosion; ! spriteSpecialExplosion = NULL; } if (spriteExtra) { delete spriteExtra; ! spriteExtra = NULL; } if (spriteExtraExplosion) { delete spriteExtraExplosion; ! spriteExtraExplosion = NULL; } --- 239,272 ---- if (spritePanel) { delete spritePanel; ! spritePanel = 0; } if (spriteShip) { delete spriteShip; ! spriteShip = 0; } if (spriteWeapon) { delete spriteWeapon; ! spriteWeapon = 0; } if (spriteWeaponExplosion) { delete spriteWeaponExplosion; ! spriteWeaponExplosion = 0; } if (spriteSpecial) { delete spriteSpecial; ! spriteSpecial = 0; } if (spriteSpecialExplosion) { delete spriteSpecialExplosion; ! spriteSpecialExplosion = 0; } if (spriteExtra) { delete spriteExtra; ! spriteExtra = 0; } if (spriteExtraExplosion) { delete spriteExtraExplosion; ! spriteExtraExplosion = 0; } *************** *** 260,295 **** // 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; status = LOADED_NONE; /* num_weapon_samples0), sampleWeapon(NULL), --- 288,350 ---- // these were created with the "new" command --> use delete // also, the wave data are kept in memory... you've to remove those data ! if (data) { ! unload_datafile(data); ! data = 0; ! } else { ! int i; ! if (sampleWeapon) ! { ! for( i = 0; i < num_weapon_samples; ++i ) ! { ! if (sampleWeapon[i]) ! destroy_sample(sampleWeapon[i]); ! } ! } ! ! if (sampleSpecial) ! { ! for( i = 0; i < num_special_samples; ++i ) ! { ! if (sampleSpecial[i]) ! destroy_sample(sampleSpecial[i]); ! } ! } ! ! if (sampleExtra) ! { ! for( i = 0; i < num_extra_samples; ++i ) ! { ! if (sampleExtra[i]) ! destroy_sample(sampleExtra[i]); ! } ! } ! if (moduleVictory) ! { ! destroy_mod(moduleVictory); ! //moduleVictory = 0; ! } } + if (sampleWeapon) + delete [] sampleWeapon; + if (sampleSpecial) + delete [] sampleSpecial; + if (sampleExtra) + delete [] sampleExtra; + + sampleWeapon = 0; + sampleSpecial = 0; + sampleExtra = 0; + moduleVictory = 0; shipdatas_loaded -= 1; status = LOADED_NONE; + //test_pointers(); + /* num_weapon_samples0), sampleWeapon(NULL), *************** *** 488,495 **** void ShipData::load() { int i, index = 0, count; ! if (status != LOADED_NONE) return; data = load_datafile(file); --- 543,551 ---- void ShipData::load() { + //test_pointers(); int i, index = 0, count; ! // if (status != LOADED_NONE) return; data = load_datafile(file); *************** *** 546,549 **** --- 602,607 ---- // initialize ship victory ditty + + //moduleVictory = (JGMOD*)data[index].dat; moduleVictory = copy_jgmod((JGMOD*)data[index].dat);//(Music *) copy_data(data[index].dat, data[index].size); index++; *************** *** 605,608 **** --- 663,668 ---- //sound.play_music(moduleVictory); + //test_pointers(); + return; |
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14367/source/newships Modified Files: shparkpi.cpp shpclofl.cpp shpearc3.cpp shpgerhe.cpp shphotsp.cpp shphydcr.cpp shpilwsp.cpp shpjnkla.cpp shpkabwe.cpp shpmoisp.cpp shpneodr.cpp shpoliha.cpp shpplane.cpp shpquasi.cpp shpraame.cpp shpsclfr.cpp shptauar.cpp shptaubo.cpp shptaule.cpp shptausl.cpp shpterbi.cpp shpyevme.cpp shpyusra.cpp Log Message: A few ship fixes, but also some minor changes made during debugging. Index: shphotsp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphotsp.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shphotsp.cpp 11 Jul 2005 00:25:31 -0000 1.13 --- shphotsp.cpp 23 Aug 2005 22:18:11 -0000 1.14 *************** *** 332,336 **** data->spriteWeapon->animate(pos-Vlens, sprite_index, frame); ! if ( weaponhs && weaponhs->exists() ) data->spriteWeapon->animate(pos-Vflame, sprite_index+64, frame); --- 332,336 ---- data->spriteWeapon->animate(pos-Vlens, sprite_index, frame); ! if ( weaponhs ) data->spriteWeapon->animate(pos-Vflame, sprite_index+64, frame); *************** *** 485,488 **** --- 485,491 ---- hidefromview = 0; + // call this for pointer cleanup. + SpaceObject::calculate(); + // check which graphic to use: //if ( normalhotspot ) Index: shpgerhe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgerhe.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** shpgerhe.cpp 14 Aug 2005 16:14:32 -0000 1.21 --- shpgerhe.cpp 23 Aug 2005 22:18:11 -0000 1.22 *************** *** 172,176 **** void GerlVirtualship::calculate() { ! STACKTRACE if ( crew == 0 ) // this value is manipulated by the moronship and the heroship --- 172,181 ---- void GerlVirtualship::calculate() { ! STACKTRACE; ! ! if (!(hero && hero->exists())) ! { ! hero = 0; ! } if ( crew == 0 ) // this value is manipulated by the moronship and the heroship Index: shpkabwe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkabwe.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpkabwe.cpp 2 Aug 2005 00:23:46 -0000 1.17 --- shpkabwe.cpp 23 Aug 2005 22:18:11 -0000 1.18 *************** *** 715,723 **** */ ! if (!host || !host->exists()) return; ! if ( state == 0 ) ! return; // the host can die in-between calculate and animate, therefore I use this; it's --- 715,723 ---- */ ! if (!host) return; ! //if ( state == 0 ) ! // return; // the host can die in-between calculate and animate, therefore I use this; it's Index: shptaule.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaule.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** shptaule.cpp 14 Aug 2005 16:14:32 -0000 1.21 --- shptaule.cpp 23 Aug 2005 22:18:11 -0000 1.22 *************** *** 545,551 **** } ! if (!ship->exists()) { ! state = 0; } --- 545,551 ---- } ! if (!(ship && ship->exists()) ) { ! die(); } Index: shpraame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpraame.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpraame.cpp 14 Aug 2005 16:14:32 -0000 1.19 --- shpraame.cpp 23 Aug 2005 22:18:11 -0000 1.20 *************** *** 320,323 **** --- 320,325 ---- int chance; + SpaceObject::calculate(); + if (!(oship && oship->exists())) { oship = 0; Index: shpterbi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpterbi.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpterbi.cpp 11 Jul 2005 00:25:32 -0000 1.8 --- shpterbi.cpp 23 Aug 2005 22:18:11 -0000 1.9 *************** *** 8,12 **** //#define TERON_COLLISION_FORWARDING ! #define TERON_TURRET_CONTROLLABLE #define TERON_SHIPS_TARGETABLE --- 8,12 ---- //#define TERON_COLLISION_FORWARDING ! //#define TERON_TURRET_CONTROLLABLE #define TERON_SHIPS_TARGETABLE *************** *** 291,294 **** --- 291,295 ---- public: IDENTITY(TeronTurret); + /* #ifdef TERON_TURRET_CONTROLLABLE TeronBuilder* docked; *************** *** 298,301 **** --- 299,303 ---- Control* orig_control; #endif + */ SpaceObject* base; *************** *** 784,794 **** weaponRange = creator->droneWeaponRange; ! control = new TeronDroneController( "Teron Drone", channel_none ); //control->load( "scp.ini", "Config0" ); ! game->add( control ); ! control->temporary = true; ! control->select_ship( this, "terbi" ); ! ((ControlWussie*)control)->option_velocity[0][0] = scale_velocity( 999 ); ! ((ControlWussie*)control)->option_range[0][0] = weaponRange; } --- 786,801 ---- weaponRange = creator->droneWeaponRange; ! TeronDroneController *c = new TeronDroneController( "Teron Drone", channel_none ); //control->load( "scp.ini", "Config0" ); ! game->add( c ); ! c->select_ship( this, "terbi" ); ! c->temporary = true; ! ((ControlWussie*)c)->option_velocity[0][0] = scale_velocity( 999 ); ! ((ControlWussie*)c)->option_range[0][0] = weaponRange; ! ! if (control->ship != this || control != c) ! { ! tw_error("incorrect control initialization"); ! } } *************** *** 909,912 **** --- 916,926 ---- void TeronDrone::calculate() { + if (!exists()) + { + Ship::calculate(); + return; + } + + /* if (death_counter != -1) // check used by control. { *************** *** 915,918 **** --- 929,934 ---- return; } + */ + if (control && !control->exists()) *************** *** 928,931 **** --- 944,950 ---- } + if (control) + { + // execute the cpu ai. *************** *** 934,937 **** --- 953,957 ---- // do not allow the AI to pick a target, only the Drones subroutines can do that control->keys &= ~(keyflag::next | keyflag::prev | keyflag::closest); + } nextkeys &= ~keyflag::next; *************** *** 1064,1074 **** weaponArmour = creator->fighterWeaponArmour; ! control = new TeronShipController( "Teron Fighter", channel_none ); //control->load( "scp.ini", "Config0" ); ! game->add( control ); ! control->temporary = true; ! control->select_ship( this, "terbi" ); ! ((ControlWussie*)control)->option_velocity[0][0] = weaponVelocity; ! ((ControlWussie*)control)->option_range[0][0] = weaponRange; } --- 1084,1100 ---- weaponArmour = creator->fighterWeaponArmour; ! TeronShipController *c; ! c = new TeronShipController( "Teron Fighter", channel_none ); //control->load( "scp.ini", "Config0" ); ! game->add( c ); ! c->temporary = true; ! c->select_ship( this, "terbi" ); ! ((ControlWussie*)c)->option_velocity[0][0] = weaponVelocity; ! ((ControlWussie*)c)->option_range[0][0] = weaponRange; ! ! if (control->ship != this || control != c) ! { ! tw_error("incorrect control initialization"); ! } } *************** *** 1102,1107 **** TeronTurret::TeronTurret( TeronBuilder *creator, Vector2 opos, double shipAngle, SpaceSprite *osprite ): ! Ship( creator, opos, shipAngle, osprite ), ! dock_counter( 0 ){ set_depth( (double)LAYER_SHIPS + 0.01 ); --- 1128,1134 ---- TeronTurret::TeronTurret( TeronBuilder *creator, Vector2 opos, double shipAngle, SpaceSprite *osprite ): ! Ship( creator, opos, shipAngle, osprite ) ! //dock_counter( 0 ) ! { set_depth( (double)LAYER_SHIPS + 0.01 ); *************** *** 1134,1146 **** weaponArmour = creator->turretWeaponArmour; ! control = new TeronShipController( "Teron Turret", channel_none ); ! control->load( "scp.ini", "Config0" ); ! game->add( control ); ! control->temporary = true; ! control->select_ship( this, "terbi" ); ! ((ControlWussie*)control)->option_velocity[0][0] = weaponVelocity; ! ((ControlWussie*)control)->option_range[0][0] = weaponRange; ! docked = 0; } --- 1161,1178 ---- weaponArmour = creator->turretWeaponArmour; ! TeronShipController *c; ! c = new TeronShipController( "Teron Turret", channel_none ); ! c->load( "scp.ini", "Config0" ); ! game->add( c ); ! c->temporary = true; ! c->select_ship( this, "terbi" ); ! ((ControlWussie*)c)->option_velocity[0][0] = weaponVelocity; ! ((ControlWussie*)c)->option_range[0][0] = weaponRange; ! if (control->ship != this || control != c) ! { ! tw_error("incorrect control initialization"); ! } ! // docked = 0; } *************** *** 1157,1160 **** --- 1189,1193 ---- int TeronTurret::activate_special(){ + /* #ifdef TERON_TURRET_CONTROLLABLE if( docked ){ *************** *** 1182,1185 **** --- 1215,1219 ---- } #endif + */ return false; } *************** *** 1187,1190 **** --- 1221,1230 ---- void TeronTurret::calculate() { + if (!exists()) + { + Ship::calculate(); + return; + } + if (target && !target->exists()) target = 0; *************** *** 1200,1203 **** --- 1240,1244 ---- //base->y = y; base->pos = pos; + /* #ifdef TERON_TURRET_CONTROLLABLE if( dock_counter > 0 ) dock_counter -= frame_time; *************** *** 1215,1218 **** --- 1256,1260 ---- } #endif + */ } *************** *** 1234,1237 **** --- 1276,1281 ---- void TeronTurret::inflict_damage( SpaceObject* other ){ SpaceObject::inflict_damage( other ); + + /* geo- okay, this code crashes (control pointer) and it's not useful #ifdef TERON_TURRET_CONTROLLABLE if( other == ship && !dock_counter ){ *************** *** 1258,1261 **** --- 1302,1306 ---- } #endif + */ } *************** *** 1276,1285 **** ship = creator; sprite_index = TERON_TURRET_BASE_INDEX; #ifdef TERON_TURRET_CONTROLLABLE collide_flag_anyone = collide_flag_sameteam = ALL_LAYERS; collide_flag_sameship = ALL_LAYERS & ~bit(LAYER_SHIPS); #else collide_flag_anyone = collide_flag_sameteam = collide_flag_sameship = ALL_LAYERS; ! #endif mass = creator->mass; layer = LAYER_SHIPS; --- 1321,1332 ---- ship = creator; sprite_index = TERON_TURRET_BASE_INDEX; + /* #ifdef TERON_TURRET_CONTROLLABLE collide_flag_anyone = collide_flag_sameteam = ALL_LAYERS; collide_flag_sameship = ALL_LAYERS & ~bit(LAYER_SHIPS); #else + */ collide_flag_anyone = collide_flag_sameteam = collide_flag_sameship = ALL_LAYERS; ! //#endif mass = creator->mass; layer = LAYER_SHIPS; *************** *** 1353,1357 **** sprite_index = index_zero; state = 0; ! delete new_ship; new_ship = NULL; } --- 1400,1407 ---- sprite_index = index_zero; state = 0; ! ! new_ship->control->die(); // the control of the ship was already added to physics ! delete new_ship; // fine, this wasn't added to physics yet. ! new_ship = NULL; } *************** *** 1377,1382 **** if( new_ship ){ sprite_index = index_zero; ! delete new_ship; ! new_ship = NULL; } } --- 1427,1435 ---- if( new_ship ){ sprite_index = index_zero; ! ! new_ship->control->die(); // the control of the ship was already added to physics ! delete new_ship; // fine, this wasn't added to physics yet. ! ! new_ship = NULL; } } Index: shphydcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphydcr.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shphydcr.cpp 14 Aug 2005 16:14:32 -0000 1.14 --- shphydcr.cpp 23 Aug 2005 22:18:11 -0000 1.15 *************** *** 338,341 **** --- 338,344 ---- // if(creator==NULL)tw_error("creator==NULL"); //debugging code + if (!(creator && creator->exists())) + creator = 0; + } *************** *** 569,575 **** STACKTRACE if(creator) ! if(creator->exists()) { *pointerToMe=NULL; ! creator->fightersOut--; } } --- 572,582 ---- STACKTRACE if(creator) ! { ! if(creator->exists()) ! { *pointerToMe=NULL; ! creator->fightersOut--; ! } ! } } Index: shpsclfr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsclfr.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpsclfr.cpp 14 Aug 2005 16:14:32 -0000 1.13 --- shpsclfr.cpp 23 Aug 2005 22:18:11 -0000 1.14 *************** *** 134,138 **** STACKTRACE if(!Sting) return(FALSE); ! if(!Sting->exists()) return(FALSE); if(Sting->powerLevel>=specialMaxPower) return(FALSE); Sting->damage_factor++; // a kludge --- 134,142 ---- STACKTRACE if(!Sting) return(FALSE); ! if(!Sting->exists()) ! { ! Sting = 0; ! return(FALSE); ! } if(Sting->powerLevel>=specialMaxPower) return(FALSE); Sting->damage_factor++; // a kludge *************** *** 150,156 **** STACKTRACE if(fire_special && fire_weapon) fireSting(); ! if(Sting!=NULL) { Sting->resetRange(); } Ship::calculate(); } --- 154,165 ---- STACKTRACE if(fire_special && fire_weapon) fireSting(); ! if(Sting!=NULL) ! { Sting->resetRange(); + + if (!Sting->exists()) + Sting = 0; } + Ship::calculate(); } *************** *** 228,233 **** } ! void ScloreSting::calculate(void) { ! STACKTRACE int x, si; double dx, dy; --- 237,249 ---- } ! void ScloreSting::calculate(void) ! { ! STACKTRACE; ! ! if (!(creator && creator->exists())) ! { ! creator = 0; ! } ! int x, si; double dx, dy; *************** *** 244,251 **** --- 260,270 ---- this->vel = creator->vel; } + Missile::calculate(); + si = get_index(this->angle); if(!launched) si = (si + 32) % 64; sprite_index = si + (x * 64); + } *************** *** 306,309 **** --- 325,329 ---- STACKTRACE Missile::calculate(); + } Index: shpoliha.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpoliha.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpoliha.cpp 11 Jul 2005 00:25:32 -0000 1.12 --- shpoliha.cpp 23 Aug 2005 22:18:11 -0000 1.13 *************** *** 361,364 **** --- 361,365 ---- } + SpaceObject::calculate(); } Index: shpclofl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpclofl.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpclofl.cpp 11 Jul 2005 00:25:29 -0000 1.14 --- shpclofl.cpp 23 Aug 2005 22:18:11 -0000 1.15 *************** *** 684,688 **** { STACKTRACE ! Presence::calculate(); vel = 0; --- 684,688 ---- { STACKTRACE ! SpaceLocation::calculate(); vel = 0; Index: shparkpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparkpi.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shparkpi.cpp 16 Aug 2005 23:22:27 -0000 1.18 --- shparkpi.cpp 23 Aug 2005 22:18:11 -0000 1.19 *************** *** 182,187 **** --- 182,189 ---- pincerR->angleSkew = -weaponSkewAngleOpen; pincerR->pointerToMe = &pincerR; + game->add(pincerL); game->add(pincerR); + jawAngle=30; jawAngle=weaponAngleOpen; Index: shptausl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptausl.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shptausl.cpp 11 Jul 2005 00:25:32 -0000 1.6 --- shptausl.cpp 23 Aug 2005 22:18:11 -0000 1.7 *************** *** 197,200 **** --- 197,208 ---- collide_flag_anyone = collide_flag_reserve; } } + + // keep track of stuff used in animations (but which are physical) + int j; + for ( j = 0; j < max_trace_number; ++j) + { + if (tr[j] && !tr[j]->exists()) + tr[j] = 0; + } } *************** *** 228,237 **** int i,j,r,g,b; double a; ! for (i=max_trace_number; i>=0; i--) { j = (ct + i) % max_trace_number; ! if (tr[j]!=NULL) { ! if (!tr[j]->exists()) { ! tr[j] = NULL; ! continue; } a = tr[j]->lifetime / trace_lifetime; r = (int)floor(195 - a*500); --- 236,244 ---- int i,j,r,g,b; double a; ! for (i=max_trace_number; i>=0; i--) ! { j = (ct + i) % max_trace_number; ! if (tr[j]) ! { a = tr[j]->lifetime / trace_lifetime; r = (int)floor(195 - a*500); *************** *** 315,318 **** --- 322,327 ---- if ((lifetime += frame_time) >= trace_lifetime) state = 0; + + SpaceLocation::calculate(); } Index: shpilwsp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpilwsp.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpilwsp.cpp 14 Aug 2005 16:14:32 -0000 1.16 --- shpilwsp.cpp 23 Aug 2005 22:18:11 -0000 1.17 *************** *** 128,132 **** void IlwrathSpiderMine::calculate() { ! STACKTRACE double alpha = (-10 + random(21)) * ANGLE_RATIO; alpha *= randomness; --- 128,135 ---- void IlwrathSpiderMine::calculate() { ! STACKTRACE; ! ! SpaceObject::calculate(); ! double alpha = (-10 + random(21)) * ANGLE_RATIO; alpha *= randomness; Index: shpmoisp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpmoisp.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpmoisp.cpp 14 Aug 2005 16:14:32 -0000 1.14 --- shpmoisp.cpp 23 Aug 2005 22:18:11 -0000 1.15 *************** *** 198,201 **** --- 198,203 ---- if (blobreleaser) { + SpaceObject::calculate(); + Trelease -= frame_time * 1E-3; Index: shpearc3.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpearc3.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpearc3.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shpearc3.cpp 23 Aug 2005 22:18:11 -0000 1.18 *************** *** 207,212 **** { STACKTRACE; ! if (exists()) ! sprite->animate(pos, sprite_index, space); } --- 207,211 ---- { STACKTRACE; ! sprite->animate(pos, sprite_index, space); } Index: shptaubo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaubo.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shptaubo.cpp 21 Aug 2005 12:44:01 -0000 1.18 --- shptaubo.cpp 23 Aug 2005 22:18:11 -0000 1.19 *************** *** 181,185 **** void TauBomberBomb::calculate() { ! STACKTRACE if (ship && !active) if ((!ship->exists()) || (!ship->fire_weapon)) { --- 181,188 ---- void TauBomberBomb::calculate() { ! STACKTRACE; ! ! SpaceLocation::calculate(); // to clean up pointers ! if (ship && !active) if ((!ship->exists()) || (!ship->fire_weapon)) { *************** *** 395,399 **** void TauBomberJam::calculate() { ! STACKTRACE if ((lifetime -= frame_time) <= 0) { state = 0; return; } --- 398,405 ---- void TauBomberJam::calculate() { ! STACKTRACE; ! ! SpaceLocation::calculate(); // needed to clean up pointers. ! if ((lifetime -= frame_time) <= 0) { state = 0; return; } *************** *** 412,415 **** --- 418,422 ---- ((Ship*)host)->control->target = tgt; } + } Index: shpyusra.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpyusra.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpyusra.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpyusra.cpp 23 Aug 2005 22:18:11 -0000 1.19 *************** *** 138,141 **** --- 138,143 ---- STACKTRACE; + Missile::calculate(); + if (latched) { *************** *** 163,167 **** } - Missile::calculate(); if( released ) return; if( !ship ){ release(); return; } --- 165,168 ---- Index: shptauar.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptauar.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shptauar.cpp 17 Aug 2005 23:52:28 -0000 1.18 --- shptauar.cpp 23 Aug 2005 22:18:11 -0000 1.19 *************** *** 399,405 **** void TauArchonShot::animate(Frame *space) { ! STACKTRACE ! if (exists()) ! sprite->animate(pos, index_base + (int)(19.89 * d / range), space); } --- 399,404 ---- void TauArchonShot::animate(Frame *space) { ! STACKTRACE; ! sprite->animate(pos, index_base + (int)(19.89 * d / range), space); } Index: shpneodr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpneodr.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpneodr.cpp 11 Jul 2005 00:25:32 -0000 1.12 --- shpneodr.cpp 23 Aug 2005 22:18:11 -0000 1.13 *************** *** 86,90 **** void NeoDrain::calculate() { ! STACKTRACE Ship::calculate(); --- 86,90 ---- void NeoDrain::calculate() { ! STACKTRACE; Ship::calculate(); Index: shpjnkla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpjnkla.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpjnkla.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpjnkla.cpp 23 Aug 2005 22:18:11 -0000 1.19 *************** *** 287,298 **** STACKTRACE; ! if (state == 0) return; ! ! if (!(o && o->exists())) ! { ! o = 0; ! state = 0; return; - } pos = o->normal_pos(); --- 287,292 ---- STACKTRACE; ! if (state == 0) return; pos = o->normal_pos(); *************** *** 301,304 **** --- 295,305 ---- // maybe "some" routine needs to access its "ship" pointer sometime ? SpaceLocation::calculate(); + + if (!(o && o->exists())) + { + o = 0; + state = 0; + return; + } } Index: shpyevme.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpyevme.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpyevme.cpp 2 Aug 2005 00:23:48 -0000 1.18 --- shpyevme.cpp 23 Aug 2005 22:18:11 -0000 1.19 *************** *** 290,295 **** } ! void YevShield::calculate() { ! STACKTRACE if(!(ship && ship->exists())) --- 290,298 ---- } ! void YevShield::calculate() ! { ! STACKTRACE; ! ! SpaceObject::calculate(); if(!(ship && ship->exists())) Index: shpquasi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpquasi.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpquasi.cpp 2 Aug 2005 00:23:46 -0000 1.16 --- shpquasi.cpp 23 Aug 2005 22:18:11 -0000 1.17 *************** *** 105,110 **** --- 105,112 ---- } + if (twait < timedelay) { + SpaceObject::calculate(); // need this, to check for other pointers... this is used best! (target pointers) twait += frame_time * 1E-3; Index: shpplane.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpplane.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpplane.cpp 16 Aug 2005 23:21:02 -0000 1.14 --- shpplane.cpp 23 Aug 2005 22:18:11 -0000 1.15 *************** *** 345,348 **** --- 345,351 ---- } + // to clean up pointers... + SpaceLocation::calculate(); + // velocity and position are handled by the orbiter return; |
From: Rob <geo...@us...> - 2005-08-23 22:18:20
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14367/source/sc1ships Modified Files: shpkzedr.cpp shpumgdr.cpp Log Message: A few ship fixes, but also some minor changes made during debugging. Index: shpkzedr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpkzedr.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpkzedr.cpp 8 Aug 2005 14:36:43 -0000 1.13 --- shpkzedr.cpp 23 Aug 2005 22:18:11 -0000 1.14 *************** *** 202,206 **** state = 0; ! if (other->isShip()) damage(other, 1, 0); } --- 202,206 ---- state = 0; ! if (other->isShip() && other != ship) damage(other, 1, 0); } Index: shpumgdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpumgdr.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpumgdr.cpp 14 Aug 2005 16:14:50 -0000 1.19 --- shpumgdr.cpp 23 Aug 2005 22:18:11 -0000 1.20 *************** *** 169,173 **** void UmgahCone::animate(Frame* space) { // calc_base(); ! if (!umgahship || !umgahship->exists() || !umgahship->firing) return; int si = sprite_index; sprite_index += ((rand()%6) << 6); //graphics --- 169,173 ---- void UmgahCone::animate(Frame* space) { // calc_base(); ! if (!umgahship || !umgahship->firing) return; int si = sprite_index; sprite_index += ((rand()%6) << 6); //graphics |
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13012/ships Modified Files: shpbubbo.dat shpbubex.dat shpchoex.dat shpconho.dat shpgahmo.dat shpostdi.dat shpphepa.dat shpqlore.dat shprogsq.dat shpulzin.dat Log Message: updated ship graphics (by deeko and shadow) Index: shpbubbo.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpbubbo.dat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsJMzjsw and /tmp/cvs3BmGFD differ Index: shpchoex.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpchoex.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsNXeRxB and /tmp/cvsRCHuSI differ Index: shpbubex.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpbubex.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsK1B4mE and /tmp/cvsPtf4ML differ Index: shprogsq.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shprogsq.dat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsLSxyfG and /tmp/cvs6K67IN differ Index: shpgahmo.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpgahmo.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvszHa1bF and /tmp/cvsDTBrLM differ Index: shpostdi.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpostdi.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsLo5VSH and /tmp/cvsqPByBP differ Index: shpconho.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpconho.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsjzj05N and /tmp/cvsdWonUV differ Index: shpphepa.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpphepa.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsDm4EcQ and /tmp/cvs9FMi5X differ Index: shpqlore.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpqlore.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs8F3G4O and /tmp/cvsylYj0W differ Index: shpulzin.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpulzin.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsI1e1FS and /tmp/cvsQfFRE0 differ |
From: Rob <geo...@us...> - 2005-08-21 13:57:30
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32535/source/other Modified Files: shippart.cpp shippart.h Log Message: pointer/ship bug fixes Index: shippart.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/shippart.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shippart.cpp 1 Aug 2005 10:46:34 -0000 1.12 --- shippart.cpp 21 Aug 2005 13:57:20 -0000 1.13 *************** *** 240,243 **** --- 240,249 ---- } + bool BigShipPart::die() + { + // you shouldn't lose a ship part ! + return false; + } + bool BigShipPart::isdisabled() Index: shippart.h =================================================================== RCS file: /cvsroot/timewarp/source/other/shippart.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shippart.h 24 Mar 2004 23:51:43 -0000 1.10 --- shippart.h 21 Aug 2005 13:57:20 -0000 1.11 *************** *** 61,64 **** --- 61,65 ---- virtual int handle_damage(SpaceLocation *source, double normal, double direct=0); virtual void inflict_damage(SpaceObject *other); + virtual bool die(); virtual void syncpos(); |
From: Rob <geo...@us...> - 2005-08-21 13:57:30
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32535/source/newships Modified Files: shpducla.cpp shpwassu.cpp Log Message: pointer/ship bug fixes Index: shpducla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpducla.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpducla.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpducla.cpp 21 Aug 2005 13:57:20 -0000 1.19 *************** *** 136,139 **** --- 136,140 ---- virtual int handle_damage(SpaceLocation *source, double normal, double direct = 0); virtual void inflict_damage(SpaceObject *other); + virtual bool die(); virtual void ShipPart::collide(SpaceObject *other); // add minor detection part *************** *** 247,250 **** --- 248,255 ---- for ( i = 0; i < Nparts; ++i ) { + if (!partlist[i]->exists()) + { + tw_error("A ship part should not die!"); + } partlist[i]->calculate_manager(oldpos, oldvel); *************** *** 369,372 **** --- 374,382 ---- } + bool ShipPart::die() + { + // do nothing + return false; + } void ShipPart::inflict_damage(SpaceObject *other) Index: shpwassu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpwassu.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpwassu.cpp 21 Aug 2005 12:44:01 -0000 1.20 --- shpwassu.cpp 21 Aug 2005 13:57:20 -0000 1.21 *************** *** 269,294 **** Clone[0]->state = 0; memcpy(&Clone[0], &Clone[1], sizeof(WasxSuperposition*) * num_Clone); ! Clone[num_Clone] = NULL; } // these lines are made obsolete/overridden by formation routine??? if (i==0) { - // dx = normal_x() + cos((angle + 30) ) * 100; - // dy = normal_y() + sin((angle + 30) ) * 100; D = normal_pos() + 100 * unit_vector((angle + 30 * ANGLE_RATIO) ); da = angle + (PI2/64); } else { - // dx = normal_x() + cos((angle + 330) ) * 100; - // dy = normal_y() + sin((angle + 330) ) * 100; D = normal_pos() + 100 * unit_vector((angle + 330 * ANGLE_RATIO) ); da = angle - (PI2/64); } ! // upto here ! crew -= int(SpawnLifeCost); num_Clone += 1; WasxClone *tmp = new WasxClone(D,da,data ,control, this); ! // added - Geo. Clone[num_Clone-1] = tmp; --- 269,294 ---- Clone[0]->state = 0; memcpy(&Clone[0], &Clone[1], sizeof(WasxSuperposition*) * num_Clone); ! Clone[num_Clone] = 0; } // these lines are made obsolete/overridden by formation routine??? if (i==0) { D = normal_pos() + 100 * unit_vector((angle + 30 * ANGLE_RATIO) ); da = angle + (PI2/64); } else { D = normal_pos() + 100 * unit_vector((angle + 330 * ANGLE_RATIO) ); da = angle - (PI2/64); } ! ! crew -= int(SpawnLifeCost); num_Clone += 1; WasxClone *tmp = new WasxClone(D,da,data ,control, this); + if (tmp->CloneIndex != num_Clone-1) + { + tw_error("Error in clone index assignment"); + } ! // added - Geo. Why was this absent ??? Clone[num_Clone-1] = tmp; *************** *** 411,416 **** if (MotherShip->target != NULL && MotherShip->target->exists()) this->target = MotherShip->target; ! //this->CloneIndex = MotherShip->num_Clone-1; ! this->CloneIndex = MotherShip->num_Clone; this->specialArmour = MotherShip->specialArmour; --- 411,415 ---- if (MotherShip->target != NULL && MotherShip->target->exists()) this->target = MotherShip->target; ! CloneIndex = MotherShip->num_Clone - 1; this->specialArmour = MotherShip->specialArmour; *************** *** 588,601 **** fabs(distance(MotherShip)) < 50) { switch (CloneIndex) { ! case 1: // upper right RelAngle = 45 * ANGLE_RATIO; break; ! case 2: // upper left RelAngle = 315 * ANGLE_RATIO; break; ! case 3: // lower left RelAngle = 225 * ANGLE_RATIO; break; ! case 4: // lower right RelAngle = 135 * ANGLE_RATIO; break; --- 587,600 ---- fabs(distance(MotherShip)) < 50) { switch (CloneIndex) { ! case 0: // upper right RelAngle = 45 * ANGLE_RATIO; break; ! case 1: // upper left RelAngle = 315 * ANGLE_RATIO; break; ! case 2: // lower left RelAngle = 225 * ANGLE_RATIO; break; ! case 3: // lower right RelAngle = 135 * ANGLE_RATIO; break; *************** *** 662,672 **** ! for (int i = 1; i <= MotherShip->num_Clone; i += 1) { if (MotherShip->Clone[i] == this) { - MotherShip->Clone[i] = NULL; - // delete MotherShip->Clone[i];// huh ???? first set to 0, then delete ??? - // you're not allowed to delete in the first place, because that's handled by the Physics manager. MotherShip->num_Clone -= 1; --- 661,675 ---- ! for (int i = 0; i < MotherShip->num_Clone; ++i) ! { if (MotherShip->Clone[i] == this) { + if (i != CloneIndex) + { + tw_error("Clone index is not correct"); + } + + MotherShip->Clone[i] = 0; MotherShip->num_Clone -= 1; *************** *** 674,685 **** (MotherShip->num_Clone-i) * sizeof(WasxClone*)); ! MotherShip->Clone[i]->CloneIndex = i; return; ! } } ! } --- 677,695 ---- (MotherShip->num_Clone-i) * sizeof(WasxClone*)); ! int j; ! for ( j = i; j < MotherShip->num_Clone; ++j ) ! { ! MotherShip->Clone[j]->CloneIndex = j; ! } return; ! } + + } ! ! } |
From: Rob <geo...@us...> - 2005-08-21 13:56:48
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32400/source/melee Modified Files: mship.cpp mship.h Log Message: exists() function changed, to account for the DYING state of a ship Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** mship.cpp 14 Aug 2005 16:14:32 -0000 1.39 --- mship.cpp 21 Aug 2005 13:56:40 -0000 1.40 *************** *** 1252,1253 **** --- 1252,1257 ---- } + bool Ship::exists() + { + return Presence::exists() && death_counter == -1; + }; //returns 0 if dead or dying, non-zero if alive Index: mship.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mship.h 8 Aug 2005 19:08:28 -0000 1.23 --- mship.h 21 Aug 2005 13:56:40 -0000 1.24 *************** *** 111,114 **** --- 111,117 ---- int death_explosion_counter; + // yeah, this is a little complicated.. a ship can also be in a *dying* state. + virtual bool exists(); //returns 0 if dead or dying, non-zero if alive + bool hashotspots; virtual void assigntarget(SpaceObject *otarget); |
From: Rob <geo...@us...> - 2005-08-21 13:56:06
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32308/source/melee Modified Files: mframe.cpp mframe.h Log Message: extra debug info Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mframe.h 11 Jul 2005 21:57:19 -0000 1.24 --- mframe.h 21 Aug 2005 13:55:58 -0000 1.25 *************** *** 203,207 **** virtual void animate_predict(Frame *space, int time); //like animate, but attempts to predict the future virtual void calculate(); //advance the item frame_time milliseconds in time ! inline bool exists() {return state > 0;}; //returns 0 if dead, non-zero if alive Presence(); virtual ~Presence(); // called when a presence is deallocated --- 203,207 ---- virtual void animate_predict(Frame *space, int time); //like animate, but attempts to predict the future virtual void calculate(); //advance the item frame_time milliseconds in time ! virtual bool exists() {return state > 0;}; //returns 0 if dead or dying, non-zero if alive Presence(); virtual ~Presence(); // called when a presence is deallocated Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** mframe.cpp 21 Aug 2005 12:43:31 -0000 1.39 --- mframe.cpp 21 Aug 2005 13:55:58 -0000 1.40 *************** *** 1173,1179 **** //call objects calculate functions {_STACKTRACE("Physics::calculate() - item calculation") ! for (i = 0; i < num_items; i += 1) { ! if (item[i]->exists()) item[i]->calculate(); #ifdef _DEBUG // check all velocities and such (costly check... only do this in debug mode.) --- 1173,1196 ---- //call objects calculate functions {_STACKTRACE("Physics::calculate() - item calculation") ! for (i = 0; i < num_items; i += 1) ! { ! if (item[i]->exists()) ! { ! if (item[i]->ship && item[i]->ship < (void*)0x01000) ! { ! tw_error("Pointer error, overwritten data ??"); ! } ! ! item[i]->calculate(); + + if (item[i]->ship && item[i]->ship < (void*)0x01000) + { + tw_error("Pointer error, overwritten data ??"); + } + } + + + /* #ifdef _DEBUG // check all velocities and such (costly check... only do this in debug mode.) *************** *** 1194,1197 **** --- 1211,1215 ---- } #endif + */ checksync(); } |
From: Rob <geo...@us...> - 2005-08-21 13:55:39
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32222/source/other Modified Files: planet3d.cpp Log Message: changing the name b --> sbitmap Index: planet3d.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/planet3d.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** planet3d.cpp 21 Aug 2005 12:43:31 -0000 1.22 --- planet3d.cpp 21 Aug 2005 13:55:29 -0000 1.23 *************** *** 37,41 **** highest_mip = 0; for (i = 1; i < MAX_MIP_LEVELS; i += 1) { ! b[i] = NULL; } --- 37,41 ---- highest_mip = 0; for (i = 1; i < MAX_MIP_LEVELS; i += 1) { ! sbitmap[i] = NULL; } *************** *** 43,47 **** smask = new PMASK* [count]; ! b[0] = new BITMAP* [count]; attributes = new char [count]; --- 43,47 ---- smask = new PMASK* [count]; ! sbitmap[0] = new BITMAP* [count]; attributes = new char [count]; *************** *** 55,59 **** color_correct_bitmap(bmp, general_attributes & MASKED); smask[i] = create_allegro_pmask(bmp); ! b[0][i] = bmp; attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } --- 55,59 ---- color_correct_bitmap(bmp, general_attributes & MASKED); smask[i] = create_allegro_pmask(bmp); ! sbitmap[0][i] = bmp; attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } |
From: Rob <geo...@us...> - 2005-08-21 13:55:39
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32222/source/melee Modified Files: msprite.cpp Log Message: changing the name b --> sbitmap Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** msprite.cpp 21 Aug 2005 12:43:31 -0000 1.23 --- msprite.cpp 21 Aug 2005 13:55:29 -0000 1.24 *************** *** 309,315 **** BITMAP *src = get_bitmap(i, 0);//b[0][i]; ! b[level][i] = create_bitmap_ex(bpp, lw, lh); ! BITMAP *dest = b[level][i]; if (general_attributes & MASKED) clear_to_color(dest, bitmap_mask_color(dest)); --- 309,315 ---- BITMAP *src = get_bitmap(i, 0);//b[0][i]; ! sbitmap[level][i] = create_bitmap_ex(bpp, lw, lh); ! BITMAP *dest = sbitmap[level][i]; if (general_attributes & MASKED) clear_to_color(dest, bitmap_mask_color(dest)); *************** *** 334,338 **** if (general_attributes & MIPMAPED) { ! bpp = bitmap_color_depth(b[0][0]); for (level = 1; level < MAX_MIP_LEVELS; level += 1) --- 334,338 ---- if (general_attributes & MIPMAPED) { ! bpp = bitmap_color_depth(sbitmap[0][0]); for (level = 1; level < MAX_MIP_LEVELS; level += 1) *************** *** 343,354 **** if ((lw < 8) || (lh < 8)) break; this->highest_mip = level; ! this->b[level] = new BITMAP*[count]; this->highest_mip = level; ! this->b[level] = new BITMAP*[count]; for (i = 0; i < count; i += 1) { ! b[level][i] = 0;//generate_mipmap(level, i, bpp); } } --- 343,354 ---- if ((lw < 8) || (lh < 8)) break; this->highest_mip = level; ! this->sbitmap[level] = new BITMAP*[count]; this->highest_mip = level; ! this->sbitmap[level] = new BITMAP*[count]; for (i = 0; i < count; i += 1) { ! sbitmap[level][i] = 0;//generate_mipmap(level, i, bpp); } } *************** *** 360,370 **** for (l = 0; l <= highest_mip; l += 1) { for (i = 0; i < count; i += 1) { ! if (b[l][i]) { BITMAP *tmp = create_bitmap_ex(newbpp, w, h); ! convert_bitmap(b[l][i], tmp, (general_attributes & MASKED) ? AA_MASKED : 0); ! if (attributes[i] & DEALLOCATE_IMAGE) destroy_bitmap(b[l][i]); attributes[i] |= DEALLOCATE_IMAGE; ! b[l][i] = tmp; } } --- 360,374 ---- for (l = 0; l <= highest_mip; l += 1) { for (i = 0; i < count; i += 1) { ! if (sbitmap[l][i]) { BITMAP *tmp = create_bitmap_ex(newbpp, w, h); ! ! convert_bitmap(sbitmap[l][i], tmp, (general_attributes & MASKED) ? AA_MASKED : 0); ! ! if (attributes[i] & DEALLOCATE_IMAGE) ! destroy_bitmap(sbitmap[l][i]); ! attributes[i] |= DEALLOCATE_IMAGE; ! sbitmap[l][i] = tmp; } } *************** *** 379,386 **** for (mip = 0; mip <= highest_mip; mip += 1) { for (i = 0; i < count; i += 1) { ! tmp[i] = b[mip][(i + phase) % count]; } for (i = 0; i < count; i += 1) { ! b[mip][i] = tmp[i]; } } --- 383,390 ---- for (mip = 0; mip <= highest_mip; mip += 1) { for (i = 0; i < count; i += 1) { ! tmp[i] = sbitmap[mip][(i + phase) % count]; } for (i = 0; i < count; i += 1) { ! sbitmap[mip][i] = tmp[i]; } } *************** *** 443,447 **** highest_mip = 0; for (i = 1; i < MAX_MIP_LEVELS; i += 1) { ! b[i] = NULL; } --- 447,451 ---- highest_mip = 0; for (i = 1; i < MAX_MIP_LEVELS; i += 1) { ! sbitmap[i] = NULL; } *************** *** 510,514 **** smask = new PMASK*[count]; ! b[0] = new BITMAP* [count]; attributes = new char [count]; --- 514,518 ---- smask = new PMASK*[count]; ! sbitmap[0] = new BITMAP* [count]; attributes = new char [count]; *************** *** 572,576 **** // m[j + (i * rotations)] = create_allegro_pmask(tmp); ! b[0][index] = 0;//tmp; attributes[j + (i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } --- 576,580 ---- // m[j + (i * rotations)] = create_allegro_pmask(tmp); ! sbitmap[0][index] = 0;//tmp; attributes[j + (i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } *************** *** 578,582 **** smask[index] = 0; // m[(i * rotations)] = create_allegro_pmask(bmp); ! b[0][index] = bmp; attributes[index] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } --- 582,586 ---- smask[index] = 0; // m[(i * rotations)] = create_allegro_pmask(bmp); ! sbitmap[0][index] = bmp; attributes[index] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } *************** *** 602,606 **** smask = new PMASK*[count]; ! b[0] = new BITMAP* [count]; attributes = new char [count]; --- 606,610 ---- smask = new PMASK*[count]; ! sbitmap[0] = new BITMAP* [count]; attributes = new char [count]; *************** *** 644,648 **** color_correct_bitmap(bmp, general_attributes & MASKED); smask[(i * rotations)] = 0;//create_allegro_pmask(bmp); ! b[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } --- 648,652 ---- color_correct_bitmap(bmp, general_attributes & MASKED); smask[(i * rotations)] = 0;//create_allegro_pmask(bmp); ! sbitmap[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } *************** *** 669,673 **** h = old.h; smask = new PMASK*[count]; ! b[0] = new BITMAP* [count]; references = 0; --- 673,677 ---- h = old.h; smask = new PMASK*[count]; ! sbitmap[0] = new BITMAP* [count]; references = 0; *************** *** 680,690 **** for(i = 0; i < count; i++) { ! if (old.b[0][i]) { ! 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); ! b[0][i] = bmp; } else { ! b[0][i] = 0; } --- 684,694 ---- for(i = 0; i < count; i++) { ! if (old.sbitmap[0][i]) { ! bmp = create_bitmap(old.sbitmap[0][i]->w, old.sbitmap[0][i]->h); ! blit(old.sbitmap[0][i], bmp, 0, 0, 0, 0, old.sbitmap[0][i]->w, old.sbitmap[0][i]->h); ! sbitmap[0][i] = bmp; } else { ! sbitmap[0][i] = 0; } *************** *** 692,703 **** attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! for (l = 1; l < MAX_MIP_LEVELS; l += 1) if (old.b[l]) ! for(i = 0; i < count; i++) { ! bmp = create_bitmap(old.b[l][i]->w, old.b[l][i]->h); ! blit(old.b[l][i], bmp, 0, 0, 0, 0, old.b[l][i]->w, old.b[l][i]->h); ! b[l][i] = bmp; } - else b[l] = NULL; } void SpaceSprite::lock() { --- 696,721 ---- attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } ! for (l = 1; l < MAX_MIP_LEVELS; l += 1) ! { ! if (old.sbitmap[l]) ! { ! sbitmap[l] = new BITMAP* [count]; ! ! for(i = 0; i < count; i++) ! { ! if (old.sbitmap[l][i]) ! { ! bmp = create_bitmap(old.sbitmap[l][i]->w, old.sbitmap[l][i]->h); ! blit(old.sbitmap[l][i], bmp, 0, 0, 0, 0, old.sbitmap[l][i]->w, old.sbitmap[l][i]->h); ! sbitmap[l][i] = bmp; ! } else { ! sbitmap[l][i] = 0; ! } ! } ! } else { ! sbitmap[l] = 0; } } + } void SpaceSprite::lock() { *************** *** 707,715 **** } ! void SpaceSprite::unlock() { STACKTRACE int i, j; for (i = 0; i < MAX_MIP_LEVELS; i += 1) { ! if (b[i]) j = i; } //We aught to rebuild mipmaps but too much work, so for now we do nothing --- 725,735 ---- } ! void SpaceSprite::unlock() ! { STACKTRACE int i, j; for (i = 0; i < MAX_MIP_LEVELS; i += 1) { ! if (sbitmap[i]) ! j = i; } //We aught to rebuild mipmaps but too much work, so for now we do nothing *************** *** 735,747 **** smask = NULL; ! 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]; - b[l] = NULL; } --- 755,771 ---- smask = NULL; ! for (l = 0; l <= highest_mip; l += 1) ! { ! if (sbitmap[l]) ! { ! for(i = 0; i < count; i++) { ! //xxx why is this conditional ?? It never borrows, that's too messy... ! //if (attributes[i] & DEALLOCATE_IMAGE) ! if (sbitmap[l][i]) ! destroy_bitmap(sbitmap[l][i]); ! } ! delete[] sbitmap[l]; ! sbitmap[l] = NULL; } } *************** *** 1097,1104 **** // changed ROB ! if (!b[miplevel][index]) { // generate a derived image... ! if (!b[0][index]) { // generate the unscaled image --- 1121,1133 ---- // changed ROB ! if (!sbitmap[miplevel][index]) { + if (!sbitmap[miplevel]) + { + tw_error("The pointer array for the mipmapped bitmaps hasn't been defined for this level!"); + } + // generate a derived image... ! if (!sbitmap[0][index]) { // generate the unscaled image *************** *** 1111,1115 **** } ! BITMAP *bmp = b[0][ipic]; if (!bmp) { --- 1140,1144 ---- } ! BITMAP *bmp = sbitmap[0][ipic]; if (!bmp) { *************** *** 1120,1124 **** rotate_sprite(tmp, bmp, 0, 0, irot * ((1<<24)/count_rotations)); ! b[0][index] = tmp; } --- 1149,1153 ---- rotate_sprite(tmp, bmp, 0, 0, irot * ((1<<24)/count_rotations)); ! sbitmap[0][index] = tmp; } *************** *** 1128,1131 **** } ! return b[miplevel][index]; } --- 1157,1160 ---- } ! return sbitmap[miplevel][index]; } |
From: Rob <geo...@us...> - 2005-08-21 13:55:39
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32222/source Modified Files: melee.h Log Message: changing the name b --> sbitmap Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** melee.h 21 Aug 2005 12:43:31 -0000 1.25 --- melee.h 21 Aug 2005 13:55:29 -0000 1.26 *************** *** 437,441 **** int h; struct PMASK **smask; ! Surface **b[MAX_MIP_LEVELS]; //char *type; --- 437,441 ---- int h; struct PMASK **smask; ! Surface **sbitmap[MAX_MIP_LEVELS]; //char *type; |
From: Rob <geo...@us...> - 2005-08-21 12:44:09
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18582/source/newships Modified Files: shpchoex.cpp shpfiear.cpp shptaubo.cpp shptaust.cpp shpwassu.cpp Log Message: a few ship bugs fixed Index: shpwassu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpwassu.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpwassu.cpp 14 Aug 2005 16:14:32 -0000 1.19 --- shpwassu.cpp 21 Aug 2005 12:44:01 -0000 1.20 *************** *** 121,128 **** --- 121,134 ---- */ + /* HUH ????? for (int i = 1; i <= max_Clone; i += 1) { Clone[i] = NULL; FireWeapon[i] = FALSE; } + */ + for ( int i = 0; i < max_Clone; ++i ) { + Clone[i] = 0; + FireWeapon[i] = FALSE; + } } *************** *** 167,173 **** --- 173,184 ---- } */ + /* HUH ??? for (j=1; j <= max_Clone; j += 1) { FireWeapon[j] = TRUE; } + */ + for ( j = 0; j < max_Clone; ++j) { + FireWeapon[j] = TRUE; + } if (target !=NULL && target->exists()) TargetRange = distance(target); *************** *** 251,260 **** for (i=0; (i < 2) && (num_Clone < max_Clone) && (crew > SpawnLifeCost); i +=1) { ! if (num_Clone == max_Clone) { num_Clone -= 1; Clone[0]->state = 0; memcpy(&Clone[0], &Clone[1], sizeof(WasxSuperposition*) * num_Clone); Clone[num_Clone] = NULL; ! } // these lines are made obsolete/overridden by formation routine??? --- 262,274 ---- for (i=0; (i < 2) && (num_Clone < max_Clone) && (crew > SpawnLifeCost); i +=1) { ! ! // geo-I suppose this never happens, because of the constraint in the for() loop. ! if (num_Clone == max_Clone) ! { num_Clone -= 1; Clone[0]->state = 0; memcpy(&Clone[0], &Clone[1], sizeof(WasxSuperposition*) * num_Clone); Clone[num_Clone] = NULL; ! } // these lines are made obsolete/overridden by formation routine??? *************** *** 276,279 **** --- 290,296 ---- WasxClone *tmp = new WasxClone(D,da,data ,control, this); + // added - Geo. + Clone[num_Clone-1] = tmp; + // mx = normal_x(); // my = normal_y(); *************** *** 650,654 **** MotherShip->Clone[i] = NULL; ! delete MotherShip->Clone[i]; MotherShip->num_Clone -= 1; --- 667,672 ---- MotherShip->Clone[i] = NULL; ! // delete MotherShip->Clone[i];// huh ???? first set to 0, then delete ??? ! // you're not allowed to delete in the first place, because that's handled by the Physics manager. MotherShip->num_Clone -= 1; Index: shptaust.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaust.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shptaust.cpp 14 Aug 2005 16:14:32 -0000 1.12 --- shptaust.cpp 21 Aug 2005 12:44:01 -0000 1.13 *************** *** 189,196 **** jr *= jr * 0.5; } ! if (latched->isShip()) ! ((Ship*)latched)->turn_step += rotation * 1000 * rt * frame_time / jr; ! else ! latched->angle += rotation * 1000 * rt * frame_time / jr; }; --- 189,199 ---- jr *= jr * 0.5; } ! if (jr) ! { ! if (latched->isShip()) ! ((Ship*)latched)->turn_step += rotation * 1000 * rt * frame_time / jr; ! else ! latched->angle += rotation * 1000 * rt * frame_time / jr; ! } }; Index: shptaubo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaubo.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shptaubo.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shptaubo.cpp 21 Aug 2005 12:44:01 -0000 1.18 *************** *** 387,391 **** host->target = tgt; if (host->isShip()) ! ((Ship*)host)->control->target = tgt; } --- 387,394 ---- host->target = tgt; if (host->isShip()) ! { ! if ( ((Ship*)host)->control ) ! ((Ship*)host)->control->target = tgt; ! } } *************** *** 405,409 **** host->target = tgt; if (host->isShip()) ! ((Ship*)host)->control->target = tgt; } --- 408,415 ---- host->target = tgt; if (host->isShip()) ! { ! if ( ((Ship*)host)->control ) ! ((Ship*)host)->control->target = tgt; ! } } Index: shpfiear.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpfiear.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpfiear.cpp 14 Aug 2005 16:14:32 -0000 1.15 --- shpfiear.cpp 21 Aug 2005 12:44:01 -0000 1.16 *************** *** 209,213 **** if (nv < 0) { ! if (o->mass > 0 && mass > 0) k = o->mass / (mass*specialMassFactor); else --- 209,213 ---- if (nv < 0) { ! if (o->mass > 0 && mass > 0 && specialMassFactor > 0) k = o->mass / (mass*specialMassFactor); else Index: shpchoex.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpchoex.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpchoex.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shpchoex.cpp 21 Aug 2005 12:44:01 -0000 1.18 *************** *** 180,184 **** { ! other->accelerate(this, other->trajectory_angle(this), tractorForce / (other->mass * 4), 2); if(other->isShip()) { --- 180,185 ---- { ! other->accelerate(this, other->trajectory_angle(this), tractorForce / (other->mass * 4), 2); ! if(other->isShip()) { |
From: Rob <geo...@us...> - 2005-08-21 12:43:40
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18478/source/other Modified Files: planet3d.cpp Log Message: m renamed into smask Index: planet3d.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/planet3d.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** planet3d.cpp 14 Aug 2005 16:14:50 -0000 1.21 --- planet3d.cpp 21 Aug 2005 12:43:31 -0000 1.22 *************** *** 42,46 **** bpp = 32;//videosystem.bpp; ! m = new PMASK* [count]; b[0] = new BITMAP* [count]; attributes = new char [count]; --- 42,46 ---- bpp = 32;//videosystem.bpp; ! smask = new PMASK* [count]; b[0] = new BITMAP* [count]; attributes = new char [count]; *************** *** 54,58 **** i = 0; color_correct_bitmap(bmp, general_attributes & MASKED); ! m[i] = create_allegro_pmask(bmp); b[0][i] = bmp; attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; --- 54,58 ---- i = 0; color_correct_bitmap(bmp, general_attributes & MASKED); ! smask[i] = create_allegro_pmask(bmp); b[0][i] = bmp; attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; |
From: Rob <geo...@us...> - 2005-08-21 12:43:40
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18478/source Modified Files: melee.h Log Message: m renamed into smask Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** melee.h 17 Aug 2005 23:51:58 -0000 1.24 --- melee.h 21 Aug 2005 12:43:31 -0000 1.25 *************** *** 436,440 **** int w; int h; ! struct PMASK **m; Surface **b[MAX_MIP_LEVELS]; --- 436,440 ---- int w; int h; ! struct PMASK **smask; Surface **b[MAX_MIP_LEVELS]; |
From: Rob <geo...@us...> - 2005-08-21 12:43:40
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18478/source/melee Modified Files: mframe.cpp mmain.cpp msprite.cpp Log Message: m renamed into smask Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** msprite.cpp 17 Aug 2005 23:51:59 -0000 1.22 --- msprite.cpp 21 Aug 2005 12:43:31 -0000 1.23 *************** *** 391,398 **** for (mip = 0; mip <= highest_mip; mip += 1) { for (i = 0; i < count; i += 1) { ! tmp2[i] = m[(i + phase) % count]; // you don't have to generate, only shift } for (i = 0; i < count; i += 1) { ! m[i] = tmp2[i]; } } --- 391,398 ---- for (mip = 0; mip <= highest_mip; mip += 1) { for (i = 0; i < count; i += 1) { ! tmp2[i] = smask[(i + phase) % count]; // you don't have to generate, only shift } for (i = 0; i < count; i += 1) { ! smask[i] = tmp2[i]; } } *************** *** 416,423 **** PMASK *SpaceSprite::get_pmask(int index) { ! if (!m[index]) ! m[index] = create_allegro_pmask(get_bitmap(index)); ! return m[index]; } --- 416,423 ---- PMASK *SpaceSprite::get_pmask(int index) { ! if (!smask[index]) ! smask[index] = create_allegro_pmask(get_bitmap(index)); ! return smask[index]; } *************** *** 509,513 **** } ! m = new PMASK*[count]; b[0] = new BITMAP* [count]; attributes = new char [count]; --- 509,513 ---- } ! smask = new PMASK*[count]; b[0] = new BITMAP* [count]; attributes = new char [count]; *************** *** 524,528 **** if (tmp != bmp) ! clear_to_color(tmp, bitmap_mask_color(tmp)); switch (originaltype) { --- 524,531 ---- if (tmp != bmp) ! { ! int col = bitmap_mask_color(tmp); ! clear_to_color(tmp, col); ! } switch (originaltype) { *************** *** 566,570 **** int index = j + (i * rotations); ! m[index] = 0; // m[j + (i * rotations)] = create_allegro_pmask(tmp); --- 569,573 ---- int index = j + (i * rotations); ! smask[index] = 0; // m[j + (i * rotations)] = create_allegro_pmask(tmp); *************** *** 573,577 **** } int index = i * rotations; ! m[index] = 0; // m[(i * rotations)] = create_allegro_pmask(bmp); b[0][index] = bmp; --- 576,580 ---- } int index = i * rotations; ! smask[index] = 0; // m[(i * rotations)] = create_allegro_pmask(bmp); b[0][index] = bmp; *************** *** 598,602 **** if (rotations != 1) {tw_error (" irregular SpaceSprites are not permitted to be autorotated");} ! m = new PMASK*[count]; b[0] = new BITMAP* [count]; attributes = new char [count]; --- 601,605 ---- if (rotations != 1) {tw_error (" irregular SpaceSprites are not permitted to be autorotated");} ! smask = new PMASK*[count]; b[0] = new BITMAP* [count]; attributes = new char [count]; *************** *** 640,644 **** } 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; --- 643,647 ---- } color_correct_bitmap(bmp, general_attributes & MASKED); ! smask[(i * rotations)] = 0;//create_allegro_pmask(bmp); b[0][(i * rotations)] = bmp; attributes[(i * rotations)] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; *************** *** 665,669 **** w = old.w; h = old.h; ! m = new PMASK*[count]; b[0] = new BITMAP* [count]; --- 668,672 ---- w = old.w; h = old.h; ! smask = new PMASK*[count]; b[0] = new BITMAP* [count]; *************** *** 672,680 **** general_attributes = old.general_attributes; ! for(i = 0; i < count; i++) { ! 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; } --- 675,693 ---- general_attributes = old.general_attributes; ! count_base = old.count_base; ! count_rotations = old.count_rotations; ! ! for(i = 0; i < count; i++) ! { ! if (old.b[0][i]) ! { ! 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); ! b[0][i] = bmp; ! } else { ! b[0][i] = 0; ! } ! ! smask[i] = 0;//create_allegro_pmask(bmp); attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK; } *************** *** 713,721 **** //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; ! m = NULL; for (l = 0; l <= highest_mip; l += 1) { --- 726,737 ---- //xxx why is this conditional ?? It never borrows, that's too messy... //if (attributes[i] & DEALLOCATE_MASK) ! if (smask[i]) ! destroy_pmask(smask[i]); } ! ! if (smask) ! delete[] smask; ! ! smask = NULL; for (l = 0; l <= highest_mip; l += 1) { Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** mmain.cpp 17 Aug 2005 23:51:59 -0000 1.43 --- mmain.cpp 21 Aug 2005 12:43:31 -0000 1.44 *************** *** 1159,1163 **** NPI* p = (NPI*)player[i]; ! if (!p) tw_error("Checking live state of a player who does not exist."); --- 1159,1163 ---- NPI* p = (NPI*)player[i]; ! if (!(p && p->control) ) tw_error("Checking live state of a player who does not exist."); Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** mframe.cpp 10 Aug 2005 21:07:48 -0000 1.38 --- mframe.cpp 21 Aug 2005 12:43:31 -0000 1.39 *************** *** 793,797 **** Vector2 nd; nd = unit_vector(dp); ! nd /= (mass + other->mass); while (sprite->collide((int)p1.x, (int)p1.y, sprite_index, (int)p2.x, (int)p2.y, other->sprite_index, other->sprite)) { --- 793,799 ---- Vector2 nd; nd = unit_vector(dp); ! if (a > 0) ! nd /= a; ! while (sprite->collide((int)p1.x, (int)p1.y, sprite_index, (int)p2.x, (int)p2.y, other->sprite_index, other->sprite)) { *************** *** 809,812 **** --- 811,821 ---- } + #ifdef _DEBUG + if (fabs(vel.x) > 1E6 || fabs(vel.y) > 1E6 || fabs(other->vel.x) > 1E6 || fabs(other->vel.y) > 1E6 ) + { + tw_error("velocity error involving objects [%s] and [%s]", get_identity(), other->get_identity()); + } + #endif + return; } *************** *** 1166,1169 **** --- 1175,1197 ---- for (i = 0; i < num_items; i += 1) { if (item[i]->exists()) item[i]->calculate(); + + #ifdef _DEBUG + // check all velocities and such (costly check... only do this in debug mode.) + int j; + for (j = 0; j < num_items; j += 1) + { + if (fabs(item[j]->vel.x) > 1E6 || fabs(item[j]->vel.y) > 1E6 ) + { + int k; + if (j > 0) + k = j-1; + else + k = num_items - 1; + + tw_error("velocity error in %s, probably due to %s", item[j]->get_identity(), + item[k]->get_identity()); + } + } + #endif checksync(); } *************** *** 1198,1211 **** {_STACKTRACE("Physics::calculate() - presence destruction") //remove presences that have been dead long enough - int deleted = 0; for(i = 0; i < num_presences; i ++) { - presence[i] = presence[i+deleted]; if (presence[i]->state == -DEATH_FRAMES) { Presence *tmp = presence[i]; num_presences -= 1; ! memmove(&presence[i], &presence[i+1], sizeof(Presence*) * (num_presences-i)); ! //presence[i] = presence[num_presences-1]; i -= 1; - //deleted += 1; delete tmp; } --- 1226,1238 ---- {_STACKTRACE("Physics::calculate() - presence destruction") //remove presences that have been dead long enough for(i = 0; i < num_presences; i ++) { if (presence[i]->state == -DEATH_FRAMES) { Presence *tmp = presence[i]; num_presences -= 1; ! ! if (num_presences > i) ! memmove(&presence[i], &presence[i+1], sizeof(Presence*) * (num_presences-i)); ! i -= 1; delete tmp; } *************** *** 1223,1235 **** //remove objects that have been dead long enough {_STACKTRACE("Physics::calculate() - item destruction") - int deleted = 0; for(i = 0; i < num_items; i ++) { ! item[i] = item[i+deleted]; ! if (item[i]->state == -DEATH_FRAMES) { SpaceLocation *tmp = item[i]; num_items -= 1; ! //item[i] = item[num_items]; ! memmove(&item[i], &item[i+1], (num_items-i) * sizeof(SpaceLocation*)); ! //deleted += 1; i -= 1; delete tmp; --- 1250,1262 ---- //remove objects that have been dead long enough {_STACKTRACE("Physics::calculate() - item destruction") for(i = 0; i < num_items; i ++) { ! if (item[i]->state == -DEATH_FRAMES) ! { SpaceLocation *tmp = item[i]; num_items -= 1; ! ! if (num_items > i) ! memmove(&item[i], &item[i+1], (num_items-i) * sizeof(SpaceLocation*)); ! i -= 1; delete tmp; *************** *** 1439,1442 **** --- 1466,1470 ---- tmp[l].y = p.y; if (tmp[l].y < 0) tmp[l].y += size.y; + //xxx goes wrong in case of Androsynth Guardian (=o) ; m=0x00003c. tmp[l].pmask = o->get_sprite()->get_pmask(o->get_sprite_index()); tmp[l].data = o; |