Lunatic: actions prototype, not enabled even in the dev build.

For Lunatic, we'll want to get rid of the t_data --> script indirections, since
the latter will be no more.  Thus, all parameters are saved in t_data directly.

For the normal build, there are no changes, only stylistic tweaks.

git-svn-id: https://svn.eduke32.com/eduke32@2669 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-18 12:46:10 +00:00
parent 165c569cbe
commit f5fb70250a
4 changed files with 62 additions and 16 deletions

View file

@ -699,7 +699,13 @@ static void A_MoveSector(int32_t i)
}
}
#define LIGHTRAD_PICOFS (T5 ? *(script+T5) + (*(script+T5+2))*T4 : 0)
#if 1 //ndef LUNATIC
# define LIGHTRAD_PICOFS (T5 ? *(script+T5) + (*(script+T5+2))*T4 : 0)
#else
// SACTION
// startframe + viewtype*???
# define LIGHTRAD_PICOFS (SACTION_STARTFRAME(actor[i].t_data) + SACTION_VIEWTYPE(actor[i].t_data)*T4)
#endif
// this is the same crap as in game.c's tspr manipulation. puke.
#define LIGHTRAD (s->yrepeat * tilesizy[s->picnum+LIGHTRAD_PICOFS])

View file

@ -43,6 +43,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define STAT_DUMMYPLAYER 13
#define STAT_LIGHT 14
#ifdef LUNATIC
// Ai, action, move getters from t_data[] (== tptr)
# define SACTION_STARTFRAME(tptr) ((tptr)[6]&65535)
# define SACTION_NUMFRAMES(tptr) (((tptr)[6]>>16)&65535)
# define SACTION_VIEWTYPE(tptr) ((tptr)[7]&0x7fffffff)
# define SACTION_INCVAL(tptr) ((tptr)[7]>>31) // arithmetic shr expected!
# define SACTION_DELAY(tptr) ((tptr)[8]&65535)
#endif
// Defines the motion characteristics of an actor
enum amoveflags_t {
face_player = 1,

View file

@ -5995,7 +5995,7 @@ static int32_t maybe_take_on_pal_of_floor(spritetype *datspr, int32_t sect)
void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
{
int32_t i, j, k, p, sect;
intptr_t l, t1,t3,t4;
intptr_t l, t_data1,t_data3,t_data4;
spritetype *s,*t;
int32_t switchpic;
@ -6130,6 +6130,9 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
for (j=spritesortcnt-1; j>=0; j--) //Between drawrooms() and drawmasks()
{
#if 0 // def LUNATIC
const int32_t *tptr;
#endif
//is the perfect time to animate sprites
t = &tsprite[j];
i = t->owner;
@ -6227,9 +6230,14 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
}
sect = s->sectnum;
t1 = T2;
t3 = T4;
t4 = T5;
t_data1 = T2;
t_data3 = T4;
#if 1 // ndef LUNATIC
t_data4 = T5; // SACTION
#else
tptr = &actor[i].t_data;
#endif
switchpic = s->picnum;
//some special cases because dynamictostatic system can't handle addition to constants
if ((s->picnum >= SCRAP6)&&(s->picnum<=SCRAP6+7))
@ -6365,7 +6373,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
}
else t->cstat &= ~4;
if (klabs(t3) > 64) k += 7;
if (klabs(t_data3) > 64) k += 7;
t->picnum = RECON+k;
break;
@ -6497,9 +6505,14 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
if (g_player[p].ps->newowner > -1)
{
t4 = *(actorscrptr[APLAYER]+1);
t3 = 0;
t1 = *(actorscrptr[APLAYER]+2);
#if 1 // ndef LUNATIC
t_data4 = *(actorscrptr[APLAYER]+1);
#else
// Lunatic TODO: SACTION of APLAYER
tptr = (void)0; // forced compilation error
#endif
t_data3 = 0;
t_data1 = *(actorscrptr[APLAYER]+2);
}
if (ud.camerasprite == -1 && g_player[p].ps->newowner == -1)
@ -6606,10 +6619,14 @@ PALONLY:
}
*/
if ((unsigned)t4 + 2 >= (unsigned)g_scriptSize)
#if 1 //ndef LUNATIC
if ((unsigned)t_data4 + 2 >= (unsigned)g_scriptSize)
goto skip;
l = *(script + t4 + 2);
l = *(script + t_data4 + 2);
#else
l = SACTION_VIEWTYPE(tptr);
#endif
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
@ -6665,7 +6682,11 @@ PALONLY:
break;
}
t->picnum += k + *(script + t4) + l*t3;
#if 1 // ndef LUNATIC
t->picnum += k + *(script + t_data4) + l*t_data3;
#else
t->picnum += k + SACTION_STARTFRAME(tptr) + l*t_data3;
#endif
if (l > 0)
while (tilesizx[t->picnum] == 0 && t->picnum > 0)
@ -6824,7 +6845,7 @@ skip:
break;
case WATERSPLASH2__STATIC:
t->picnum = WATERSPLASH2+t1;
t->picnum = WATERSPLASH2+t_data1;
break;
case SHELL__STATIC:
t->picnum = s->picnum+(T1&1);

View file

@ -5004,17 +5004,27 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
/* Helixhorned: let's do away with intptr_t's... */
if ((unsigned)vm.g_t[4] + 4 < (unsigned)g_scriptSize)
{
#if 1 //ndef LUNATIC
const int32_t action_frames = *(script + vm.g_t[4] + 1);
const int32_t action_incval = *(script + vm.g_t[4] + 3);
const int32_t action_delay = *(script + vm.g_t[4] + 4);
#else
// SACTION
const int32_t action_frames = SACTION_NUMFRAMES(vm.g_t);
const int32_t action_incval = SACTION_INCVAL(vm.g_t);
const int32_t action_delay = SACTION_DELAY(vm.g_t);
#endif
vm.g_sp->lotag += TICSPERFRAME;
if (vm.g_sp->lotag > *(script + vm.g_t[4] + 4))
if (vm.g_sp->lotag > action_delay)
{
vm.g_t[2]++;
vm.g_sp->lotag = 0;
vm.g_t[3] += *(script + vm.g_t[4] + 3);
vm.g_t[3] += action_incval;
}
if (klabs(vm.g_t[3]) >= klabs(*(script + vm.g_t[4] + 1) * *(script + vm.g_t[4] + 3)))
if (klabs(vm.g_t[3]) >= klabs(action_frames * action_incval))
vm.g_t[3] = 0;
}