CON access to tsprite

git-svn-id: https://svn.eduke32.com/eduke32@853 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-07-12 10:57:52 +00:00
parent 110bd25989
commit fb80a8ec28
10 changed files with 222 additions and 20 deletions

View file

@ -168,6 +168,7 @@ typedef struct BPACK {
unsigned char flags; unsigned char flags;
unsigned char xpanning, ypanning; unsigned char xpanning, ypanning;
char filler[1]; char filler[1];
spritetype *tspr;
} spriteexttype; } spriteexttype;
typedef struct BPACK { typedef struct BPACK {
@ -181,6 +182,8 @@ typedef struct BPACK {
#define SPREXT_NOMDANIM 2 #define SPREXT_NOMDANIM 2
#define SPREXT_AWAY1 4 #define SPREXT_AWAY1 4
#define SPREXT_AWAY2 8 #define SPREXT_AWAY2 8
#define SPREXT_TSPRACCESS 16
EXTERN spriteexttype *spriteext; EXTERN spriteexttype *spriteext;
EXTERN spritesmoothtype *spritesmooth; EXTERN spritesmoothtype *spritesmooth;
EXTERN int guniqhudid; EXTERN int guniqhudid;

View file

@ -756,6 +756,7 @@ static void scansector(short sectnum)
if ((spr->cstat&48) || (xs*cosglobalang+ys*singlobalang > 0)) if ((spr->cstat&48) || (xs*cosglobalang+ys*singlobalang > 0))
{ {
copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype)); copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype));
spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt];
tsprite[spritesortcnt++].owner = z; tsprite[spritesortcnt++].owner = z;
} }
} }

View file

@ -3923,6 +3923,7 @@ static void polymost_scansector(int sectnum)
if ((spr->cstat&48) || (xs*gcosang+ys*gsinang > 0)) if ((spr->cstat&48) || (xs*gcosang+ys*gsinang > 0))
{ {
copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype)); copybufbyte(spr,&tsprite[spritesortcnt],sizeof(spritetype));
spriteext[z].tspr = (spritetype *)&tsprite[spritesortcnt];
tsprite[spritesortcnt++].owner = z; tsprite[spritesortcnt++].owner = z;
} }
} }

View file

@ -168,6 +168,7 @@ static int infobox=3; // bit0: current window, bit1: mouse pointer, the variable
extern char mskip; extern char mskip;
extern short capturecount; extern short capturecount;
extern int editorgridextent; // in engine.c
static void clearfilenames(void) static void clearfilenames(void)
{ {
@ -6346,10 +6347,13 @@ static void Keys2d(void)
else if (pointhighlight <= 16383) else if (pointhighlight <= 16383)
{ {
i = linehighlight; i = linehighlight;
j = wall[i].x;
k = wall[i].y;
Bsprintf(tempbuf,"Wall %d x: ",i); Bsprintf(tempbuf,"Wall %d x: ",i);
wall[i].x = getnumber16(tempbuf,wall[i].x,131072,1); j = getnumber16(tempbuf,j,editorgridextent,1);
Bsprintf(tempbuf,"Wall %d y: ",i); Bsprintf(tempbuf,"Wall %d y: ",i);
wall[i].y = getnumber16(tempbuf,wall[i].y,131072,1); k = getnumber16(tempbuf,k,editorgridextent,1);
dragpoint(i, j, k);
Bsprintf(tempbuf,"Wall %d updated",i); Bsprintf(tempbuf,"Wall %d updated",i);
printmessage16(tempbuf); printmessage16(tempbuf);
} }

View file

@ -799,7 +799,8 @@ enum events {
EVENT_DISPLAYBONUSSCREEN, EVENT_DISPLAYBONUSSCREEN,
EVENT_DISPLAYMENU, EVENT_DISPLAYMENU,
EVENT_DISPLAYMENUREST, EVENT_DISPLAYMENUREST,
EVENT_DISPLAYLOADINGSCREEN EVENT_DISPLAYLOADINGSCREEN,
EVENT_ANIMATESPRITES
}; };
enum sysstrs { enum sysstrs {

View file

@ -194,7 +194,6 @@ extern void setgamepalette(player_struct *player, char *pal, int set);
extern void fadepal(int r, int g, int b, int start, int end, int step); extern void fadepal(int r, int g, int b, int start, int end, int step);
extern inline int minitextshade(int x,int y,const char *t,int s,int p,int sb); extern inline int minitextshade(int x,int y,const char *t,int s,int p,int sb);
extern inline int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2);
extern inline int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2,int z); extern inline int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2,int z);
extern void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z); extern void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2, int z);
extern void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2); extern void txdigitalnumber(int starttile, int x,int y,int n,int s,int pal,int cs,int x1, int y1, int x2, int y2);

