More readability cleanup. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5835 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-08-27 01:42:01 +00:00
parent bd628ea2f7
commit d7d6623364
29 changed files with 2333 additions and 2378 deletions

View file

@ -246,7 +246,7 @@ void OSD_ResizeDisplay(int32_t w,int32_t h);
void OSD_CaptureInput(int32_t cap);
// sets the console version string
void OSD_SetVersion(const char *version, int32_t shade, int32_t pal);
void OSD_SetVersion(const char *gameVersion, int osdShade, int osdPal);
// shows or hides the onscreen display
void OSD_ShowDisplay(int32_t onf);

File diff suppressed because it is too large Load diff

View file

@ -297,36 +297,36 @@ enum pflags_t
PROJECTILE_TYPE_MASK = PROJECTILE_HITSCAN | PROJECTILE_RPG | PROJECTILE_KNEE | PROJECTILE_BLOOD,
};
extern tiledata_t g_tile[MAXTILES];
extern actor_t actor[MAXSPRITES];
extern int32_t block_deletesprite;
extern int32_t g_noEnemies;
extern int32_t otherp;
extern int32_t ticrandomseed;
extern projectile_t SpriteProjectile[MAXSPRITES];
extern tiledata_t g_tile[MAXTILES];
extern actor_t actor[MAXSPRITES];
extern int32_t block_deletesprite;
extern int32_t g_noEnemies;
extern int32_t otherp;
extern int32_t ticrandomseed;
extern projectile_t SpriteProjectile[MAXSPRITES];
void A_AddToDeleteQueue(int32_t i);
int32_t A_CheckNoSE7Water(uspritetype const * const pSprite, int32_t sectNum, int32_t sectLotag, int32_t *pOther);
int32_t A_CheckSwitchTile(int32_t i);
void A_DeleteSprite(int spriteNum);
void A_DoGuts(int32_t sp, int32_t gtype, int32_t n);
void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n);
int A_IncurDamage(int spriteNum);
void A_MoveCyclers(void);
void A_MoveDummyPlayers(void);
void A_MoveSector(int i);
void A_PlayAlertSound(int32_t i);
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4);
void A_SpawnMultiple(int32_t sp, int32_t pic, int32_t n);
int A_CheckNoSE7Water(uspritetype const *const pSprite, int sectNum, int sectLotag, int32_t *pOther);
int A_CheckSwitchTile(int spriteNum);
int A_IncurDamage(int spriteNum);
void A_AddToDeleteQueue(int spriteNum);
void A_DeleteSprite(int spriteNum);
void A_DoGuts(int spriteNum, int tileNum, int spawnCnt);
void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt);
void A_MoveCyclers(void);
void A_MoveDummyPlayers(void);
void A_MoveSector(int i);
void A_PlayAlertSound(int spriteNum);
void A_RadiusDamage(int spriteNum, int blastRadius, int dmg1, int dmg2, int dmg3, int dmg4);
void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt);
void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority);
void G_ClearCameraView(DukePlayer_t *ps);
void G_DoInterpolations(int32_t smoothratio);
void G_MoveWorld(void);
void G_RefreshLights(void);
int32_t G_SetInterpolation(int32_t *const posptr);
void G_StopInterpolation(int32_t *const posptr);
int G_SetInterpolation(int32_t *const posptr);
void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio);
void G_ClearCameraView(DukePlayer_t *ps);
void G_DoInterpolations(int smoothRatio);
void G_MoveWorld(void);
void G_RefreshLights(void);
void G_StopInterpolation(int32_t *const posptr);
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
void Sect_ToggleInterpolation(int sectnum, int doset);

View file

