void RapidFire::Update() { Unit *u = NULL; if (delete_me) return; if (life + time_stamp < timer.GetTime()) delete_me = true; else if (org[1] < terrain.GetHeight(org[0], org[2])) { for (int i = 0; i < 5; i++) pman.Explosion2(org); // con->Printf("hit terrain"); delete_me = true; } else { Vector3f v = vel; v.Normalise(); for (u = uman.uhead; u; u = u->next) { if ((u->health > 0) && (u != this) && (u != owner) && (u->TraceUnit(org, v))) { float l1, l2; l1 = (u->org - org).Length(); l2 = unit_scale * vel.Length() * timer.Delta(); if (l1 < l2) { delete_me = true; vel.Clear(); for (int i = 0; i < 5; i++) pman.Explosion2(org); u->health -= damage; con->Printf("hit %s health %d\n", u->name, u->health); break; } } } } org += unit_scale * vel * timer.Delta(); if (u) org = u->org; // pman.Trail(org); Vector3f p1 = org, p2 = org; p1.x -= ZAP_SIZE; p2.x += ZAP_SIZE; hrib.AddPoint(p1, p2); p1.x += ZAP_SIZE; p2.x -= ZAP_SIZE; p1.y += ZAP_SIZE; p2.y -= ZAP_SIZE; vrib.AddPoint(p1, p2); hrib.Update(); vrib.Update(); }