Changeset 1900 in orxonox.OLD for orxonox/trunk/core/shoot_laser.cc
- Timestamp:
- May 23, 2004, 11:21:38 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/shoot_laser.cc
r1899 r1900 29 29 { 30 30 lastShoot = null; 31 step = 1.0; 31 32 } 32 33 … … 46 47 glPushMatrix(); 47 48 glTranslatef(tmpShoot->xCor, tmpShoot->yCor, tmpShoot->zCor); 49 tmpShoot->xCor+=tmpShoot->xInc; 48 50 tmpShoot->yCor+=tmpShoot->yInc; 49 51 glScalef(0.1, 0.1, 0.1); … … 55 57 /* fix2: conditions, that a struct tree can be cut off */ 56 58 /* fix3: more efficent and nicer please */ 57 if (tmpShoot->yCor > 50)59 if (tmpShoot->yCor > 20) 58 60 { 61 /* normal case: delete one element, link the others */ 59 62 if (lastRef != null) 60 63 { 61 cout << "garbage collection" << endl;64 //cout << "garbage collection" << endl; 62 65 lastRef->next = tmpShoot->next; 63 66 delete tmpShoot; 64 tmpShoot = lastRef; 65 lastRef = tmpShoot; 66 tmpShoot = tmpShoot->next; 67 cout << "garbage collection left" << endl; 67 tmpShoot = lastRef->next; 68 //cout << "garbage collection left" << endl; 68 69 } 69 70 else 70 71 { 71 cout << "garbage collecton on last el" << endl; 72 /* special case: first element to be processed */ 73 //cout << "garbage collecton: first el in queue" << endl; 72 74 lastRef = tmpShoot->next; 73 75 delete tmpShoot; 74 76 tmpShoot = lastRef; 75 if (tmpShoot != null) { 76 lastRef = tmpShoot; 77 tmpShoot = tmpShoot->next; 78 cout << "noch nich null" << endl; 79 } 80 else { 81 lastRef = null; 82 tmpShoot = null; 83 lastShoot = null; 84 cout << "endl null" << endl; 85 } 86 cout << "garbage collection on last el left" << endl; 77 lastShoot = tmpShoot; 78 if (tmpShoot != null) 79 { 80 tmpShoot = tmpShoot->next; 81 //cout << "noch nich null" << endl; 82 } 83 else 84 { 85 lastRef = null; 86 tmpShoot = null; 87 lastShoot = null; 88 //cout << "endl null" << endl; 89 } 90 91 //cout << "garbage collection: firtst el in queue left" << endl; 87 92 } 88 93 } … … 108 113 shoot* sh = new shoot; 109 114 sh->xCor = x; sh->yCor = y; sh->zCor = z; 110 sh->xInc = 0; sh->yInc = . 2; sh->zInc = 0;115 sh->xInc = 0; sh->yInc = .4/step; sh->zInc = 0; 111 116 sh->next = lastShoot; 112 117 lastShoot = sh; 113 118 } 114 119 120 void ShootLaser::addShootExt(float x, float y, float z, 121 float xInc, float yInc, float zInc) 122 { 123 //cout << "ShootLaser::addShootExtended" << endl; 124 shoot* sh = new shoot; 125 sh->xCor = x; sh->yCor = y; sh->zCor = z; 126 sh->xInc = xInc/step; sh->yInc = yInc/step; sh->zInc = zInc/step; 127 sh->next = lastShoot; 128 lastShoot = sh; 129 } 130 131 void ShootLaser::setShootStep(float step) 132 { 133 cout << "ShootLaser::setShootStep to " << step << endl; 134 this->step = step; 135 } 136 137 138 /* Exterminate shoot from game, implement this method */ 139 /* if you like to add animatiion */ 140 void ShootLaser::removeShoot(shoot* sh) 141 { 142 glPushMatrix(); 143 glTranslatef(sh->xCor, sh->yCor, sh->zCor); 144 glutWireCube(1.0); 145 glPopMatrix(); 146 }
Note: See TracChangeset
for help on using the changeset viewer.