mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Fix some weirdness in osdcmd_setactorvar() and remove an unused counter var from osdcmd_map()
git-svn-id: https://svn.eduke32.com/eduke32@7037 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2f410776ec
commit
f67f935807
1 changed files with 14 additions and 16 deletions
|
@ -185,14 +185,13 @@ static int32_t osdcmd_map(osdfuncparm_t const * const parm)
|
||||||
|
|
||||||
if (maxwidth > 0)
|
if (maxwidth > 0)
|
||||||
{
|
{
|
||||||
int32_t x = 0, count = 0;
|
int32_t x = 0;
|
||||||
maxwidth += 3;
|
maxwidth += 3;
|
||||||
OSD_Printf(OSDTEXT_RED "Map listing:\n");
|
OSD_Printf(OSDTEXT_RED "Map listing:\n");
|
||||||
for (r=fnlist.findfiles; r; r=r->next)
|
for (r=fnlist.findfiles; r; r=r->next)
|
||||||
{
|
{
|
||||||
OSD_Printf("%-*s",maxwidth,r->name);
|
OSD_Printf("%-*s",maxwidth,r->name);
|
||||||
x += maxwidth;
|
x += maxwidth;
|
||||||
count++;
|
|
||||||
if (x > OSD_GetCols() - maxwidth)
|
if (x > OSD_GetCols() - maxwidth)
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -641,9 +640,6 @@ static int32_t osdcmd_addlogvar(osdfuncparm_t const * const parm)
|
||||||
|
|
||||||
static int32_t osdcmd_setactorvar(osdfuncparm_t const * const parm)
|
static int32_t osdcmd_setactorvar(osdfuncparm_t const * const parm)
|
||||||
{
|
{
|
||||||
int32_t i, varval, ID;
|
|
||||||
char varname[256];
|
|
||||||
|
|
||||||
if (parm->numparms != 3) return OSDCMD_SHOWHELP;
|
if (parm->numparms != 3) return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
if (numplayers > 1)
|
if (numplayers > 1)
|
||||||
|
@ -652,24 +648,26 @@ static int32_t osdcmd_setactorvar(osdfuncparm_t const * const parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ID=Batol(parm->parms[0]);
|
int32_t spriteNum = Batol(parm->parms[0]);
|
||||||
if (ID>=MAXSPRITES)
|
|
||||||
|
if ((unsigned)spriteNum >= MAXSPRITES)
|
||||||
{
|
{
|
||||||
OSD_Printf("Invalid sprite ID\n");
|
OSD_Printf("Invalid sprite ID\n");
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
varval = Batol(parm->parms[2]);
|
// get value to set
|
||||||
strcpy(varname,parm->parms[2]);
|
char varname[MAXVARLABEL];
|
||||||
varval = Batol(varname);
|
strcpy(varname, parm->parms[2]);
|
||||||
i = hash_find(&h_gamevars,varname);
|
|
||||||
if (i >= 0)
|
|
||||||
varval=Gv_GetVar(i, g_player[screenpeek].ps->i, screenpeek);
|
|
||||||
|
|
||||||
strcpy(varname,parm->parms[1]);
|
int32_t i = hash_find(&h_gamevars, varname);
|
||||||
i = hash_find(&h_gamevars,varname);
|
int32_t const newValue = (i >= 0) ? Gv_GetVar(i, g_player[screenpeek].ps->i, screenpeek) : Batol(varname);
|
||||||
|
|
||||||
|
strcpy(varname, parm->parms[1]);
|
||||||
|
i = hash_find(&h_gamevars, varname);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
Gv_SetVar(i, varval, ID, -1);
|
Gv_SetVar(i, newValue, spriteNum, -1);
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue