mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-16 17:01:39 +00:00
- Tidy up warptocoords
CCMD since everything is in an actor now.
* Now accepts floating point inputs. * Restores lost pitch capability.
This commit is contained in:
parent
e6cffbaefb
commit
3c4b4e4483
10 changed files with 21 additions and 67 deletions
|
@ -105,7 +105,7 @@ struct GameInterface
|
|||
virtual bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) { return false; }
|
||||
virtual DAngle playerPitchMin() { return DAngle::fromDeg(57.375); }
|
||||
virtual DAngle playerPitchMax() { return DAngle::fromDeg(-57.375); }
|
||||
virtual void WarpToCoords(double x, double y, double z, DAngle a) {}
|
||||
virtual DCoreActor* getConsoleActor() = 0;
|
||||
virtual void ToggleThirdPerson() { }
|
||||
virtual void SwitchCoopView() { Printf("Unsupported command\n"); }
|
||||
virtual void ToggleShowWeapon() { Printf("Unsupported command\n"); }
|
||||
|
|
|
@ -365,7 +365,7 @@ CCMD(warptocoords)
|
|||
}
|
||||
if (argv.argc() < 4)
|
||||
{
|
||||
Printf("warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates\n");
|
||||
Printf("warptocoords [x] [y] [z] [yaw] (optional) [pitch] (optional): warps the player to the specified coordinates\n");
|
||||
return;
|
||||
}
|
||||
if (gamestate != GS_LEVEL)
|
||||
|
@ -373,20 +373,14 @@ CCMD(warptocoords)
|
|||
Printf("warptocoords: must be in a level\n");
|
||||
return;
|
||||
}
|
||||
int x = atoi(argv[1]);
|
||||
int y = atoi(argv[2]);
|
||||
int z = atoi(argv[3]);
|
||||
int ang = INT_MIN, horiz = INT_MIN;
|
||||
if (argv.argc() > 4)
|
||||
{
|
||||
ang = atoi(argv[4]);
|
||||
}
|
||||
if (argv.argc() > 5)
|
||||
{
|
||||
horiz = atoi(argv[5]);
|
||||
}
|
||||
|
||||
gi->WarpToCoords(x, y, z, DAngle::fromDeg(ang));
|
||||
if (const auto pActor = gi->getConsoleActor())
|
||||
{
|
||||
pActor->spr.pos = DVector3(atof(argv[1]), atof(argv[2]), atof(argv[3]));
|
||||
if (argv.argc() > 4) pActor->spr.Angles.Yaw = DAngle::fromDeg(atof(argv[4]));
|
||||
if (argv.argc() > 5) pActor->spr.Angles.Pitch = DAngle::fromDeg(atof(argv[5]));
|
||||
pActor->backuploc();
|
||||
}
|
||||
}
|
||||
|
||||
CCMD(third_person_view)
|
||||
|
|
|
@ -133,7 +133,7 @@ struct GameInterface : public ::GameInterface
|
|||
bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override;
|
||||
DAngle playerPitchMin() override { return DAngle::fromDeg(54.575); }
|
||||
DAngle playerPitchMax() override { return DAngle::fromDeg(-43.15); }
|
||||
void WarpToCoords(double x, double y, double z, DAngle a) override;
|
||||
DCoreActor* getConsoleActor() override;
|
||||
void ToggleThirdPerson() override;
|
||||
void SwitchCoopView() override;
|
||||
void ToggleShowWeapon() override;
|
||||
|
|
|
@ -31,18 +31,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
|
||||
DCoreActor* GameInterface::getConsoleActor()
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[myconnectindex];
|
||||
|
||||
pPlayer->actor->spr.pos = { x, y, z };
|
||||
playerResetInertia(pPlayer);
|
||||
|
||||
if (ang != DAngle::fromDeg(INT_MIN))
|
||||
{
|
||||
pPlayer->actor->spr.Angles.Yaw = ang;
|
||||
pPlayer->actor->backupang();
|
||||
}
|
||||
return gPlayer[myconnectindex].actor;
|
||||
}
|
||||
|
||||
void GameInterface::ToggleThirdPerson()
|
||||
|
|
|
@ -118,20 +118,9 @@ static int ccmd_spawn(CCmdFuncPtr parm)
|
|||
return CCMD_OK;
|
||||
}
|
||||
|
||||
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
|
||||
DCoreActor* GameInterface::getConsoleActor()
|
||||
{
|
||||
player_struct* p = &ps[myconnectindex];
|
||||
auto pActor = p->GetActor();
|
||||
|
||||
if (!pActor) return;
|
||||
|
||||
pActor->spr.pos = DVector3(x, y, z);
|
||||
pActor->backuppos();
|
||||
|
||||
if (ang != DAngle::fromDeg(INT_MIN))
|
||||
{
|
||||
p->GetActor()->PrevAngles.Yaw = p->GetActor()->spr.Angles.Yaw = ang;
|
||||
}
|
||||
return ps[myconnectindex].GetActor();
|
||||
}
|
||||
|
||||
void GameInterface::ToggleThirdPerson()
|
||||
|
|
|
@ -51,7 +51,7 @@ struct GameInterface : public ::GameInterface
|
|||
void NewGame(MapRecord* map, int skill, bool) override;
|
||||
void LevelCompleted(MapRecord* map, int skill) override;
|
||||
bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override;
|
||||
void WarpToCoords(double x, double y, double z, DAngle ang) override;
|
||||
DCoreActor* getConsoleActor() override;
|
||||
void ToggleThirdPerson() override;
|
||||
void SwitchCoopView() override;
|
||||
void ToggleShowWeapon() override;
|
||||
|
|
|
@ -234,7 +234,7 @@ struct GameInterface : public ::GameInterface
|
|||
bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override;
|
||||
DAngle playerPitchMin() override { return DAngle::fromDeg(49.5); }
|
||||
DAngle playerPitchMax() override { return DAngle::fromDeg(-49.5); }
|
||||
void WarpToCoords(double x, double y, double z, DAngle ang) override;
|
||||
DCoreActor* getConsoleActor() override;
|
||||
void ToggleThirdPerson() override;
|
||||
void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double interpfrac) override;
|
||||
int GetCurrentSkill() override;
|
||||
|
|
|
@ -39,17 +39,9 @@ BEGIN_PS_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
|
||||
DCoreActor* GameInterface::getConsoleActor()
|
||||
{
|
||||
Player *nPlayer = &PlayerList[nLocalPlayer];
|
||||
|
||||
nPlayer->pActor->spr.pos = DVector3(x, y, z);
|
||||
nPlayer->pActor->backuppos();
|
||||
|
||||
if (ang != DAngle::fromDeg(INT_MIN))
|
||||
{
|
||||
nPlayer->pActor->PrevAngles.Yaw = nPlayer->pActor->spr.Angles.Yaw = ang;
|
||||
}
|
||||
return PlayerList[nLocalPlayer].pActor;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -1694,7 +1694,7 @@ struct GameInterface : public ::GameInterface
|
|||
void NextLevel(MapRecord *map, int skill) override;
|
||||
void NewGame(MapRecord *map, int skill, bool) override;
|
||||
bool DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos, const DAngle cang, const DVector2& xydim, const double czoom, double const interpfrac) override;
|
||||
void WarpToCoords(double x, double y, double z, DAngle ang) override;
|
||||
DCoreActor* getConsoleActor() override;
|
||||
void ToggleThirdPerson() override;
|
||||
void SwitchCoopView() override;
|
||||
void processSprites(tspriteArray& tsprites, const DVector3& view, DAngle viewang, double smoothRatio) override;
|
||||
|
|
|
@ -54,21 +54,9 @@ BEGIN_SW_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void GameInterface::WarpToCoords(double x, double y, double z, DAngle ang)
|
||||
DCoreActor* GameInterface::getConsoleActor()
|
||||
{
|
||||
auto pp = &Player[myconnectindex];
|
||||
auto ppActor = pp->actor;
|
||||
|
||||
if (!ppActor) return;
|
||||
|
||||
ppActor->spr.pos = DVector3(x,y,z);
|
||||
|
||||
if (ang != DAngle::fromDeg(INT_MIN))
|
||||
{
|
||||
Player->actor->spr.Angles.Yaw = ang;
|
||||
}
|
||||
|
||||
ppActor->backuploc();
|
||||
return Player[myconnectindex].actor;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue