Move around some #ifdef LUNATIC to compile out more code, minor cleanup.

git-svn-id: https://svn.eduke32.com/eduke32@3459 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-02-07 21:00:48 +00:00
parent 728ae2bb76
commit 8e0c7b133e
7 changed files with 31 additions and 37 deletions

View file

@ -9587,6 +9587,7 @@ static void G_CompileScripts(void)
#if defined LUNATIC
Gv_Init();
C_InitProjectiles();
#else
// if we compile for a V7 engine wall[] should be used for label names since it's bigger
pathsearchmode = 1;

View file

@ -6038,9 +6038,9 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("PROJ_XREPEAT",PROJ_XREPEAT,LABEL_DEFINE);
C_AddDefinition("PROJ_YREPEAT",PROJ_YREPEAT,LABEL_DEFINE);
}
#endif
#pragma pack(push,1)
static void C_InitProjectiles(void)
void C_InitProjectiles(void)
{
int32_t i;
@ -6077,8 +6077,8 @@ static void C_InitProjectiles(void)
Bmemcpy(&g_tile[i].defproj, &DefaultProjectile, sizeof(projectile_t));
}
}
#pragma pack(pop)
#if !defined LUNATIC
extern int32_t g_numObituaries;
extern int32_t g_numSelfObituaries;

View file

