mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
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:
parent
728ae2bb76
commit
8e0c7b133e
7 changed files with 31 additions and 37 deletions
|
@ -9587,6 +9587,7 @@ static void G_CompileScripts(void)
|
||||||
|
|
||||||
#if defined LUNATIC
|
#if defined LUNATIC
|
||||||
Gv_Init();
|
Gv_Init();
|
||||||
|
C_InitProjectiles();
|
||||||
#else
|
#else
|
||||||
// if we compile for a V7 engine wall[] should be used for label names since it's bigger
|
// if we compile for a V7 engine wall[] should be used for label names since it's bigger
|
||||||
pathsearchmode = 1;
|
pathsearchmode = 1;
|
||||||
|
|
|
@ -6038,9 +6038,9 @@ static void C_AddDefaultDefinitions(void)
|
||||||
C_AddDefinition("PROJ_XREPEAT",PROJ_XREPEAT,LABEL_DEFINE);
|
C_AddDefinition("PROJ_XREPEAT",PROJ_XREPEAT,LABEL_DEFINE);
|
||||||
C_AddDefinition("PROJ_YREPEAT",PROJ_YREPEAT,LABEL_DEFINE);
|
C_AddDefinition("PROJ_YREPEAT",PROJ_YREPEAT,LABEL_DEFINE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma pack(push,1)
|
void C_InitProjectiles(void)
|
||||||
static void C_InitProjectiles(void)
|
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
|
@ -6077,8 +6077,8 @@ static void C_InitProjectiles(void)
|
||||||
Bmemcpy(&g_tile[i].defproj, &DefaultProjectile, sizeof(projectile_t));
|
Bmemcpy(&g_tile[i].defproj, &DefaultProjectile, sizeof(projectile_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
|
#if !defined LUNATIC
|
||||||
extern int32_t g_numObituaries;
|
extern int32_t g_numObituaries;
|
||||||
extern int32_t g_numSelfObituaries;
|
extern int32_t g_numSelfObituaries;
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ extern const memberlabel_t TsprLabels[];
|
||||||
|
|
||||||
int32_t C_AllocQuote(int32_t qnum);
|
int32_t C_AllocQuote(int32_t qnum);
|
||||||
void C_InitQuotes(void);
|
void C_InitQuotes(void);
|
||||||
|
void C_InitProjectiles(void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t g_i, g_p, g_x;
|
int32_t g_i, g_p, g_x;
|
||||||
|
|
|
@ -450,7 +450,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t a)
|
||||||
{
|
{
|
||||||
const int32_t ticselapsed = (vm.g_t[0])&31;
|
const int32_t ticselapsed = (vm.g_t[0])&31;
|
||||||
|
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
const intptr_t *moveptr;
|
const intptr_t *moveptr;
|
||||||
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
|
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;
|
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;
|
vm.g_sp->ang += angdif;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_face_player(int32_t shr)
|
static void VM_FacePlayer(int32_t shr)
|
||||||
{
|
{
|
||||||
int32_t goalang;
|
int32_t goalang;
|
||||||
const DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
const DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
||||||
|
@ -546,16 +546,16 @@ static void do_face_player(int32_t shr)
|
||||||
else
|
else
|
||||||
goalang = getangle(ps->pos.x-vm.g_sp->x, ps->pos.y-vm.g_sp->y);
|
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)
|
GAMEEXEC_STATIC void VM_Move(void)
|
||||||
{
|
{
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
const intptr_t *moveptr;
|
const intptr_t *moveptr;
|
||||||
#endif
|
#endif
|
||||||
int32_t a = vm.g_sp->hitag, goalang, angdif;
|
int32_t a = vm.g_sp->hitag, angdif;
|
||||||
int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
|
const int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
|
||||||
|
|
||||||
if (a == -1) a = 0;
|
if (a == -1) a = 0;
|
||||||
|
|
||||||
|
@ -575,13 +575,13 @@ GAMEEXEC_STATIC void VM_Move(void)
|
||||||
if (deadflag) goto dead;
|
if (deadflag) goto dead;
|
||||||
|
|
||||||
if (a&face_player)
|
if (a&face_player)
|
||||||
do_face_player(2);
|
VM_FacePlayer(2);
|
||||||
|
|
||||||
if (a&spin)
|
if (a&spin)
|
||||||
vm.g_sp->ang += sintable[((vm.g_t[0]<<3)&2047)]>>6;
|
vm.g_sp->ang += sintable[((vm.g_t[0]<<3)&2047)]>>6;
|
||||||
|
|
||||||
if (a&face_player_slow)
|
if (a&face_player_slow)
|
||||||
do_face_player(4);
|
VM_FacePlayer(4);
|
||||||
|
|
||||||
if ((a&jumptoplayer) == jumptoplayer)
|
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 newx = ps->pos.x + (ps->vel.x/768);
|
||||||
int32_t newy = ps->pos.y + (ps->vel.y/768);
|
int32_t newy = ps->pos.y + (ps->vel.y/768);
|
||||||
|
|
||||||
goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
|
int32_t goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
|
||||||
|
VM_AddAngle(2, goalang);
|
||||||
do_face_player_addang(2, goalang);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dead:
|
dead:
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
|
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
|
||||||
{
|
{
|
||||||
vm.g_t[1] = 0;
|
vm.g_t[1] = 0;
|
||||||
|
@ -813,7 +812,7 @@ static int32_t VM_AddWeapon(int32_t weap, int32_t amount, DukePlayer_t *ps)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void VM_Fall(void)
|
static void VM_Fall()
|
||||||
{
|
{
|
||||||
vm.g_sp->xoffset = vm.g_sp->yoffset = 0;
|
vm.g_sp->xoffset = vm.g_sp->yoffset = 0;
|
||||||
|
|
||||||
|
@ -887,13 +886,13 @@ static void VM_Fall(void)
|
||||||
default:
|
default:
|
||||||
// fix for flying/jumping monsters getting stuck in water
|
// fix for flying/jumping monsters getting stuck in water
|
||||||
{
|
{
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
int32_t moveScriptOfs = vm.g_t[1];
|
int32_t moveScriptOfs = vm.g_t[1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((vm.g_sp->hitag & jumptoplayer) ||
|
if ((vm.g_sp->hitag & jumptoplayer) ||
|
||||||
(G_HaveActor(vm.g_sp->picnum) &&
|
(G_HaveActor(vm.g_sp->picnum) &&
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
(unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1]
|
(unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1]
|
||||||
#else
|
#else
|
||||||
actor[vm.g_i].mv.vvel != 0
|
actor[vm.g_i].mv.vvel != 0
|
||||||
|
@ -914,6 +913,7 @@ static void VM_Fall(void)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.g_sp->zvel = 0;
|
vm.g_sp->zvel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2001,8 +2001,6 @@ nullquote:
|
||||||
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
|
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
|
||||||
actor[i].flags = 0;
|
actor[i].flags = 0;
|
||||||
sprite[i].hitag = 0;
|
sprite[i].hitag = 0;
|
||||||
|
|
||||||
#if !defined LUNATIC
|
|
||||||
// TODO: Lunatic
|
// TODO: Lunatic
|
||||||
if (g_tile[sprite[i].picnum].execPtr)
|
if (g_tile[sprite[i].picnum].execPtr)
|
||||||
{
|
{
|
||||||
|
@ -2011,7 +2009,6 @@ nullquote:
|
||||||
T2 = *(g_tile[sprite[i].picnum].execPtr+2); // move
|
T2 = *(g_tile[sprite[i].picnum].execPtr+2); // move
|
||||||
sprite[i].hitag = *(g_tile[sprite[i].picnum].execPtr+3); // ai bits
|
sprite[i].hitag = *(g_tile[sprite[i].picnum].execPtr+3); // ai bits
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
changespritestat(i,j);
|
changespritestat(i,j);
|
||||||
continue;
|
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*
|
* (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 */
|
* which might be corrected if the code is converted to use offsets */
|
||||||
/* Helixhorned: let's do away with intptr_t's... */
|
/* Helixhorned: let's do away with intptr_t's... */
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
// NOTE: for Lunatic, need split into numeric literal / action label
|
// NOTE: for Lunatic, need split into numeric literal / action label
|
||||||
// (maybe >=0/<0, respectively?)
|
// (maybe >=0/<0, respectively?)
|
||||||
if (vm.g_t[4]!=0 && (unsigned)vm.g_t[4] + 4 < (unsigned)g_scriptSize)
|
if (vm.g_t[4]!=0 && (unsigned)vm.g_t[4] + 4 < (unsigned)g_scriptSize)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef LUNATIC
|
#if !defined LUNATIC
|
||||||
const int32_t action_frames = *(script + vm.g_t[4] + 1);
|
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_incval = *(script + vm.g_t[4] + 3);
|
||||||
const int32_t action_delay = *(script + vm.g_t[4] + 4);
|
const int32_t action_delay = *(script + vm.g_t[4] + 4);
|
||||||
|
|
|
@ -28,16 +28,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
|
|
||||||
#define _gamevars_c_
|
#define _gamevars_c_
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
# include "gamestructures.c"
|
# include "gamestructures.c"
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int32_t OSD_errors;
|
extern int32_t OSD_errors;
|
||||||
|
|
||||||
void Gv_RefreshPointers(void);
|
void Gv_RefreshPointers(void);
|
||||||
extern void G_FreeMapState(int32_t mapnum);
|
extern void G_FreeMapState(int32_t mapnum);
|
||||||
|
|
||||||
#if !defined LUNATIC
|
|
||||||
static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */
|
static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */
|
||||||
{
|
{
|
||||||
// call this function as many times as needed.
|
// call this function as many times as needed.
|
||||||
|
@ -971,9 +970,7 @@ int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iAct
|
||||||
|
|
||||||
return Gv_GetVar(i, iActor, iPlayer);
|
return Gv_GetVar(i, iActor, iPlayer);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined LUNATIC
|
|
||||||
static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
|
static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
|
||||||
{
|
{
|
||||||
int32_t i = hash_find(&h_gamevars,szGameLabel);
|
int32_t i = hash_find(&h_gamevars,szGameLabel);
|
||||||
|
@ -1002,9 +999,8 @@ static void G_InitProjectileData(void)
|
||||||
void Gv_ResetSystemDefaults(void)
|
void Gv_ResetSystemDefaults(void)
|
||||||
{
|
{
|
||||||
// call many times...
|
// call many times...
|
||||||
|
|
||||||
int32_t i;
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
|
int32_t i;
|
||||||
int32_t j;
|
int32_t j;
|
||||||
char aszBuf[64];
|
char aszBuf[64];
|
||||||
|
|
||||||
|
@ -1405,13 +1401,12 @@ void Gv_Init(void)
|
||||||
//AddLog("Gv_Init");
|
//AddLog("Gv_Init");
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
Gv_AddSystemVars(); // set up weapon defaults, g_playerWeapon[][]
|
Gv_AddSystemVars(); // set up weapon defaults, g_playerWeapon[][]
|
||||||
Gv_ResetSystemDefaults();
|
|
||||||
#else
|
#else
|
||||||
Gv_Clear();
|
Gv_Clear();
|
||||||
Gv_AddSystemVars();
|
Gv_AddSystemVars();
|
||||||
Gv_InitWeaponPointers();
|
Gv_InitWeaponPointers();
|
||||||
Gv_ResetSystemDefaults();
|
|
||||||
#endif
|
#endif
|
||||||
|
Gv_ResetSystemDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
|
|
|
@ -113,9 +113,9 @@ void G_FreeMapState(int32_t mapnum);
|
||||||
void Gv_DumpValues(void);
|
void Gv_DumpValues(void);
|
||||||
void Gv_InitWeaponPointers(void);
|
void Gv_InitWeaponPointers(void);
|
||||||
void Gv_RefreshPointers(void);
|
void Gv_RefreshPointers(void);
|
||||||
void Gv_ResetSystemDefaults(void);
|
|
||||||
void Gv_ResetVars(void);
|
void Gv_ResetVars(void);
|
||||||
#endif
|
#endif
|
||||||
|
void Gv_ResetSystemDefaults(void);
|
||||||
int32_t Gv_ReadSave(int32_t fil,int32_t newbehav);
|
int32_t Gv_ReadSave(int32_t fil,int32_t newbehav);
|
||||||
void Gv_Init(void);
|
void Gv_Init(void);
|
||||||
void Gv_WriteSave(FILE *fil,int32_t newbehav);
|
void Gv_WriteSave(FILE *fil,int32_t newbehav);
|
||||||
|
|
|
@ -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,
|
// PK: Gv_ResetVars() might trip up the system (pointer) gamevars,
|
||||||
// e.g. if some earlier-version CON code had been loaded before
|
// e.g. if some earlier-version CON code had been loaded before
|
||||||
Gv_RefreshPointers();
|
Gv_RefreshPointers();
|
||||||
|
|
||||||
Gv_ResetSystemDefaults();
|
|
||||||
#endif
|
#endif
|
||||||
|
Gv_ResetSystemDefaults();
|
||||||
|
|
||||||
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
|
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
|
||||||
if (MapInfo[i].savedstate)
|
if (MapInfo[i].savedstate)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue