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

@ -4070,9 +4070,9 @@ void displayrooms(int snum,int smoothratio)
#endif
if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0)
#if defined(POLYMOST) && defined(USE_OPENGL)
&& (rendmode != 4)
&& (rendmode != 4)
#endif
)
)
{
dst = 0x7fffffff;
i = 0;
@ -8285,7 +8285,7 @@ static void comlinehelp(void)
"-xFILE\t\tLoad CON script FILE (default EDUKE.CON/GAME.CON)\n"
"-zNUM,\n-condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n"
"\n-?, -help\tDisplay this help message and exit"
;
;
#if defined RENDERTYPEWIN
wm_msgbox(HEAD2,s);
#else

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);
@ -5193,10 +5270,10 @@ void loadefs(const char *filenam)
loadfromgrouponly = 1;
return;
}
else
else
{
#if (defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2))
while(!quitevent) // keep the window open so people can copy CON errors out of it
while (!quitevent) // keep the window open so people can copy CON errors out of it
handleevents();
#endif
gameexit("");

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;
@ -5750,9 +5774,9 @@ static int parse(void)
#endif
if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0)
#if defined(POLYMOST) && defined(USE_OPENGL)
&& (rendmode != 4)
&& (rendmode != 4)
#endif
)
)
{
int j, i = 0, k, dst = 0x7fffffff;
@ -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.