@ -94,6 +94,7 @@ extern const memberlabel_t TsprLabels[];
int32_t C_AllocQuote(int32_t qnum);
void C_InitQuotes(void);
void C_InitProjectiles(void);
typedef struct {
int32_t g_i, g_p, g_x;

View file

@ -450,7 +450,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t a)
{
const int32_t ticselapsed = (vm.g_t[0])&31;
#ifndef LUNATIC
#if !defined LUNATIC
const intptr_t *moveptr;
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
@ -526,7 +526,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t a)
}
}
static void do_face_player_addang(int32_t shr, int32_t goalang)
static void VM_AddAngle(int32_t shr, int32_t goalang)
{
int32_t angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>shr;
@ -536,7 +536,7 @@ static void do_face_player_addang(int32_t shr, int32_t goalang)
vm.g_sp->ang += angdif;
}
static void do_face_player(int32_t shr)
static void VM_FacePlayer(int32_t shr)
{
int32_t goalang;
const DukePlayer_t *const ps = g_player[vm.g_p].ps;
@ -546,16 +546,16 @@ static void do_face_player(int32_t shr)
else
goalang = getangle(ps->pos.x-vm.g_sp->x, ps->pos.y-vm.g_sp->y);
do_face_player_addang(shr, goalang);
VM_AddAngle(shr, goalang);
}
GAMEEXEC_STATIC void VM_Move(void)
{
#ifndef LUNATIC
#if !defined LUNATIC
const intptr_t *moveptr;
#endif
int32_t a = vm.g_sp->hitag, goalang, angdif;
int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
int32_t a = vm.g_sp->hitag, angdif;
const int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
if (a == -1) a = 0;
@ -575,13 +575,13 @@ GAMEEXEC_STATIC void VM_Move(void)
if (deadflag) goto dead;
if (a&face_player)
do_face_player(2);
VM_FacePlayer(2);
if (a&spin)
vm.g_sp->ang += sintable[((vm.g_t[0]<<3)&2047)]>>6;
if (a&face_player_slow)
do_face_player(4);
VM_FacePlayer(4);
if ((a&jumptoplayer) == jumptoplayer)
{
@ -595,13 +595,12 @@ GAMEEXEC_STATIC void VM_Move(void)
int32_t newx = ps->pos.x + (ps->vel.x/768);
int32_t newy = ps->pos.y + (ps->vel.y/768);
goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
do_face_player_addang(2, goalang);
int32_t goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
VM_AddAngle(2, goalang);
}
dead:
#ifndef LUNATIC
#if !defined LUNATIC
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
{
vm.g_t[1] = 0;
@ -813,7 +812,7 @@ static int32_t VM_AddWeapon(int32_t weap, int32_t amount, DukePlayer_t *ps)
}
#endif
static void VM_Fall(void)
static void VM_Fall()
{
vm.g_sp->xoffset = vm.g_sp->yoffset = 0;
@ -887,13 +886,13 @@ static void VM_Fall(void)
default:
// fix for flying/jumping monsters getting stuck in water
{
#ifndef LUNATIC
#if !defined LUNATIC
int32_t moveScriptOfs = vm.g_t[1];
#endif
if ((vm.g_sp->hitag & jumptoplayer) ||
(G_HaveActor(vm.g_sp->picnum) &&
#ifndef LUNATIC
#if !defined LUNATIC
(unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1]
#else
actor[vm.g_i].mv.vvel != 0
@ -914,6 +913,7 @@ static void VM_Fall(void)
}
return;
}
vm.g_sp->zvel = 0;
}
@ -2001,8 +2001,6 @@ nullquote:
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
actor[i].flags = 0;
sprite[i].hitag = 0;
#if !defined LUNATIC
// TODO: Lunatic
if (g_tile[sprite[i].picnum].execPtr)
{
@ -2011,7 +2009,6 @@ nullquote:
T2 = *(g_tile[sprite[i].picnum].execPtr+2); // move
sprite[i].hitag = *(g_tile[sprite[i].picnum].execPtr+3); // ai bits
}
#endif
}
changespritestat(i,j);
continue;
@ -5187,13 +5184,13 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
* (whether it is int32_t vs intptr_t), Although it is specifically cast to intptr_t*
* which might be corrected if the code is converted to use offsets */
/* Helixhorned: let's do away with intptr_t's... */
#ifndef LUNATIC
#if !defined LUNATIC
// NOTE: for Lunatic, need split into numeric literal / action label
// (maybe >=0/<0, respectively?)
if (vm.g_t[4]!=0 && (unsigned)vm.g_t[4] + 4 < (unsigned)g_scriptSize)
#endif
{
#ifndef LUNATIC
#if !defined 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);

View file

@ -28,16 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "savegame.h"
#define _gamevars_c_
#if !defined LUNATIC
# include "gamestructures.c"
#endif
extern int32_t OSD_errors;
void Gv_RefreshPointers(void);
extern void G_FreeMapState(int32_t mapnum);
#if !defined LUNATIC
static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */
{
// call this function as many times as needed.
@ -216,7 +215,7 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
if (Bmemcmp(tbuf, "EOF: EDuke32", 12)) { OSD_Printf("EOF ERR\n"); return 2; }
}
#if 0
# if 0
{
FILE *fp;
AddLog("Dumping Vars...");
@ -228,7 +227,7 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
}
AddLog("Done Dumping...");
}
#endif
# endif
return(0);
corrupt:
#endif
@ -971,9 +970,7 @@ int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iAct
return Gv_GetVar(i, iActor, iPlayer);
}
#endif
#if !defined LUNATIC
static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
{
int32_t i = hash_find(&h_gamevars,szGameLabel);
@ -1002,9 +999,8 @@ static void G_InitProjectileData(void)
void Gv_ResetSystemDefaults(void)
{
// call many times...
int32_t i;
#if !defined LUNATIC
int32_t i;
int32_t j;
char aszBuf[64];
@ -1405,13 +1401,12 @@ void Gv_Init(void)
//AddLog("Gv_Init");
#ifdef LUNATIC
Gv_AddSystemVars(); // set up weapon defaults, g_playerWeapon[][]
Gv_ResetSystemDefaults();
#else
Gv_Clear();
Gv_AddSystemVars();
Gv_InitWeaponPointers();
Gv_ResetSystemDefaults();
#endif
Gv_ResetSystemDefaults();
}
#if !defined LUNATIC

View file

@ -113,9 +113,9 @@ void G_FreeMapState(int32_t mapnum);
void Gv_DumpValues(void);
void Gv_InitWeaponPointers(void);
void Gv_RefreshPointers(void);
void Gv_ResetSystemDefaults(void);
void Gv_ResetVars(void);
#endif
void Gv_ResetSystemDefaults(void);
int32_t Gv_ReadSave(int32_t fil,int32_t newbehav);
void Gv_Init(void);
void Gv_WriteSave(FILE *fil,int32_t newbehav);

View file

@ -1473,9 +1473,9 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
// PK: Gv_ResetVars() might trip up the system (pointer) gamevars,
// e.g. if some earlier-version CON code had been loaded before
Gv_RefreshPointers();
Gv_ResetSystemDefaults();
#endif
Gv_ResetSystemDefaults();
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (MapInfo[i].savedstate)
{