source/duke3d/src: Remove almost all "#ifdef LUNATIC" blocks.

Surrounding "#if !defined LUNATIC"/"#endif" pairs are also covered.

# Conflicts:
#	source/duke3d/src/astub.cpp
#	source/duke3d/src/cmdline.cpp
#	source/duke3d/src/demo.cpp
#	source/duke3d/src/duke3d.h
#	source/duke3d/src/game.cpp
#	source/duke3d/src/game.h
#	source/duke3d/src/gamedef.cpp
#	source/duke3d/src/gamedef.h
#	source/duke3d/src/gameexec.cpp
#	source/duke3d/src/gameexec.h
#	source/duke3d/src/gamevars.cpp
#	source/duke3d/src/gamevars.h
#	source/duke3d/src/namesdyn.cpp
#	source/duke3d/src/osdcmds.cpp
#	source/duke3d/src/premap.cpp
#	source/duke3d/src/savegame.cpp
#	source/duke3d/src/savegame.h
#	source/duke3d/src/sbar.cpp
#	source/duke3d/src/screens.cpp
This commit is contained in:
NY00123 2020-05-17 20:29:34 +03:00 committed by Christoph Oelckers
parent 1a1039a2d3
commit 7cf7ccfd05
21 changed files with 18 additions and 474 deletions

View file

@ -916,13 +916,8 @@ void A_MoveSector(int spriteNum)
}
}
#if !defined LUNATIC
// NOTE: T5 is AC_ACTION_ID
# define LIGHTRAD_PICOFS(i) (T5(i) ? *(apScript + T5(i)) + (*(apScript + T5(i) + 2)) * AC_CURFRAME(actor[i].t_data) : 0)
#else
// startframe + viewtype*[cyclic counter]
# define LIGHTRAD_PICOFS(i) (actor[i].ac.startframe + actor[i].ac.viewtype * AC_CURFRAME(actor[i].t_data))
#endif
#define LIGHTRAD_PICOFS(i) (T5(i) ? *(apScript + T5(i)) + (*(apScript + T5(i) + 2)) * AC_CURFRAME(actor[i].t_data) : 0)
// this is the same crap as in game.c's tspr manipulation. puke.
// XXX: may access tilesizy out-of-bounds by bad user code.

View file

@ -193,9 +193,9 @@ error_wopen_demo:
ud.reccnt = 0;
ud.recstat = m_recstat = 1; //
# if KRANDDEBUG
#if KRANDDEBUG
krd_enable(1);
# endif
#endif
g_demo_cnt = 1;
}

View file

@ -164,9 +164,6 @@ enum GameEvent_t {
EVENT_NEWGAMECUSTOM,
EVENT_INITCOMPLETE,
EVENT_CAPIR,
#ifdef LUNATIC
EVENT_ANIMATEALLSPRITES,
#endif
MAXEVENTS
};

View file

