Lunatic: conditionally compile out more legacy code, remove old mixed mode code.

git-svn-id: https://svn.eduke32.com/eduke32@3456 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-02-03 12:48:17 +00:00
parent 4e5cdba646
commit d82b198799
6 changed files with 22 additions and 65 deletions

View file

@ -177,9 +177,10 @@ typedef struct {
} netactor_t;
typedef struct {
#if !defined LUNATIC
intptr_t *execPtr; // pointer to CON script for this tile, formerly actorscrptr
intptr_t *loadPtr; // pointer to load time CON script, formerly actorLoadEventScrPtr or something
#endif
uint32_t flags; // formerly SpriteFlags, ActorType
int16_t cacherange; // formerly SpriteCache
@ -251,33 +252,6 @@ extern intptr_t *g_parsingActorPtr;
extern projectile_t SpriteProjectile[MAXSPRITES];
#ifdef LUNATIC
// Legacy action/move setters from the CON script + t_data pointer:
extern intptr_t *script;
// tptr[4] expected to be set
static inline void set_action_members(int32_t i)
{
actor_t *const aptr = &actor[i];
int32_t acofs = aptr->t_data[4];
aptr->ac.startframe = script[acofs];
aptr->ac.numframes = script[acofs+1];
aptr->ac.viewtype = script[acofs+2];
aptr->ac.incval = script[acofs+3];
aptr->ac.delay = script[acofs+4];
}
// tptr[1] expected to be set
static inline void set_move_members(int32_t i)
{
actor_t *const aptr = &actor[i];
int32_t mvofs = aptr->t_data[1];
aptr->mv.hvel = script[mvofs];
aptr->mv.vvel = script[mvofs+1];
}
#endif
void A_AddToDeleteQueue(int32_t i);
int32_t A_CheckEnemyTile(int32_t pn);

View file

@ -147,11 +147,11 @@ static inline int32_t G_HaveEvent(int32_t iEventID)
static inline int32_t G_HaveActor(int32_t actortile)
{
return
#ifdef LUNATIC
El_HaveActor(actortile) ||
return El_HaveActor(actortile);
#else
return g_tile[actortile].execPtr!=NULL;
#endif
g_tile[actortile].execPtr!=NULL;
}
static inline int32_t G_InitialActorStrength(int32_t actortile)

View file

@ -3987,22 +3987,20 @@ static void G_DumpDebugInfo(void)
// else only if it equals 0.
static int32_t G_InitActor(int32_t i, int32_t tilenum, int32_t set_movflag_uncond)
{
#if !defined LUNATIC
if (g_tile[tilenum].execPtr)
{
SH = *(g_tile[tilenum].execPtr);
T5 = *(g_tile[tilenum].execPtr+1);
T2 = *(g_tile[tilenum].execPtr+2);
#ifdef LUNATIC
set_action_members(i);
set_move_members(i);
#endif
if (set_movflag_uncond || SHT == 0)
SHT = *(g_tile[tilenum].execPtr+3);
return 1;
}
#ifdef LUNATIC
else if (El_HaveActor(tilenum))
#else
if (El_HaveActor(tilenum))
{
// ^^^ C-CON takes precedence for now.
const el_actor_t *a = &g_elActors[tilenum];

View file

@ -1172,16 +1172,11 @@ skip_check:
vm.g_t[5] = *insptr++; // Ai
vm.g_t[4] = *(script + vm.g_t[5]); // Action
#ifdef LUNATIC
set_action_members(vm.g_i);
#endif
// NOTE: "if (g_t[5])" added in r1155. It used to be a pointer though.
if (vm.g_t[5])
{
vm.g_t[1] = *(script + vm.g_t[5] + 1); // move
#ifdef LUNATIC
set_move_members(vm.g_i);
#endif
}
vm.g_sp->hitag = *(script + vm.g_t[5] + 2); // move flags
@ -1195,9 +1190,6 @@ skip_check:
insptr++;
vm.g_t[2] = vm.g_t[3] = 0;
vm.g_t[4] = *insptr++;
#ifdef LUNATIC
set_action_members(vm.g_i);
#endif
continue;
case CON_IFPDISTL:
@ -1608,9 +1600,6 @@ skip_check:
insptr++;
vm.g_t[0]=0;
vm.g_t[1] = *insptr++;
#ifdef LUNATIC
set_move_members(vm.g_i);
#endif
vm.g_sp->hitag = *insptr++;
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack
continue;
@ -5233,21 +5222,13 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
if (L_IsInitialized(&g_ElState) && El_HaveActor(vm.g_sp->picnum))
killit = (El_CallActor(&g_ElState, vm.g_sp->picnum, iActor, iPlayer, lDist)==1);
else if (g_tile[vm.g_sp->picnum].execPtr)
{
#endif
#if !defined LUNATIC
insptr = 4 + (g_tile[vm.g_sp->picnum].execPtr);
VM_Execute(1);
insptr = NULL;
#endif
#ifdef LUNATIC
}
g_actorTotalMs[vm.g_sp->picnum] += gethitickms()-t;
g_actorCalls[vm.g_sp->picnum]++;
#else
insptr = 4 + (g_tile[vm.g_sp->picnum].execPtr);
VM_Execute(1);
insptr = NULL;
#endif
if ((vm.g_flags & VM_KILL)

View file

@ -346,9 +346,6 @@ typedef struct {
} projectile_t;
typedef struct {
intptr_t *execPtr;
intptr_t *loadPtr;
uint32_t flags;
int16_t cacherange;

View file

@ -844,10 +844,12 @@ static uint32_t calcsz(const dataspec_t *spec)
static void sv_prespriteextsave();
static void sv_postspriteext();
#endif
#if !defined LUNATIC
static void sv_calcbitptrsize();
static void sv_prescriptsave_once();
static void sv_prescriptload_once();
static void sv_postscript_once();
#endif
static void sv_preactordatasave();
static void sv_postactordata();
static void sv_preanimateptrsave();
@ -962,17 +964,20 @@ static const dataspec_t svgm_secwsp[] =
static const dataspec_t svgm_script[] =
{
{ DS_STRING, (void *)"blK:scri", 0, 1 },
#if !defined LUNATIC
{ DS_NOCHK, &g_scriptSize, sizeof(g_scriptSize), 1 },
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_calcbitptrsize, 0, 1 },
{ DS_DYNAMIC|DS_CNT(savegame_bitptrsize)|DS_NOCHK, &bitptr, sizeof(bitptr[0]), (intptr_t)&savegame_bitptrsize },
{ DS_SAVEFN|DS_NOCHK, (void *)&sv_prescriptsave_once, 0, 1 },
#endif
{ DS_NOCHK, &g_tile[0], sizeof(tiledata_t), MAXTILES },
#if !defined LUNATIC
{ DS_LOADFN|DS_NOCHK, (void *)&sv_prescriptload_once, 0, 1 },
{ DS_DYNAMIC|DS_CNT(g_scriptSize)|DS_NOCHK, &script, sizeof(script[0]), (intptr_t)&g_scriptSize },
// { DS_NOCHK, &apScriptGameEvent[0], sizeof(apScriptGameEvent[0]), MAXGAMEEVENTS },
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_postscript_once, 0, 1 },
#endif
{ DS_SAVEFN, (void *)&sv_preactordatasave, 0, 1 },
{ 0, &actor[0], sizeof(actor_t), MAXSPRITES },
{ DS_SAVEFN|DS_LOADFN, (void *)&sv_postactordata, 0, 1 },
@ -1475,6 +1480,7 @@ void sv_postyaxload(void)
}
#endif
#if !defined LUNATIC
static void sv_calcbitptrsize()
{
savegame_bitptrsize = (g_scriptSize+7)>>3;
@ -1506,6 +1512,7 @@ static void sv_postscript_once()
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
script[i] = (intptr_t)(script + script[i]);
}
#endif
static void sv_preactordatasave()
{