- make ang and horiz optional on each game's warptocoords CCMD as suggested in commentary for 1dc6edfa56.

This commit is contained in:
Mitchell Richters 2020-08-04 22:33:17 +10:00
parent 8817914744
commit b9eef9c6a3
4 changed files with 51 additions and 20 deletions

View file

@ -194,7 +194,7 @@ static int osdcmd_levelwarp(CCmdFuncPtr parm)
static int osdcmd_warptocoords(CCmdFuncPtr parm)
{
if (parm->numparms != 5)
if (parm->numparms < 3 || parm->numparms > 5)
return CCMD_SHOWHELP;
PLAYER *pPlayer = &gPlayer[myconnectindex];
@ -202,9 +202,18 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
pPlayer->pSprite->x = gView->pSprite->x = atoi(parm->parms[0]);
pPlayer->pSprite->y = gView->pSprite->y = atoi(parm->parms[1]);
pPlayer->zView = gView->zView = atoi(parm->parms[2]);
if (parm->numparms == 4)
{
pPlayer->q16ang = gView->q16ang = fix16_from_int(atoi(parm->parms[3]));
}
if (parm->numparms == 5)
{
// fix me, I'm broken.
pPlayer->q16horiz = gView->q16horiz = fix16_from_int(atoi(parm->parms[4]));
gViewAngle = fix16_from_dbl(atan2(atoi(parm->parms[4]), 100) * (1024. / pi::pi()));
}
viewBackupView(pPlayer->nPlayer);
@ -221,7 +230,7 @@ int32_t registerosdcommands(void)
C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] [horiz]: warps the player to the specified coordinates",osdcmd_warptocoords);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
return 0;
}

View file

@ -125,7 +125,7 @@ static int osdcmd_changelevel(CCmdFuncPtr parm)
static int osdcmd_warptocoords(CCmdFuncPtr parm)
{
if (parm->numparms != 5)
if (parm->numparms < 3 || parm->numparms > 5)
return CCMD_SHOWHELP;
Player *nPlayer = &PlayerList[nLocalPlayer];
@ -135,8 +135,15 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
nPlayer->opos.y = pSprite->y = atoi(parm->parms[1]);
nPlayer->opos.z = pSprite->z = atoi(parm->parms[2]);
if (parm->numparms == 4)
{
nPlayer->q16angle = fix16_from_int(atoi(parm->parms[3]));
}
if (parm->numparms == 5)
{
nPlayer->q16horiz = fix16_from_int(atoi(parm->parms[4]));
}
return CCMD_OK;
}
@ -162,7 +169,7 @@ int32_t registerosdcommands(void)
//C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] [horiz]: warps the player to the specified coordinates",osdcmd_warptocoords);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
return 0;
}

View file

@ -263,7 +263,7 @@ static int ccmd_give(CCmdFuncPtr parm)
static int osdcmd_warptocoords(CCmdFuncPtr parm)
{
if (parm->numparms != 5)
if (parm->numparms < 3 || parm->numparms > 5)
return CCMD_SHOWHELP;
player_struct* p = &ps[myconnectindex];
@ -271,8 +271,16 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
p->oposx = p->posx = atoi(parm->parms[0]);
p->oposy = p->posy = atoi(parm->parms[1]);
p->oposz = p->posz = atoi(parm->parms[2]);
if (parm->numparms == 4)
{
p->oq16ang = p->q16ang = fix16_from_int(atoi(parm->parms[3]));
}
if (parm->numparms == 5)
{
p->oq16horiz = p->q16horiz = fix16_from_int(atoi(parm->parms[4]));
}
return CCMD_OK;
}
@ -292,7 +300,7 @@ int registerosdcommands(void)
C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",ccmd_spawn);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] [horiz]: warps the player to the specified coordinates",osdcmd_warptocoords);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
return 0;
}

View file

@ -278,15 +278,22 @@ static int osdcmd_give(CCmdFuncPtr parm)
static int osdcmd_warptocoords(CCmdFuncPtr parm)
{
if (parm->numparms != 5)
if (parm->numparms < 3 || parm->numparms > 5)
return CCMD_SHOWHELP;
Player->oposx = Player->posx = atoi(parm->parms[0]);
Player->oposy = Player->posy = atoi(parm->parms[1]);
Player->oposz = Player->posz = atoi(parm->parms[2]);
if (parm->numparms == 4)
{
Player->oq16ang = Player->q16ang = Player->camq16ang = fix16_from_int(atoi(parm->parms[3]));
}
if (parm->numparms == 5)
{
Player->oq16horiz = Player->q16horiz = Player->camq16horiz = fix16_from_int(atoi(parm->parms[4]));
}
return CCMD_OK;
}
@ -306,7 +313,7 @@ int32_t registerosdcommands(void)
// C_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] [horiz]: warps the player to the specified coordinates",osdcmd_warptocoords);
C_RegisterFunction("warptocoords","warptocoords [x] [y] [z] [ang] (optional) [horiz] (optional): warps the player to the specified coordinates",osdcmd_warptocoords);
return 0;
}