@ -1059,13 +1059,7 @@ int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int1
spriteext[newSprite] = {};
spritesmooth[newSprite] = {};
#if defined LUNATIC
if (!g_noResetVars)
#endif
A_ResetVars(newSprite);
#if defined LUNATIC
g_noResetVars = 0;
#endif
if (VM_HaveEvent(EVENT_EGS))
{
@ -3501,11 +3495,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
{
int32_t switchpic;
int32_t curframe;
#if !defined LUNATIC
int32_t scrofs_action;
#else
int32_t startframe, viewtype;
#endif
//is the perfect time to animate sprites
auto const t = &tsprite[j];
const int32_t i = t->owner;
@ -3552,12 +3542,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
const int32_t sect = pSprite->sectnum;
curframe = AC_CURFRAME(actor[i].t_data);
#if !defined LUNATIC
scrofs_action = AC_ACTION_ID(actor[i].t_data);
#else
startframe = actor[i].ac.startframe;
viewtype = actor[i].ac.viewtype;
#endif
switchpic = pSprite->picnum;
// Some special cases because dynamictostatic system can't handle
// addition to constants.
@ -3792,12 +3777,10 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
{
// Display APLAYER sprites with action PSTAND when viewed through
// a camera. Not implemented for Lunatic.
#if !defined LUNATIC
const intptr_t *aplayer_scr = g_tile[APLAYER].execPtr;
// [0]=strength, [1]=actionofs, [2]=moveofs
scrofs_action = aplayer_scr[1];
#endif
curframe = 0;
}
#endif
@ -3892,15 +3875,11 @@ PALONLY:
if (G_TileHasActor(pSprite->picnum))
{
#if !defined LUNATIC
if ((unsigned)scrofs_action + ACTION_PARAM_COUNT > (unsigned)g_scriptSize)
goto skip;
int32_t viewtype = apScript[scrofs_action + ACTION_VIEWTYPE];
uint16_t const action_flags = apScript[scrofs_action + ACTION_FLAGS];
#else
uint16_t const action_flags = actor[i].ac.flags;
#endif
int const invertp = viewtype < 0;
l = klabs(viewtype);
@ -3953,11 +3932,7 @@ PALONLY:
}
}
#if !defined LUNATIC
t->picnum += frameOffset + apScript[scrofs_action + ACTION_STARTFRAME] + viewtype*curframe;
#else
t->picnum += frameOffset + startframe + viewtype*curframe;
#endif
// XXX: t->picnum can be out-of-bounds by bad user code.
if (viewtype > 0)
@ -3972,9 +3947,7 @@ PALONLY:
/* completemirror() already reverses the drawn frame, so the above isn't necessary.
* Even Polymost's and Polymer's mirror seems to function correctly this way. */
#if !defined LUNATIC
skip:
#endif
// Night vision goggles tsprite tinting.
// XXX: Currently, for the splitscreen mod, sprites will be pal6-colored iff the first
// player has nightvision on. We should pass stuff like "from which player is this view
@ -4057,11 +4030,7 @@ skip:
}
}
#ifdef LUNATIC
bool const haveAction = false; // FIXME!
#else
bool const haveAction = scrofs_action != 0 && (unsigned)scrofs_action + ACTION_PARAM_COUNT <= (unsigned)g_scriptSize;
#endif
switch (DYNAMICTILEMAP(pSprite->picnum))
{
@ -4196,9 +4165,6 @@ skip:
G_DoEventAnimSprites(j);
}
#ifdef LUNATIC
VM_OnEvent(EVENT_ANIMATEALLSPRITES);
#endif
#ifdef DEBUGGINGAIDS
g_spriteStat.numonscreen = spritesortcnt;
#endif
@ -5170,7 +5136,6 @@ static void G_Cleanup(void)
Xfree(g_player[i].input);
}
#if !defined LUNATIC
if (label != (char *)&sprite[0]) Xfree(label);
if (labelcode != (int32_t *)&sector[0]) Xfree(labelcode);
if (labeltype != (uint8_t*)&wall[0]) Xfree(labeltype);
@ -5184,7 +5149,6 @@ static void G_Cleanup(void)
hash_free(&h_gamevars);
hash_free(&h_arrays);
hash_free(&h_labels);
#endif
}
/*
@ -5209,16 +5173,10 @@ void G_Shutdown(void)
static void G_CompileScripts(void)
{
#if !defined LUNATIC
label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816
labelcode = (int32_t *)&sector[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240
labeltype = (uint8_t *)&wall[0]; // V8: 16384*32 = 524288 V7: 8192*32/4 = 262144
#endif
#if defined LUNATIC
Gv_Init();
C_InitProjectiles();
#else
C_Compile(G_ConFile());
if ((uint32_t)g_labelCnt > MAXSPRITES*sizeof(spritetype)/64) // see the arithmetic above for why
@ -5241,7 +5199,6 @@ static void G_CompileScripts(void)
Bmemset(wall, 0, MAXWALLS*sizeof(walltype));
VM_OnEvent(EVENT_INIT);
#endif
}
static inline void G_CheckGametype(void)
@ -5305,52 +5262,6 @@ static void A_InitEnemyFlags(void)
}
#undef SETFLAG
#ifdef LUNATIC
// Will be used to store CON code translated to Lua.
int32_t g_elCONSize;
char *g_elCON; // NOT 0-terminated!
LUNATIC_EXTERN void El_SetCON(const char *conluacode)
{
int32_t slen = Bstrlen(conluacode);
g_elCON = (char *)Xmalloc(slen);
g_elCONSize = slen;
Bmemcpy(g_elCON, conluacode, slen);
}
void El_CreateGameState(void)
{
int32_t i;
El_DestroyState(&g_ElState);
if ((i = El_CreateState(&g_ElState, "game")))
{
Printf("Lunatic: Error initializing global ELua state (code %d)\n", i);
}
else
{
extern const char luaJIT_BC__defs_game[];
if ((i = L_RunString(&g_ElState, luaJIT_BC__defs_game,
LUNATIC_DEFS_BC_SIZE, "_defs_game.lua")))
{
Printf("Lunatic: Error preparing global ELua state (code %d)\n", i);
El_DestroyState(&g_ElState);
}
}
if (i)
G_GameExit("Failure setting up Lunatic!");
# if !defined DEBUGGINGAIDS
El_ClearErrors();
# endif
}
#endif
// Throw in everything here that needs to be called after a Lua game state
// recreation (or on initial startup in a non-Lunatic build.)
void G_PostCreateGameState(void)
@ -5371,11 +5282,6 @@ static void G_Startup(void)
if (engineInit())
G_FatalEngineError();
#ifdef LUNATIC
El_CreateGameState();
C_InitQuotes();
#endif
G_InitDynamicTiles();
G_InitDynamicSounds();
@ -5383,11 +5289,6 @@ static void G_Startup(void)
G_InitMultiPsky(CLOUDYOCEAN, MOONSKY1, BIGORBIT1, LA);
Gv_FinalizeWeaponDefaults();
G_PostCreateGameState();
#ifdef LUNATIC
// NOTE: This is only effective for CON-defined EVENT_INIT. See EVENT_INIT
// not in _defs_game.lua.
VM_OnEvent(EVENT_INIT);
#endif
if (g_netServer || ud.multimode > 1) G_CheckGametype();
if (userConfig.CommandMap.IsNotEmpty())

View file

@ -113,9 +113,9 @@ static inline int32_t G_GetLogoFlags(void)
return Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1);
}
# define CAMERA(Membname) (ud.camera ## Membname)
# define CAMERADIST g_cameraDistance
# define CAMERACLOCK g_cameraClock
#define CAMERA(Membname) (ud.camera ## Membname)
#define CAMERADIST g_cameraDistance
#define CAMERACLOCK g_cameraClock
#endif
@ -212,10 +212,8 @@ extern char ror_protectedsectors[MAXSECTORS];
extern int32_t g_Debug;
extern int32_t g_Shareware;
#if !defined LUNATIC
extern int32_t g_cameraClock;
extern int32_t g_cameraDistance;
#endif
extern int32_t g_crosshairSum;
extern int32_t g_doQuickSave;
extern int32_t g_levelTextTime;
@ -241,9 +239,6 @@ void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
#define Yax_SetBunchZs(sectnum, cf, daz)
#endif
#ifdef LUNATIC
void El_CreateGameState(void);
#endif
void G_PostCreateGameState(void);
void A_SpawnCeilingGlass(int spriteNum,int sectNum,int glassCnt);

View file

@ -58,7 +58,6 @@ int32_t g_lineNumber;
uint32_t g_scriptcrc;
char g_szBuf[1024];
#if !defined LUNATIC
static char *textptr;
static char g_szCurrentBlockName[64] = "(none)";
@ -89,17 +88,11 @@ static intptr_t *g_caseTablePtr;
static bool C_ParseCommand(bool loop = false);
static void C_SetScriptSize(int32_t newsize);
#endif
int32_t g_errorCnt;
int32_t g_warningCnt;
int32_t g_numXStrings;
#ifdef LUNATIC
weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS];
#endif
#if !defined LUNATIC
static char *C_GetLabelType(int const type)
{
static tokenmap_t const LabelType[] =
@ -867,7 +860,6 @@ char const *VM_GetKeywordForID(int32_t id)
return "<unknown instruction>";
}
#endif
// KEEPINSYNC with enum GameEvent_t and lunatic/con_lang.lua
const char *EventNames[MAXEVENTS] =
@ -1029,9 +1021,6 @@ const char *EventNames[MAXEVENTS] =
"EVENT_NEWGAMECUSTOM",
"EVENT_INITCOMPLETE",
"EVENT_CAPIR",
#ifdef LUNATIC
"EVENT_ANIMATEALLSPRITES",
#endif
};
uint8_t *bitptr; // pointer to bitmap of which bytecode positions contain pointers
@ -1040,7 +1029,6 @@ uint8_t *bitptr; // pointer to bitmap of which bytecode positions contain pointe
#define BITPTR_CLEAR(x) bitmap_clear(bitptr, x)
#define BITPTR_IS_POINTER(x) bitmap_test(bitptr, x)
#if !defined LUNATIC
hashtable_t h_arrays = { MAXGAMEARRAYS >> 1, NULL };
hashtable_t h_gamevars = { MAXGAMEVARS >> 1, NULL };
hashtable_t h_labels = { 11264 >> 1, NULL };
@ -1981,7 +1969,6 @@ static void C_Include(const char *confile)
Xfree(mptr);
}
#endif // !defined LUNATIC
void G_DoGameStartup(const int32_t *params)
{
@ -2215,7 +2202,6 @@ void C_InitQuotes(void)
}
}
#if !defined LUNATIC
static inline void C_BitOrNextValue(int32_t *valptr)
{
C_GetNextValue(LABEL_DEFINE);
@ -5807,7 +5793,6 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("NO", 0, LABEL_DEFINE | LABEL_ACTION | LABEL_AI | LABEL_MOVE);
}
#endif
void C_InitProjectiles(void)
{
@ -5842,7 +5827,6 @@ void C_InitProjectiles(void)
}
}
#if !defined LUNATIC
static char const * C_ScriptVersionString(int32_t version)
{
#ifdef EDUKE32_STANDALONE
@ -6129,6 +6113,5 @@ void C_ReportError(int error)
break;
}
}
#endif
END_DUKE_NS

View file

@ -78,10 +78,8 @@ enum
g_warningCnt++; \
} while (0)
#if !defined LUNATIC
extern intptr_t const * insptr;
void VM_ScriptInfo(intptr_t const * const ptr, int const range);
#endif
extern hashtable_t h_gamevars;
extern hashtable_t h_arrays;
@ -141,9 +139,7 @@ extern uint8_t *bitptr;
extern const char *EventNames[MAXEVENTS];
#if !defined LUNATIC
extern intptr_t *g_scriptPtr;
#endif
typedef projectile_t defaultprojectile_t;
@ -179,8 +175,6 @@ void C_DefineVolumeFlags(int32_t vol, int32_t flags);
void C_UndefineVolume(int32_t vol);
void C_UndefineSkill(int32_t skill);
void C_UndefineLevel(int32_t vol, int32_t lev);
#if defined LUNATIC
#else
void C_ReportError(int error);
void C_Compile(const char *filenam);
@ -756,7 +750,6 @@ enum PalDataLabel_t
PALDATA_END
};
#endif
// KEEPINSYNC lunatic/con_lang.lua
enum ProjectileLabel_t
{
@ -792,7 +785,6 @@ enum ProjectileLabel_t
PROJ_USERDATA,
PROJ_END
};
#if !defined LUNATIC
enum IterationTypes_t
{
@ -1362,8 +1354,6 @@ enum ScriptKeywords_t
#undef ENUM_TRANSFORM
#undef COMMA
#endif
END_DUKE_NS
#endif // gamedef_h_

View file

@ -65,9 +65,6 @@ BEGIN_DUKE_NS
vmstate_t vm;
#if !defined LUNATIC
int32_t g_tw;
int32_t g_currentEvent = -1;
@ -91,9 +88,6 @@ double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILE
GAMEEXEC_STATIC void VM_Execute(int const loop = false);
#endif
#if !defined LUNATIC
void VM_ScriptInfo(intptr_t const * const ptr, int const range)
{
if (!apScript || !ptr || g_currentEvent == -1)
@ -128,7 +122,6 @@ void VM_ScriptInfo(intptr_t const * const ptr, int const range)
Printf("g_errorLineNum: %d, g_tw: %d\n", VM_DECODE_LINE_NUMBER(g_tw), VM_DECODE_INST(g_tw));
}
}
#endif
static void VM_DeleteSprite(int const spriteNum, int const playerNum)
{
@ -144,24 +137,6 @@ static void VM_DeleteSprite(int const spriteNum, int const playerNum)
intptr_t apScriptEvents[MAXEVENTS];
// May recurse, e.g. through EVENT_XXX -> ... -> EVENT_KILLIT
#ifdef LUNATIC
static FORCE_INLINE int32_t VM_EventInlineInternal__(int const &eventNum, int const &spriteNum, int const &playerNum, int const &playerDist, int32_t returnValue)
{
const double t = timerGetHiTicks();
int32_t ret = El_CallEvent(&g_ElState, eventNum, spriteNum, playerNum, playerDist, &returnValue);
// NOTE: the run times are those of the called event plus any events
// called by it, *not* "self" time.
g_eventTotalMs[eventNum] += timerGetHiTicks()-t;
g_eventCalls[eventNum]++;
if (ret == 1)
VM_DeleteSprite(spriteNum, playerNum);
return returnValue;
}
#else
static uspritetype dummy_sprite;
static actor_t dummy_actor;
@ -223,7 +198,6 @@ static FORCE_INLINE int32_t VM_EventInlineInternal__(int const eventNum, int con
return returnValue;
}
#endif
// the idea here is that the compiler inlines the call to VM_EventInlineInternal__() and gives us a set of
// functions which are optimized further based on distance/return having values known at compile time
@ -290,7 +264,6 @@ static int VM_CheckSquished(void)
return 1;
}
#if !defined LUNATIC
GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer)
{
int const nAngle = 128-(krand()&255);
@ -300,7 +273,6 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer)
pPlayer->q16rotscrnang = fix16_from_int(nAngle >> 1);
pPlayer->q16look_ang = pPlayer->q16rotscrnang;
}
#endif
// wow, this function sucks
@ -533,7 +505,6 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t const moveFlags)
{
int const elapsedTics = (AC_COUNT(vm.pData))&31;
#if !defined LUNATIC
if (EDUKE32_PREDICT_FALSE((unsigned)AC_MOVE_ID(vm.pData) >= (unsigned)g_scriptSize-1))
{
@ -545,10 +516,6 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t const moveFlags)
auto const moveptr = apScript + AC_MOVE_ID(vm.pData);
auto &hvel = moveptr[0];
auto &vvel = moveptr[1];
#else
auto &hvel = vm.pActor->mv.hvel;
auto &vvel = vm.pActor->mv.vvel;
#endif
vm.pSprite->xvel += (hvel - vm.pSprite->xvel)/5;
if (vm.pSprite->zvel < 648)
@ -691,7 +658,6 @@ GAMEEXEC_STATIC void VM_Move(void)
}
}
#if !defined LUNATIC
if (EDUKE32_PREDICT_FALSE((unsigned)AC_MOVE_ID(vm.pData) >= (unsigned)g_scriptSize-1))
{
AC_MOVE_ID(vm.pData) = 0;
@ -702,10 +668,6 @@ GAMEEXEC_STATIC void VM_Move(void)
auto const moveptr = apScript + AC_MOVE_ID(vm.pData);
auto &hvel = moveptr[0];
auto &vvel = moveptr[1];
#else
auto &hvel = vm.pActor->mv.hvel;
auto &vvel = vm.pActor->mv.vvel;
#endif
if (movflags & geth)
vm.pSprite->xvel += (hvel - vm.pSprite->xvel) >> 1;
@ -880,9 +842,6 @@ static void P_AddWeaponMaybeSwitch(DukePlayer_t * const ps, int const weaponNum)
}
}
#if defined LUNATIC
void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap) { P_AddWeaponMaybeSwitch(g_player[snum].ps, weap); }
#else
static void P_AddWeaponAmmoCommon(DukePlayer_t * const pPlayer, int const weaponNum, int const nAmount)
{
P_AddAmmo(pPlayer, weaponNum, nAmount);
@ -963,17 +922,12 @@ static void VM_AddInventory(DukePlayer_t * const pPlayer, int const itemNum, int
default: CON_ERRPRINTF("invalid inventory item %d\n", itemNum); break;
}
}
#endif
static int A_GetVerticalVel(actor_t const * const pActor)
{
#ifdef LUNATIC
return pActor->mv.vvel;
#else
int32_t moveScriptOfs = AC_MOVE_ID(pActor->t_data);
return ((unsigned) moveScriptOfs < (unsigned) g_scriptSize - 1) ? apScript[moveScriptOfs + 1] : 0;
#endif
}
static int32_t A_GetWaterZOffset(int const spriteNum)
@ -1167,7 +1121,6 @@ static int G_StartTrackSlot(int const volumeNum, int const levelNum)
return 1;
}
#ifndef LUNATIC
static int G_StartTrackSlotWrap(int const volumeNum, int const levelNum)
{
if (EDUKE32_PREDICT_FALSE(G_StartTrackSlot(volumeNum, levelNum)))
@ -1178,9 +1131,6 @@ static int G_StartTrackSlotWrap(int const volumeNum, int const levelNum)
return 0;
}
#else
int G_StartTrack(int const levelNum) { return G_StartTrackSlot(ud.volume_number, levelNum); }
#endif
LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, int ix1, int iy1, int ix2, int iy2, int unbiasedp)
{
@ -1338,7 +1288,6 @@ static void ResizeArray(int const arrayNum, int const newSize)
Xaligned_free(oldArray);
}
#if !defined LUNATIC
#if defined __GNUC__ || defined __clang__
// # define CON_USE_COMPUTED_GOTO does not work anymore with some of the changes.
#endif
@ -6261,11 +6210,9 @@ void A_LoadActor(int const spriteNum)
if (vm.flags & VM_KILL)
A_DeleteSprite(vm.spriteNum);
}
#endif
void VM_UpdateAnim(int const spriteNum, int32_t * const pData)
{
#if !defined LUNATIC
size_t const actionofs = AC_ACTION_ID(pData);
auto const actionptr = (actionofs != 0 && actionofs + (ACTION_PARAM_COUNT-1) < (unsigned) g_scriptSize) ? &apScript[actionofs] : NULL;
@ -6274,11 +6221,6 @@ void VM_UpdateAnim(int const spriteNum, int32_t * const pData)
int const action_frames = actionptr[ACTION_NUMFRAMES];
int const action_incval = actionptr[ACTION_INCVAL];
int const action_delay = actionptr[ACTION_DELAY];
#else
int const action_frames = actor[spriteNum].ac.numframes;
int const action_incval = actor[spriteNum].ac.incval;
int const action_delay = actor[spriteNum].ac.delay;
#endif
auto actionticsptr = &AC_ACTIONTICS(&sprite[spriteNum], &actor[spriteNum]);
*actionticsptr += TICSPERFRAME;
@ -6331,15 +6273,9 @@ void A_Execute(int const spriteNum, int const playerNum, int const playerDist)
double t = timerGetHiTicks();
#ifdef LUNATIC
int32_t killit=0;
if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum))
killit = (El_CallActor(&g_ElState, picnum, spriteNum, playerNum, playerDist)==1);
#else
insptr = 4 + (g_tile[vm.pSprite->picnum].execPtr);
VM_Execute(true);
insptr = NULL;
#endif
t = timerGetHiTicks()-t;
g_actorTotalMs[picnum] += t;
@ -6347,11 +6283,7 @@ void A_Execute(int const spriteNum, int const playerNum, int const playerDist)
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t);
g_actorCalls[picnum]++;
#ifdef LUNATIC
if (!killit)
#else
if ((vm.flags & VM_KILL) == 0)
#endif
{
VM_Move();
@ -6431,10 +6363,8 @@ void G_SaveMapState(void)
Bmemcpy(&save->sprite[0],&sprite[0],sizeof(spritetype)*MAXSPRITES);
// If we're in EVENT_ANIMATESPRITES, we'll be saving pointer values to disk :-/
#if !defined LUNATIC
if (EDUKE32_PREDICT_FALSE(g_currentEvent == EVENT_ANIMATESPRITES))
Printf("Line %d: savemapstate called from EVENT_ANIMATESPRITES. WHY?\n", VM_DECODE_LINE_NUMBER(g_tw));
#endif
Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES);
#ifndef NEW_MAP_FORMAT
Bmemcpy(&save->wallext[0],&wallext[0],sizeof(wallext_t)*MAXWALLS);
@ -6492,7 +6422,6 @@ void G_SaveMapState(void)
save->randomseed = randomseed;
save->g_globalRandom = g_globalRandom;
#if !defined LUNATIC
for (native_t i=g_gameVarCount-1; i>=0; i--)
{
if (aGameVars[i].flags & GAMEVAR_NORESET)
@ -6523,21 +6452,6 @@ void G_SaveMapState(void)
save->arrays[i] = (intptr_t *)Xaligned_alloc(ARRAY_ALIGNMENT, Gv_GetArrayAllocSize(i));
Bmemcpy(&save->arrays[i][0], aGameArrays[i].pValues, Gv_GetArrayAllocSize(i));
}
#else
int32_t slen;
const char *svcode = El_SerializeGamevars(&slen, levelNum);
if (slen < 0)
{
El_OnError("ERROR: savemapstate: serialization failed!");
}
else
{
char *savecode = Xstrdup(svcode);
Xfree(save->savecode);
save->savecode = savecode;
}
#endif
ototalclock = totalclock;
}
@ -6569,14 +6483,12 @@ void G_RestoreMapState(void)
// If we're restoring from EVENT_ANIMATESPRITES, all spriteext[].tspr
// will be overwritten, so NULL them.
#if !defined LUNATIC
if (EDUKE32_PREDICT_FALSE(g_currentEvent == EVENT_ANIMATESPRITES))
{
Printf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n", VM_DECODE_LINE_NUMBER(g_tw));
for (native_t i=0; i<MAXSPRITES; i++)
spriteext[i].tspr = NULL;
}
#endif
Numsprites = pSavedState->numsprites;
tailspritefree = pSavedState->tailspritefree;
Bmemcpy(&headspritesect[0],&pSavedState->headspritesect[0],sizeof(headspritesect));
@ -6624,7 +6536,6 @@ void G_RestoreMapState(void)
randomseed = pSavedState->randomseed;
g_globalRandom = pSavedState->g_globalRandom;
#if !defined LUNATIC
for (native_t i=g_gameVarCount-1; i>=0; i--)
{
if (aGameVars[i].flags & GAMEVAR_NORESET)
@ -6658,12 +6569,6 @@ void G_RestoreMapState(void)
}
Gv_RefreshPointers();
#else
if (pSavedState->savecode)
{
El_RestoreGamevars(pSavedState->savecode);
}
#endif
// Update g_player[].ps->i (sprite indices of players) to be consistent
// with just loaded sprites.
// Otherwise, crashes may ensue: e.g. WGR2 SVN r391, map spiderden:
@ -6721,22 +6626,6 @@ void G_RestoreMapState(void)
}
}
#ifdef LUNATIC
void VM_FallSprite(int32_t i) { VM_Fall(i, &sprite[i]); }
int32_t VM_ResetPlayer2(int32_t snum, int32_t flags) { return VM_ResetPlayer(snum, 0, flags); }
int32_t VM_CheckSquished2(int32_t i, int32_t snum)
{
vm.spriteNum = i;
vm.pSprite = &sprite[i];
vm.playerNum = snum;
vm.pPlayer = g_player[snum].ps;
return VM_CheckSquished();
}
#endif
// MYOS* CON commands.
void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
{
@ -6753,7 +6642,6 @@ void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int
rotatesprite_win(x, y, zoom, rotAngle, tilenum, shade, p, 2|orientation);
}
#if !defined LUNATIC
void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation)
{
auto const pPlayer = g_player[screenpeek].ps;
@ -6769,7 +6657,4 @@ void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int3
VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, tilePal);
}
#endif
END_DUKE_NS

View file

@ -71,12 +71,10 @@ enum vmflags_t
extern int32_t ticrandomseed;
extern vmstate_t vm;
#if !defined LUNATIC
extern int32_t g_tw;
extern int32_t g_currentEvent;
void A_LoadActor(int const spriteNum);
#endif
extern uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
extern double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
@ -93,7 +91,6 @@ void G_SaveMapState();
void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
int32_t shade, int32_t orientation, int32_t p);
#if !defined LUNATIC
void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation);
static inline void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
{
@ -104,7 +101,6 @@ static inline void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, in
VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, p);
}
void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation);
#endif
#define CON_ERRPRINTF(Text, ...) do { \

View file

@ -30,12 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamestructures.h"
BEGIN_DUKE_NS
#ifdef LUNATIC
int32_t g_noResetVars;
LUNATIC_CB void (*A_ResetVars)(int32_t spriteNum);
#else
gamevar_t aGameVars[MAXGAMEVARS];
gamearray_t aGameArrays[MAXGAMEARRAYS];
int32_t g_gameVarCount = 0;
@ -833,12 +827,10 @@ static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
return &(var.global);
}
#endif // !defined LUNATIC
void Gv_ResetSystemDefaults(void)
{
// call many times...
#if !defined LUNATIC
char aszBuf[64];
//AddLog("ResetWeaponDefaults");
@ -901,7 +893,6 @@ void Gv_ResetSystemDefaults(void)
g_weaponVarID = Gv_GetVarIndex("WEAPON");
g_worksLikeVarID = Gv_GetVarIndex("WORKSLIKE");
g_zRangeVarID = Gv_GetVarIndex("ZRANGE");
#endif
for (auto & tile : g_tile)
if (tile.defproj)
@ -1131,16 +1122,13 @@ void Gv_FinalizeWeaponDefaults(void)
#undef FINISH_WEAPON_DEFAULT_X
#undef POSTADDWEAPONVAR
#if !defined LUNATIC
static int32_t lastvisinc;
#endif
static void Gv_AddSystemVars(void)
{
// only call ONCE
#if !defined LUNATIC
// special vars for struct access
// KEEPINSYNC gamedef.h: enum QuickStructureAccess_t (including order)
Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
@ -1159,7 +1147,6 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("input", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("tiledata", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("paldata", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
#endif
#ifndef EDUKE32_STANDALONE
if (NAM_WW2GI)
@ -1230,21 +1217,6 @@ static void Gv_AddSystemVars(void)
ADDWEAPONVAR(i, WorksLike);
}
#ifdef LUNATIC
for (int i=0; i<MAXPLAYERS; i++)
{
auto ps = g_player[i].ps;
ps->pipebombControl = NAM_WW2GI ? PIPEBOMB_TIMER : PIPEBOMB_REMOTE;
ps->pipebombLifetime = NAM_GRENADE_LIFETIME;
ps->pipebombLifetimeVar = NAM_GRENADE_LIFETIME_VAR;
ps->tripbombControl = TRIPBOMB_TRIPWIRE;
ps->tripbombLifetime = NAM_GRENADE_LIFETIME;
ps->tripbombLifetimeVar = NAM_GRENADE_LIFETIME_VAR;
}
#else
#ifndef EDUKE32_STANDALONE
Gv_NewVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
Gv_NewVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
@ -1318,11 +1290,11 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("ydim", (intptr_t)&ydim, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
Gv_NewVar("yxaspect", (intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
# ifdef USE_OPENGL
#ifdef USE_OPENGL
Gv_NewVar("rendmode", (intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
# else
#else
Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
# endif
#endif
// SYSTEM_GAMEARRAY
Gv_NewArray("gotpic", (void *)&gotpic[0], MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP);
@ -1330,33 +1302,22 @@ static void Gv_AddSystemVars(void)
Gv_NewArray("show2dsector", (void *)&show2dsector, MAXSECTORS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP);
Gv_NewArray("tilesizx", (void *)tileWidth, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_FUNC | GAMEARRAY_READONLY);
Gv_NewArray("tilesizy", (void *)tileHeight, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_FUNC | GAMEARRAY_READONLY);
#endif
}
#undef ADDWEAPONVAR
void Gv_Init(void)
{
#if !defined LUNATIC
// already initialized
if (aGameVars[0].flags)
return;
#else
static int32_t inited=0;
if (inited)
return;
inited = 1;
#endif
// Set up weapon defaults, g_playerWeapon[][].
Gv_AddSystemVars();
#if !defined LUNATIC
Gv_InitWeaponPointers();
#endif
Gv_ResetSystemDefaults();
}
#if !defined LUNATIC
void Gv_InitWeaponPointers(void)
{
char aszBuf[64];
@ -1470,14 +1431,12 @@ void Gv_RefreshPointers(void)
aGameVars[Gv_GetVarIndex("ydim")].global = (intptr_t)&ydim;
aGameVars[Gv_GetVarIndex("yxaspect")].global = (intptr_t)&yxaspect;
# ifdef USE_OPENGL
#ifdef USE_OPENGL
aGameVars[Gv_GetVarIndex("rendmode")].global = (intptr_t)&rendmode;
# endif
#endif
aGameArrays[Gv_GetArrayIndex("gotpic")].pValues = (intptr_t *)&gotpic[0];
aGameArrays[Gv_GetArrayIndex("tilesizx")].pValues = (intptr_t *)tileWidth;
aGameArrays[Gv_GetArrayIndex("tilesizy")].pValues = (intptr_t *)tileHeight;
}
#endif
END_DUKE_NS

View file

@ -61,8 +61,6 @@ enum GamevarFlags_t
GAMEVAR_PTR_MASK = GAMEVAR_INT32PTR | GAMEVAR_INT16PTR | GAMEVAR_Q16PTR | GAMEVAR_RAWQ16PTR,
};
#if !defined LUNATIC
// Alignments for per-player and per-actor variables.
#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t))
#define ACTOR_VAR_ALIGNMENT 16
@ -160,16 +158,11 @@ void Gv_ResetVars(void);
int Gv_ReadSave(FileReader &kFile);
void Gv_WriteSave(FileWriter &fil);
void Gv_Clear(void);
#else
extern int32_t g_noResetVars;
extern LUNATIC_CB void (*A_ResetVars)(int32_t spriteNum);
#endif
void Gv_ResetSystemDefaults(void);
void Gv_Init(void);
void Gv_FinalizeWeaponDefaults(void);
#if !defined LUNATIC
static inline int __fastcall VM_GetStruct(uint32_t const flags, intptr_t * const addr)
{
Bassert(flags & (LABEL_CHAR|LABEL_SHORT|LABEL_INT));
@ -290,8 +283,6 @@ VM_GAMEVAR_OPERATOR(Gv_ShiftVarR, >>=)
#undef VM_GAMEVAR_OPERATOR
#endif
END_DUKE_NS
#endif

View file

@ -661,10 +661,8 @@ void G_InitDynamicTiles(void);
void G_ProcessDynamicTileMapping(const char *szLabel, int32_t lValue);
#if !defined LUNATIC
void inithashnames(void);
void freehashnames(void);
#endif
extern int32_t ACCESS_ICON;
extern int32_t ACCESSCARD;

View file

@ -364,19 +364,11 @@ static int GetAutoAimAng(int spriteNum, int playerNum, int projecTile, int zAdju
Bassert((unsigned)playerNum < MAXPLAYERS);
#ifdef LUNATIC
g_player[playerNum].ps->autoaimang = g_player[playerNum].ps->auto_aim == 3 ? AUTO_AIM_ANGLE<<1 : AUTO_AIM_ANGLE;
#else
Gv_SetVar(g_aimAngleVarID, g_player[playerNum].ps->auto_aim == 3 ? AUTO_AIM_ANGLE<<1 : AUTO_AIM_ANGLE, spriteNum, playerNum);
#endif
VM_OnEvent(EVENT_GETAUTOAIMANGLE, spriteNum, playerNum);
#ifdef LUNATIC
int aimang = g_player[playerNum].ps->autoaimang;
#else
int aimang = Gv_GetVar(g_aimAngleVarID, spriteNum, playerNum);
#endif
if (aimang > 0)
returnSprite = A_FindTargetSprite(&sprite[spriteNum], aimang, projecTile);
@ -483,23 +475,13 @@ static void P_PreFireHitscan(int spriteNum, int playerNum, int projecTile, vec3_
auto const pPlayer = g_player[playerNum].ps;
#ifdef LUNATIC
pPlayer->angrange = angRange;
pPlayer->zrange = zRange;
#else
Gv_SetVar(g_angRangeVarID, angRange, spriteNum, playerNum);
Gv_SetVar(g_zRangeVarID, zRange, spriteNum, playerNum);
#endif
VM_OnEvent(EVENT_GETSHOTRANGE, spriteNum, playerNum);
#ifdef LUNATIC
angRange = pPlayer->angrange;
zRange = pPlayer->zrange;
#else
angRange = Gv_GetVar(g_angRangeVarID, spriteNum, playerNum);
zRange = Gv_GetVar(g_zRangeVarID, spriteNum, playerNum);
#endif
if (accurateAim)
{
@ -1511,24 +1493,15 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec
if (placeMine == 1)
{
int const tripBombMode = (playerNum < 0) ? 0 :
#ifdef LUNATIC
g_player[playerNum].ps->tripbombControl;
#else
Gv_GetVarByLabel("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE,
g_player[playerNum].ps->i, playerNum);
#endif
int const spawnedSprite = A_InsertSprite(hitData.sect, hitData.pos.x, hitData.pos.y, hitData.pos.z, TRIPBOMB, -16, 4, 5,
shootAng, 0, 0, spriteNum, 6);
if (tripBombMode & TRIPBOMB_TIMER)
{
#ifdef LUNATIC
int32_t lLifetime = g_player[playerNum].ps->tripbombLifetime;
int32_t lLifetimeVar = g_player[playerNum].ps->tripbombLifetimeVar;
#else
int32_t lLifetime = Gv_GetVarByLabel("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, g_player[playerNum].ps->i, playerNum);
int32_t lLifetimeVar
= Gv_GetVarByLabel("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, g_player[playerNum].ps->i, playerNum);
#endif
// set timer. blows up when at zero....
actor[spawnedSprite].t_data[7] = lLifetime + mulscale14(krand(), lLifetimeVar) - lLifetimeVar;
// TIMER_CONTROL
@ -3814,13 +3787,6 @@ void P_CheckWeapon(DukePlayer_t *pPlayer)
P_ChangeWeapon(pPlayer, weaponNum);
}
#ifdef LUNATIC
void P_CheckWeaponI(int playerNum)
{
P_CheckWeapon(g_player[playerNum].ps);
}
#endif
static void DoWallTouchDamage(const DukePlayer_t *pPlayer, int32_t wallNum)
{
vec3_t const davect = { pPlayer->pos.x + (sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047] >> 9),
@ -4108,11 +4074,7 @@ void P_FragPlayer(int playerNum)
}
}
#ifdef LUNATIC
# define PIPEBOMB_CONTROL(playerNum) (g_player[playerNum].ps->pipebombControl)
#else
# define PIPEBOMB_CONTROL(playerNum) (Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, playerNum))
#endif
#define PIPEBOMB_CONTROL(playerNum) (Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, playerNum))
static void P_ProcessWeapon(int playerNum)
{
@ -4430,13 +4392,8 @@ static void P_ProcessWeapon(int playerNum)
if (pipeBombType & PIPEBOMB_TIMER)
{
#ifdef LUNATIC
int pipeLifeTime = g_player[playerNum].ps->pipebombLifetime;
int pipeLifeVariance = g_player[playerNum].ps->pipebombLifetimeVar;
#else
int pipeLifeTime = Gv_GetVarByLabel("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, playerNum);
int pipeLifeVariance = Gv_GetVarByLabel("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, playerNum);
#endif
actor[pipeSpriteNum].t_data[7]= pipeLifeTime
+ mulscale14(krand(), pipeLifeVariance)
- pipeLifeVariance;

View file

@ -152,13 +152,6 @@ typedef struct {
int32_t autostep, autostep_sbw;
uint32_t interface_toggle;
#ifdef LUNATIC
int32_t pipebombControl, pipebombLifetime, pipebombLifetimeVar;
int32_t tripbombControl, tripbombLifetime, tripbombLifetimeVar;
int32_t zrange;
int16_t angrange, autoaimang;
#endif
uint16_t max_actors_killed, actors_killed;
uint16_t gotweapon, zoom;
@ -213,14 +206,6 @@ typedef struct {
int8_t last_used_weapon;
#ifdef LUNATIC
int8_t palsfadespeed, palsfadenext, palsfadeprio, padding2_;
// The player index. Always valid since we have no loose DukePlayer_t's
// anywhere (like with spritetype_t): g_player[i].ps->wa.idx == i.
struct { int32_t idx; } wa;
#endif
int8_t crouch_toggle;
int8_t padding_[1];
} DukePlayer_t;
@ -277,11 +262,7 @@ typedef struct
int32_t FlashColor; // Muzzle flash color
} weapondata_t;
#ifdef LUNATIC
# define PWEAPON(Player, Weapon, Wmember) (g_playerWeapon[Player][Weapon].Wmember)
extern weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS];
#else
# define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player])
#define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player])
extern intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in clip
extern intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire)
extern intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire
@ -301,7 +282,6 @@ extern intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of maga
extern intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
extern intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound for weapon selection
extern intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Color for polymer muzzle flash
#endif
typedef struct {
int32_t workslike, cstat; // 8b
@ -348,19 +328,10 @@ static inline int A_Shoot(int spriteNum, int projecTile)
static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_t g, uint8_t b)
{
#ifdef LUNATIC
// Compare with _defs_game.lua: player[]:_palfrom().
if (pPlayer->pals.f == 0 || pPlayer->palsfadeprio <= 0)
#endif
{
pPlayer->pals.f = f;
pPlayer->pals.r = r;
pPlayer->pals.g = g;
pPlayer->pals.b = b;
#ifdef LUNATIC
pPlayer->palsfadespeed = pPlayer->palsfadenext = 0;
#endif
}
pPlayer->pals.f = f;
pPlayer->pals.r = r;
pPlayer->pals.g = g;
pPlayer->pals.b = b;
}
void P_AddKills(DukePlayer_t * pPlayer, uint16_t kills);
@ -388,15 +359,7 @@ int P_GetOverheadPal(const DukePlayer_t *pPlayer);
int Proj_GetDamage(projectile_t const *pProj);
#if !defined LUNATIC
void P_SetWeaponGamevars(int playerNum, const DukePlayer_t *pPlayer);
#else
static inline void P_SetWeaponGamevars(int playerNum, const DukePlayer_t *pPlayer)
{
UNREFERENCED_PARAMETER(playerNum);
UNREFERENCED_PARAMETER(pPlayer);
}
#endif
// Get the player index given an APLAYER sprite pointer.
static inline int P_GetP(const void *pSprite)

View file

@ -1277,9 +1277,7 @@ static void prelevel(int g)
for (int nextSprite, SPRITES_OF_STAT_SAFE(STAT_DEFAULT, i, nextSprite))
{
A_ResetVars(i);
#if !defined LUNATIC
A_LoadActor(i);
#endif
VM_OnEvent(EVENT_LOADACTOR, i);
A_MaybeProcessEffector(i);
@ -1362,11 +1360,9 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
M_ClearMenus();
#if !defined LUNATIC
Gv_ResetVars();
Gv_InitWeaponPointers();
Gv_RefreshPointers();
#endif
Gv_ResetSystemDefaults();
for (int i=0; i < (MAXVOLUMES*MAXLEVELS); i++)
@ -1391,13 +1387,6 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
display_mirror = 0;
#ifdef LUNATIC
// NOTE: Lunatic state creation is relatively early. No map has yet been loaded.
// XXX: What about the cases where G_EnterLevel() is called without a preceding G_NewGame()?
El_CreateGameState();
G_PostCreateGameState();
#endif
VM_OnEvent(EVENT_NEWGAME, g_player[screenpeek].ps->i, screenpeek);
}
@ -1924,7 +1913,6 @@ void G_FreeMapState(int levelNum)
if (board.savedstate == NULL)
return;
#if !defined LUNATIC
for (int j=0; j<g_gameVarCount; j++)
{
if (aGameVars[j].flags & GAMEVAR_NORESET)
@ -1939,9 +1927,6 @@ void G_FreeMapState(int levelNum)
if (aGameArrays[j].flags & GAMEARRAY_RESTORE)
ALIGNED_FREE_AND_NULL(board.savedstate->arrays[j]);
}
#else
Xfree(board.savedstate->savecode);
#endif
ALIGNED_FREE_AND_NULL(board.savedstate);
}

View file

@ -297,11 +297,9 @@ int32_t G_LoadPlayer(FSaveGameNode *sv)
M_ClearMenus();
#if !defined LUNATIC
Gv_ResetVars();
Gv_InitWeaponPointers();
Gv_RefreshPointers();
#endif
Gv_ResetSystemDefaults();
for (int i=0; i < (MAXVOLUMES*MAXLEVELS); i++)
@ -1136,9 +1134,6 @@ static const dataspec_t svgm_script[] =
{ DS_LOADFN, (void *) &sv_postprojectileload, 0, 1 },
{ 0, &actor[0], sizeof(actor_t), MAXSPRITES },
{ DS_SAVEFN|DS_LOADFN, (void *)&sv_postactordata, 0, 1 },
#if defined LUNATIC
{ DS_LOADFN|DS_NOCHK, (void *)&sv_create_lua_state, 0, 1 },
#endif
{ DS_END, 0, 0, 0 }
};
@ -1189,7 +1184,6 @@ static uint8_t *svdiff;
#include "gamedef.h"
#if !defined LUNATIC
#define SV_SKIPMASK (/*GAMEVAR_SYSTEM|*/ GAMEVAR_READONLY | GAMEVAR_PTR_MASK | /*GAMEVAR_NORESET |*/ GAMEVAR_SPECIAL)
static char svgm_vars_string [] = "blK:vars";
@ -1259,7 +1253,6 @@ static void sv_makevarspec()
svgm_vars[vcnt].size = 0;
svgm_vars[vcnt].cnt = 0;
}
#endif
void sv_freemem()
{
@ -1285,12 +1278,8 @@ int32_t sv_saveandmakesnapshot(FileWriter &fil, int8_t spot)
savehead_t h;
// calculate total snapshot size
#if !defined LUNATIC
sv_makevarspec();
svsnapsiz = calcsz((const dataspec_t *)svgm_vars);
#else
svsnapsiz = 0;
#endif
svsnapsiz += calcsz(svgm_udnetw) + calcsz(svgm_secwsp) + calcsz(svgm_script) + calcsz(svgm_anmisc);
@ -1490,9 +1479,7 @@ uint32_t sv_writediff(FileWriter *fil)
cmpspecdata(svgm_secwsp, &p, &d);
cmpspecdata(svgm_script, &p, &d);
cmpspecdata(svgm_anmisc, &p, &d);
#if !defined LUNATIC
cmpspecdata((const dataspec_t *)svgm_vars, &p, &d);
#endif
if (p != svsnapshot+svsnapsiz)
Printf("sv_writediff: dump+siz=%p, p=%p!\n", svsnapshot+svsnapsiz, p);
@ -1524,9 +1511,7 @@ int32_t sv_readdiff(FileReader &fil)
if (applydiff(svgm_secwsp, &p, &d)) return -4;
if (applydiff(svgm_script, &p, &d)) return -5;
if (applydiff(svgm_anmisc, &p, &d)) return -6;
#if !defined LUNATIC
if (applydiff((const dataspec_t *)svgm_vars, &p, &d)) return -7;
#endif
int i = 0;
@ -1680,12 +1665,6 @@ static void sv_restload()
# define PRINTSIZE(name) do { } while (0)
#endif
#ifdef LUNATIC
// <levelnum>: if we're not serializing for a mapstate, -1
// otherwise, the linearized level number
LUNATIC_CB const char *(*El_SerializeGamevars)(int32_t *slenptr, int32_t levelnum);
#endif
static uint8_t *dosaveplayer2(FileWriter &fil, uint8_t *mem)
{
#ifdef DEBUGGINGAIDS
@ -1701,11 +1680,9 @@ static uint8_t *dosaveplayer2(FileWriter &fil, uint8_t *mem)
mem=writespecdata(svgm_anmisc, &fil, mem); // animates, quotes & misc.
PRINTSIZE("animisc");
#if !defined LUNATIC
Gv_WriteSave(fil); // gamevars
mem=writespecdata((const dataspec_t *)svgm_vars, 0, mem);
PRINTSIZE("vars");
#endif
return mem;
}
@ -1727,7 +1704,6 @@ static int32_t doloadplayer2(FileReader &fil, uint8_t **memptr)
if (readspecdata(svgm_anmisc, &fil, &mem)) return -6;
PRINTSIZE("animisc");
#if !defined LUNATIC
int i;
if ((i = Gv_ReadSave(fil))) return i;
@ -1744,7 +1720,6 @@ static int32_t doloadplayer2(FileReader &fil, uint8_t **memptr)
}
}
PRINTSIZE("vars");
#endif
if (memptr)
*memptr = mem;
@ -1763,9 +1738,7 @@ int32_t sv_updatestate(int32_t frominit)
if (readspecdata(svgm_script, nullptr, &p)) return -5;
if (readspecdata(svgm_anmisc, nullptr, &p)) return -6;
#if !defined LUNATIC
if (readspecdata((const dataspec_t *)svgm_vars, nullptr, &p)) return -8;
#endif
if (p != pbeg+svsnapsiz)
{
@ -1884,11 +1857,7 @@ static void postloadplayer(int32_t savegamep)
//8
// if (savegamep) ?
#ifdef LUNATIC
G_ResetTimers(1);
#else
G_ResetTimers(0);
#endif
#ifdef USE_STRUCT_TRACKERS
Bmemset(sectorchanged, 0, sizeof(sectorchanged));

View file

@ -28,11 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_DUKE_NS
#ifdef LUNATIC
# define SV_MAJOR_VER 2
#else
# define SV_MAJOR_VER 1
#endif
#define SV_MAJOR_VER 1
#define SV_MINOR_VER 7
#pragma pack(push,1)

View file

@ -1038,11 +1038,7 @@ void G_DrawBackground(void)
// Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1);
bgtile = VM_OnEventWithReturn(EVENT_GETMENUTILE, g_player[screenpeek].ps->i, screenpeek, bgtile);
// MENU_TILE: is the menu tile tileable?
#if !defined LUNATIC
if (Gv_GetVarByLabel("MENU_TILE", !fstilep, -1, -1))
#else
if (!fstilep)
#endif
{
if ((unsigned) bgtile < MAXTILES)
for (y=y1; y<y2; y+=tilesiz[bgtile].y)

View file

@ -958,10 +958,6 @@ void G_DisplayRest(int32_t smoothratio)
G_ShowScores();
#ifdef LUNATIC
El_DisplayErrors();
#endif
#ifndef EDUKE32_TOUCH_DEVICES
if (VOLUMEONE)
{
@ -1070,10 +1066,6 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t
} while (start != end+step);
}
#ifdef LUNATIC
int32_t g_logoFlags = 255;
#endif
#ifdef __ANDROID__
int inExtraScreens = 0;
#endif

View file

@ -338,7 +338,6 @@ int32_t FLAMETHROWER_LOOP = FLAMETHROWER_LOOP__STATIC;
int32_t FLAMETHROWER_END = FLAMETHROWER_END__STATIC;
int32_t E5L7_DUKE_QUIT_YOU = E5L7_DUKE_QUIT_YOU__STATIC;
#if !defined LUNATIC
static hashtable_t h_names = {512, NULL};
void G_ProcessDynamicSoundMapping(const char *szLabel, int32_t lValue)
@ -372,7 +371,6 @@ void freesoundhashnames(void)
hash_free(&h_names);
}
#endif
#endif
// This is run after all CON define's have been processed to set up the
// dynamic->static sound mapping.

View file

@ -178,10 +178,8 @@ void G_InitDynamicSounds(void);
void G_ProcessDynamicSoundMapping(const char *szLabel, int32_t lValue);
#if !defined LUNATIC
void initsoundhashnames(void);
void freesoundhashnames(void);
#endif
extern int32_t ALIEN_SWITCH1;
extern int32_t BIGBANG;