Make the tsprite CON stuff into its own commands

git-svn-id: https://svn.eduke32.com/eduke32@856 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-07-13 07:10:47 +00:00
parent 5ce5b287fa
commit 99671274aa
6 changed files with 134 additions and 10 deletions

View file

@ -5714,6 +5714,7 @@ void overheadeditor(void)
{
if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //Ctrl
{
nextmap:
// bad = 0;
i = menuselect_pk(keystatus[0x2a]>0 ? 0:1); // Left Shift: prev map
if (i < 0)
@ -5744,7 +5745,8 @@ void overheadeditor(void)
oposz = posz;
if (i < 0)
{
printmessage16("Invalid map format.");
// printmessage16("Invalid map format.");
goto nextmap;
}
else
{

View file

@ -2888,7 +2888,7 @@ void drawtileinfo(char *title,int x,int y,int picnum,int shade,int pal,int cstat
{
char buf[64];
int i,j;
int scale=65526;
int scale=65536;
int x1;
j = xdimgame>640?0:1;

View file

@ -453,6 +453,8 @@ static const char *keyw[] =
"starttrackvar", // 321
"qgetsysstr", // 322
"getticks", // 323
"gettspr", // 324
"settspr", // 325
"<null>"
};
@ -564,6 +566,11 @@ const memberlabel_t actorlabels[]=
{ "xpanning", ACTOR_XPANNING, 0, 0 },
{ "ypanning", ACTOR_YPANNING, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST
};
const memberlabel_t tsprlabels[]=
{
// tsprite access
{ "tsprx", ACTOR_TSPRX, 0, 0 },
@ -3303,6 +3310,76 @@ static int parsecommand(void)
break;
}
case CON_GETTSPR:
case CON_SETTSPR:
{
int lLabelID;
if (current_event != EVENT_ANIMATESPRITES)
{
ReportError(-1);
initprintf("%s:%d: warning: found `%s' outside of EVENT_ANIMATESPRITES\n",compilefile,line_number,tempbuf);
}
// syntax getwall[<var>].x <VAR>
// gets the value of wall[<var>].xxx into <VAR>
// now get name of .xxx
while ((*textptr != '['))
{
textptr++;
}
if (*textptr == '[')
textptr++;
// get the ID of the DEF
// labelsonly = 1;
transvar();
labelsonly = 0;
// now get name of .xxx
while (*textptr != '.')
{
if (*textptr == 0xa)
break;
if (!*textptr)
break;
textptr++;
}
if (*textptr!='.')
{
error++;
ReportError(ERROR_SYNTAXERROR);
return 0;
}
textptr++;
/// now pointing at 'xxx'
getlabel();
//printf("found xxx label of '%s'\n", label+(labelcnt<<6));
lLabelID=getlabeloffset(tsprlabels,label+(labelcnt<<6));
//printf("LabelID is %d\n",lLabelID);
if (lLabelID == -1)
{
error++;
ReportError(ERROR_SYMBOLNOTRECOGNIZED);
return 0;
}
*scriptptr++=tsprlabels[lLabelID].lId;
//printf("member's flags are: %02Xh\n",actorlabels[lLabelID].flags);
// now at target VAR...
// get the ID of the DEF
if (tw == CON_GETTSPR)
transvartype(GAMEVAR_FLAG_READONLY);
else
transvar();
break;
}
case CON_GETTICKS:
if (CheckEventSync(current_event))
ReportError(WARNING_REVEVENTSYNC);

View file

@ -443,6 +443,10 @@ enum actorlabels
ACTOR_MDFLAGS,
ACTOR_XPANNING,
ACTOR_YPANNING,
};
enum tsprlabels
{
ACTOR_TSPRX,
ACTOR_TSPRY,
ACTOR_TSPRZ,
@ -825,5 +829,7 @@ enum keywords
CON_READARRAYFROMFILE, // 320
CON_STARTTRACKVAR, // 321
CON_QGETSYSSTR, // 322
CON_GETTICKS // 323
CON_GETTICKS, // 323
CON_GETTSPR, // 324
CON_SETTSPR, // 325
};

View file

@ -3433,6 +3433,30 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
SetGameVarID(lVar2, spriteext[iActor].ypanning,g_i,g_p);
return;
default:
return;
}
}
static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
{
int lValue;
int iActor=g_i;
if (lVar1 != g_iThisActorID)
iActor=GetGameVarID(lVar1, g_i, g_p);
if (iActor < 0 || iActor >= MAXSPRITES)
{
OSD_Printf("DoTsprite(): invalid target sprite (%d) %d %d\n",iActor,g_i,g_sp->picnum);
insptr += (lVar2 == MAXGAMEVARS);
return;
}
lValue=GetGameVarID(lVar2, g_i, g_p);
switch (lLabelID)
{
case ACTOR_TSPRX:
if (!spriteext[iActor].tspr)
return;
@ -6920,6 +6944,21 @@ static int parse(void)
break;
}
case CON_SETTSPR:
case CON_GETTSPR:
insptr++;
{
// syntax [gs]etactor[<var>].x <VAR>
// <varid> <xxxid> <varid>
int lVar1=*insptr++, lLabelID=*insptr++, lVar2;
lVar2=*insptr++;
DoTsprite(tw==CON_SETTSPR, lVar1, lLabelID, lVar2);
break;
}
case CON_GETANGLETOTARGET:
insptr++;
// hittype[g_i].lastvx and lastvy are last known location of target.