| 464 | |
| 465 | |
| 466 | static std::string cmdViewZoom(const std::string&, const CmdArgList& args, bool*) { |
| 467 | if (args.size() != 1) { |
| 468 | return "usage: viewZoom {in|out|toggle}"; |
| 469 | } |
| 470 | |
| 471 | float fov = BZDB.eval("displayFOV"); |
| 472 | float defFov = BZDB.eval("defaultFOV"); |
| 473 | |
| 474 | if (args[0] == "out") { |
| 475 | fov += 1.0f; |
| 476 | if (fov > defFov) { |
| 477 | fov = defFov; |
| 478 | } |
| 479 | BZDB.setFloat("displayFOV", fov); |
| 480 | } |
| 481 | else if (args[0] == "in") { |
| 482 | fov -= 1.0f; |
| 483 | if (fov < 15.0f) { |
| 484 | fov = 15.0f; |
| 485 | } |
| 486 | BZDB.setFloat("displayFOV", fov); |
| 487 | } |
| 488 | else if (args[0] == "toggle") { |
| 489 | if (fov < (defFov + 15.0f) * 0.5f) { // 60+15/2 |
| 490 | fov = defFov; |
| 491 | } |
| 492 | else { |
| 493 | fov = 15.0f; |
| 494 | } |
| 495 | BZDB.setFloat("displayFOV", fov); |
| 496 | // also toggle the observer fov |
| 497 | if (ROAM.getZoom() != defFov) { |
| 498 | ROAM.setZoom(defFov); |
| 499 | } |
| 500 | else { |
| 501 | ROAM.setZoom(15.0f); |
| 502 | } |
| 503 | } |
| 504 | else if (args[0] == "reset") { |
| 505 | fov = defFov; |
| 506 | ROAM.setZoom(defFov); |
| 507 | BZDB.setFloat("displayFOV", fov); |
| 508 | } |
| 509 | else { |
| 510 | return "usage: viewZoom {in|out|toggle|reset}"; |
| 511 | } |
| 512 | |
| 513 | return std::string(); |
| 514 | } |
| 515 | |
| 516 | |
| 517 | static std::string cmdMessagePanel(const std::string&, const CmdArgList& args, bool*) { |