virtual wxRect GetClientArea() const { // we intentionally don't cache the result here because the client // display area may change (e.g. the user resized or hid a panel) and // we don't currently react to its changes return IsPrimary() ? wxGetClientDisplayRect() : m_rect; }
Shot* Weapon::NetFireSecondary(SimObject* tgt, System* sub, DWORD objid) { Shot* shot = 0; if (IsPrimary() || Game::Paused()) return shot; if (active_barrel < 0 || active_barrel >= nbarrels) active_barrel = 0; target = tgt; subtarget = sub; aim_time = 0; shot = FireBarrel(active_barrel++); if (active_barrel >= nbarrels) { active_barrel = 0; refire += design->salvo_delay; } if (shot) shot->SetObjID(objid); if (target) Observe(target); return shot; }
Shot* Weapon::NetFirePrimary(SimObject* tgt, System* sub, int count) { Shot* shot = 0; if (!IsPrimary() || Game::Paused()) return shot; if (active_barrel < 0 || active_barrel >= nbarrels) active_barrel = 0; target = tgt; subtarget = sub; aim_time = 0; for (int i = 0; i < count; i++) { shot = FireBarrel(active_barrel++); if (active_barrel >= nbarrels) { active_barrel = 0; refire += design->salvo_delay; } } if (target) Observe(target); return shot; }
wxRect wxDisplayImplMacOSX::GetClientArea() const { // VZ: I don't know how to get client area for arbitrary display but // wxGetClientDisplayRect() does work correctly for at least the main // one (TODO: do it correctly for the other displays too) if ( IsPrimary() ) return wxGetClientDisplayRect(); return wxDisplayImpl::GetClientArea(); }
Shot* Weapon::Fire() { if (Game::Paused()) return 0; if (ship && ship->CheckFire()) return 0; if (ship->IsStarship() && target && !centered) return 0; if (beams && active_barrel >= 0 && active_barrel < nbarrels && beams[active_barrel]) return 0; Shot* shot = 0; if (ammo && enabled && (refire <= 0) && (energy > design->min_charge) && (availability > crit_level)) { refire = design->refire_delay; NetGame* net_game = NetGame::GetInstance(); bool net_client = net_game ? net_game->IsClient() : false; // all barrels if (active_barrel < 0) { if (net_client || IsPrimary()) NetUtil::SendWepTrigger(this, nbarrels); if (!net_game || IsPrimary()) { for (int i = 0; i < nbarrels; i++) shot = FireBarrel(i); } else if (net_game && net_game->IsServer() && IsMissile()) { for (int i = 0; i < nbarrels; i++) { shot = FireBarrel(i); NetUtil::SendWepRelease(this, shot); } } } // single barrel else { if (net_client || IsPrimary()) NetUtil::SendWepTrigger(this, nbarrels); if (!net_game || IsPrimary()) { shot = FireBarrel(active_barrel++); } else if (net_game && net_game->IsServer() && IsMissile()) { shot = FireBarrel(active_barrel++); NetUtil::SendWepRelease(this, shot); } if (active_barrel >= nbarrels) { active_barrel = 0; refire += design->salvo_delay; } } if (design->ripple_count > 0 && ripple_count <= 0) ripple_count = design->ripple_count-1; if (status != NOMINAL) refire *= 2; } return shot; }