@ -153,8 +153,8 @@ void G_SetupCheats(void)
Bstrcpy(CheatStrings[24], "2debug");
Bstrcpy(CheatStrings[26], "2cgs");
Bstrcpy(GametypeNames[0], "GI Match (Spawn)");
Bstrcpy(GametypeNames[2], "GI Match (No Spawn)");
Bstrcpy(g_gametypeNames[0], "GI Match (Spawn)");
Bstrcpy(g_gametypeNames[2], "GI Match (No Spawn)");
}
else if (NAM)
{
@ -185,8 +185,8 @@ void G_SetupCheats(void)
Bstrcpy(CheatStrings[24], "adebug");
Bstrcpy(CheatStrings[26], "acgs");
Bstrcpy(GametypeNames[0], "GruntMatch (Spawn)");
Bstrcpy(GametypeNames[2], "GruntMatch (No Spawn)");
Bstrcpy(g_gametypeNames[0], "GruntMatch (Spawn)");
Bstrcpy(g_gametypeNames[2], "GruntMatch (No Spawn)");
}
}
@ -472,8 +472,8 @@ void G_DoCheats(void)
volnume--;
levnume--;
if ((VOLUMEONE && volnume > 0) || volnume > g_numVolumes-1 ||
levnume >= MAXLEVELS || aMapInfo[volnume *MAXLEVELS+levnume].filename == NULL)
if ((VOLUMEONE && volnume > 0) || volnume > g_volumeCnt-1 ||
levnume >= MAXLEVELS || g_mapInfo[volnume *MAXLEVELS+levnume].filename == NULL)
{
end_cheat(pPlayer);
return;

View file

@ -270,7 +270,7 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
{
if (argc > i+1)
{
Bstrcpy(setupfilename, argv[i+1]);
Bstrcpy(g_setupFileName, argv[i+1]);
i++;
}
i++;

View file

@ -521,20 +521,20 @@ int32_t CONFIG_ReadSetup(void)
pathsearchmode = 1;
#ifndef EDUKE32_TOUCH_DEVICES
if (SafeFileExists(setupfilename) && ud.config.scripthandle < 0) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(setupfilename);
if (SafeFileExists(g_setupFileName) && ud.config.scripthandle < 0) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
else if (SafeFileExists(SETUPFILENAME) && ud.config.scripthandle < 0)
{
int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",setupfilename,SETUPFILENAME);
"Import configuration data from \"%s\"?",g_setupFileName,SETUPFILENAME);
if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
}
else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0)
{
int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"duke3d.cfg\"?",setupfilename);
"Import configuration data from \"duke3d.cfg\"?",g_setupFileName);
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg");
}
#endif
@ -637,10 +637,10 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
{
int32_t i;
BFILE *fp;
char *ptr = Xstrdup(setupfilename);
char *ptr = Xstrdup(g_setupFileName);
char tempbuf[128];
if (!Bstrcmp(setupfilename, SETUPFILENAME))
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
Bsprintf(tempbuf, "settings.cfg");
else Bsprintf(tempbuf, "%s_settings.cfg", strtok(ptr, "."));
@ -673,7 +673,7 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
Bfclose(fp);
if (!Bstrcmp(setupfilename, SETUPFILENAME))
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
OSD_Printf("Wrote settings.cfg\n");
else OSD_Printf("Wrote %s_settings.cfg\n",ptr);
@ -681,7 +681,7 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
return;
}
if (!Bstrcmp(setupfilename, SETUPFILENAME))
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
OSD_Printf("Error writing settings.cfg: %s\n", strerror(errno));
else OSD_Printf("Error writing %s_settings.cfg: %s\n",ptr,strerror(errno));
@ -695,7 +695,7 @@ void CONFIG_WriteSetup(uint32_t flags)
if (!ud.config.setupread) return;
if (ud.config.scripthandle < 0)
ud.config.scripthandle = SCRIPT_Init(setupfilename);
ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE);
@ -723,9 +723,9 @@ void CONFIG_WriteSetup(uint32_t flags)
// exit early after only updating the values that can be changed from the startup window
if (flags & 1)
{
SCRIPT_Save(ud.config.scripthandle, setupfilename);
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
SCRIPT_Free(ud.config.scripthandle);
OSD_Printf("Updated %s\n",setupfilename);
OSD_Printf("Updated %s\n",g_setupFileName);
return;
}
@ -862,12 +862,12 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
}
SCRIPT_Save(ud.config.scripthandle, setupfilename);
SCRIPT_Save(ud.config.scripthandle, g_setupFileName);
if ((flags & 2) == 0)
SCRIPT_Free(ud.config.scripthandle);
OSD_Printf("Wrote %s\n",setupfilename);
OSD_Printf("Wrote %s\n",g_setupFileName);
CONFIG_WriteSettings();
Bfflush(NULL);
}
@ -916,7 +916,7 @@ int32_t CONFIG_GetMapBestTime(char const * const mapname, uint8_t const * const
int32_t CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t const tm)
{
if (ud.config.scripthandle < 0) ud.config.scripthandle = SCRIPT_Init(setupfilename);
if (ud.config.scripthandle < 0) ud.config.scripthandle = SCRIPT_Init(g_setupFileName);
if (ud.config.scripthandle < 0) return -1;
char m[37];

View file

@ -273,7 +273,7 @@ void G_GameExit(const char *msg)
if (!g_quickExit)
{
if (playerswhenstarted > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{
G_BonusScreen(1);
setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP);
@ -404,7 +404,7 @@ static void G_OROR_DupeSprites(const spritetype *sp)
int32_t k;
const spritetype *refsp;
if ((unsigned)sp->yvel >= (unsigned)playerswhenstarted)
if ((unsigned)sp->yvel >= (unsigned)g_mostConcurrentPlayers)
return;
refsp = &sprite[sp->yvel];
@ -2220,7 +2220,7 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->cstat = 32768;
changespritestat(newSprite, ((!g_netServer && ud.multimode < 2)
|| ((GametypeFlags[ud.coop] & GAMETYPE_COOPSPAWN) / GAMETYPE_COOPSPAWN) != pSprite->lotag)
|| ((g_gametypeFlags[ud.coop] & GAMETYPE_COOPSPAWN) / GAMETYPE_COOPSPAWN) != pSprite->lotag)
? STAT_MISC
: STAT_PLAYER);
break;
@ -4405,11 +4405,11 @@ extern int G_StartRTS(int lumpNum, int localPlayer)
void G_StartMusic(void)
{
int const levelNum = g_musicIndex;
Bassert(aMapInfo[levelNum].musicfn != NULL);
Bassert(g_mapInfo[levelNum].musicfn != NULL);
S_PlayMusic(aMapInfo[levelNum].musicfn);
S_PlayMusic(g_mapInfo[levelNum].musicfn);
Bsnprintf(apStrings[QUOTE_MUSIC], MAXQUOTELEN, "Playing %s", aMapInfo[levelNum].musicfn);
Bsnprintf(apStrings[QUOTE_MUSIC], MAXQUOTELEN, "Playing %s", g_mapInfo[levelNum].musicfn);
P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
}
@ -4638,7 +4638,7 @@ void G_HandleLocalKeys(void)
if (g_musicIndex >= maxi)
g_musicIndex = 0;
}
while (aMapInfo[g_musicIndex].musicfn == NULL);
while (g_mapInfo[g_musicIndex].musicfn == NULL);
G_StartMusic();
@ -4785,7 +4785,7 @@ FAKE_F3:
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicToggle)
{
map_t *const pMapInfo = &aMapInfo[g_musicIndex];
map_t *const pMapInfo = &g_mapInfo[g_musicIndex];
char *const musicString = apStrings[QUOTE_MUSIC];
KB_ClearKeyDown(sc_F5);
@ -4824,7 +4824,7 @@ FAKE_F3:
// dirty hack... char 127 in last position indicates an auto-filled name
if (ud.savegame[g_lastSaveSlot][MAXSAVEGAMENAME-2] == 127)
{
Bstrncpy(&ud.savegame[g_lastSaveSlot][0], aMapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, 19);
Bstrncpy(&ud.savegame[g_lastSaveSlot][0], g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, 19);
ud.savegame[g_lastSaveSlot][MAXSAVEGAMENAME-2] = 127;
}
@ -5017,7 +5017,7 @@ static int32_t S_DefineMusic(const char *ID, const char *name)
return -1;
}
return S_DefineAudioIfSupported(&aMapInfo[sel].musicfn, name);
return S_DefineAudioIfSupported(&g_mapInfo[sel].musicfn, name);
}
static int32_t parsedefinitions_game(scriptfile *script, int32_t preload);
@ -5448,9 +5448,9 @@ static void G_Cleanup(void)
for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music
{
Bfree(aMapInfo[i].name);
Bfree(aMapInfo[i].filename);
Bfree(aMapInfo[i].musicfn);
Bfree(g_mapInfo[i].name);
Bfree(g_mapInfo[i].filename);
Bfree(g_mapInfo[i].musicfn);
G_FreeMapState(i);
}
@ -5545,18 +5545,18 @@ static void G_CompileScripts(void)
if (g_loadFromGroupOnly) // g_loadFromGroupOnly is true only when compiling fails and internal defaults are utilized
C_Compile(G_ConFile());
if ((uint32_t)g_numLabels > MAXSPRITES*sizeof(spritetype)/64) // see the arithmetic above for why
if ((uint32_t)g_labelCnt > MAXSPRITES*sizeof(spritetype)/64) // see the arithmetic above for why
G_GameExit("Error: too many labels defined!");
{
char *newlabel;
int32_t *newlabelcode;
newlabel = (char *)Xmalloc(g_numLabels<<6);
newlabelcode = (int32_t *)Xmalloc(g_numLabels*sizeof(int32_t));
newlabel = (char *)Xmalloc(g_labelCnt<<6);
newlabelcode = (int32_t *)Xmalloc(g_labelCnt*sizeof(int32_t));
Bmemcpy(newlabel, label, g_numLabels*64);
Bmemcpy(newlabelcode, labelcode, g_numLabels*sizeof(int32_t));
Bmemcpy(newlabel, label, g_labelCnt*64);
Bmemcpy(newlabelcode, labelcode, g_labelCnt*sizeof(int32_t));
label = newlabel;
labelcode = newlabelcode;
@ -5573,9 +5573,9 @@ static void G_CompileScripts(void)
static inline void G_CheckGametype(void)
{
ud.m_coop = clamp(ud.m_coop, 0, g_numGametypes-1);
initprintf("%s\n",GametypeNames[ud.m_coop]);
if (GametypeFlags[ud.m_coop] & GAMETYPE_ITEMRESPAWN)
ud.m_coop = clamp(ud.m_coop, 0, g_gametypeCnt-1);
initprintf("%s\n",g_gametypeNames[ud.m_coop]);
if (g_gametypeFlags[ud.m_coop] & GAMETYPE_ITEMRESPAWN)
ud.m_respawn_items = ud.m_respawn_inventory = 1;
}
@ -6101,7 +6101,7 @@ int app_main(int argc, char const * const * argv)
if (!g_useCwd)
G_AddSearchPaths();
g_numSkills = 4;
g_skillCnt = 4;
ud.multimode = 1;
// This needs to happen before G_CheckCommandLine() because G_GameExit()
@ -6181,8 +6181,8 @@ int app_main(int argc, char const * const * argv)
Bexit(2);
}
if (Bstrcmp(setupfilename, SETUPFILENAME))
initprintf("Using config file \"%s\".\n",setupfilename);
if (Bstrcmp(g_setupFileName, SETUPFILENAME))
initprintf("Using config file \"%s\".\n",g_setupFileName);
G_ScanGroups();
@ -6238,7 +6238,7 @@ int app_main(int argc, char const * const * argv)
}
#endif
numplayers = 1;
playerswhenstarted = ud.multimode; // Lunatic needs this (player[] bound)
g_mostConcurrentPlayers = ud.multimode; // Lunatic needs this (player[] bound)
if (!g_fakeMultiMode)
{
@ -6319,7 +6319,7 @@ int app_main(int argc, char const * const * argv)
}
}
playerswhenstarted = ud.multimode; // XXX: redundant?
g_mostConcurrentPlayers = ud.multimode; // XXX: redundant?
ud.last_level = 0;
// the point of this block is to avoid overwriting the default in the cfg while asserting our selection
@ -6389,10 +6389,10 @@ int app_main(int argc, char const * const * argv)
system_getcvars();
char *const setupFileName = Xstrdup(setupfilename);
char *const setupFileName = Xstrdup(g_setupFileName);
char *const p = strtok(setupFileName, ".");
if (!Bstrcmp(setupfilename, SETUPFILENAME))
if (!Bstrcmp(g_setupFileName, SETUPFILENAME))
Bsprintf(tempbuf, "settings.cfg");
else
Bsprintf(tempbuf, "%s_settings.cfg", p);
@ -6531,7 +6531,7 @@ MAIN_LOOP_RESTART:
P_SetupMiscInputSettings();
g_player[myconnectindex].pteam = ud.team;
if (GametypeFlags[ud.coop] & GAMETYPE_TDM)
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = G_GetTeamPalette(g_player[myconnectindex].pteam);
else
{
@ -6601,15 +6601,7 @@ MAIN_LOOP_RESTART:
P_GetInput(myconnectindex);
}
avg.fvel += localInput.fvel;
avg.svel += localInput.svel;
avg.avel += localInput.avel;
avg.horz += localInput.horz;
avg.bits |= localInput.bits;
avg.extbits |= localInput.extbits;
Bmemcpy(&inputfifo[0][myconnectindex], &avg, sizeof(input_t));
Bmemset(&avg, 0, sizeof(input_t));
Bmemcpy(&inputfifo[0][myconnectindex], &localInput, sizeof(input_t));
do
{
@ -6827,13 +6819,13 @@ int G_DoMoveThings(void)
if (g_player[i].inputBits->extbits&(1<<6))
{
g_player[i].ps->team = g_player[i].pteam;
if (GametypeFlags[ud.coop] & GAMETYPE_TDM)
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
{
actor[g_player[i].ps->i].picnum = APLAYERTOP;
P_QuickKill(g_player[i].ps);
}
}
if (GametypeFlags[ud.coop] & GAMETYPE_TDM)
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
g_player[i].ps->palookup = g_player[i].pcolor = G_GetTeamPalette(g_player[i].ps->team);
if (sprite[g_player[i].ps->i].pal != 1)

File diff suppressed because it is too large Load diff

View file

@ -40,20 +40,20 @@ extern "C" {
#define VM_INSTMASK 0xfff
#define C_CUSTOMERROR(Text, ...) \
do \
{ \
C_ReportError(-1); \
initprintf("%s:%d: error: " Text "\n", g_szScriptFileName, g_lineNumber, ##__VA_ARGS__); \
g_numCompilerErrors++; \
#define C_CUSTOMERROR(Text, ...) \
do \
{ \
C_ReportError(-1); \
initprintf("%s:%d: error: " Text "\n", g_scriptFileName, g_lineNumber, ##__VA_ARGS__); \
g_errorCnt++; \
} while (0)
#define C_CUSTOMWARNING(Text, ...) \
do \
{ \
C_ReportError(-1); \
initprintf("%s:%d: warning: " Text "\n", g_szScriptFileName, g_lineNumber, ##__VA_ARGS__); \
g_numCompilerWarnings++; \
#define C_CUSTOMWARNING(Text, ...) \
do \
{ \
C_ReportError(-1); \
initprintf("%s:%d: warning: " Text "\n", g_scriptFileName, g_lineNumber, ##__VA_ARGS__); \
g_warningCnt++; \
} while (0)
#if !defined LUNATIC
@ -68,16 +68,16 @@ extern hashtable_t h_gamevars;
extern hashtable_t h_arrays;
extern hashtable_t h_labels;
extern int32_t g_aimAngleVarID; // var ID of "AUTOAIMANGLE"
extern int32_t g_angRangeVarID; // var ID of "ANGRANGE"
extern int32_t g_hitagVarID; // var ID of "HITAG"
extern int32_t g_lotagVarID; // var ID of "LOTAG"
extern int32_t g_returnVarID; // var ID of "RETURN"
extern int32_t g_textureVarID; // var ID of "TEXTURE"
extern int32_t g_thisActorVarID; // var ID of "THISACTOR"
extern int32_t g_weaponVarID; // var ID of "WEAPON"
extern int32_t g_worksLikeVarID; // var ID of "WORKSLIKE"
extern int32_t g_zRangeVarID; // var ID of "ZRANGE"
extern int32_t g_angRangeVarID; // var ID of "ANGRANGE"
extern int32_t g_aimAngleVarID; // var ID of "AUTOAIMANGLE"
extern int32_t g_lotagVarID; // var ID of "LOTAG"
extern int32_t g_hitagVarID; // var ID of "HITAG"
extern int32_t g_textureVarID; // var ID of "TEXTURE"
extern int32_t g_thisActorVarID; // var ID of "THISACTOR"
// KEEPINSYNC gamevars.c: "special vars for struct access"
enum QuickStructureAccess_t
@ -103,15 +103,20 @@ extern int32_t g_structVarIDs;
extern intptr_t apScriptEvents[MAXGAMEEVENTS];
#endif
extern int32_t otherp;
extern char CheatStrings[][MAXCHEATLEN];
extern char CheatStrings[][MAXCHEATLEN];
extern char g_scriptFileName[BMAX_PATH];
extern const uint32_t CheatFunctionFlags[];
extern const uint8_t CheatFunctionIDs[];
extern char g_szScriptFileName[BMAX_PATH];
extern int32_t g_totalLines, g_lineNumber;
extern int32_t g_numCompilerErrors, g_numCompilerWarnings, g_numXStrings;
extern int32_t g_scriptVersion;
extern char g_szBuf[1024];
extern int g_errorCnt;
extern int g_lineNumber;
extern int g_numXStrings;
extern int g_scriptVersion;
extern int g_totalLines;
extern int g_warningCnt;
extern int32_t otherp;
extern const char *EventNames[]; // MAXEVENTS
@ -124,16 +129,16 @@ typedef struct
int lId, flags, maxParm2;
} memberlabel_t;
extern const memberlabel_t SectorLabels[];
extern const memberlabel_t WallLabels[];
extern const memberlabel_t ActorLabels[];
extern const memberlabel_t InputLabels[];
extern const memberlabel_t PalDataLabels[];
extern const memberlabel_t PlayerLabels[];
extern const memberlabel_t ProjectileLabels[];
extern const memberlabel_t UserdefsLabels[];
extern const memberlabel_t InputLabels[];
extern const memberlabel_t TsprLabels[];
extern const memberlabel_t SectorLabels[];
extern const memberlabel_t TileDataLabels[];
extern const memberlabel_t PalDataLabels[];
extern const memberlabel_t TsprLabels[];
extern const memberlabel_t UserdefsLabels[];
extern const memberlabel_t WallLabels[];
#endif
typedef projectile_t defaultprojectile_t;
@ -166,7 +171,7 @@ typedef struct {
extern vmstate_t vm;
void G_DoGameStartup(const int32_t *params);
void C_DefineMusic(int32_t vol, int32_t lev, const char *fn);
void C_DefineMusic(int volumeNum, int levelNum, const char *fileName);
void C_DefineVolumeFlags(int32_t vol, int32_t flags);
void C_UndefineVolume(int32_t vol);

View file

@ -193,7 +193,7 @@ FORCE_INLINE int32_t VM_EventCommon_(int const eventNum, int const spriteNum, in
vm.pData = dummy_t;
}
if ((unsigned)playerNum >= (unsigned)playerswhenstarted)
if ((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers)
vm.pPlayer = g_player[0].ps;
VM_Execute(1);
@ -1083,11 +1083,11 @@ int G_StartTrack(int levelNum)
{
int trackNum = MAXLEVELS*ud.volume_number + levelNum;
if (aMapInfo[trackNum].musicfn != NULL)
if (g_mapInfo[trackNum].musicfn != NULL)
{
// Only set g_musicIndex on success.
g_musicIndex = trackNum;
S_PlayMusic(aMapInfo[trackNum].musicfn);
S_PlayMusic(g_mapInfo[trackNum].musicfn);
return 0;
}
@ -1451,7 +1451,7 @@ skip_check:
case CON_IFGOTWEAPONCE:
insptr++;
if ((GametypeFlags[ud.coop]&GAMETYPE_WEAPSTAY) && (g_netServer || ud.multimode > 1))
if ((g_gametypeFlags[ud.coop]&GAMETYPE_WEAPSTAY) && (g_netServer || ud.multimode > 1))
{
if (*insptr == 0)
{
@ -1639,7 +1639,7 @@ skip_check:
insptr++;
continue;
}
if (vm.playerNum == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND)
if (vm.playerNum == screenpeek || (g_gametypeFlags[ud.coop]&GAMETYPE_COOPSOUND)
#ifdef SPLITSCREEN_MOD_HACKS
|| (g_fakeMultiMode==2)
#endif
@ -1888,7 +1888,7 @@ skip_check:
int const nTag = Gv_GetVarX(*insptr++);
int const playerNum = (*insptr++ == g_thisActorVarID) ? vm.playerNum : Gv_GetVarX(*(insptr-1));
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("Invalid player %d\n", playerNum);
break;
@ -2214,14 +2214,14 @@ skip_check:
int32_t levelNum = ud.volume_number*MAXLEVELS + ud.level_number;
const char *pName;
if (EDUKE32_PREDICT_FALSE((unsigned)levelNum >= ARRAY_SIZE(aMapInfo)))
if (EDUKE32_PREDICT_FALSE((unsigned)levelNum >= ARRAY_SIZE(g_mapInfo)))
{
CON_ERRPRINTF("out of bounds map number (vol=%d, lev=%d)\n",
ud.volume_number, ud.level_number);
break;
}
pName = j == STR_MAPNAME ? aMapInfo[levelNum].name : aMapInfo[levelNum].filename;
pName = j == STR_MAPNAME ? g_mapInfo[levelNum].name : g_mapInfo[levelNum].filename;
if (EDUKE32_PREDICT_FALSE(pName == NULL))
{
@ -2231,11 +2231,11 @@ skip_check:
break;
}
Bstrcpy(apStrings[i], j==STR_MAPNAME ? aMapInfo[levelNum].name : aMapInfo[levelNum].filename);
Bstrcpy(apStrings[i], j==STR_MAPNAME ? g_mapInfo[levelNum].name : g_mapInfo[levelNum].filename);
break;
}
case STR_PLAYERNAME:
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("Invalid player ID %d\n", vm.playerNum);
break;
@ -2247,7 +2247,7 @@ skip_check:
Bstrcpy(apStrings[i],tempbuf);
break;
case STR_GAMETYPE:
Bstrcpy(apStrings[i],GametypeNames[ud.coop]);
Bstrcpy(apStrings[i],g_gametypeNames[ud.coop]);
break;
case STR_VOLUMENAME:
if (EDUKE32_PREDICT_FALSE((unsigned)ud.volume_number >= MAXVOLUMES))
@ -2255,7 +2255,7 @@ skip_check:
CON_ERRPRINTF("invalid volume (%d)\n", ud.volume_number);
break;
}
Bstrcpy(apStrings[i],EpisodeNames[ud.volume_number]);
Bstrcpy(apStrings[i],g_volumeNames[ud.volume_number]);
break;
case STR_YOURTIME:
Bstrcpy(apStrings[i],G_PrintYourTime());
@ -3435,7 +3435,7 @@ nullquote:
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), vm.spriteNum, 5);
sprite[spriteNum].yvel =
(vm.pSprite->picnum == BLIMP && debrisTile == SCRAP1) ? BlimpSpawnSprites[cnt % 14] : -1;
(vm.pSprite->picnum == BLIMP && debrisTile == SCRAP1) ? g_blimpSpawnItems[cnt % 14] : -1;
sprite[spriteNum].pal = vm.pSprite->pal;
}
insptr++;
@ -3783,7 +3783,7 @@ nullquote:
case CON_PALFROM:
insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("invalid player ID %d\n", vm.playerNum);
insptr += 4;
@ -3976,13 +3976,13 @@ finish_qsprintf:
continue; // out of switch
}
}
Bsprintf(szBuf,"CONLOGVAR: L=%d %s ",g_errorLineNum, aGameVars[lVarID].szLabel);
strcpy(g_szBuf,szBuf);
Bsprintf(tempbuf,"CONLOGVAR: L=%d %s ",g_errorLineNum, aGameVars[lVarID].szLabel);
Bstrcpy(tempbuf,szBuf);
if (aGameVars[lVarID].flags & GAMEVAR_READONLY)
{
Bsprintf(szBuf," (read-only)");
strcat(g_szBuf,szBuf);
Bstrcat(tempbuf,szBuf);
}
if (aGameVars[lVarID].flags & GAMEVAR_PERPLAYER)
{
@ -3996,10 +3996,10 @@ finish_qsprintf:
{
Bsprintf(szBuf," (Global)");
}
Bstrcat(g_szBuf,szBuf);
Bsprintf(szBuf," =%d\n", Gv_GetVarX(lVarID)*m);
Bstrcat(g_szBuf,szBuf);
OSD_Printf(OSDTEXT_GREEN "%s",g_szBuf);
Bstrcat(tempbuf, szBuf);
Bsprintf(szBuf, " =%d\n", Gv_GetVarX(lVarID) * m);
Bstrcat(tempbuf, szBuf);
OSD_Printf(OSDTEXT_GREEN "%s", tempbuf);
insptr++;
continue;
}
@ -4428,7 +4428,7 @@ finish_qsprintf:
int const lVar1 = *insptr++;
int const lVar2 = *insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("invalid player ID %d\n", playerNum);
@ -4520,7 +4520,7 @@ finish_qsprintf:
tw = (*insptr != g_thisActorVarID) ? Gv_GetVarX(*insptr) : vm.playerNum;
insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned)tw >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)tw >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("Invalid player ID %d\n", tw);
continue;
@ -4534,7 +4534,7 @@ finish_qsprintf:
tw = (*insptr != g_thisActorVarID) ? Gv_GetVarX(*insptr) : vm.playerNum;
insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned)tw >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)tw >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("Invalid player ID %d\n", tw);
continue;
@ -5559,7 +5559,7 @@ finish_qsprintf:
if (cansee(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z - ZOFFSET6, vm.pSprite->sectnum, pPlayer->pos.x,
pPlayer->pos.y, pPlayer->pos.z + ZOFFSET2, sprite[pPlayer->i].sectnum))
{
int32_t numPlayers = playerswhenstarted - 1;
int32_t numPlayers = g_mostConcurrentPlayers - 1;
for (; numPlayers >= 0; --numPlayers)
{
@ -5921,8 +5921,8 @@ void A_Execute(int spriteNum, int playerNum, int32_t playerDist)
void G_SaveMapState(void)
{
int32_t levelNum = ud.volume_number * MAXLEVELS + ud.level_number;
map_t *const pMapInfo = &aMapInfo[levelNum];
int const levelNum = ud.volume_number * MAXLEVELS + ud.level_number;
map_t *const pMapInfo = &g_mapInfo[levelNum];
if (pMapInfo->savedstate == NULL)
{
@ -5965,10 +5965,10 @@ void G_SaveMapState(void)
#endif
Bmemcpy(&save->actor[0],&actor[0],sizeof(actor_t)*MAXSPRITES);
Bmemcpy(&save->g_numCyclers,&g_numCyclers,sizeof(g_numCyclers));
Bmemcpy(&save->cyclers[0],&cyclers[0],sizeof(cyclers));
Bmemcpy(&save->g_cyclerCnt,&g_cyclerCnt,sizeof(g_cyclerCnt));
Bmemcpy(&save->g_cyclers[0],&g_cyclers[0],sizeof(g_cyclers));
Bmemcpy(&save->g_playerSpawnPoints[0],&g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints));
Bmemcpy(&save->g_numAnimWalls,&g_numAnimWalls,sizeof(g_numAnimWalls));
Bmemcpy(&save->g_animWallCnt,&g_animWallCnt,sizeof(g_animWallCnt));
Bmemcpy(&save->SpriteDeletionQueue[0],&SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue));
Bmemcpy(&save->g_spriteDeleteQueuePos,&g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos));
Bmemcpy(&save->animwall[0],&animwall[0],sizeof(animwall));
@ -5977,25 +5977,25 @@ void G_SaveMapState(void)
Bmemcpy(&save->g_mirrorSector[0],&g_mirrorSector[0],sizeof(g_mirrorSector));
Bmemcpy(&save->g_mirrorCount,&g_mirrorCount,sizeof(g_mirrorCount));
Bmemcpy(&save->show2dsector[0],&show2dsector[0],sizeof(show2dsector));
Bmemcpy(&save->g_numClouds,&g_numClouds,sizeof(g_numClouds));
Bmemcpy(&save->clouds[0],&clouds[0],sizeof(clouds));
Bmemcpy(&save->cloudx,&cloudx,sizeof(cloudx));
Bmemcpy(&save->cloudy,&cloudy,sizeof(cloudy));
Bmemcpy(&save->g_cloudCnt,&g_cloudCnt,sizeof(g_cloudCnt));
Bmemcpy(&save->g_cloudSect[0],&g_cloudSect[0],sizeof(g_cloudSect));
Bmemcpy(&save->g_cloudX,&g_cloudX,sizeof(g_cloudX));
Bmemcpy(&save->g_cloudY,&g_cloudY,sizeof(g_cloudY));
Bmemcpy(&save->pskyidx,&g_pskyidx,sizeof(g_pskyidx));
Bmemcpy(&save->animategoal[0],&animategoal[0],sizeof(animategoal));
Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel));
Bmemcpy(&save->g_animateCount,&g_animateCount,sizeof(g_animateCount));
Bmemcpy(&save->animatesect[0],&animatesect[0],sizeof(animatesect));
Bmemcpy(&save->g_animateGoal[0],&g_animateGoal[0],sizeof(g_animateGoal));
Bmemcpy(&save->g_animateVel[0],&g_animateVel[0],sizeof(g_animateVel));
Bmemcpy(&save->g_animateCnt,&g_animateCnt,sizeof(g_animateCnt));
Bmemcpy(&save->g_animateSect[0],&g_animateSect[0],sizeof(g_animateSect));
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_FWD);
Bmemcpy(&save->animateptr[0],&animateptr[0],sizeof(animateptr));
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
G_Util_PtrToIdx(g_animatePtr, g_animateCnt, sector, P2I_FWD);
Bmemcpy(&save->g_animatePtr[0],&g_animatePtr[0],sizeof(g_animatePtr));
G_Util_PtrToIdx(g_animatePtr, g_animateCnt, sector, P2I_BACK);
{
EDUKE32_STATIC_ASSERT(sizeof(save->animateptr) == sizeof(animateptr));
EDUKE32_STATIC_ASSERT(sizeof(save->g_animatePtr) == sizeof(g_animatePtr));
}
Bmemcpy(&save->g_numPlayerSprites,&g_numPlayerSprites,sizeof(g_numPlayerSprites));
Bmemcpy(&save->g_playerSpawnCnt,&g_playerSpawnCnt,sizeof(g_playerSpawnCnt));
Bmemcpy(&save->g_earthquakeTime,&g_earthquakeTime,sizeof(g_earthquakeTime));
Bmemcpy(&save->lockclock,&lockclock,sizeof(lockclock));
Bmemcpy(&save->randomseed,&randomseed,sizeof(randomseed));
@ -6060,14 +6060,14 @@ void G_SaveMapState(void)
void G_RestoreMapState(void)
{
int32_t levelNum = ud.volume_number * MAXLEVELS + ud.level_number;
mapstate_t *pSavedState = aMapInfo[levelNum].savedstate;
int const levelNum = ud.volume_number * MAXLEVELS + ud.level_number;
mapstate_t *pSavedState = g_mapInfo[levelNum].savedstate;
if (pSavedState != NULL)
{
int playerHealth[MAXPLAYERS];
for (bssize_t i=0; i<playerswhenstarted; i++)
for (bssize_t i=0; i<g_mostConcurrentPlayers; i++)
playerHealth[i] = sprite[g_player[i].ps->i].extra;
pub = NUMPAGES;
@ -6108,10 +6108,10 @@ void G_RestoreMapState(void)
#endif
Bmemcpy(&actor[0],&pSavedState->actor[0],sizeof(actor_t)*MAXSPRITES);
Bmemcpy(&g_numCyclers,&pSavedState->g_numCyclers,sizeof(g_numCyclers));
Bmemcpy(&cyclers[0],&pSavedState->cyclers[0],sizeof(cyclers));
Bmemcpy(&g_cyclerCnt,&pSavedState->g_cyclerCnt,sizeof(g_cyclerCnt));
Bmemcpy(&g_cyclers[0],&pSavedState->g_cyclers[0],sizeof(g_cyclers));
Bmemcpy(&g_playerSpawnPoints[0],&pSavedState->g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints));
Bmemcpy(&g_numAnimWalls,&pSavedState->g_numAnimWalls,sizeof(g_numAnimWalls));
Bmemcpy(&g_animWallCnt,&pSavedState->g_animWallCnt,sizeof(g_animWallCnt));
Bmemcpy(&SpriteDeletionQueue[0],&pSavedState->SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue));
Bmemcpy(&g_spriteDeleteQueuePos,&pSavedState->g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos));
Bmemcpy(&animwall[0],&pSavedState->animwall[0],sizeof(animwall));
@ -6120,20 +6120,20 @@ void G_RestoreMapState(void)
Bmemcpy(&g_mirrorSector[0],&pSavedState->g_mirrorSector[0],sizeof(g_mirrorSector));
Bmemcpy(&g_mirrorCount,&pSavedState->g_mirrorCount,sizeof(g_mirrorCount));
Bmemcpy(&show2dsector[0],&pSavedState->show2dsector[0],sizeof(show2dsector));
Bmemcpy(&g_numClouds,&pSavedState->g_numClouds,sizeof(g_numClouds));
Bmemcpy(&clouds[0],&pSavedState->clouds[0],sizeof(clouds));
Bmemcpy(&cloudx,&pSavedState->cloudx,sizeof(cloudx));
Bmemcpy(&cloudy,&pSavedState->cloudy,sizeof(cloudy));
Bmemcpy(&g_cloudCnt,&pSavedState->g_cloudCnt,sizeof(g_cloudCnt));
Bmemcpy(&g_cloudSect[0],&pSavedState->g_cloudSect[0],sizeof(g_cloudSect));
Bmemcpy(&g_cloudX,&pSavedState->g_cloudX,sizeof(g_cloudX));
Bmemcpy(&g_cloudY,&pSavedState->g_cloudY,sizeof(g_cloudY));
Bmemcpy(&g_pskyidx,&pSavedState->pskyidx,sizeof(g_pskyidx));
Bmemcpy(&animategoal[0],&pSavedState->animategoal[0],sizeof(animategoal));
Bmemcpy(&animatevel[0],&pSavedState->animatevel[0],sizeof(animatevel));
Bmemcpy(&g_animateCount,&pSavedState->g_animateCount,sizeof(g_animateCount));
Bmemcpy(&animatesect[0],&pSavedState->animatesect[0],sizeof(animatesect));
Bmemcpy(&g_animateGoal[0],&pSavedState->g_animateGoal[0],sizeof(g_animateGoal));
Bmemcpy(&g_animateVel[0],&pSavedState->g_animateVel[0],sizeof(g_animateVel));
Bmemcpy(&g_animateCnt,&pSavedState->g_animateCnt,sizeof(g_animateCnt));
Bmemcpy(&g_animateSect[0],&pSavedState->g_animateSect[0],sizeof(g_animateSect));
Bmemcpy(&animateptr[0],&pSavedState->animateptr[0],sizeof(animateptr));
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
Bmemcpy(&g_animatePtr[0],&pSavedState->g_animatePtr[0],sizeof(g_animatePtr));
G_Util_PtrToIdx(g_animatePtr, g_animateCnt, sector, P2I_BACK);
Bmemcpy(&g_numPlayerSprites,&pSavedState->g_numPlayerSprites,sizeof(g_numPlayerSprites));
Bmemcpy(&g_playerSpawnCnt,&pSavedState->g_playerSpawnCnt,sizeof(g_playerSpawnCnt));
Bmemcpy(&g_earthquakeTime,&pSavedState->g_earthquakeTime,sizeof(g_earthquakeTime));
Bmemcpy(&lockclock,&pSavedState->lockclock,sizeof(lockclock));
Bmemcpy(&randomseed,&pSavedState->randomseed,sizeof(randomseed));
@ -6193,7 +6193,7 @@ void G_RestoreMapState(void)
g_player[snum].ps->i = i;
}
for (bssize_t i=0; i<playerswhenstarted; i++)
for (bssize_t i=0; i<g_mostConcurrentPlayers; i++)
sprite[g_player[i].ps->i].extra = playerHealth[i];
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
@ -6207,7 +6207,7 @@ void G_RestoreMapState(void)
if (ud.lockout)
{
for (bssize_t x=g_numAnimWalls-1; x>=0; x--)
for (bssize_t x=g_animWallCnt-1; x>=0; x--)
switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum))
{
case FEMPIC1__STATIC:

View file

@ -116,6 +116,8 @@ int32_t VM_ResetPlayer2(int32_t snum, int32_t flags);
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
#endif
void VM_UpdateAnim(int spriteNum, int32_t *pData);
#ifdef __cplusplus
}
#endif

View file