View file

@ -277,11 +277,6 @@ void setgamepalette(player_struct *player, char *pal, int set)
#define TEXTWRAPLEN (scale(39,ud.config.ScreenWidth,320)) #define TEXTWRAPLEN (scale(39,ud.config.ScreenWidth,320))
int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2)
{
return gametext_z(small,starttile,x,y,t,s,p,orientation,x1,y1,x2,y2,65536);
}
int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2, int z) int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,int orientation,int x1, int y1, int x2, int y2, int z)
{ {
int ac,newx,oldx=x; int ac,newx,oldx=x;
@ -358,9 +353,9 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
rotatesprite(x<<16,(y<<16)+(small?ud.config.ScreenHeight<<15:0),z,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2); rotatesprite(x<<16,(y<<16)+(small?ud.config.ScreenHeight<<15:0),z,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2);
// if ((*t >= '0' && *t <= '9')) if ((*t >= '0' && *t <= '9'))
x += 8*z/65536; x += 8*z/65536;
// else x += tilesizx[ac]*z/65536;//(tilesizx[ac]>>small); else x += tilesizx[ac]*z/65536;//(tilesizx[ac]>>small);
if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = (char *)t, x = oldx, y+=8*z/65536; if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = (char *)t, x = oldx, y+=8*z/65536;
t++; t++;
} }
@ -370,19 +365,19 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i
inline int gametext(int x,int y,const char *t,int s,int dabits) inline int gametext(int x,int y,const char *t,int s,int dabits)
{ {
return(gametext_(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); return(gametext_z(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536));
} }
inline int gametextpal(int x,int y,const char *t,int s,int p) inline int gametextpal(int x,int y,const char *t,int s,int p)
{ {
return(gametext_(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1)); return(gametext_z(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536));
} }
static inline int mpgametext(int y,const char *t,int s,int dabits) static inline int mpgametext(int y,const char *t,int s,int dabits)
{ {
if (xdim >= 640 && ydim >= 480) if (xdim >= 640 && ydim >= 480)
return(gametext_(1,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); return(gametext_z(1,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536));
return(gametext_(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); return(gametext_z(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536));
} }
static int minitext_(int x,int y,const char *t,int s,int p,int sb) static int minitext_(int x,int y,const char *t,int s,int p,int sb)
@ -7077,6 +7072,12 @@ PALONLY:
if (sector[t->sectnum].floorpicnum == MIRROR) if (sector[t->sectnum].floorpicnum == MIRROR)
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
} }
for (j=0;j < spritesortcnt; j++)
if (spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS)
{
OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1);
spriteext[tsprite[j].owner].tspr = NULL;
}
} }
#ifdef _MSC_VER #ifdef _MSC_VER
//#pragma auto_inline() //#pragma auto_inline()
@ -8248,7 +8249,7 @@ static void comlinehelp(void)
"-NUM\t\tLoad and run a game from slot NUM (0-9)\n" "-NUM\t\tLoad and run a game from slot NUM (0-9)\n"
"-a\t\tUse fake player AI (fake multiplayer only)\n" "-a\t\tUse fake player AI (fake multiplayer only)\n"
"-cNUM\t\tUse MP mode NUM, 1 = DukeMatch(spawn), 2 = Coop, 3 = Dukematch(no spawn)\n" "-cNUM\t\tUse MP mode NUM, 1 = DukeMatch(spawn), 2 = Coop, 3 = Dukematch(no spawn)\n"
"-cfg FILE\tUse configuration file FILE\n" "-cfg FILE\t\tUse configuration file FILE\n"
"-dFILE\t\tStart to play demo FILE\n" "-dFILE\t\tStart to play demo FILE\n"
/* "-fNUM\t\tSend fewer packets in multiplayer (1, 2, 4) (deprecated)\n" */ /* "-fNUM\t\tSend fewer packets in multiplayer (1, 2, 4) (deprecated)\n" */
"-game_dir DIR\tSee -j\n" "-game_dir DIR\tSee -j\n"
@ -8278,10 +8279,14 @@ static void comlinehelp(void)
#endif #endif
"-vNUM\t\tWarp to volume NUM (1-4), see -l\n" "-vNUM\t\tWarp to volume NUM (1-4), see -l\n"
"-xFILE\t\tLoad CON script FILE (default EDUKE.CON/GAME.CON)\n" "-xFILE\t\tLoad CON script FILE (default EDUKE.CON/GAME.CON)\n"
"-zNUM, -condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n" "-zNUM,\n-condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n"
"\n-?, -help, --help\tDisplay this help message and exit" "\n-?, -help\tDisplay this help message and exit"
; ;
#if defined RENDERTYPEWIN
wm_msgbox(HEAD2,s); wm_msgbox(HEAD2,s);
#else
initprintf("%s\n",s);
#endif
} }
static signed int rancid_players = 0; static signed int rancid_players = 0;

