Chooses a player start, deathmatch start, coop start, etc.
(edict_t ent, float[] origin, float[] angles, GameExportsImpl gameExports)
| 572 | * Chooses a player start, deathmatch start, coop start, etc. |
| 573 | */ |
| 574 | public static void SelectSpawnPoint(edict_t ent, float[] origin, float[] angles, GameExportsImpl gameExports) { |
| 575 | SubgameEntity spot = null; |
| 576 | |
| 577 | if (gameExports.gameCvars.deathmatch.value != 0) |
| 578 | spot = SelectDeathmatchSpawnPoint(gameExports); |
| 579 | else if (gameExports.gameCvars.coop.value != 0) |
| 580 | spot = SelectCoopSpawnPoint(ent, gameExports); |
| 581 | |
| 582 | EdictIterator es = null; |
| 583 | // find a single player start spot |
| 584 | if (null == spot) { |
| 585 | while ((es = GameBase.G_Find(es, GameBase.findByClassName, "info_player_start", gameExports)) != null) { |
| 586 | spot = es.o; |
| 587 | |
| 588 | if (gameExports.game.spawnpoint.length() == 0 |
| 589 | && spot.targetname == null) |
| 590 | break; |
| 591 | |
| 592 | if (gameExports.game.spawnpoint.length() == 0 |
| 593 | || spot.targetname == null) |
| 594 | continue; |
| 595 | |
| 596 | if (Lib.Q_stricmp(gameExports.game.spawnpoint, spot.targetname) == 0) |
| 597 | break; |
| 598 | } |
| 599 | |
| 600 | if (null == spot) { |
| 601 | if (gameExports.game.spawnpoint.length() == 0) { |
| 602 | // there wasn't a spawnpoint without a |
| 603 | // target, so use any |
| 604 | es = GameBase.G_Find(es, GameBase.findByClassName, "info_player_start", gameExports); |
| 605 | |
| 606 | if (es != null) |
| 607 | spot = es.o; |
| 608 | } |
| 609 | if (null == spot) { |
| 610 | gameExports.gameImports.error("Couldn't find spawn point " + gameExports.game.spawnpoint + "\n"); |
| 611 | return; |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | Math3D.VectorCopy(spot.s.origin, origin); |
| 617 | origin[2] += 9; |
| 618 | Math3D.VectorCopy(spot.s.angles, angles); |
| 619 | } |
| 620 | |
| 621 | |
| 622 | public static void InitBodyQue(GameExportsImpl gameExports) { |
no test coverage detected