Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1900 in orxonox.OLD for orxonox/trunk/core/shoot_laser.cc


Ignore:
Timestamp:
May 23, 2004, 11:21:38 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: hardware independant game speed, more shoots, more speed - see mail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/core/shoot_laser.cc

    r1899 r1900  
    2929{
    3030  lastShoot = null;
     31  step = 1.0;
    3132}
    3233
     
    4647      glPushMatrix();
    4748      glTranslatef(tmpShoot->xCor, tmpShoot->yCor, tmpShoot->zCor);
     49      tmpShoot->xCor+=tmpShoot->xInc;
    4850      tmpShoot->yCor+=tmpShoot->yInc;
    4951      glScalef(0.1, 0.1, 0.1);
     
    5557      /* fix2: conditions, that a struct tree can be cut off */
    5658      /* fix3: more efficent and nicer please */
    57       if (tmpShoot->yCor > 50)
     59      if (tmpShoot->yCor > 20)
    5860        {
     61          /* normal case: delete one element, link the others */
    5962          if (lastRef != null)
    6063            {
    61               cout << "garbage collection" << endl;
     64              //cout << "garbage collection" << endl;
    6265              lastRef->next = tmpShoot->next;
    6366              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;
    6869            }
    6970          else
    7071            {
    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;
    7274              lastRef = tmpShoot->next;
    7375              delete tmpShoot;
    7476              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;
    8792            }
    8893        }
     
    108113  shoot* sh = new shoot;
    109114  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;
    111116  sh->next = lastShoot;
    112117  lastShoot = sh;
    113118}
    114119
     120void 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
     131void 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 */
     140void 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.