View file

@ -563,6 +563,23 @@ const memberlabel_t actorlabels[]=
{ "mdflags", ACTOR_MDFLAGS, 0, 0 }, { "mdflags", ACTOR_MDFLAGS, 0, 0 },
{ "xpanning", ACTOR_XPANNING, 0, 0 }, { "xpanning", ACTOR_XPANNING, 0, 0 },
{ "ypanning", ACTOR_YPANNING, 0, 0 }, { "ypanning", ACTOR_YPANNING, 0, 0 },
// tsprite access
{ "tsprx", ACTOR_TSPRX, 0, 0 },
{ "tspry", ACTOR_TSPRY, 0, 0 },
{ "tsprz", ACTOR_TSPRZ, 0, 0 },
{ "tsprcstat", ACTOR_TSPRCSTAT, 0, 0 },
{ "tsprpicnum", ACTOR_TSPRPICNUM, 0, 0 },
{ "tsprshade", ACTOR_TSPRSHADE, 0, 0 },
{ "tsprpal", ACTOR_TSPRPAL, 0, 0 },
{ "tsprxrepeat", ACTOR_TSPRXREPEAT, 0, 0 },
{ "tspryrepeat", ACTOR_TSPRYREPEAT, 0, 0 },
{ "tsprxoffset", ACTOR_TSPRXOFFSET, 0, 0 },
{ "tspryoffset", ACTOR_TSPRYOFFSET, 0, 0 },
{ "tsprsectnum", ACTOR_TSPRSECTNUM, 0, 0 },
{ "tsprang", ACTOR_TSPRANG, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST { "", -1, 0, 0 } // END OF LIST
}; };
@ -1154,6 +1171,7 @@ static int CheckEventSync(int iEventID)
{ {
switch (iEventID) switch (iEventID)
{ {
case EVENT_ANIMATESPRITES:
case EVENT_CHEATGETSTEROIDS: case EVENT_CHEATGETSTEROIDS:
case EVENT_CHEATGETHEAT: case EVENT_CHEATGETHEAT:
case EVENT_CHEATGETBOOT: case EVENT_CHEATGETBOOT:
@ -4890,6 +4908,7 @@ static void AddDefaultDefinitions(void)
{ {
AddDefinition("EVENT_AIMDOWN",EVENT_AIMDOWN,LABEL_DEFINE); AddDefinition("EVENT_AIMDOWN",EVENT_AIMDOWN,LABEL_DEFINE);
AddDefinition("EVENT_AIMUP",EVENT_AIMUP,LABEL_DEFINE); AddDefinition("EVENT_AIMUP",EVENT_AIMUP,LABEL_DEFINE);
AddDefinition("EVENT_ANIMATESPRITES",EVENT_ANIMATESPRITES,LABEL_DEFINE);
AddDefinition("EVENT_CHANGEWEAPON",EVENT_CHANGEWEAPON,LABEL_DEFINE); AddDefinition("EVENT_CHANGEWEAPON",EVENT_CHANGEWEAPON,LABEL_DEFINE);
AddDefinition("EVENT_CHEATGETBOOT",EVENT_CHEATGETBOOT,LABEL_DEFINE); AddDefinition("EVENT_CHEATGETBOOT",EVENT_CHEATGETBOOT,LABEL_DEFINE);
AddDefinition("EVENT_CHEATGETFIRSTAID",EVENT_CHEATGETFIRSTAID,LABEL_DEFINE); AddDefinition("EVENT_CHEATGETFIRSTAID",EVENT_CHEATGETFIRSTAID,LABEL_DEFINE);

View file

@ -442,7 +442,20 @@ enum actorlabels
ACTOR_MDZOFF, ACTOR_MDZOFF,
ACTOR_MDFLAGS, ACTOR_MDFLAGS,
ACTOR_XPANNING, ACTOR_XPANNING,
ACTOR_YPANNING ACTOR_YPANNING,
ACTOR_TSPRX,
ACTOR_TSPRY,
ACTOR_TSPRZ,
ACTOR_TSPRCSTAT,
ACTOR_TSPRPICNUM,
ACTOR_TSPRSHADE,
ACTOR_TSPRPAL,
ACTOR_TSPRXREPEAT,
ACTOR_TSPRYREPEAT,
ACTOR_TSPRXOFFSET,
ACTOR_TSPRYOFFSET,
ACTOR_TSPRSECTNUM,
ACTOR_TSPRANG,
}; };
enum inputlabels enum inputlabels

View file

@ -3433,6 +3433,162 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
SetGameVarID(lVar2, spriteext[iActor].ypanning,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].ypanning,g_i,g_p);
return; return;
case ACTOR_TSPRX:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->x=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->x,g_i,g_p);
return;
case ACTOR_TSPRY:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->y=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->y,g_i,g_p);
return;
case ACTOR_TSPRZ:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->z=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->z,g_i,g_p);
return;
case ACTOR_TSPRCSTAT:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->cstat=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->cstat,g_i,g_p);
return;
case ACTOR_TSPRPICNUM:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->picnum=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->picnum,g_i,g_p);
return;
case ACTOR_TSPRSHADE:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->shade=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->shade,g_i,g_p);
return;
case ACTOR_TSPRPAL:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->pal=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->pal,g_i,g_p);
return;
case ACTOR_TSPRXREPEAT:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->xrepeat=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->xrepeat,g_i,g_p);
return;
case ACTOR_TSPRYREPEAT:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->yrepeat=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->yrepeat,g_i,g_p);
return;
case ACTOR_TSPRXOFFSET:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->xoffset=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->xoffset,g_i,g_p);
return;
case ACTOR_TSPRYOFFSET:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->yoffset=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->yoffset,g_i,g_p);
return;
case ACTOR_TSPRSECTNUM:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->sectnum=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->sectnum,g_i,g_p);
return;
case ACTOR_TSPRANG:
if (!spriteext[iActor].tspr)
return;
if (iSet)
{
spriteext[iActor].tspr->ang=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->ang,g_i,g_p);
return;
default: default:
return; return;
} }