@ -161,8 +161,8 @@ int32_t __fastcall VM_GetUserdef(register int32_t labelNum)
labelNum = 0;
#endif
break;
case USERDEFS_GAMETYPEFLAGS: labelNum = GametypeFlags[ud.coop]; break;
case USERDEFS_M_GAMETYPEFLAGS: labelNum = GametypeFlags[ud.m_coop]; break;
case USERDEFS_GAMETYPEFLAGS: labelNum = g_gametypeFlags[ud.coop]; break;
case USERDEFS_M_GAMETYPEFLAGS: labelNum = g_gametypeFlags[ud.m_coop]; break;
case USERDEFS_GLOBALFLAGS: labelNum = globalflags; break;
case USERDEFS_GLOBALGAMEFLAGS: labelNum = duke3d_globalflags; break;
case USERDEFS_VM_PLAYER: labelNum = vm.playerNum; break;
@ -390,7 +390,7 @@ void __fastcall VM_SetActiveProjectile(register int32_t const spriteNum, registe
int32_t __fastcall VM_GetPlayer(register int32_t const playerNum, register int32_t labelNum, register int32_t const lParm2)
{
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("tried to get %s on invalid target player (%d) from spr %d\n",
PlayerLabels[labelNum].name,playerNum,vm.spriteNum);
@ -575,7 +575,7 @@ int32_t __fastcall VM_GetPlayer(register int32_t const playerNum, register int32
void __fastcall VM_SetPlayer(register int32_t const playerNum, register int32_t const labelNum, register int32_t const lParm2, register int32_t const iSet)
{
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("tried to set %s on invalid target player (%d) from spr %d\n",
PlayerLabels[labelNum].name,playerNum,vm.spriteNum);
@ -769,7 +769,7 @@ void __fastcall VM_SetPlayer(register int32_t const playerNum, register int32_t
int32_t __fastcall VM_GetPlayerInput(register int32_t const playerNum, register int32_t labelNum)
{
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("VM_GetPlayerInput: invalid target player (%d) %d\n", playerNum,vm.spriteNum);
return -1;
@ -793,7 +793,7 @@ int32_t __fastcall VM_GetPlayerInput(register int32_t const playerNum, register
void __fastcall VM_SetPlayerInput(register int32_t const playerNum, register int32_t const labelNum, register int32_t const iSet)
{
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)playerswhenstarted))
if (EDUKE32_PREDICT_FALSE((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers))
{
CON_ERRPRINTF("VM_SetPlayerInput: invalid target player (%d) %d\n", playerNum,vm.spriteNum);
return;

View file

@ -205,23 +205,23 @@ int Gv_ReadSave(int32_t kFile)
{
if (savedstate[i])
{
if (aMapInfo[i].savedstate == NULL)
aMapInfo[i].savedstate = (mapstate_t *)Xaligned_alloc(16, sizeof(mapstate_t));
if (kdfread(aMapInfo[i].savedstate,sizeof(mapstate_t),1,kFile) != sizeof(mapstate_t)) goto corrupt;
if (g_mapInfo[i].savedstate == NULL)
g_mapInfo[i].savedstate = (mapstate_t *)Xaligned_alloc(16, sizeof(mapstate_t));
if (kdfread(g_mapInfo[i].savedstate,sizeof(mapstate_t),1,kFile) != sizeof(mapstate_t)) goto corrupt;
for (bssize_t j=0; j<g_gameVarCount; j++)
{
if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
if (aGameVars[j].flags & GAMEVAR_PERPLAYER)
{
// if (!MapInfo[i].savedstate->vars[j])
aMapInfo[i].savedstate->vars[j] = (intptr_t *)Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t));
if (kdfread(&aMapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, kFile) != 1) goto corrupt;
g_mapInfo[i].savedstate->vars[j] = (intptr_t *)Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t));
if (kdfread(&g_mapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, kFile) != 1) goto corrupt;
}
else if (aGameVars[j].flags & GAMEVAR_PERACTOR)
{
// if (!MapInfo[i].savedstate->vars[j])
aMapInfo[i].savedstate->vars[j] = (intptr_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t));
if (kdfread(&aMapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, kFile) != MAXSPRITES) goto corrupt;
g_mapInfo[i].savedstate->vars[j] = (intptr_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t));
if (kdfread(&g_mapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, kFile) != MAXSPRITES) goto corrupt;
}
}
}
@ -299,25 +299,25 @@ void Gv_WriteSave(FILE *fil)
dfwrite(apScriptEvents,sizeof(apScriptEvents),1,fil);
for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (aMapInfo[i].savedstate != NULL)
if (g_mapInfo[i].savedstate != NULL)
savedstate[i] = 1;
dfwrite(&savedstate[0],sizeof(savedstate),1,fil);
for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (aMapInfo[i].savedstate)
if (g_mapInfo[i].savedstate)
{
dfwrite(aMapInfo[i].savedstate,sizeof(mapstate_t),1,fil);
dfwrite(g_mapInfo[i].savedstate,sizeof(mapstate_t),1,fil);
for (bssize_t j=0; j<g_gameVarCount; j++)
{
if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
if (aGameVars[j].flags & GAMEVAR_PERPLAYER)
{
dfwrite(&aMapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil);
dfwrite(&g_mapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil);
}
else if (aGameVars[j].flags & GAMEVAR_PERACTOR)
{
dfwrite(&aMapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil);
dfwrite(&g_mapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil);
}
}
}
@ -391,17 +391,17 @@ int32_t Gv_NewArray(const char *pszLabel, void *pArray, intptr_t arraySize, uint
if (EDUKE32_PREDICT_FALSE(g_gameArrayCount >= MAXGAMEARRAYS))
{
g_numCompilerErrors++;
g_errorCnt++;
C_ReportError(-1);
initprintf("%s:%d: error: too many arrays!\n",g_szScriptFileName,g_lineNumber);
initprintf("%s:%d: error: too many arrays!\n",g_scriptFileName,g_lineNumber);
return 0;
}
if (EDUKE32_PREDICT_FALSE(Bstrlen(pszLabel) > (MAXARRAYLABEL-1)))
{
g_numCompilerErrors++;
g_errorCnt++;
C_ReportError(-1);
initprintf("%s:%d: error: array name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXARRAYLABEL);
initprintf("%s:%d: error: array name `%s' exceeds limit of %d characters.\n",g_scriptFileName,g_lineNumber,pszLabel, MAXARRAYLABEL);
return 0;
}
i = hash_find(&h_arrays,pszLabel);
@ -410,7 +410,7 @@ int32_t Gv_NewArray(const char *pszLabel, void *pArray, intptr_t arraySize, uint
{
// found it it's a duplicate in error
g_numCompilerWarnings++;
g_warningCnt++;
if (aGameArrays[i].flags&GAMEARRAY_TYPE_MASK)
{
@ -461,17 +461,17 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (EDUKE32_PREDICT_FALSE(g_gameVarCount >= MAXGAMEVARS))
{
g_numCompilerErrors++;
g_errorCnt++;
C_ReportError(-1);
initprintf("%s:%d: error: too many gamevars!\n",g_szScriptFileName,g_lineNumber);
initprintf("%s:%d: error: too many gamevars!\n",g_scriptFileName,g_lineNumber);
return 0;
}
if (EDUKE32_PREDICT_FALSE(Bstrlen(pszLabel) > (MAXVARLABEL-1)))
{
g_numCompilerErrors++;
g_errorCnt++;
C_ReportError(-1);
initprintf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXVARLABEL);
initprintf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_scriptFileName,g_lineNumber,pszLabel, MAXVARLABEL);
return 0;
}
@ -483,13 +483,13 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (EDUKE32_PREDICT_FALSE(aGameVars[gV].flags & (GAMEVAR_PTR_MASK)))
{
C_ReportError(-1);
initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_scriptFileName,g_lineNumber,label+(g_labelCnt<<6));
return 0;
}
else if (EDUKE32_PREDICT_FALSE(!(aGameVars[gV].flags & GAMEVAR_SYSTEM)))
{
// it's a duplicate in error
g_numCompilerWarnings++;
g_warningCnt++;
C_ReportError(WARNING_DUPLICATEDEFINITION);
return 0;
}
@ -552,20 +552,20 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
return 1;
}
static int32_t Gv_GetVarIndex(const char *szGameLabel)
static int Gv_GetVarIndex(const char *szGameLabel)
{
int32_t gV = hash_find(&h_gamevars,szGameLabel);
int gameVar = hash_find(&h_gamevars,szGameLabel);
if (EDUKE32_PREDICT_FALSE(gV == -1))
if (EDUKE32_PREDICT_FALSE(gameVar == -1))
{
OSD_Printf(OSD_ERROR "Gv_GetVarIndex(): INTERNAL ERROR: couldn't find gamevar %s!\n",szGameLabel);
return 0;
}
return gV;
return gameVar;
}
int32_t __fastcall Gv_GetGameArrayValue(int const id, int index)
int __fastcall Gv_GetGameArrayValue(int const id, int index)
{
if (aGameArrays[id].flags & GAMEARRAY_STRIDE2)
index <<= 1;
@ -583,7 +583,7 @@ int32_t __fastcall Gv_GetGameArrayValue(int const id, int index)
return returnValue;
}
int32_t __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
int __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
{
if (gameVar == g_thisActorVarID)
return spriteNum;
@ -591,55 +591,55 @@ int32_t __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
if (gameVar == MAXGAMEVARS)
return *insptr++;
int nNegative = !!(gameVar & (MAXGAMEVARS << 1));
int invertResult = !!(gameVar & (MAXGAMEVARS << 1));
if (EDUKE32_PREDICT_FALSE((gameVar & ~(MAXGAMEVARS << 1)) >= g_gameVarCount))
goto nastyhacks;
gameVar &= (MAXGAMEVARS - 1);
int nReturn, nFlags;
nFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK);
int returnValue, varFlags;
varFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK);
if (nFlags == GAMEVAR_PERACTOR)
if (varFlags == GAMEVAR_PERACTOR)
{
if (EDUKE32_PREDICT_FALSE((unsigned) spriteNum >= MAXSPRITES)) goto badindex;
nReturn = aGameVars[gameVar].pValues[spriteNum];
returnValue = aGameVars[gameVar].pValues[spriteNum];
}
else if (!nFlags) nReturn = aGameVars[gameVar].global;
else if (nFlags == GAMEVAR_PERPLAYER)
else if (!varFlags) returnValue = aGameVars[gameVar].global;
else if (varFlags == GAMEVAR_PERPLAYER)
{
if (EDUKE32_PREDICT_FALSE((unsigned) playerNum >= MAXPLAYERS))
{
spriteNum = playerNum;
goto badindex;
}
nReturn = aGameVars[gameVar].pValues[playerNum];
returnValue = aGameVars[gameVar].pValues[playerNum];
}
else switch (nFlags)
else switch (varFlags)
{
case GAMEVAR_INTPTR: nReturn = *(int32_t *)aGameVars[gameVar].global; break;
case GAMEVAR_SHORTPTR: nReturn = *(int16_t *)aGameVars[gameVar].global; break;
case GAMEVAR_CHARPTR: nReturn = *(char *)aGameVars[gameVar].global; break;
default: EDUKE32_UNREACHABLE_SECTION(nReturn = 0; break);
case GAMEVAR_INTPTR: returnValue = *(int32_t *)aGameVars[gameVar].global; break;
case GAMEVAR_SHORTPTR: returnValue = *(int16_t *)aGameVars[gameVar].global; break;
case GAMEVAR_CHARPTR: returnValue = *(char *)aGameVars[gameVar].global; break;
default: EDUKE32_UNREACHABLE_SECTION(returnValue = 0; break);
}
return (nReturn ^ -nNegative) + nNegative;
return (returnValue ^ -invertResult) + invertResult;
nastyhacks:
if (gameVar & (MAXGAMEVARS << 2)) // array
{
gameVar &= (MAXGAMEVARS - 1); // ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
int nArrayIndex = Gv_GetVar(*insptr++, spriteNum, playerNum);
int const arrayIndex = Gv_GetVar(*insptr++, spriteNum, playerNum);
if (EDUKE32_PREDICT_FALSE((unsigned)nArrayIndex >= (unsigned)aGameArrays[gameVar].size))
if (EDUKE32_PREDICT_FALSE((unsigned)arrayIndex >= (unsigned)aGameArrays[gameVar].size))
{
spriteNum = nArrayIndex;
spriteNum = arrayIndex;
goto badarrayindex;
}
nReturn = Gv_GetGameArrayValue(gameVar, nArrayIndex);
returnValue = Gv_GetGameArrayValue(gameVar, arrayIndex);
}
else if (gameVar&(MAXGAMEVARS<<3)) // struct shortcut vars
{
@ -663,7 +663,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetSprite(arrayIndex, label, arrayIndexVar);
returnValue = VM_GetSprite(arrayIndex, label, arrayIndexVar);
break;
}
case STRUCT_TSPR:
@ -676,7 +676,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetTsprite(arrayIndex, label);
returnValue = VM_GetTsprite(arrayIndex, label);
break;
}
case STRUCT_THISPROJECTILE:
@ -689,7 +689,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetActiveProjectile(arrayIndex, label);
returnValue = VM_GetActiveProjectile(arrayIndex, label);
break;
}
@ -703,7 +703,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetProjectile(arrayIndex, label);
returnValue = VM_GetProjectile(arrayIndex, label);
break;
}
case STRUCT_TILEDATA:
@ -716,7 +716,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetTileData(arrayIndex, label);
returnValue = VM_GetTileData(arrayIndex, label);
break;
}
@ -730,7 +730,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetPalData(arrayIndex, label);
returnValue = VM_GetPalData(arrayIndex, label);
break;
}
@ -749,7 +749,7 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetPlayer(arrayIndex, label, arrayIndexVar);
returnValue = VM_GetPlayer(arrayIndex, label, arrayIndexVar);
break;
}
case STRUCT_INPUT:
@ -764,13 +764,13 @@ nastyhacks:
goto badindex;
}
nReturn = VM_GetPlayerInput(arrayIndex, label);
returnValue = VM_GetPlayerInput(arrayIndex, label);
break;
}
case STRUCT_ACTORVAR:
case STRUCT_PLAYERVAR:
nReturn = Gv_GetVar(*insptr++, arrayIndex, playerNum);
returnValue = Gv_GetVar(*insptr++, arrayIndex, playerNum);
break;
case STRUCT_SECTOR:
@ -781,7 +781,7 @@ nastyhacks:
insptr++;
goto badindex;
}
nReturn = VM_GetSector(arrayIndex, *insptr++);
returnValue = VM_GetSector(arrayIndex, *insptr++);
break;
case STRUCT_WALL:
@ -791,11 +791,11 @@ nastyhacks:
insptr++;
goto badindex;
}
nReturn = VM_GetWall(arrayIndex, *insptr++);
returnValue = VM_GetWall(arrayIndex, *insptr++);
break;
case STRUCT_USERDEF:
nReturn = VM_GetUserdef(*insptr++);
returnValue = VM_GetUserdef(*insptr++);
break;
default:
@ -808,7 +808,7 @@ nastyhacks:
return -1;
}
return (nReturn ^ -nNegative) + nNegative;
return (returnValue ^ -invertResult) + invertResult;
badarrayindex:
CON_ERRPRINTF("Gv_GetVar(): invalid array index (%s[%d])\n", aGameArrays[gameVar].szLabel,spriteNum);
@ -819,31 +819,31 @@ badindex:
return -1;
}
void __fastcall Gv_SetVar(int const gameVar, int32_t const nValue, int const spriteNum, int const playerNum)
void __fastcall Gv_SetVar(int const gameVar, int const newValue, int const spriteNum, int const playerNum)
{
int const nFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
int const varFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
if (EDUKE32_PREDICT_FALSE((unsigned)gameVar >= (unsigned)g_gameVarCount)) goto badvarid;
if (!nFlags) aGameVars[gameVar].global=nValue;
else if (nFlags == GAMEVAR_PERPLAYER)
if (!varFlags) aGameVars[gameVar].global=newValue;
else if (varFlags == GAMEVAR_PERPLAYER)
{
if (EDUKE32_PREDICT_FALSE((unsigned) playerNum > MAXPLAYERS-1)) goto badindex;
// for the current player
aGameVars[gameVar].pValues[playerNum]=nValue;
aGameVars[gameVar].pValues[playerNum]=newValue;
}
else if (nFlags == GAMEVAR_PERACTOR)
else if (varFlags == GAMEVAR_PERACTOR)
{
if (EDUKE32_PREDICT_FALSE((unsigned) spriteNum > MAXSPRITES-1)) goto badindex;
aGameVars[gameVar].pValues[spriteNum]=nValue;
aGameVars[gameVar].pValues[spriteNum]=newValue;
}
else
{
switch (nFlags)
switch (varFlags)
{
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)nValue; break;
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)nValue; break;
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)nValue; break;
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
}
}
return;
@ -882,31 +882,31 @@ static const char *gvxerrs[] = {
"Gv_GetVarX(): invalid pal ID",
};
int32_t __fastcall Gv_GetSpecialVarX(int gameVar)
int __fastcall Gv_GetSpecialVarX(int gameVar)
{
int nReturn = -1;
int returnValue = -1;
if (gameVar & (MAXGAMEVARS << 2)) // array
{
int const nArrayIndex = Gv_GetVarX(*insptr++);
int const arrayIndex = Gv_GetVarX(*insptr++);
gameVar &= (MAXGAMEVARS - 1); // ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
int const nArraySize =
(aGameArrays[gameVar].flags & GAMEARRAY_VARSIZE) ? Gv_GetVarX(aGameArrays[gameVar].size) : aGameArrays[gameVar].size;
int const arraySiz
= (aGameArrays[gameVar].flags & GAMEARRAY_VARSIZE) ? Gv_GetVarX(aGameArrays[gameVar].size) : aGameArrays[gameVar].size;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= (unsigned) nArraySize))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= (unsigned) arraySiz))
{
CON_ERRPRINTF("%s %s[%d]\n", gvxerrs[GVX_BADINDEX], aGameArrays[gameVar].szLabel, nArrayIndex);
CON_ERRPRINTF("%s %s[%d]\n", gvxerrs[GVX_BADINDEX], aGameArrays[gameVar].szLabel, arrayIndex);
return -1;
}
nReturn = Gv_GetGameArrayValue(gameVar, nArrayIndex);
returnValue = Gv_GetGameArrayValue(gameVar, arrayIndex);
}
else if (gameVar & (MAXGAMEVARS << 3)) // struct shortcut vars
{
int nArrayIndexVar = *insptr++;
int nArrayIndex = Gv_GetVarX(nArrayIndexVar);
int arrayIndexVar = *insptr++;
int arrayIndex = Gv_GetVarX(arrayIndexVar);
switch ((gameVar & (MAXGAMEVARS - 1)) - g_structVarIDs)
{
@ -914,45 +914,44 @@ int32_t __fastcall Gv_GetSpecialVarX(int gameVar)
{
int const labelNum = *insptr++;
nArrayIndexVar = (EDUKE32_PREDICT_FALSE(ActorLabels[labelNum].flags & LABEL_HASPARM2)) ?
Gv_GetVarX(*insptr++) : 0;
arrayIndexVar = (EDUKE32_PREDICT_FALSE(ActorLabels[labelNum].flags & LABEL_HASPARM2)) ? Gv_GetVarX(*insptr++) : 0;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXSPRITES))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSPRITE], gameVar);
return -1;
}
nReturn = VM_GetSprite(nArrayIndex, labelNum, nArrayIndexVar);
returnValue = VM_GetSprite(arrayIndex, labelNum, arrayIndexVar);
break;
}
case STRUCT_TSPR:
{
int const labelNum = *insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXSPRITES))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSPRITE], gameVar);
return -1;
}
nReturn = VM_GetTsprite(nArrayIndex, labelNum);
returnValue = VM_GetTsprite(arrayIndex, labelNum);
break;
}
case STRUCT_THISPROJECTILE:
{
int const labelNum = *insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXSPRITES))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSPRITE], gameVar);
return -1;
}
nReturn = VM_GetActiveProjectile(nArrayIndex, labelNum);
returnValue = VM_GetActiveProjectile(arrayIndex, labelNum);
break;
}
@ -960,28 +959,28 @@ int32_t __fastcall Gv_GetSpecialVarX(int gameVar)
{
int const labelNum = *insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXTILES))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXTILES))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADTILE], gameVar);
return -1;
}
nReturn = VM_GetProjectile(nArrayIndex, labelNum);
returnValue = VM_GetProjectile(arrayIndex, labelNum);
break;
}
case STRUCT_TILEDATA:
{
int const labelNum = *insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXTILES))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXTILES))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADTILE], gameVar);
return -1;
}
nReturn = VM_GetTileData(nArrayIndex, labelNum);
returnValue = VM_GetTileData(arrayIndex, labelNum);
break;
}
@ -989,14 +988,14 @@ int32_t __fastcall Gv_GetSpecialVarX(int gameVar)
{
int const labelNum = *insptr++;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXPALOOKUPS))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPALOOKUPS))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPAL], gameVar);
return -1;
}
nReturn = VM_GetPalData(nArrayIndex, labelNum);
returnValue = VM_GetPalData(arrayIndex, labelNum);
break;
}
@ -1004,82 +1003,82 @@ int32_t __fastcall Gv_GetSpecialVarX(int gameVar)
{
int const labelNum = *insptr++;
if (nArrayIndexVar == g_thisActorVarID)
nArrayIndex = vm.playerNum;
if (arrayIndexVar == g_thisActorVarID)
arrayIndex = vm.playerNum;
nArrayIndexVar = (EDUKE32_PREDICT_FALSE(PlayerLabels[labelNum].flags & LABEL_HASPARM2)) ?
arrayIndexVar = (EDUKE32_PREDICT_FALSE(PlayerLabels[labelNum].flags & LABEL_HASPARM2)) ?
Gv_GetVarX(*insptr++) : 0;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXPLAYERS))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPLAYERS))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPLAYER], gameVar);
return -1;
}
nReturn = VM_GetPlayer(nArrayIndex, labelNum, nArrayIndexVar);
returnValue = VM_GetPlayer(arrayIndex, labelNum, arrayIndexVar);
break;
}
case STRUCT_INPUT:
{
int const labelNum = *insptr++;
if (nArrayIndexVar == g_thisActorVarID)
nArrayIndex = vm.playerNum;
if (arrayIndexVar == g_thisActorVarID)
arrayIndex = vm.playerNum;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXPLAYERS))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPLAYERS))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPLAYER], gameVar);
return -1;
}
nReturn = VM_GetPlayerInput(nArrayIndex, labelNum);
returnValue = VM_GetPlayerInput(arrayIndex, labelNum);
break;
}
case STRUCT_ACTORVAR:
case STRUCT_PLAYERVAR:
nReturn = Gv_GetVar(*insptr++, nArrayIndex, vm.playerNum);
returnValue = Gv_GetVar(*insptr++, arrayIndex, vm.playerNum);
break;
case STRUCT_SECTOR:
if (nArrayIndexVar == g_thisActorVarID)
nArrayIndex = sprite[vm.spriteNum].sectnum;
if (arrayIndexVar == g_thisActorVarID)
arrayIndex = sprite[vm.spriteNum].sectnum;
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXSECTORS))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSECTORS))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
insptr++;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSECTOR], gameVar);
return -1;
}
nReturn = VM_GetSector(nArrayIndex, *insptr++);
returnValue = VM_GetSector(arrayIndex, *insptr++);
break;
case STRUCT_WALL:
if (EDUKE32_PREDICT_FALSE((unsigned) nArrayIndex >= MAXWALLS))
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXWALLS))
{
gameVar = nArrayIndex;
gameVar = arrayIndex;
insptr++;
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADWALL], gameVar);
return -1;
}
nReturn = VM_GetWall(nArrayIndex, *insptr++);
returnValue = VM_GetWall(arrayIndex, *insptr++);
break;
case STRUCT_USERDEF:
nReturn = VM_GetUserdef(*insptr++);
returnValue = VM_GetUserdef(*insptr++);
break;
default: EDUKE32_UNREACHABLE_SECTION(return -1);
}
}
return nReturn;
return returnValue;
}
int32_t __fastcall Gv_GetVarX(int gameVar)
int __fastcall Gv_GetVarX(int gameVar)
{
if (gameVar == g_thisActorVarID)
return vm.spriteNum;
@ -1087,35 +1086,35 @@ int32_t __fastcall Gv_GetVarX(int gameVar)
if (gameVar == MAXGAMEVARS)
return *insptr++;
int const nNegative = !!(gameVar & (MAXGAMEVARS << 1));
int nReturn = -1;
int const invertResult = !!(gameVar & (MAXGAMEVARS << 1));
int returnValue = -1;
if (EDUKE32_PREDICT_FALSE(gameVar >= g_gameVarCount && nNegative == 0))
nReturn = Gv_GetSpecialVarX(gameVar);
if (EDUKE32_PREDICT_FALSE(gameVar >= g_gameVarCount && invertResult == 0))
returnValue = Gv_GetSpecialVarX(gameVar);
else
{
gameVar &= MAXGAMEVARS-1;
int const nFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
int const varFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
if (!nFlags) nReturn = aGameVars[gameVar].global;
else if (nFlags == GAMEVAR_PERPLAYER)
if (!varFlags) returnValue = aGameVars[gameVar].global;
else if (varFlags == GAMEVAR_PERPLAYER)
{
if (EDUKE32_PREDICT_FALSE((unsigned) vm.playerNum >= MAXPLAYERS))
goto perr;
nReturn = aGameVars[gameVar].pValues[vm.playerNum];
returnValue = aGameVars[gameVar].pValues[vm.playerNum];
}
else if (nFlags == GAMEVAR_PERACTOR)
nReturn = aGameVars[gameVar].pValues[vm.spriteNum];
else switch (nFlags)
else if (varFlags == GAMEVAR_PERACTOR)
returnValue = aGameVars[gameVar].pValues[vm.spriteNum];
else switch (varFlags)
{
case GAMEVAR_INTPTR: nReturn = (*((int32_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_SHORTPTR: nReturn = (*((int16_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_CHARPTR: nReturn = (*((uint8_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_INTPTR: returnValue = (*((int32_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_SHORTPTR: returnValue = (*((int16_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_CHARPTR: returnValue = (*((uint8_t *)aGameVars[gameVar].global)); break;
}
}
return (nReturn ^ -nNegative) + nNegative;
return (returnValue ^ -invertResult) + invertResult;
perr:
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPLAYER], vm.playerNum);
@ -1140,9 +1139,9 @@ void __fastcall Gv_GetManyVars(int const count, int32_t * const rv)
continue;
}
int const nNegative = !!(gameVar & (MAXGAMEVARS << 1));
int const invertResult = !!(gameVar & (MAXGAMEVARS << 1));
if (EDUKE32_PREDICT_FALSE(gameVar >= g_gameVarCount && nNegative == 0))
if (EDUKE32_PREDICT_FALSE(gameVar >= g_gameVarCount && invertResult == 0))
{
rv[j] = Gv_GetSpecialVarX(gameVar);
continue;
@ -1150,28 +1149,28 @@ void __fastcall Gv_GetManyVars(int const count, int32_t * const rv)
gameVar &= MAXGAMEVARS - 1;
int const nFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK);
int nValue = aGameVars[gameVar].global;
int const varFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK);
int value = aGameVars[gameVar].global;
if (nFlags == GAMEVAR_PERPLAYER)
if (varFlags == GAMEVAR_PERPLAYER)
{
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum >= MAXPLAYERS))
goto perr;
nValue = aGameVars[gameVar].pValues[vm.playerNum];
value = aGameVars[gameVar].pValues[vm.playerNum];
}
else if (nFlags == GAMEVAR_PERACTOR)
nValue = aGameVars[gameVar].pValues[vm.spriteNum];
else if (varFlags == GAMEVAR_PERACTOR)
value = aGameVars[gameVar].pValues[vm.spriteNum];
else
{
switch (nFlags)
switch (varFlags)
{
case GAMEVAR_INTPTR: nValue = (*((int32_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_SHORTPTR: nValue = (*((int16_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_CHARPTR: nValue = (*((uint8_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_INTPTR: value = (*((int32_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_SHORTPTR: value = (*((int16_t *)aGameVars[gameVar].global)); break;
case GAMEVAR_CHARPTR: value = (*((uint8_t *)aGameVars[gameVar].global)); break;
}
}
rv[j] = (nValue ^ -nNegative) + nNegative;
rv[j] = (value ^ -invertResult) + invertResult;
continue;
perr:
@ -1179,26 +1178,26 @@ void __fastcall Gv_GetManyVars(int const count, int32_t * const rv)
}
}
void __fastcall Gv_SetVarX(int const gameVar, int32_t const nValue)
void __fastcall Gv_SetVarX(int const gameVar, int const newValue)
{
int const nFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
int const varFlags = aGameVars[gameVar].flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
if (!nFlags) aGameVars[gameVar].global = nValue;
else if (nFlags == GAMEVAR_PERPLAYER)
if (!varFlags) aGameVars[gameVar].global = newValue;
else if (varFlags == GAMEVAR_PERPLAYER)
{
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum >= MAXPLAYERS)) goto badindex;
aGameVars[gameVar].pValues[vm.playerNum] = nValue;
aGameVars[gameVar].pValues[vm.playerNum] = newValue;
}
else if (nFlags == GAMEVAR_PERACTOR)
else if (varFlags == GAMEVAR_PERACTOR)
{
if (EDUKE32_PREDICT_FALSE((unsigned)vm.spriteNum >= MAXSPRITES)) goto badindex;
aGameVars[gameVar].pValues[vm.spriteNum] = nValue;
aGameVars[gameVar].pValues[vm.spriteNum] = newValue;
}
else switch (nFlags)
else switch (varFlags)
{
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)nValue; break;
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)nValue; break;
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)nValue; break;
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
}
return;
@ -1209,10 +1208,10 @@ badindex:
aGameVars[gameVar].szLabel);
}
int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t const nDefault, int const spriteNum, int const playerNum)
int Gv_GetVarByLabel(const char *szGameLabel, int const defaultValue, int const spriteNum, int const playerNum)
{
int const gameVar = hash_find(&h_gamevars, szGameLabel);
return EDUKE32_PREDICT_FALSE(gameVar < 0) ? nDefault : Gv_GetVar(gameVar, spriteNum, playerNum);
return EDUKE32_PREDICT_FALSE(gameVar < 0) ? defaultValue : Gv_GetVar(gameVar, spriteNum, playerNum);
}
static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
@ -1643,8 +1642,8 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("gametype_flags",(intptr_t)&GametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("gametype_flags",(intptr_t)&g_gametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
Gv_NewVar("framerate",(intptr_t)&g_frameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
@ -1797,8 +1796,8 @@ void Gv_RefreshPointers(void)
aGameVars[Gv_GetVarIndex("current_menu")].global = (intptr_t)&g_currentMenu;
aGameVars[Gv_GetVarIndex("viewingrange")].global = (intptr_t)&viewingrange;
aGameVars[Gv_GetVarIndex("yxaspect")].global = (intptr_t)&yxaspect;
aGameVars[Gv_GetVarIndex("gametype_flags")].global = (intptr_t)&GametypeFlags[ud.coop];
aGameVars[Gv_GetVarIndex("framerate")].global = (intptr_t)&g_currentFrameRate;
aGameVars[Gv_GetVarIndex("gametype_flags")].global = (intptr_t)&g_gametypeFlags[ud.coop];
aGameVars[Gv_GetVarIndex("framerate")].global = (intptr_t)&g_frameRate;
aGameVars[Gv_GetVarIndex("gravitationalconstant")].global = (intptr_t)&g_spriteGravity;

View file

@ -32,19 +32,13 @@ const char *s_buildDate = "20120522";
extern "C" {
#endif
// JBF: g_spriteGravity modified to default to Atomic ed. default when using 1.3d CONs
int32_t g_spriteGravity=176;
char g_volumeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" };
int32_t g_volumeFlags[MAXVOLUMES]; // all initialize to zero
char g_skillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" };
char g_gametypeNames[MAXGAMETYPES][33]
= { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
int16_t g_deleteQueueSize = 64;
char EpisodeNames[MAXVOLUMES][33] = { "L.A. Meltdown", "Lunar Apocalypse", "Shrapnel City" };
int32_t EpisodeFlags[MAXVOLUMES]; // all initialize to zero
char SkillNames[MAXSKILLS][33] = { "Piece Of Cake", "Let's Rock", "Come Get Some", "Damn I'm Good" };
char GametypeNames[MAXGAMETYPES][33] = { "DukeMatch (Spawn)", "Cooperative Play", "DukeMatch (No Spawn)", "Team DM (Spawn)", "Team DM (No Spawn)" };
int32_t GametypeFlags[MAXGAMETYPES] =
int32_t g_gametypeFlags[MAXGAMETYPES] =
{
/*4+*/8+16+1024+2048+16384,
1+2+32+64+128+256+512+4096+8192+32768,
@ -52,25 +46,27 @@ int32_t GametypeFlags[MAXGAMETYPES] =
/*4+*/8+16+1024+2048+16384+65536+131072,
2+/*4+*/8+16+16384+65536+131072
};
char g_numGametypes = 5;
char g_numVolumes = 3;
int g_actorRespawnTime = 768;
int g_bouncemineRadius = 2500;
int g_deleteQueueSize = 64;
int g_itemRespawnTime = 768;
int g_lastSaveSlot = -1;
int g_morterRadius = 2500;
int g_numFreezeBounces = 3;
int g_gametypeCnt = 5;
int g_volumeCnt = 3;
int g_pipebombRadius = 2500;
int g_playerFriction = 0xCFD0;
int g_rpgRadius = 1780;
int g_scriptSize = 1048576;
int g_seenineRadius = 2048;
int g_shrinkerRadius = 650;
int g_spriteGravity = 176;
int g_timerTicsPerSecond = TICRATE;
int g_tripbombRadius = 3880;
int32_t g_timerTicsPerSecond = TICRATE;
int32_t g_actorRespawnTime = 768;
int32_t g_itemRespawnTime = 768;
int32_t g_rpgBlastRadius = 1780;
int32_t g_pipebombBlastRadius = 2500;
int32_t g_shrinkerBlastRadius = 650;
int32_t g_tripbombBlastRadius = 3880;
int32_t g_morterBlastRadius = 2500;
int32_t g_bouncemineBlastRadius = 2500;
int32_t g_seenineBlastRadius = 2048;
int32_t g_scriptSize = 1048576;
int16_t BlimpSpawnSprites[15] =
int16_t g_blimpSpawnItems[15] =
{
RPGSPRITE__STATIC,
CHAINGUNSPRITE__STATIC,
@ -89,15 +85,9 @@ int16_t BlimpSpawnSprites[15] =
FREEZEAMMO__STATIC
};
int32_t g_playerFriction = 0xCFD0;
char CheatKeys[2] = { sc_D, sc_N };
int32_t g_numFreezeBounces = 3;
int32_t g_lastSaveSlot = -1;
char CheatKeys[2] = { sc_D, sc_N };
char setupfilename[BMAX_PATH] = SETUPFILENAME;
char g_setupFileName[BMAX_PATH] = SETUPFILENAME;
#ifdef __cplusplus
}

View file

@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "build.h"
G_EXTERN int32_t g_numInterpolations;
G_EXTERN int32_t g_interpolationCnt;
G_EXTERN int32_t g_interpolationLock;
G_EXTERN int32_t oldipos[MAXINTERPOLATIONS];
G_EXTERN int32_t *curipos[MAXINTERPOLATIONS];
@ -73,7 +73,7 @@ G_EXTERN char *apStrings[MAXQUOTES],*apXStrings[MAXQUOTES];
G_EXTERN char *label;
G_EXTERN int32_t g_musicIndex;
G_EXTERN char g_loadFromGroupOnly;
G_EXTERN char g_numSkills;
G_EXTERN char g_skillCnt;
G_EXTERN char pus,pub;
G_EXTERN char ready2send;
#define MAXPLAYERNAME 32
@ -83,41 +83,61 @@ G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],menutextbuf[128],buf[
#define TYPEBUFSIZE 141
G_EXTERN char typebuf[TYPEBUFSIZE];
G_EXTERN input_t avg;
G_EXTERN input_t localInput;
G_EXTERN input_t recsync[RECSYNCBUFSIZ];
G_EXTERN int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
G_EXTERN int16_t animatesect[MAXANIMATES];
G_EXTERN int16_t g_curViewscreen;
G_EXTERN int16_t cyclers[MAXCYCLERS][6],g_numCyclers;
G_EXTERN int16_t g_globalRandom;
G_EXTERN int16_t g_mirrorWall[64],g_mirrorSector[64],g_mirrorCount;
G_EXTERN int16_t g_numAnimWalls;
G_EXTERN int16_t g_numClouds,clouds[256],cloudx,cloudy;
G_EXTERN int32_t *animateptr[MAXANIMATES];
G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount;
G_EXTERN int32_t cloudtotalclock;
G_EXTERN int32_t g_currentFrameRate;
G_EXTERN int32_t g_damageCameras,g_freezerSelfDamage;
G_EXTERN int32_t g_doQuickSave;
G_EXTERN uint16_t g_earthquakeTime;
G_EXTERN int32_t g_gameQuit;
G_EXTERN int32_t g_impactDamage,g_maxPlayerHealth;
G_EXTERN int32_t g_musicSize;
G_EXTERN int32_t g_numLabels,g_numDefaultLabels;
G_EXTERN int32_t g_scriptDebug;
G_EXTERN int32_t g_showShareware;
G_EXTERN int8_t g_numPlayerSprites;
G_EXTERN int32_t g_tripbombLaserMode;
G_EXTERN vec2_t g_origins[MAXANIMPOINTS];
G_EXTERN int32_t neartaghitdist,lockclock,g_startArmorAmount;
G_EXTERN int32_t playerswhenstarted;
G_EXTERN int32_t screenpeek;
G_EXTERN int g_animWallCnt;
G_EXTERN int g_animateCnt;
G_EXTERN int g_cloudCnt;
G_EXTERN int g_curViewscreen;
G_EXTERN int g_frameRate;
G_EXTERN int g_cyclerCnt;
G_EXTERN int g_damageCameras;
G_EXTERN int g_defaultLabelCnt;
G_EXTERN int g_doQuickSave;
G_EXTERN int g_earthquakeTime;
G_EXTERN int g_freezerSelfDamage;
G_EXTERN int g_gameQuit;
G_EXTERN int g_globalRandom;
G_EXTERN int g_impactDamage;
G_EXTERN int g_labelCnt;
G_EXTERN int g_maxPlayerHealth;
G_EXTERN int g_mirrorCount;
G_EXTERN int g_mostConcurrentPlayers;
G_EXTERN int g_musicSize;
G_EXTERN int g_playerSpawnCnt;
G_EXTERN int g_scriptDebug;
G_EXTERN int g_showShareware;
G_EXTERN int g_spriteDeleteQueuePos;
G_EXTERN int g_startArmorAmount;
G_EXTERN int g_tripbombLaserMode;
G_EXTERN int screenpeek;
G_EXTERN int16_t g_animateSect[MAXANIMATES];
G_EXTERN int32_t *g_animatePtr[MAXANIMATES];
G_EXTERN int32_t g_animateGoal[MAXANIMATES];
G_EXTERN int32_t g_animateVel[MAXANIMATES];
G_EXTERN int16_t g_cloudSect[256];
G_EXTERN int16_t g_cloudX;
G_EXTERN int16_t g_cloudY;
G_EXTERN int32_t g_cloudClock;
G_EXTERN int16_t SpriteDeletionQueue[1024];
G_EXTERN int16_t g_cyclers[MAXCYCLERS][6];
G_EXTERN int16_t g_mirrorSector[64];
G_EXTERN int16_t g_mirrorWall[64];
G_EXTERN int32_t *labelcode;
G_EXTERN int32_t *labeltype;
G_EXTERN int32_t lockclock;
G_EXTERN int32_t ototalclock;
G_EXTERN intptr_t *g_scriptPtr;
G_EXTERN int32_t *labelcode,*labeltype;
G_EXTERN intptr_t *apScript;
G_EXTERN map_t aMapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music
G_EXTERN intptr_t *g_scriptPtr;
G_EXTERN map_t g_mapInfo[(MAXVOLUMES + 1) * MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music
G_EXTERN vec2_t g_origins[MAXANIMPOINTS];
// XXX: I think this pragma pack is meaningless here.
// MSDN (https://msdn.microsoft.com/en-us/library/2e70t5y1%28VS.80%29.aspx) says:
@ -134,43 +154,46 @@ G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
#pragma pack(pop)
G_EXTERN char g_soundlocks[MAXSOUNDS];
G_EXTERN int g_noEnemies;
G_EXTERN int g_restorePalette;
G_EXTERN int g_screenCapture;
G_EXTERN projectile_t SpriteProjectile[MAXSPRITES];
G_EXTERN sound_t g_sounds[MAXSOUNDS];
G_EXTERN uint32_t everyothertime;
G_EXTERN uint32_t g_moveThingsCount;
G_EXTERN char g_soundlocks[MAXSOUNDS];
G_EXTERN int32_t g_restorePalette;
G_EXTERN int32_t g_screenCapture;
G_EXTERN int32_t g_noEnemies;
#ifndef global_c_
extern char CheatKeys[2];
extern char g_gametypeNames[MAXGAMETYPES][33];
extern char g_setupFileName[BMAX_PATH];
extern char g_skillNames[MAXSKILLS][33];
extern char g_volumeNames[MAXVOLUMES][33];
extern int g_actorRespawnTime;
extern int g_bouncemineRadius;
extern int g_deleteQueueSize;
extern int g_gametypeCnt;
extern int g_itemRespawnTime;
extern int g_lastSaveSlot;
extern int g_morterRadius;
extern int g_numFreezeBounces;
extern int g_pipebombRadius;
extern int g_playerFriction;
extern int g_rpgRadius;
extern int g_scriptSize;
extern int g_seenineRadius;
extern int g_shrinkerRadius;
extern int g_spriteGravity;
extern int g_timerTicsPerSecond;
extern int g_tripbombRadius;
extern int g_volumeCnt;
extern int16_t g_blimpSpawnItems[15];
extern int32_t g_gametypeFlags[MAXGAMETYPES];
extern int32_t g_volumeFlags[MAXVOLUMES];
extern const char *s_buildDate;
extern int32_t g_spriteGravity;
extern int16_t g_deleteQueueSize;
extern char EpisodeNames[MAXVOLUMES][33];
extern int32_t EpisodeFlags[MAXVOLUMES];
extern char SkillNames[MAXSKILLS][33];
extern char GametypeNames[MAXGAMETYPES][33];
extern int32_t GametypeFlags[MAXGAMETYPES];
extern char g_numGametypes;
extern char g_numVolumes;
extern int32_t g_timerTicsPerSecond;
extern int32_t g_actorRespawnTime;
extern int32_t g_itemRespawnTime;
extern int32_t g_scriptSize;
extern int16_t BlimpSpawnSprites[15];
extern int32_t g_playerFriction;
extern int32_t g_numFreezeBounces;
extern int32_t g_lastSaveSlot;
extern int32_t g_rpgBlastRadius;
extern int32_t g_pipebombBlastRadius;
extern int32_t g_tripbombBlastRadius;
extern int32_t g_shrinkerBlastRadius;
extern int32_t g_morterBlastRadius;
extern int32_t g_bouncemineBlastRadius;
extern int32_t g_seenineBlastRadius;
extern char CheatKeys[2];
extern char setupfilename[BMAX_PATH];
#endif
enum
@ -190,12 +213,12 @@ EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
{
for (bssize_t i=g_numInterpolations-1; i>=0; i--) oldipos[i] = *curipos[i];
for (bssize_t i=g_interpolationCnt-1; i>=0; i--) oldipos[i] = *curipos[i];
}
EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen
{
int32_t i=g_numInterpolations-1;
int32_t i=g_interpolationCnt-1;
if (--g_interpolationLock)
return;

View file

@ -22,7 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#pragma once
enum dukeinv_t {
enum dukeinv_t
{
GET_STEROIDS, // 0
GET_SHIELD,
GET_SCUBA,
@ -38,7 +39,8 @@ enum dukeinv_t {
};
// these are not in the same order as the above, and it can't be changed for compat reasons. lame!
enum dukeinvicon_t {
enum dukeinvicon_t
{
ICON_NONE, // 0
ICON_FIRSTAID,
ICON_STEROIDS,
@ -56,7 +58,8 @@ static int const icon_to_inv[ICON_MAX] = { GET_FIRSTAID, GET_FIRSTAID, GET_STERO
static int const inv_to_icon[GET_MAX] = { ICON_STEROIDS, ICON_NONE, ICON_SCUBA, ICON_HOLODUKE, ICON_JETPACK, ICON_NONE,
ICON_NONE, ICON_HEATS, ICON_NONE, ICON_FIRSTAID, ICON_BOOTS };
enum dukeweapon_t {
enum dukeweapon_t
{
KNEE_WEAPON, // 0
PISTOL_WEAPON,
SHOTGUN_WEAPON,

View file

@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define RANDOMSCRAP(s, i) A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,s->z-ZOFFSET3-(krand()&8191),\
SCRAP6+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-512-(krand()&2047),i,5)
#define GTFLAGS(x) (GametypeFlags[ud.coop] & x)
#define GTFLAGS(x) (g_gametypeFlags[ud.coop] & x)
#define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n)
#define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n)

View file

@ -1436,20 +1436,20 @@ void M_Init(void)
// prepare episodes
k = 0;
for (i = 0; i < g_numVolumes; ++i)
for (i = 0; i < g_volumeCnt; ++i)
{
if (EpisodeNames[i][0])
if (g_volumeNames[i][0])
{
if (!(EpisodeFlags[i] & EF_HIDEFROMSP))
if (!(g_volumeFlags[i] & EF_HIDEFROMSP))
{
MEL_EPISODE[i] = &ME_EPISODE[i];
ME_EPISODE[i] = ME_EPISODE_TEMPLATE;
ME_EPISODE[i].name = EpisodeNames[i];
ME_EPISODE[i].name = g_volumeNames[i];
}
// if (!(EpisodeFlags[i] & EF_HIDEFROMMP))
{
MEOSN_NetEpisodes[k] = EpisodeNames[i];
MEOSN_NetEpisodes[k] = g_volumeNames[i];
MEOSV_NetEpisodes[k] = i;
k++;
@ -1460,48 +1460,48 @@ void M_Init(void)
MEOS_NETOPTIONS_LEVEL[i] = MEOS_NETOPTIONS_LEVEL_TEMPLATE;
for (j = 0; j < MAXLEVELS; ++j)
{
MEOSN_NetLevels[i][j] = aMapInfo[MAXLEVELS*i+j].name;
if (aMapInfo[i*MAXLEVELS+j].filename != NULL)
MEOSN_NetLevels[i][j] = g_mapInfo[MAXLEVELS*i+j].name;
if (g_mapInfo[i*MAXLEVELS+j].filename != NULL)
MEOS_NETOPTIONS_LEVEL[i].numOptions = j+1;
}
MEOS_NETOPTIONS_LEVEL[i].optionNames = MEOSN_NetLevels[i];
}
M_EPISODE.numEntries = g_numVolumes+2;
MEL_EPISODE[g_numVolumes] = &ME_Space4;
MEL_EPISODE[g_numVolumes+1] = &ME_EPISODE_USERMAP;
M_EPISODE.numEntries = g_volumeCnt+2;
MEL_EPISODE[g_volumeCnt] = &ME_Space4;
MEL_EPISODE[g_volumeCnt+1] = &ME_EPISODE_USERMAP;
MEOS_NETOPTIONS_EPISODE.numOptions = k + 1;
MEOSN_NetEpisodes[k] = MenuUserMap;
MEOSV_NetEpisodes[k] = MAXVOLUMES;
NetEpisode = MEOSV_NetEpisodes[0];
MMF_Top_Episode.pos.y = (48-(g_numVolumes*2))<<16;
if (g_numSkills == 0)
MMF_Top_Episode.pos.y = (48-(g_volumeCnt*2))<<16;
if (g_skillCnt == 0)
MEO_EPISODE.linkID = MENU_NULL;
// prepare skills
k = -1;
for (i = 0; i < g_numSkills && SkillNames[i][0]; ++i)
for (i = 0; i < g_skillCnt && g_skillNames[i][0]; ++i)
{
MEL_SKILL[i] = &ME_SKILL[i];
ME_SKILL[i] = ME_SKILL_TEMPLATE;
ME_SKILL[i].name = SkillNames[i];
ME_SKILL[i].name = g_skillNames[i];
MEOSN_NetSkills[i] = SkillNames[i];
MEOSN_NetSkills[i] = g_skillNames[i];
k = i;
}
++k;
M_SKILL.numEntries = g_numSkills; // k;
MEOS_NETOPTIONS_MONSTERS.numOptions = g_numSkills + 1; // k+1;
MEOSN_NetSkills[g_numSkills] = MenuSkillNone;
MMF_Top_Skill.pos.y = (58 + (4-g_numSkills)*6)<<16;
M_SKILL.numEntries = g_skillCnt; // k;
MEOS_NETOPTIONS_MONSTERS.numOptions = g_skillCnt + 1; // k+1;
MEOSN_NetSkills[g_skillCnt] = MenuSkillNone;
MMF_Top_Skill.pos.y = (58 + (4-g_skillCnt)*6)<<16;
M_SKILL.currentEntry = 1;
// prepare multiplayer gametypes
k = -1;
for (i = 0; i < MAXGAMETYPES; ++i)
if (GametypeNames[i][0])
if (g_gametypeNames[i][0])
{
MEOSN_NetGametypes[i] = GametypeNames[i];
MEOSN_NetGametypes[i] = g_gametypeNames[i];
k = i;
}
++k;
@ -1623,7 +1623,7 @@ void M_Init(void)
if (VOLUMEONE)
{
// blue out episodes beyond the first
for (i = 1; i < g_numVolumes; ++i)
for (i = 1; i < g_volumeCnt; ++i)
{
if (MEL_EPISODE[i])
{
@ -1631,7 +1631,7 @@ void M_Init(void)
ME_EPISODE[i].entry = &MEO_EPISODE_SHAREWARE;
}
}
M_EPISODE.numEntries = g_numVolumes; // remove User Map (and spacer)
M_EPISODE.numEntries = g_volumeCnt; // remove User Map (and spacer)
MEOS_NETOPTIONS_EPISODE.numOptions = 1;
MenuEntry_DisableOnCondition(&ME_NETOPTIONS_EPISODE, 1);
}
@ -1762,8 +1762,8 @@ static void M_PreMenu(MenuID_t cm)
MEL_NETOPTIONS[2] = &ME_NETOPTIONS_LEVEL;
MEO_NETOPTIONS_LEVEL.options = &MEOS_NETOPTIONS_LEVEL[MEOSV_NetEpisodes[MEO_NETOPTIONS_EPISODE.currentOption]];
}
MEL_NETOPTIONS[4] = (GametypeFlags[ud.m_coop] & GAMETYPE_MARKEROPTION) ? &ME_NETOPTIONS_MARKERS : &ME_NETOPTIONS_MARKERS_DISABLED;
MEL_NETOPTIONS[5] = (GametypeFlags[ud.m_coop] & (GAMETYPE_PLAYERSFRIENDLY|GAMETYPE_TDM)) ? &ME_NETOPTIONS_FRFIRE : &ME_NETOPTIONS_MAPEXITS;
MEL_NETOPTIONS[4] = (g_gametypeFlags[ud.m_coop] & GAMETYPE_MARKEROPTION) ? &ME_NETOPTIONS_MARKERS : &ME_NETOPTIONS_MARKERS_DISABLED;
MEL_NETOPTIONS[5] = (g_gametypeFlags[ud.m_coop] & (GAMETYPE_PLAYERSFRIENDLY|GAMETYPE_TDM)) ? &ME_NETOPTIONS_FRFIRE : &ME_NETOPTIONS_MAPEXITS;
break;
case MENU_OPTIONS:
@ -1924,12 +1924,12 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
mminitext(origin.x + (90<<16), origin.y + ((90+8+8+8+8)<<16), "Friendly Fire", 2);
mminitext(origin.x + (90<<16), origin.y + ((90+8+8+8+8+8)<<16), "User Map", 2);
mminitext(origin.x + ((90+60)<<16), origin.y + (90<<16), GametypeNames[ud.m_coop], 0);
mminitext(origin.x + ((90+60)<<16), origin.y + (90<<16), g_gametypeNames[ud.m_coop], 0);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8)<<16), EpisodeNames[ud.m_volume_number], 0);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8)<<16), aMapInfo[MAXLEVELS*ud.m_volume_number+ud.m_level_number].name, 0);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8)<<16), g_volumeNames[ud.m_volume_number], 0);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8)<<16), g_mapInfo[MAXLEVELS*ud.m_volume_number+ud.m_level_number].name, 0);
if (ud.m_monsters_off == 0 || ud.m_player_skill > 0)
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), SkillNames[ud.m_player_skill], 0);
mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), g_skillNames[ud.m_player_skill], 0);
else mminitext(origin.x + ((90+60)<<16), origin.y + ((90+8+8+8)<<16), "None", 0);
if (ud.m_coop == 0)
{
@ -2029,8 +2029,8 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
}
{
const char *name = aMapInfo[(savehead.volnum*MAXLEVELS) + savehead.levnum].name;
Bsprintf(tempbuf, "%s / %s", name ? name : "^10unnamed^0", SkillNames[savehead.skill-1]);
const char *name = g_mapInfo[(savehead.volnum*MAXLEVELS) + savehead.levnum].name;
Bsprintf(tempbuf, "%s / %s", name ? name : "^10unnamed^0", g_skillNames[savehead.skill-1]);
}
mgametextcenter(origin.x, origin.y + (168<<16), tempbuf);
@ -2083,7 +2083,7 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
mgametextcenter(origin.x, origin.y + (156<<16), tempbuf);
}
Bsprintf(tempbuf,"%s / %s",aMapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, SkillNames[ud.player_skill-1]);
Bsprintf(tempbuf,"%s / %s",g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, g_skillNames[ud.player_skill-1]);
mgametextcenter(origin.x, origin.y + (168<<16), tempbuf);
if (ud.volume_number == 0 && ud.level_number == 7)
mgametextcenter(origin.x, origin.y + (180<<16), currentboardfilename);
@ -2104,7 +2104,7 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
if (g_oldverSavegame[M_LOAD.currentEntry])
{
mgametextcenter(origin.x, origin.y + (90<<16), "Start new game:");
Bsprintf(tempbuf,"%s / %s",aMapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, SkillNames[ud.player_skill-1]);
Bsprintf(tempbuf,"%s / %s",g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, g_skillNames[ud.player_skill-1]);
mgametextcenter(origin.x, origin.y + (99<<16), tempbuf);
}
else
@ -2566,8 +2566,8 @@ static int32_t M_Cheat_Warp(char const * const numbers)
osdcmd_cheatsinfo_stat.volume--;
osdcmd_cheatsinfo_stat.level--;
if ((VOLUMEONE && osdcmd_cheatsinfo_stat.volume > 0) || osdcmd_cheatsinfo_stat.volume > g_numVolumes-1 ||
osdcmd_cheatsinfo_stat.level >= MAXLEVELS || aMapInfo[osdcmd_cheatsinfo_stat.volume *MAXLEVELS+osdcmd_cheatsinfo_stat.level].filename == NULL)
if ((VOLUMEONE && osdcmd_cheatsinfo_stat.volume > 0) || osdcmd_cheatsinfo_stat.volume > g_volumeCnt-1 ||
osdcmd_cheatsinfo_stat.level >= MAXLEVELS || g_mapInfo[osdcmd_cheatsinfo_stat.volume *MAXLEVELS+osdcmd_cheatsinfo_stat.level].filename == NULL)
return 1;
osdcmd_cheatsinfo_stat.cheatnum = CHEAT_SCOTTY;
@ -2604,7 +2604,7 @@ static void M_MenuEntryLinkActivate(MenuEntry_t *entry)
ud.m_volume_number = M_EPISODE.currentEntry;
ud.m_level_number = 0;
if (g_numSkills == 0)
if (g_skillCnt == 0)
M_StartGameWithoutSkill();
}
break;
@ -2844,20 +2844,20 @@ static int32_t M_MenuEntryOptionModify(MenuEntry_t *entry, int32_t newOption)
CONTROL_MapAnalogAxis(M_JOYSTICKAXES.currentEntry, newOption, controldevice_joystick);
else if (entry == &ME_NETOPTIONS_EPISODE)
{
if ((unsigned)newOption < g_numVolumes)
if (newOption < g_volumeCnt)
ud.m_volume_number = newOption;
}
else if (entry == &ME_NETOPTIONS_MONSTERS)
{
ud.m_monsters_off = (newOption == g_numSkills);
if (newOption < g_numSkills)
ud.m_monsters_off = (newOption == g_skillCnt);
if (newOption < g_skillCnt)
ud.m_player_skill = newOption;
}
else if (entry == &ME_ADULTMODE)
{
if (newOption)
{
for (x=0; x<g_numAnimWalls; x++)
for (x=0; x<g_animWallCnt; x++)
switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum))
{
case FEMPIC1__STATIC:
@ -3064,7 +3064,7 @@ static int32_t M_MenuEntryStringSubmit(MenuEntry_t *entry, char *input)
save_xxh == XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], MAXSAVEGAMENAME-3, 0xDEADBEEF)))
#endif
{
Bstrncpy(&ud.savegame[M_SAVE.currentEntry][0], aMapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME-3);
Bstrncpy(&ud.savegame[M_SAVE.currentEntry][0], g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME-3);
ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] = 127;
returnvar = -1;
}
@ -3128,7 +3128,7 @@ static int32_t M_MenuEntryOptionSource(MenuEntry_t *entry, int32_t currentValue)
else if (entry == &ME_SOUND_DUKETALK)
return ud.config.VoiceToggle & 1;
else if (entry == &ME_NETOPTIONS_MONSTERS)
return (ud.m_monsters_off ? g_numSkills : ud.m_player_skill);
return (ud.m_monsters_off ? g_skillCnt : ud.m_player_skill);
return currentValue;
}
@ -3237,7 +3237,7 @@ static void M_MenuTextFormSubmit(char *input)
Bstrcpy(&ud.pwlockout[0], input);
else if (Bstrcmp(input, &ud.pwlockout[0]) == 0)
{
for (bssize_t x=0; x<g_numAnimWalls; x++)
for (bssize_t x=0; x<g_animWallCnt; x++)
if ((unsigned) animwall[x].wallnum < (unsigned)numwalls && wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
@ -3402,7 +3402,7 @@ static void M_MenuFileSelect(int32_t input)
ud.m_volume_number = 0;
ud.m_level_number = 7;
if (g_numSkills > 0)
if (g_skillCnt > 0)
M_ChangeMenuAnimate(MENU_SKILL, MA_Advance);
else
M_StartGameWithoutSkill();

View file

@ -1290,21 +1290,21 @@ void G_InitDynamicTiles(void)
DynamicTileMap[g_dynTileList[i].staticval] = g_dynTileList[i].staticval;
#endif
BlimpSpawnSprites[0] = RPGSPRITE;
BlimpSpawnSprites[1] = CHAINGUNSPRITE;
BlimpSpawnSprites[2] = DEVISTATORAMMO;
BlimpSpawnSprites[3] = RPGAMMO;
BlimpSpawnSprites[4] = RPGAMMO;
BlimpSpawnSprites[5] = JETPACK;
BlimpSpawnSprites[6] = SHIELD;
BlimpSpawnSprites[7] = FIRSTAID;
BlimpSpawnSprites[8] = STEROIDS;
BlimpSpawnSprites[9] = RPGAMMO;
BlimpSpawnSprites[10] = RPGAMMO;
BlimpSpawnSprites[11] = RPGSPRITE;
BlimpSpawnSprites[12] = RPGAMMO;
BlimpSpawnSprites[13] = FREEZESPRITE;
BlimpSpawnSprites[14] = FREEZEAMMO;
g_blimpSpawnItems[0] = RPGSPRITE;
g_blimpSpawnItems[1] = CHAINGUNSPRITE;
g_blimpSpawnItems[2] = DEVISTATORAMMO;
g_blimpSpawnItems[3] = RPGAMMO;
g_blimpSpawnItems[4] = RPGAMMO;
g_blimpSpawnItems[5] = JETPACK;
g_blimpSpawnItems[6] = SHIELD;
g_blimpSpawnItems[7] = FIRSTAID;
g_blimpSpawnItems[8] = STEROIDS;
g_blimpSpawnItems[9] = RPGAMMO;
g_blimpSpawnItems[10] = RPGAMMO;
g_blimpSpawnItems[11] = RPGSPRITE;
g_blimpSpawnItems[12] = RPGAMMO;
g_blimpSpawnItems[13] = FREEZESPRITE;
g_blimpSpawnItems[14] = FREEZEAMMO;
WeaponPickupSprites[0] = KNEE;
WeaponPickupSprites[1] = FIRSTGUNSPRITE;

View file

@ -145,7 +145,7 @@ void Net_SyncPlayer(ENetEvent *event)
if (i == -1)
{
i = playerswhenstarted++;
i = g_mostConcurrentPlayers++;
}
event->peer->data = (void *)(intptr_t)i;
@ -154,12 +154,12 @@ void Net_SyncPlayer(ENetEvent *event)
g_player[i].playerquitflag = 1;
//g_player[i].revision = g_netMapRevision;
for (j=0; j<playerswhenstarted-1; j++)
for (j=0; j<g_mostConcurrentPlayers-1; j++)
{
connectpoint2[j] = j+1;
}
connectpoint2[playerswhenstarted-1] = -1;
connectpoint2[g_mostConcurrentPlayers-1] = -1;
G_MaybeAllocPlayer(i);
@ -324,7 +324,7 @@ void Net_Disconnect(void)
break;
case ENET_EVENT_TYPE_DISCONNECT:
numplayers = playerswhenstarted = ud.multimode = 1;
numplayers = g_mostConcurrentPlayers = ud.multimode = 1;
myconnectindex = screenpeek = 0;
G_BackToMenu();
break;
@ -367,7 +367,7 @@ void Net_Disconnect(void)
void Net_ReceiveDisconnect(ENetEvent *event)
{
g_netDisconnect = 1;
numplayers = playerswhenstarted = ud.multimode = 1;
numplayers = g_mostConcurrentPlayers = ud.multimode = 1;
myconnectindex = screenpeek = 0;
G_BackToMenu();
@ -506,7 +506,7 @@ void Net_HandleClientPackets(void)
packbuf[1] = playeridx;
packbuf[2] = numplayers;
packbuf[3] = ud.multimode;
packbuf[4] = playerswhenstarted;
packbuf[4] = g_mostConcurrentPlayers;
packbuf[5] = myconnectindex;
enet_host_broadcast(g_netServer, CHAN_GAMESTATE,
@ -654,7 +654,7 @@ void Net_ParseServerPacket(ENetEvent *event)
P_RemovePlayer(pbuf[1]);
numplayers = pbuf[2];
ud.multimode = pbuf[3];
playerswhenstarted = pbuf[4];
g_mostConcurrentPlayers = pbuf[4];
break;
case PACKET_PLAYER_SPAWN:
@ -790,7 +790,7 @@ void Net_SendNewPlayer(int32_t newplayerindex)
{
packbuf[0] = PACKET_NUM_PLAYERS;
packbuf[1] = numplayers;
packbuf[2] = playerswhenstarted;
packbuf[2] = g_mostConcurrentPlayers;
packbuf[3] = ud.multimode;
packbuf[4] = newplayerindex;
packbuf[5] = g_networkMode;
@ -805,7 +805,7 @@ void Net_ReceiveNewPlayer(uint8_t *pbuf, int32_t packbufleng)
UNREFERENCED_PARAMETER(packbufleng); // remove when this variable is used
numplayers = pbuf[1];
playerswhenstarted = pbuf[2];
g_mostConcurrentPlayers = pbuf[2];
ud.multimode = pbuf[3];
if (pbuf[4]) // ID of new player
{
@ -826,12 +826,12 @@ void Net_ReceiveNewPlayer(uint8_t *pbuf, int32_t packbufleng)
g_networkMode = NET_DEDICATED_CLIENT;
}
for (i=0; i<playerswhenstarted-1; i++)
for (i=0; i<g_mostConcurrentPlayers-1; i++)
{
connectpoint2[i] = i+1;
}
connectpoint2[playerswhenstarted-1] = -1;
connectpoint2[g_mostConcurrentPlayers-1] = -1;
S_PlaySound(DUKE_GETWEAPON2);
@ -2066,7 +2066,7 @@ void Net_ReceiveMapVoteInitiate(uint8_t *pbuf)
Bsprintf(tempbuf,"%s^00 has called a vote to change map to %s (E%dL%d)",
g_player[voting].user_name,
aMapInfo[(uint8_t)(vote_episode*MAXLEVELS + vote_map)].name,
g_mapInfo[(uint8_t)(vote_episode*MAXLEVELS + vote_map)].name,
vote_episode+1,vote_map+1);
G_AddUserQuote(tempbuf);

View file

@ -76,14 +76,14 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
if (!VOLUMEONE)
{
if (volume > g_numVolumes)
if (volume > g_volumeCnt)
{
OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",g_numVolumes);
OSD_Printf("changelevel: invalid volume number (range 1-%d)\n",g_volumeCnt);
return OSDCMD_OK;
}
}
if (level > MAXLEVELS || aMapInfo[volume *MAXLEVELS+level].filename == NULL)
if (level > MAXLEVELS || g_mapInfo[volume *MAXLEVELS+level].filename == NULL)
{
OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP;
@ -141,15 +141,16 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
// out-of-game behave like a menu command
osdcmd_cheatsinfo_stat.cheatnum = -1;
ud.m_volume_number = volume;
ud.m_level_number = level;
ud.m_volume_number = volume;
ud.m_level_number = level;
ud.m_monsters_off = ud.monsters_off = 0;
ud.m_monsters_off = 0;
ud.monsters_off = 0;
ud.m_respawn_items = 0;
ud.m_respawn_items = 0;
ud.m_respawn_inventory = 0;
ud.multimode = 1;
ud.multimode = 1;
G_NewGame_EnterLevel();
}
@ -386,7 +387,7 @@ static int32_t osdcmd_music(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
if (aMapInfo[sel].musicfn != NULL)
if (g_mapInfo[sel].musicfn != NULL)
{
g_musicIndex = sel;
G_StartMusic();
@ -517,7 +518,7 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
{
int32_t i;
#ifdef LUNATIC
i = g_numLabels;
i = g_labelCnt;
picnum = El_GetLabelValue(parm->parms[0]);
if (picnum != INT32_MIN)
i = !i;
@ -526,7 +527,7 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
for (j=0; j<2; j++)
{
for (i=0; i<g_numLabels; i++)
for (i=0; i<g_labelCnt; i++)
{
if ((j == 0 && !Bstrcmp(label+(i<<6), parm->parms[0])) ||
(j == 1 && !Bstrcasecmp(label+(i<<6), parm->parms[0])))
@ -536,11 +537,11 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
}
}
if (i < g_numLabels)
if (i < g_labelCnt)
break;
}
#endif
if (i==g_numLabels)
if (i==g_labelCnt)
{
OSD_Printf("spawn: Invalid tile label given\n");
return OSDCMD_OK;

View file

@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
extern "C" {
#endif
extern int32_t playerswhenstarted;
extern int32_t g_mostConcurrentPlayers;
#define MOVEFIFOSIZ 2
@ -248,8 +248,6 @@ typedef struct
int32_t FlashColor; // Muzzle flash color
} weapondata_t;
extern int8_t g_numPlayerSprites;
#ifdef LUNATIC
# define PWEAPON(Player, Weapon, Wmember) (g_playerWeapon[Player][Weapon].Wmember)
extern weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS];
@ -383,7 +381,7 @@ static inline int P_GetP(const void *pSprite)
return 0;
#else
int playerNum = ((const uspritetype *)pSprite)->yvel;
if ((unsigned)playerNum >= (unsigned)playerswhenstarted)
if ((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers)
playerNum = 0;
return playerNum;
#endif

View file

@ -353,8 +353,8 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
else
{
menutext(160,90,0,0,"Loading");
if (aMapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
menutext(160,90+16+8,0,0,aMapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name);
if (g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
menutext(160,90+16+8,0,0,g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name);
}
#ifndef EDUKE32_TOUCH_DEVICES
@ -426,10 +426,10 @@ void G_CacheMapData(void)
S_PauseMusic(1);
#endif
if (aMapInfo[MUS_LOADING].musicfn)
if (g_mapInfo[MUS_LOADING].musicfn)
{
S_StopMusic();
S_PlayMusic(aMapInfo[MUS_LOADING].musicfn);
S_PlayMusic(g_mapInfo[MUS_LOADING].musicfn);
}
#if defined EDUKE32_TOUCH_DEVICES && defined USE_OPENGL
@ -580,7 +580,7 @@ void G_UpdateScreenArea(void)
int32_t y1 = ss;
int32_t y2 = 200;
if (ud.screen_size > 0 && (GametypeFlags[ud.coop]&GAMETYPE_FRAGBAR) && (g_netServer || ud.multimode > 1))
if (ud.screen_size > 0 && (g_gametypeFlags[ud.coop]&GAMETYPE_FRAGBAR) && (g_netServer || ud.multimode > 1))
{
int32_t i, j = 0;
@ -630,17 +630,17 @@ void P_RandomSpawnPoint(int playerNum)
uint32_t dist;
uint32_t pdist = -1;
if ((g_netServer || ud.multimode > 1) && !(GametypeFlags[ud.coop] & GAMETYPE_FIXEDRESPAWN))
if ((g_netServer || ud.multimode > 1) && !(g_gametypeFlags[ud.coop] & GAMETYPE_FIXEDRESPAWN))
{
i = krand() % g_numPlayerSprites;
i = krand() % g_playerSpawnCnt;
if (GametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN)
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN)
{
for (bssize_t j=0; j<ud.multimode; j++)
{
if (j != playerNum && g_player[j].ps->team == pPlayer->team && sprite[g_player[j].ps->i].extra > 0)
{
for (bssize_t k=0; k<g_numPlayerSprites; k++)
for (bssize_t k=0; k<g_playerSpawnCnt; k++)
{
dist = FindDistance2D(g_player[j].ps->pos.x - g_playerSpawnPoints[k].pos.x,
g_player[j].ps->pos.y - g_playerSpawnPoints[k].pos.y);
@ -789,7 +789,7 @@ void P_ResetStatus(int playerNum)
pPlayer->rapid_fire_hold = 0;
pPlayer->toggle_key_flag = 0;
pPlayer->access_spritenum = -1;
pPlayer->got_access = ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop] & GAMETYPE_ACCESSATSTART)) ? 7 : 0;
pPlayer->got_access = ((g_netServer || ud.multimode > 1) && (g_gametypeFlags[ud.coop] & GAMETYPE_ACCESSATSTART)) ? 7 : 0;
pPlayer->random_club_frame = 0;
pus = 1;
pPlayer->on_warping_sector = 0;
@ -911,22 +911,22 @@ static void resetprestat(int playerNum, int gameMode)
pPlayer->one_parallax_sectnum = -1;
pPlayer->visibility = ud.const_visibility;
screenpeek = myconnectindex;
g_numAnimWalls = 0;
g_numCyclers = 0;
g_animateCount = 0;
parallaxtype = 0;
randomseed = 1996;
ud.pause_on = 0;
ud.camerasprite = -1;
ud.eog = 0;
tempwallptr = 0;
g_curViewscreen = -1;
g_earthquakeTime = 0;
g_numInterpolations = 0;
screenpeek = myconnectindex;
g_animWallCnt = 0;
g_cyclerCnt = 0;
g_animateCnt = 0;
parallaxtype = 0;
randomseed = 1996;
ud.pause_on = 0;
ud.camerasprite = -1;
ud.eog = 0;
tempwallptr = 0;
g_curViewscreen = -1;
g_earthquakeTime = 0;
g_interpolationCnt = 0;
if (((gameMode & MODE_EOL) != MODE_EOL && numplayers < 2 && !g_netServer)
|| (!(GametypeFlags[ud.coop] & GAMETYPE_PRESERVEINVENTORYDEATH) && numplayers > 1))
|| (!(g_gametypeFlags[ud.coop] & GAMETYPE_PRESERVEINVENTORYDEATH) && numplayers > 1))
{
P_ResetWeapons(playerNum);
P_ResetInventory(playerNum);
@ -1005,8 +1005,6 @@ static inline int G_CheckExitSprite(int spriteNum) { return (sprite[spriteNum].l
static void prelevel(char g)
{
int32_t i, nexti, j, startwall, endwall;
int32_t switchpicnum;
uint8_t *tagbitmap = (uint8_t *)Xcalloc(65536>>3, 1);
Bmemset(show2dsector, 0, sizeof(show2dsector));
@ -1014,7 +1012,7 @@ static void prelevel(char g)
Bmemset(ror_protectedsectors, 0, MAXSECTORS);
#endif
resetprestat(0,g);
g_numClouds = 0;
g_cloudCnt = 0;
G_SetupGlobalPsky();
@ -1022,7 +1020,7 @@ static void prelevel(char g)
int missedCloudSectors = 0;
for (i=0; i<numsectors; i++)
for (bssize_t i=0; i<numsectors; i++)
{
sector[i].extra = 256;
@ -1040,14 +1038,14 @@ static void prelevel(char g)
if (waloff[sector[i].ceilingpicnum] == 0)
{
if (sector[i].ceilingpicnum == LA)
for (j=0; j<5; j++)
tloadtile(sector[i].ceilingpicnum+j, 0);
for (bsize_t j = 0; j < 5; j++)
tloadtile(sector[i].ceilingpicnum + j, 0);
}
if (sector[i].ceilingpicnum == CLOUDYSKIES)
{
if (g_numClouds < ARRAY_SSIZE(clouds))
clouds[g_numClouds++] = i;
if (g_cloudCnt < ARRAY_SSIZE(g_cloudSect))
g_cloudSect[g_cloudCnt++] = i;
else
missedCloudSectors++;
}
@ -1074,7 +1072,7 @@ static void prelevel(char g)
OSD_Printf(OSDTEXT_RED "Map warning: have %d unhandled CLOUDYSKIES ceilings.\n", missedCloudSectors);
// NOTE: must be safe loop because callbacks could delete sprites.
for (SPRITES_OF_STAT_SAFE(STAT_DEFAULT, i, nexti))
for (bssize_t nextSprite, SPRITES_OF_STAT_SAFE(STAT_DEFAULT, i, nextSprite))
{
A_ResetVars(i);
#if !defined LUNATIC
@ -1095,18 +1093,18 @@ static void prelevel(char g)
case CYCLER__STATIC:
// DELETE_AFTER_LOADACTOR. Must not change statnum.
if (g_numCyclers >= MAXCYCLERS)
if (g_cyclerCnt >= MAXCYCLERS)
{
Bsprintf(tempbuf,"\nToo many cycling sectors (%d max).",MAXCYCLERS);
G_GameExit(tempbuf);
}
cyclers[g_numCyclers][0] = SECT(i);
cyclers[g_numCyclers][1] = SLT(i);
cyclers[g_numCyclers][2] = SS(i);
cyclers[g_numCyclers][3] = sector[SECT(i)].floorshade;
cyclers[g_numCyclers][4] = SHT(i);
cyclers[g_numCyclers][5] = (SA(i) == 1536);
g_numCyclers++;
g_cyclers[g_cyclerCnt][0] = SECT(i);
g_cyclers[g_cyclerCnt][1] = SLT(i);
g_cyclers[g_cyclerCnt][2] = SS(i);
g_cyclers[g_cyclerCnt][3] = sector[SECT(i)].floorshade;
g_cyclers[g_cyclerCnt][4] = SHT(i);
g_cyclers[g_cyclerCnt][5] = (SA(i) == 1536);
g_cyclerCnt++;
break;
case SECTOREFFECTOR__STATIC:
@ -1124,7 +1122,7 @@ static void prelevel(char g)
// Delete some effector / effector modifier sprites AFTER the loop running
// the LOADACTOR events. DELETE_AFTER_LOADACTOR.
for (SPRITES_OF_STAT_SAFE(STAT_DEFAULT, i, nexti))
for (bssize_t nextSprite, SPRITES_OF_STAT_SAFE(STAT_DEFAULT, i, nextSprite))
if (!G_CheckExitSprite(i))
switch (DYNAMICTILEMAP(PN(i)))
{
@ -1134,13 +1132,13 @@ static void prelevel(char g)
break;
}
for (i = 0; i < MAXSPRITES; i++)
for (size_t i = 0; i < MAXSPRITES; i++)
{
if (sprite[i].statnum < MAXSTATUS && (PN(i) != SECTOREFFECTOR || SLT(i) != SE_14_SUBWAY_CAR))
A_Spawn(-1, i);
}
for (i = 0; i < MAXSPRITES; i++)
for (size_t i = 0; i < MAXSPRITES; i++)
{
if (sprite[i].statnum < MAXSTATUS && PN(i) == SECTOREFFECTOR && SLT(i) == SE_14_SUBWAY_CAR)
A_Spawn(-1, i);
@ -1148,14 +1146,13 @@ static void prelevel(char g)
G_SetupRotfixedSprites();
for (i=headspritestat[STAT_DEFAULT]; i>=0; i=nextspritestat[i])
for (bssize_t i=headspritestat[STAT_DEFAULT]; i>=0; i=nextspritestat[i])
{
int32_t ii;
if (PN(i) <= 0) // oob safety for switch below
continue;
for (ii=0; ii<2; ii++)
for (bsize_t ii=0; ii<2; ii++)
{
switch (DYNAMICTILEMAP(PN(i)-1+ii))
{
case DIPSWITCH__STATIC:
@ -1174,20 +1171,21 @@ static void prelevel(char g)
// the lower code only for the 'on' state (*)
if (ii==0)
{
j = sprite[i].lotag;
tagbitmap[j>>3] |= 1<<(j&7);
int const tag = sprite[i].lotag;
tagbitmap[tag>>3] |= 1<<(tag&7);
}
break;
}
}
}
// initially 'on' SE 12 light (*)
for (j=headspritestat[STAT_EFFECTOR]; j>=0; j=nextspritestat[j])
for (bssize_t j=headspritestat[STAT_EFFECTOR]; j>=0; j=nextspritestat[j])
{
int32_t t = sprite[j].hitag;
int const tag = sprite[j].hitag;
if (sprite[j].lotag == SE_12_LIGHT_SWITCH && tagbitmap[t>>3]&(1<<(t&7)))
if (sprite[j].lotag == SE_12_LIGHT_SWITCH && tagbitmap[tag>>3]&(1<<(tag&7)))
actor[j].t_data[0] = 1;
}
@ -1195,153 +1193,151 @@ static void prelevel(char g)
g_mirrorCount = 0;
for (i = 0; i < numwalls; i++)
for (bssize_t i = 0; i < numwalls; i++)
{
walltype *wal;
wal = &wall[i];
walltype * const pWall = &wall[i];
if (wal->overpicnum == MIRROR && (wal->cstat&32) != 0)
if (pWall->overpicnum == MIRROR && (pWall->cstat&32) != 0)
{
j = wal->nextsector;
int const nextSectnum = pWall->nextsector;
if ((j >= 0) && sector[j].ceilingpicnum != MIRROR)
if ((nextSectnum >= 0) && sector[nextSectnum].ceilingpicnum != MIRROR)
{
if (g_mirrorCount > 63)
{
G_GameExit("\nToo many mirrors (64 max.)");
}
sector[j].ceilingpicnum = MIRROR;
sector[j].floorpicnum = MIRROR;
g_mirrorWall[g_mirrorCount] = i;
g_mirrorSector[g_mirrorCount] = j;
sector[nextSectnum].ceilingpicnum = MIRROR;
sector[nextSectnum].floorpicnum = MIRROR;
g_mirrorWall[g_mirrorCount] = i;
g_mirrorSector[g_mirrorCount] = nextSectnum;
g_mirrorCount++;
continue;
}
}
if (g_numAnimWalls >= MAXANIMWALLS)
if (g_animWallCnt >= MAXANIMWALLS)
{
Bsprintf(tempbuf,"\nToo many 'anim' walls (%d max).",MAXANIMWALLS);
G_GameExit(tempbuf);
}
animwall[g_numAnimWalls].tag = 0;
animwall[g_numAnimWalls].wallnum = 0;
animwall[g_animWallCnt].tag = 0;
animwall[g_animWallCnt].wallnum = 0;
switchpicnum = G_GetForcefieldPicnum(i);
int const switchPic = G_GetForcefieldPicnum(i);
if (switchpicnum >= 0)
if (switchPic >= 0)
{
switch (DYNAMICTILEMAP(switchpicnum))
switch (DYNAMICTILEMAP(switchPic))
{
case FANSHADOW__STATIC:
case FANSPRITE__STATIC:
wall->cstat |= 65;
animwall[g_numAnimWalls].wallnum = i;
g_numAnimWalls++;
break;
case FANSHADOW__STATIC:
case FANSPRITE__STATIC:
wall->cstat |= 65;
animwall[g_animWallCnt].wallnum = i;
g_animWallCnt++;
break;
case W_FORCEFIELD__STATIC:
if (wal->overpicnum==W_FORCEFIELD__STATIC)
for (j=0; j<3; j++)
tloadtile(W_FORCEFIELD+j, 0);
if (wal->shade > 31)
wal->cstat = 0;
else wal->cstat |= FORCEFIELD_CSTAT|256;
case W_FORCEFIELD__STATIC:
if (pWall->overpicnum == W_FORCEFIELD__STATIC)
for (bsize_t j = 0; j < 3; j++) tloadtile(W_FORCEFIELD + j, 0);
if (pWall->shade > 31)
pWall->cstat = 0;
else
pWall->cstat |= FORCEFIELD_CSTAT | 256;
if (wal->lotag && wal->nextwall >= 0)
wall[wal->nextwall].lotag =
wal->lotag;
if (pWall->lotag && pWall->nextwall >= 0)
wall[pWall->nextwall].lotag = pWall->lotag;
case BIGFORCE__STATIC:
animwall[g_numAnimWalls].wallnum = i;
g_numAnimWalls++;
case BIGFORCE__STATIC:
animwall[g_animWallCnt].wallnum = i;
g_animWallCnt++;
continue;
continue;
}
}
wal->extra = -1;
pWall->extra = -1;
switch (DYNAMICTILEMAP(wal->picnum))
switch (DYNAMICTILEMAP(pWall->picnum))
{
case WATERTILE2__STATIC:
for (j=0; j<3; j++)
tloadtile(wal->picnum+j, 0);
break;
case WATERTILE2__STATIC:
for (bsize_t j = 0; j < 3; j++)
tloadtile(pWall->picnum + j, 0);
break;
case TECHLIGHT2__STATIC:
case TECHLIGHT4__STATIC:
tloadtile(wal->picnum, 0);
break;
case W_TECHWALL1__STATIC:
case W_TECHWALL2__STATIC:
case W_TECHWALL3__STATIC:
case W_TECHWALL4__STATIC:
animwall[g_numAnimWalls].wallnum = i;
// animwall[g_numAnimWalls].tag = -1;
g_numAnimWalls++;
break;
case SCREENBREAK6__STATIC:
case SCREENBREAK7__STATIC:
case SCREENBREAK8__STATIC:
for (j=SCREENBREAK6; j<SCREENBREAK9; j++)
tloadtile(j, 0);
animwall[g_numAnimWalls].wallnum = i;
animwall[g_numAnimWalls].tag = -1;
g_numAnimWalls++;
break;
case TECHLIGHT2__STATIC:
case TECHLIGHT4__STATIC: tloadtile(pWall->picnum, 0); break;
case W_TECHWALL1__STATIC:
case W_TECHWALL2__STATIC:
case W_TECHWALL3__STATIC:
case W_TECHWALL4__STATIC:
animwall[g_animWallCnt].wallnum = i;
// animwall[g_numAnimWalls].tag = -1;
g_animWallCnt++;
break;
case SCREENBREAK6__STATIC:
case SCREENBREAK7__STATIC:
case SCREENBREAK8__STATIC:
for (bssize_t j = SCREENBREAK6; j < SCREENBREAK9; j++)
tloadtile(j, 0);
case FEMPIC1__STATIC:
case FEMPIC2__STATIC:
case FEMPIC3__STATIC:
wal->extra = wal->picnum;
animwall[g_numAnimWalls].tag = -1;
if (ud.lockout)
{
if (wal->picnum == FEMPIC1)
wal->picnum = BLANKSCREEN;
else wal->picnum = SCREENBREAK6;
}
animwall[g_animWallCnt].wallnum = i;
animwall[g_animWallCnt].tag = -1;
g_animWallCnt++;
break;
animwall[g_numAnimWalls].wallnum = i;
animwall[g_numAnimWalls].tag = wal->picnum;
g_numAnimWalls++;
break;
case FEMPIC1__STATIC:
case FEMPIC2__STATIC:
case FEMPIC3__STATIC:
pWall->extra = pWall->picnum;
animwall[g_animWallCnt].tag = -1;
case SCREENBREAK1__STATIC:
case SCREENBREAK2__STATIC:
case SCREENBREAK3__STATIC:
case SCREENBREAK4__STATIC:
case SCREENBREAK5__STATIC:
if (ud.lockout)
pWall->picnum = (pWall->picnum == FEMPIC1) ? BLANKSCREEN : SCREENBREAK6;
animwall[g_animWallCnt].wallnum = i;
animwall[g_animWallCnt].tag = pWall->picnum;
g_animWallCnt++;
break;
case SCREENBREAK1__STATIC:
case SCREENBREAK2__STATIC:
case SCREENBREAK3__STATIC:
case SCREENBREAK4__STATIC:
case SCREENBREAK5__STATIC:
//
case SCREENBREAK9__STATIC:
case SCREENBREAK10__STATIC:
case SCREENBREAK11__STATIC:
case SCREENBREAK12__STATIC:
case SCREENBREAK13__STATIC:
case SCREENBREAK14__STATIC:
case SCREENBREAK15__STATIC:
case SCREENBREAK16__STATIC:
case SCREENBREAK17__STATIC:
case SCREENBREAK18__STATIC:
case SCREENBREAK19__STATIC:
animwall[g_numAnimWalls].wallnum = i;
animwall[g_numAnimWalls].tag = wal->picnum;
g_numAnimWalls++;
break;
case SCREENBREAK9__STATIC:
case SCREENBREAK10__STATIC:
case SCREENBREAK11__STATIC:
case SCREENBREAK12__STATIC:
case SCREENBREAK13__STATIC:
case SCREENBREAK14__STATIC:
case SCREENBREAK15__STATIC:
case SCREENBREAK16__STATIC:
case SCREENBREAK17__STATIC:
case SCREENBREAK18__STATIC:
case SCREENBREAK19__STATIC:
animwall[g_animWallCnt].wallnum = i;
animwall[g_animWallCnt].tag = pWall->picnum;
g_animWallCnt++;
break;
}
}
//Invalidate textures in sector behind mirror
for (i=0; i<g_mirrorCount; i++)
for (bssize_t i=0; i<g_mirrorCount; i++)
{
startwall = sector[g_mirrorSector[i]].wallptr;
endwall = startwall + sector[g_mirrorSector[i]].wallnum;
for (j=startwall; j<endwall; j++)
int const startWall = sector[g_mirrorSector[i]].wallptr;
int const endWall = startWall + sector[g_mirrorSector[i]].wallnum;
for (bssize_t j = startWall; j < endWall; j++)
{
wall[j].picnum = MIRROR;
wall[j].picnum = MIRROR;
wall[j].overpicnum = MIRROR;
if (wall[g_mirrorWall[i]].pal == 4)
wall[j].pal = 4;
}
@ -1371,7 +1367,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
if (levelNum == 0 && volumeNum == 3 && (!g_netServer && ud.multimode < 2) && ud.lockout == 0
&& (G_GetLogoFlags() & LOGO_NOE4CUTSCENE)==0)
{
S_PlayMusic(aMapInfo[MUS_BRIEFING].musicfn);
S_PlayMusic(g_mapInfo[MUS_BRIEFING].musicfn);
flushperms();
setview(0,0,xdim-1,ydim-1);
@ -1430,7 +1426,7 @@ end_vol4a:
Gv_ResetSystemDefaults();
for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
ALIGNED_FREE_AND_NULL(aMapInfo[i].savedstate);
ALIGNED_FREE_AND_NULL(g_mapInfo[i].savedstate);
if (ud.m_coop != 1)
{
@ -1478,7 +1474,7 @@ static void resetpspritevars(char gameMode)
aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps->weaponswitch;
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
if ((g_netServer || ud.multimode > 1) && (g_gametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0; j<MAX_WEAPONS; j++)
tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
@ -1501,7 +1497,7 @@ static void resetpspritevars(char gameMode)
g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps->weaponswitch = weaponswitch[i];
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
if ((g_netServer || ud.multimode > 1) && (g_gametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0; j<MAX_WEAPONS; j++)
g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
@ -1513,7 +1509,7 @@ static void resetpspritevars(char gameMode)
}
}
g_numPlayerSprites = 0;
g_playerSpawnCnt = 0;
// circ = 2048/ud.multimode;
g_whichPalForPlayer = 9;
@ -1524,16 +1520,16 @@ static void resetpspritevars(char gameMode)
const int32_t nexti = nextspritestat[i];
spritetype *const s = &sprite[i];
if (g_numPlayerSprites == MAXPLAYERS)
if (g_playerSpawnCnt == MAXPLAYERS)
G_GameExit("\nToo many player sprites (max 16.)");
g_playerSpawnPoints[g_numPlayerSprites].pos.x = s->x;
g_playerSpawnPoints[g_numPlayerSprites].pos.y = s->y;
g_playerSpawnPoints[g_numPlayerSprites].pos.z = s->z;
g_playerSpawnPoints[g_numPlayerSprites].ang = s->ang;
g_playerSpawnPoints[g_numPlayerSprites].sect = s->sectnum;
g_playerSpawnPoints[g_playerSpawnCnt].pos.x = s->x;
g_playerSpawnPoints[g_playerSpawnCnt].pos.y = s->y;
g_playerSpawnPoints[g_playerSpawnCnt].pos.z = s->z;
g_playerSpawnPoints[g_playerSpawnCnt].ang = s->ang;
g_playerSpawnPoints[g_playerSpawnCnt].sect = s->sectnum;
g_numPlayerSprites++;
g_playerSpawnCnt++;
if (j < MAXPLAYERS)
{
@ -1560,7 +1556,7 @@ static void resetpspritevars(char gameMode)
s->yvel = j;
if (!g_player[j].pcolor && (g_netServer || ud.multimode > 1) && !(GametypeFlags[ud.coop] & GAMETYPE_TDM))
if (!g_player[j].pcolor && (g_netServer || ud.multimode > 1) && !(g_gametypeFlags[ud.coop] & GAMETYPE_TDM))
{
if (s->pal == 0)
{
@ -1586,7 +1582,7 @@ static void resetpspritevars(char gameMode)
{
int32_t k = g_player[j].pcolor;
if (GametypeFlags[ud.coop] & GAMETYPE_TDM)
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM)
{
k = G_GetTeamPalette(g_player[j].pteam);
g_player[j].ps->team = g_player[j].pteam;
@ -1629,7 +1625,7 @@ static inline void clearfrags(void)
void G_ResetTimers(uint8_t keepgtics)
{
totalclock = cloudtotalclock = ototalclock = lockclock = 0;
totalclock = g_cloudClock = ototalclock = lockclock = 0;
ready2send = 1;
g_levelTextTime = 85;
@ -1642,20 +1638,16 @@ void G_ResetTimers(uint8_t keepgtics)
void G_ClearFIFO(void)
{
int32_t i = MAXPLAYERS-1;
g_emuJumpTics = 0;
Bmemset(&avg, 0, sizeof(input_t));
clearbufbyte(&localInput, sizeof(input_t), 0L);
clearbufbyte(&inputfifo, sizeof(input_t) * MOVEFIFOSIZ * MAXPLAYERS, 0L);
for (; i >= 0; i--)
for (bsize_t p = 0; p <= MAXPLAYERS - 1; ++p)
{
if (g_player[i].inputBits != NULL)
Bmemset(g_player[i].inputBits, 0, sizeof(input_t));
g_player[i].vote = g_player[i].gotvote = 0;
if (g_player[p].inputBits != NULL)
Bmemset(g_player[p].inputBits, 0, sizeof(input_t));
g_player[p].vote = g_player[p].gotvote = 0;
}
}
@ -1663,15 +1655,15 @@ int G_FindLevelByFile(const char *fileName)
{
for (bssize_t volumeNum = 0; volumeNum < MAXVOLUMES; volumeNum++)
{
int const volumeOffset = volumeNum * MAXLEVELS;
int const volOffset = volumeNum * MAXLEVELS;
for (bssize_t levelNum = 0; levelNum < MAXLEVELS; levelNum++)
{
if (aMapInfo[volumeOffset + levelNum].filename == NULL)
if (g_mapInfo[volOffset + levelNum].filename == NULL)
continue;
if (!Bstrcasecmp(fileName, aMapInfo[volumeOffset + levelNum].filename))
return volumeOffset + levelNum;
if (!Bstrcasecmp(fileName, g_mapInfo[volOffset + levelNum].filename))
return volOffset + levelNum;
}
}
@ -1763,12 +1755,12 @@ void G_SetupFilenameBasedMusic(char *nameBuf, const char *fileName, int levelNum
if ((kFile = kopen4loadfrommod(nameBuf, 0)) != -1)
{
kclose(kFile);
realloc_copy(&aMapInfo[levelNum].musicfn, nameBuf);
realloc_copy(&g_mapInfo[levelNum].musicfn, nameBuf);
return;
}
}
realloc_copy(&aMapInfo[levelNum].musicfn, "dethtoll.mid");
realloc_copy(&g_mapInfo[levelNum].musicfn, "dethtoll.mid");
}
static inline int G_HaveUserMap(void)
@ -1829,14 +1821,14 @@ int G_EnterLevel(int gameMode)
mii = (ud.volume_number*MAXLEVELS)+ud.level_number;
if (aMapInfo[mii].name == NULL || aMapInfo[mii].filename == NULL)
if (g_mapInfo[mii].name == NULL || g_mapInfo[mii].filename == NULL)
{
if (G_HaveUserMap())
{
if (aMapInfo[mii].filename == NULL)
aMapInfo[mii].filename = (char *)Xcalloc(BMAX_PATH, sizeof(uint8_t));
if (aMapInfo[mii].name == NULL)
aMapInfo[mii].name = Xstrdup("User Map");
if (g_mapInfo[mii].filename == NULL)
g_mapInfo[mii].filename = (char *)Xcalloc(BMAX_PATH, sizeof(uint8_t));
if (g_mapInfo[mii].name == NULL)
g_mapInfo[mii].name = Xstrdup("User Map");
}
else
{
@ -1864,9 +1856,9 @@ int G_EnterLevel(int gameMode)
else
{
if (g_gameNamePtr)
Bsprintf(apptitle,"%s - %s - " APPNAME,aMapInfo[mii].name,g_gameNamePtr);
Bsprintf(apptitle,"%s - %s - " APPNAME,g_mapInfo[mii].name,g_gameNamePtr);
else
Bsprintf(apptitle,"%s - " APPNAME,aMapInfo[mii].name);
Bsprintf(apptitle,"%s - " APPNAME,g_mapInfo[mii].name);
}
Bstrcpy(tempbuf,apptitle);
@ -1886,14 +1878,14 @@ int G_EnterLevel(int gameMode)
G_LoadMapHack(levelName, boardfilename);
G_SetupFilenameBasedMusic(levelName, boardfilename, ud.m_level_number);
}
else if (loadboard(aMapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &pPlayer->ang, &pPlayer->cursectnum) < 0)
else if (loadboard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &pPlayer->ang, &pPlayer->cursectnum) < 0)
{
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", aMapInfo[mii].filename);
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", g_mapInfo[mii].filename);
return 1;
}
else
{
G_LoadMapHack(levelName, aMapInfo[mii].filename);
G_LoadMapHack(levelName, g_mapInfo[mii].filename);
}
g_precacheCount = 0;
@ -1907,7 +1899,7 @@ int G_EnterLevel(int gameMode)
G_AlignWarpElevators();
resetpspritevars(gameMode);
ud.playerbest = CONFIG_GetMapBestTime(G_HaveUserMap() ? boardfilename : aMapInfo[mii].filename, g_loadedMapHack.md4);
ud.playerbest = CONFIG_GetMapBestTime(G_HaveUserMap() ? boardfilename : g_mapInfo[mii].filename, g_loadedMapHack.md4);
G_FadeLoad(0,0,0, 252,0, -28, 4, -1);
G_CacheMapData();
@ -1916,8 +1908,8 @@ int G_EnterLevel(int gameMode)
if (ud.recstat != 2)
{
g_musicIndex = mii;
if (aMapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(aMapInfo[g_musicIndex].musicfn);
if (g_mapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(g_mapInfo[g_musicIndex].musicfn);
}
if (gameMode & (MODE_GAME|MODE_EOL))
@ -1980,7 +1972,7 @@ int G_EnterLevel(int gameMode)
G_ClearFIFO();
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
for (i=g_interpolationCnt-1; i>=0; i--) bakipos[i] = *curipos[i];
g_player[myconnectindex].ps->over_shoulder_on = 0;
@ -2002,7 +1994,7 @@ int G_EnterLevel(int gameMode)
}
OSD_Printf(OSDTEXT_YELLOW "E%dL%d: %s\n", ud.volume_number+1, ud.level_number+1,
aMapInfo[mii].name);
g_mapInfo[mii].name);
g_restorePalette = -1;
@ -2017,7 +2009,7 @@ int G_EnterLevel(int gameMode)
void G_FreeMapState(int levelNum)
{
map_t *const pMapInfo = &aMapInfo[levelNum];
map_t *const pMapInfo = &g_mapInfo[levelNum];
if (pMapInfo->savedstate == NULL)
return;

View file

@ -100,7 +100,7 @@ void G_ResetInterpolations(void)
{
int32_t k, i;
g_numInterpolations = 0;
g_interpolationCnt = 0;
k = headspritestat[STAT_EFFECTOR];
while (k >= 0)
@ -134,9 +134,9 @@ void G_ResetInterpolations(void)
k = nextspritestat[k];
}
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
for (i = g_animateCount-1; i>=0; i--)
G_SetInterpolation(animateptr[i]);
for (i=g_interpolationCnt-1; i>=0; i--) bakipos[i] = *curipos[i];
for (i = g_animateCnt-1; i>=0; i--)
G_SetInterpolation(g_animatePtr[i]);
}
void ReadSaveGameHeaders(void)
@ -300,8 +300,8 @@ int32_t G_LoadPlayer(int32_t spot)
if (boardfilename[0])
Bstrcpy(currentboardfilename, boardfilename);
else if (aMapInfo[mapIdx].filename)
Bstrcpy(currentboardfilename, aMapInfo[mapIdx].filename);
else if (g_mapInfo[mapIdx].filename)
Bstrcpy(currentboardfilename, g_mapInfo[mapIdx].filename);
if (currentboardfilename[0])
{
@ -996,7 +996,7 @@ static const dataspec_t svgm_udnetw[] =
{
{ DS_STRING, (void *)svgm_udnetw_string, 0, 1 },
{ 0, &ud.multimode, sizeof(ud.multimode), 1 },
{ 0, &g_numPlayerSprites, sizeof(g_numPlayerSprites), 1 },
{ 0, &g_playerSpawnCnt, sizeof(g_playerSpawnCnt), 1 },
{ 0, &g_playerSpawnPoints, sizeof(g_playerSpawnPoints), 1 },
{ DS_NOCHK, &ud.volume_number, sizeof(ud.volume_number), 1 },
@ -1074,10 +1074,10 @@ static const dataspec_t svgm_secwsp[] =
#endif
{ 0, &DynamicTileMap[0], sizeof(DynamicTileMap[0]), MAXTILES }, // NOCHK?
{ 0, &DynamicSoundMap[0], sizeof(DynamicSoundMap[0]), MAXSOUNDS }, // NOCHK?
{ DS_NOCHK, &g_numCyclers, sizeof(g_numCyclers), 1 },
{ DS_CNT(g_numCyclers), &cyclers[0][0], sizeof(cyclers[0]), (intptr_t)&g_numCyclers },
{ DS_NOCHK, &g_numAnimWalls, sizeof(g_numAnimWalls), 1 },
{ DS_CNT(g_numAnimWalls), &animwall, sizeof(animwall[0]), (intptr_t)&g_numAnimWalls },
{ DS_NOCHK, &g_cyclerCnt, sizeof(g_cyclerCnt), 1 },
{ DS_CNT(g_cyclerCnt), &g_cyclers[0][0], sizeof(g_cyclers[0]), (intptr_t)&g_cyclerCnt },
{ DS_NOCHK, &g_animWallCnt, sizeof(g_animWallCnt), 1 },
{ DS_CNT(g_animWallCnt), &animwall, sizeof(animwall[0]), (intptr_t)&g_animWallCnt },
{ DS_NOCHK, &g_mirrorCount, sizeof(g_mirrorCount), 1 },
{ DS_NOCHK, &g_mirrorWall[0], sizeof(g_mirrorWall[0]), ARRAY_SIZE(g_mirrorWall) },
{ DS_NOCHK, &g_mirrorSector[0], sizeof(g_mirrorSector[0]), ARRAY_SIZE(g_mirrorSector) },
@ -1125,12 +1125,12 @@ static char svgm_end_string [] = "savegame_end";
static const dataspec_t svgm_anmisc[] =
{
{ DS_STRING, (void *)svgm_anmisc_string, 0, 1 },
{ 0, &g_animateCount, sizeof(g_animateCount), 1 },
{ 0, &animatesect[0], sizeof(animatesect[0]), MAXANIMATES },
{ 0, &animategoal[0], sizeof(animategoal[0]), MAXANIMATES },
{ 0, &animatevel[0], sizeof(animatevel[0]), MAXANIMATES },
{ 0, &g_animateCnt, sizeof(g_animateCnt), 1 },
{ 0, &g_animateSect[0], sizeof(g_animateSect[0]), MAXANIMATES },
{ 0, &g_animateGoal[0], sizeof(g_animateGoal[0]), MAXANIMATES },
{ 0, &g_animateVel[0], sizeof(g_animateVel[0]), MAXANIMATES },
{ DS_SAVEFN, (void *)&sv_preanimateptrsave, 0, 1 },
{ 0, &animateptr[0], sizeof(animateptr[0]), MAXANIMATES },
{ 0, &g_animatePtr[0], sizeof(g_animatePtr[0]), MAXANIMATES },
{ DS_SAVEFN|DS_LOADFN , (void *)&sv_postanimateptr, 0, 1 },
{ 0, &g_curViewscreen, sizeof(g_curViewscreen), 1 },
{ 0, &g_origins[0], sizeof(g_origins[0]), ARRAY_SIZE(g_origins) },
@ -1138,10 +1138,10 @@ static const dataspec_t svgm_anmisc[] =
{ DS_NOCHK, &g_deleteQueueSize, sizeof(g_deleteQueueSize), 1 },
{ DS_CNT(g_deleteQueueSize), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&g_deleteQueueSize },
{ 0, &show2dsector[0], sizeof(uint8_t), MAXSECTORS>>3 },
{ DS_NOCHK, &g_numClouds, sizeof(g_numClouds), 1 },
{ 0, &clouds[0], sizeof(clouds), 1 },
{ 0, &cloudx, sizeof(cloudx), 1 },
{ 0, &cloudy, sizeof(cloudy), 1 },
{ DS_NOCHK, &g_cloudCnt, sizeof(g_cloudCnt), 1 },
{ 0, &g_cloudSect[0], sizeof(g_cloudSect), 1 },
{ 0, &g_cloudX, sizeof(g_cloudX), 1 },
{ 0, &g_cloudY, sizeof(g_cloudY), 1 },
{ 0, &g_pskyidx, sizeof(g_pskyidx), 1 }, // DS_NOCHK?
{ 0, &g_earthquakeTime, sizeof(g_earthquakeTime), 1 },
@ -1325,8 +1325,8 @@ int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t
// savegame
Bstrncpyz(h.savename, ud.savegame[spot], sizeof(h.savename));
#ifdef __ANDROID__
Bstrncpyz(h.volname, EpisodeNames[ud.volume_number], sizeof(h.volname));
Bstrncpyz(h.skillname, SkillNames[ud.player_skill], sizeof(h.skillname));
Bstrncpyz(h.volname, g_volumeNames[ud.volume_number], sizeof(h.volname));
Bstrncpyz(h.skillname, g_skillNames[ud.player_skill], sizeof(h.skillname));
#endif
}
else
@ -1703,11 +1703,11 @@ static void sv_postactordata()
static void sv_preanimateptrsave()
{
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_FWD);
G_Util_PtrToIdx(g_animatePtr, g_animateCnt, sector, P2I_FWD);
}
static void sv_postanimateptr()
{
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
G_Util_PtrToIdx(g_animatePtr, g_animateCnt, sector, P2I_BACK);
}
static void sv_prequote()
{
@ -2120,13 +2120,13 @@ static void postloadplayer(int32_t savegamep)
if (ud.config.MusicToggle)
{
if (aMapInfo[musicIdx].musicfn != NULL &&
if (g_mapInfo[musicIdx].musicfn != NULL &&
(musicIdx != g_musicIndex /* || MapInfo[MUS_LOADING].musicfn */))
{
S_StopMusic();
g_musicIndex = musicIdx;
S_PlayMusic(aMapInfo[g_musicIndex].musicfn);
S_PlayMusic(g_mapInfo[g_musicIndex].musicfn);
}
S_PauseMusic(0);
@ -2162,7 +2162,7 @@ static void postloadplayer(int32_t savegamep)
{
if (ud.lockout)
{
for (i=0; i<g_numAnimWalls; i++)
for (i=0; i<g_animWallCnt; i++)
switch (DYNAMICTILEMAP(wall[animwall[i].wallnum].picnum))
{
case FEMPIC1__STATIC:

View file

@ -580,7 +580,7 @@ void G_DrawStatusBar(int32_t snum)
if (getrendermode() >= REND_POLYMOST) pus = NUMPAGES; // JBF 20040101: always redraw in GL
if ((g_netServer || ud.multimode > 1) && ((GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR) || g_fakeMultiMode))
if ((g_netServer || ud.multimode > 1) && ((g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR) || g_fakeMultiMode))
{
if (pus)
G_DrawFrags();
@ -921,11 +921,11 @@ void G_DrawStatusBar(int32_t snum)
if (u == -1)
{
G_PatchStatusBar(0, 0, 320, 200);
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))
if ((g_netServer || ud.multimode > 1) && (g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))
rotatesprite_fs(sbarx(277+1), sbary(SBY+7-1), sb16, 0, KILLSICON, 0, 0, 10+16);
}
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))
if ((g_netServer || ud.multimode > 1) && (g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))
{
if (u&32768)
{
@ -1030,7 +1030,7 @@ void G_DrawBackground(void)
if ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat == 2)
{
if (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)
if (g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)
{
if ((g_netServer || ud.multimode > 1)) y1 += scale(ydim, 8, 200);
if (ud.multimode > 4) y1 += scale(ydim, 8, 200);
@ -1112,7 +1112,7 @@ void G_DrawBackground(void)
if (ud.screen_size > 8)
{
y = 0;
if (GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)
if (g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR)
{
if ((g_netServer || ud.multimode > 1)) y += 8;
if (ud.multimode > 4) y += 8;

View file

@ -177,10 +177,10 @@ static void G_ShowScores(void)
{
int32_t t, i;
if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{
gametext(160, SCORESHEETOFFSET+58+2, "Multiplayer Totals", 0, 2+8+16);
gametext(160, SCORESHEETOFFSET+58+10, aMapInfo[G_LastMapInfoIndex()].name, 0, 2+8+16);
gametext(160, SCORESHEETOFFSET+58+10, g_mapInfo[G_LastMapInfoIndex()].name, 0, 2+8+16);
t = 0;
minitext(70, SCORESHEETOFFSET+80, "Name", 8, 2+8+16+ROTATESPRITE_MAX);
@ -188,7 +188,7 @@ static void G_ShowScores(void)
minitext(200, SCORESHEETOFFSET+80, "Deaths", 8, 2+8+16+ROTATESPRITE_MAX);
minitext(235, SCORESHEETOFFSET+80, "Ping", 8, 2+8+16+ROTATESPRITE_MAX);
for (i=playerswhenstarted-1; i>=0; i--)
for (i=g_mostConcurrentPlayers-1; i>=0; i--)
{
if (!g_player[i].playerquitflag)
continue;
@ -292,18 +292,18 @@ static inline void G_MoveClouds(void)
{
int32_t i;
if (totalclock <= cloudtotalclock && totalclock >= (cloudtotalclock-7))
if (totalclock <= g_cloudClock && totalclock >= (g_cloudClock-7))
return;
cloudtotalclock = totalclock+6;
g_cloudClock = totalclock+6;
cloudx += sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9;
cloudy += sintable[g_player[screenpeek].ps->ang&2047]>>9;
g_cloudX += sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9;
g_cloudY += sintable[g_player[screenpeek].ps->ang&2047]>>9;
for (i=g_numClouds-1; i>=0; i--)
for (i=g_cloudCnt-1; i>=0; i--)
{
sector[clouds[i]].ceilingxpanning = cloudx>>6;
sector[clouds[i]].ceilingypanning = cloudy>>6;
sector[g_cloudSect[i]].ceilingxpanning = g_cloudX>>6;
sector[g_cloudSect[i]].ceilingypanning = g_cloudY>>6;
}
}
@ -616,7 +616,7 @@ static void G_PrintCoords(int32_t snum)
const DukePlayer_t *ps = g_player[snum].ps;
const int32_t sectnum = ps->cursectnum;
if ((GametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))
if ((g_gametypeFlags[ud.coop] & GAMETYPE_FRAGBAR))
{
if (ud.multimode > 4)
y = 32;
@ -821,7 +821,7 @@ static void G_PrintFPS(void)
if (thisSec - LastSec)
{
g_currentFrameRate = LastCount = tabledivide32_noinline(FrameCount, thisSec - LastSec);
g_frameRate = LastCount = tabledivide32_noinline(FrameCount, thisSec - LastSec);
LastSec = thisSec;
FrameCount = 0;
@ -1046,8 +1046,8 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on == 2)
{
const int32_t a = (ud.screen_size > 0) ? 147 : 179;
minitext(5, a+6, EpisodeNames[ud.volume_number], 0, 2+8+16+256);
minitext(5, a+6+6, aMapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name, 0, 2+8+16+256);
minitext(5, a+6, g_volumeNames[ud.volume_number], 0, 2+8+16+256);
minitext(5, a+6+6, g_mapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name, 0, 2+8+16+256);
}
}
}
@ -1077,11 +1077,11 @@ void G_DisplayRest(int32_t smoothratio)
else if (g_levelTextTime < 5)
bits |= 1;
if (aMapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
if (g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
{
if (currentboardfilename[0] != 0 && ud.volume_number == 0 && ud.level_number == 7)
menutext_(160, 90+16+8, -g_levelTextTime+22/*quotepulseshade*/, 0, currentboardfilename, bits);
else menutext_(160, 90+16+8, -g_levelTextTime+22/*quotepulseshade*/, 0, aMapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, bits);
else menutext_(160, 90+16+8, -g_levelTextTime+22/*quotepulseshade*/, 0, g_mapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name, bits);
}
}
@ -1221,7 +1221,7 @@ void G_DisplayRest(int32_t smoothratio)
{
Bsprintf(tempbuf, "%s^00 has called a vote for map", g_player[voting].user_name);
gametext(160, 40, tempbuf, 0, 2+8+16);
Bsprintf(tempbuf, "%s (E%dL%d)", aMapInfo[vote_episode*MAXLEVELS + vote_map].name, vote_episode+1, vote_map+1);
Bsprintf(tempbuf, "%s (E%dL%d)", g_mapInfo[vote_episode*MAXLEVELS + vote_map].name, vote_episode+1, vote_map+1);
gametext(160, 48, tempbuf, 0, 2+8+16);
gametext(160, 70, "Press F1 to Accept, F2 to Decline", 0, 2+8+16);
}
@ -1451,7 +1451,7 @@ void G_DisplayLogo(void)
if (logoflags & LOGO_PLAYMUSIC)
{
g_musicIndex = MUS_INTRO;
S_PlayMusic(aMapInfo[g_musicIndex].musicfn);
S_PlayMusic(g_mapInfo[g_musicIndex].musicfn);
}
if (!NAM)
@ -1971,18 +1971,18 @@ static void G_DisplayMPResultsScreen(void)
if (PLUTOPAK) // JBF 20030804
rotatesprite_fs((260)<<16, 36<<16, 65536L, 0, PLUTOPAKSPRITE+2, 0, 0, 2+8);
gametext(160, 58+2, "Multiplayer Totals", 0, 2+8+16);
gametext(160, 58+10, aMapInfo[G_LastMapInfoIndex()].name, 0, 2+8+16);
gametext(160, 58+10, g_mapInfo[G_LastMapInfoIndex()].name, 0, 2+8+16);
gametext(160, 165, "Press any key or button to continue", quotepulseshade, 2+8+16);
minitext(23, 80, " Name Kills", 8, 2+8+16+128);
for (i=0; i<playerswhenstarted; i++)
for (i=0; i<g_mostConcurrentPlayers; i++)
{
Bsprintf(tempbuf, "%-4d", i+1);
minitext(92+(i*23), 80, tempbuf, 3, 2+8+16+128);
}
for (i=0; i<playerswhenstarted; i++)
for (i=0; i<g_mostConcurrentPlayers; i++)
{
int32_t xfragtotal = 0;
Bsprintf(tempbuf, "%d", i+1);
@ -1990,7 +1990,7 @@ static void G_DisplayMPResultsScreen(void)
minitext(30, 90+t, tempbuf, 0, 2+8+16+128);
minitext(38, 90+t, g_player[i].user_name, g_player[i].ps->palookup, 2+8+16+128);
for (y=0; y<playerswhenstarted; y++)
for (y=0; y<g_mostConcurrentPlayers; y++)
{
if (i == y)
{
@ -2012,10 +2012,10 @@ static void G_DisplayMPResultsScreen(void)
t += 7;
}
for (y=0; y<playerswhenstarted; y++)
for (y=0; y<g_mostConcurrentPlayers; y++)
{
int32_t yfragtotal = 0;
for (i=0; i<playerswhenstarted; i++)
for (i=0; i<g_mostConcurrentPlayers; i++)
{
if (i == y)
yfragtotal += g_player[i].ps->fraggedself;
@ -2037,11 +2037,11 @@ static int32_t G_PrintTime_ClockPad(void)
clockpad = max(clockpad, ij);
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
for (ii=aMapInfo[G_LastMapInfoIndex()].partime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
for (ii=g_mapInfo[G_LastMapInfoIndex()].partime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij);
if (!NAM_WW2GI && aMapInfo[G_LastMapInfoIndex()].designertime)
if (!NAM_WW2GI && g_mapInfo[G_LastMapInfoIndex()].designertime)
{
for (ii=aMapInfo[G_LastMapInfoIndex()].designertime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
for (ii=g_mapInfo[G_LastMapInfoIndex()].designertime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij);
}
}
@ -2070,13 +2070,13 @@ const char* G_PrintParTime(void)
{
if (ud.last_level < 1)
return "<invalid>";
return G_PrintTime2(aMapInfo[G_LastMapInfoIndex()].partime);
return G_PrintTime2(g_mapInfo[G_LastMapInfoIndex()].partime);
}
const char* G_PrintDesignerTime(void)
{
if (ud.last_level < 1)
return "<invalid>";
return G_PrintTime2(aMapInfo[G_LastMapInfoIndex()].designertime);
return G_PrintTime2(g_mapInfo[G_LastMapInfoIndex()].designertime);
}
const char* G_PrintBestTime(void)
{
@ -2103,9 +2103,9 @@ void G_BonusScreen(int32_t bonusonly)
}
else
{
lastmapname = aMapInfo[G_LastMapInfoIndex()].name;
lastmapname = g_mapInfo[G_LastMapInfoIndex()].name;
if (!lastmapname) // this isn't right but it's better than no name at all
lastmapname = aMapInfo[G_LastMapInfoIndex()].name;
lastmapname = g_mapInfo[G_LastMapInfoIndex()].name;
}
@ -2133,7 +2133,7 @@ void G_BonusScreen(int32_t bonusonly)
FX_StopAllSounds();
S_ClearSoundLocks();
if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{
clearallviews(0);
G_DisplayMPResultsScreen();
@ -2269,12 +2269,12 @@ void G_BonusScreen(int32_t bonusonly)
yy+=10;
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
if (aMapInfo[G_LastMapInfoIndex()].partime)
if (g_mapInfo[G_LastMapInfoIndex()].partime)
{
gametext(10, yy+9, "Par Time:", 0, 2+8+16);
yy+=10;
}
if (!NAM_WW2GI && !DUKEBETA && aMapInfo[G_LastMapInfoIndex()].designertime)
if (!NAM_WW2GI && !DUKEBETA && g_mapInfo[G_LastMapInfoIndex()].designertime)
{
// EDuke 2.0 / NAM source suggests "Green Beret's Time:"
gametext(10, yy+9, "3D Realms' Time:", 0, 2+8+16);
@ -2313,13 +2313,13 @@ void G_BonusScreen(int32_t bonusonly)
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
if (aMapInfo[G_LastMapInfoIndex()].partime)
if (g_mapInfo[G_LastMapInfoIndex()].partime)
{
G_PrintParTime();
gametext((320>>2)+71, yy+9, tempbuf, 0, 2+8+16);
yy+=10;
}
if (!NAM_WW2GI && !DUKEBETA && aMapInfo[G_LastMapInfoIndex()].designertime)
if (!NAM_WW2GI && !DUKEBETA && g_mapInfo[G_LastMapInfoIndex()].designertime)
{
G_PrintDesignerTime();
gametext((320>>2)+71, yy+9, tempbuf, 0, 2+8+16);

File diff suppressed because it is too large Load diff

View file

@ -46,20 +46,20 @@ typedef struct {
typedef struct {
// this needs to have a copy of everything related to the map/actor state
// see savegame.c
int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount;
intptr_t animateptr[MAXANIMATES];
int32_t g_animateGoal[MAXANIMATES], g_animateVel[MAXANIMATES], g_animateCnt;
intptr_t g_animatePtr[MAXANIMATES];
int32_t lockclock;
vec2_t origins[MAXANIMPOINTS];
int32_t randomseed, g_globalRandom;
int32_t pskyidx;
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
int16_t animatesect[MAXANIMATES];
int16_t cyclers[MAXCYCLERS][6];
int16_t g_animateSect[MAXANIMATES];
int16_t g_cyclers[MAXCYCLERS][6];
int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
int16_t g_numAnimWalls;
int16_t g_numClouds,clouds[256],cloudx,cloudy;
int16_t g_numCyclers;
int16_t g_animWallCnt;
int16_t g_cloudCnt,g_cloudSect[256],g_cloudX,g_cloudY;
int16_t g_cyclerCnt;
int32_t numsprites;
int16_t tailspritefree;
@ -73,7 +73,7 @@ typedef struct {
int16_t prevspritestat[MAXSPRITES];
uint16_t g_earthquakeTime;
int8_t g_numPlayerSprites;
int8_t g_playerSpawnCnt;
uint8_t show2dsector[(MAXSECTORS+7)>>3];
@ -111,32 +111,32 @@ typedef struct {
//extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
void G_ActivateBySector(int32_t sect,int32_t j);
int32_t S_FindMusicSFX(int32_t sn, int32_t *sndptr);
int32_t A_CallSound(int32_t sn,int32_t whatsprite);
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp);
int S_FindMusicSFX(int sectNum, int32_t *sndptr);
int A_CallSound(int sectNum,int spriteNum);
int A_CheckHitSprite(int spriteNum,int16_t *hitSprite);
void A_DamageObject(int32_t i,int32_t sn);
void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith);
int32_t __fastcall A_FindPlayer(const spritetype *s,int32_t *d);
int __fastcall A_FindPlayer(const spritetype *pSprite,int32_t *dist);
void G_AlignWarpElevators(void);
int32_t CheckDoorTile(int32_t dapic);
void G_AnimateCamSprite(int32_t smoothratio);
int CheckDoorTile(int tileNum);
void G_AnimateCamSprite(int smoothRatio);
void G_AnimateWalls(void);
int32_t G_ActivateWarpElevators(int32_t s,int32_t d);
int32_t G_CheckActivatorMotion(int32_t lotag);
int G_ActivateWarpElevators(int s,int d);
int G_CheckActivatorMotion(int lotag);
void G_DoSectorAnimations(void);
void G_OperateActivators(int nTag, int playerNum);
void G_OperateForceFields(int spriteNum,int wallTag);
void G_OperateMasterSwitches(int nTag);
void G_OperateRespawns(int32_t low);
extern void G_OperateSectors(int sectNum,int spriteNum);
void P_HandleSharedKeys(int32_t snum);
int32_t GetAnimationGoal(const int32_t *animptr);
int32_t isanearoperator(int32_t lotag);
int32_t isanunderoperator(int32_t lotag);
void G_OperateRespawns(int lotag);
void G_OperateSectors(int sectNum,int spriteNum);
void P_HandleSharedKeys(int playerNum);
int GetAnimationGoal(const int32_t *animPtr);
int isanearoperator(int lotag);
int isanunderoperator(int lotag);
int P_ActivateSwitch(int playerNum, int nObject, int nSwitchType);
void P_CheckSectors(int32_t snum);
int Sect_DamageCeilingOrFloor(int nDmgFloor, int const nSectnum);
int32_t SetAnimation(int32_t animsect,int32_t *animptr,int32_t thegoal,int32_t thevel);
int SetAnimation(int sectNum,int32_t *animPtr,int goalVal,int animVel);
#define FORCEFIELD_CSTAT (64+16+4+1)

View file

@ -168,13 +168,13 @@ void S_RestartMusic(void)
{
if (ud.recstat != 2 && g_player[myconnectindex].ps->gm&MODE_GAME)
{
if (aMapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(aMapInfo[g_musicIndex].musicfn);
if (g_mapInfo[g_musicIndex].musicfn != NULL)
S_PlayMusic(g_mapInfo[g_musicIndex].musicfn);
}
else if (aMapInfo[MUS_INTRO].musicfn != 0 && (G_GetLogoFlags() & LOGO_PLAYMUSIC))
else if (g_mapInfo[MUS_INTRO].musicfn != 0 && (G_GetLogoFlags() & LOGO_PLAYMUSIC))
{
g_musicIndex = MUS_INTRO;
S_PlayMusic(aMapInfo[MUS_INTRO].musicfn);
S_PlayMusic(g_mapInfo[MUS_INTRO].musicfn);
}
}