2006-12-10 06:49:01 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2010-05-25 10:56:00 +00:00
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-12-10 06:49:01 +00:00
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "duke3d.h"
|
2012-06-03 16:09:33 +00:00
|
|
|
#include "common_game.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "gamevars.h"
|
2006-12-10 06:49:01 +00:00
|
|
|
#include "gamedef.h"
|
2007-03-04 19:52:57 +00:00
|
|
|
#include "osd.h"
|
2011-07-29 22:07:49 +00:00
|
|
|
#include "savegame.h"
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
#define _gamevars_c_
|
2013-02-07 21:00:48 +00:00
|
|
|
|
2014-01-31 21:13:03 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
int32_t g_noResetVars;
|
|
|
|
LUNATIC_CB void (*A_ResetVars)(int32_t iActor);
|
|
|
|
#else
|
2013-01-01 15:24:18 +00:00
|
|
|
# include "gamestructures.c"
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t OSD_errors;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
// call this function as many times as needed.
|
2013-01-20 21:17:10 +00:00
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (i=MAXGAMEVARS-1; i>=0; i--)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2009-11-14 02:30:47 +00:00
|
|
|
if ((aGameVars[i].dwFlags & GAMEVAR_USER_MASK) && aGameVars[i].val.plValues)
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
|
|
|
Bfree(aGameVars[i].val.plValues);
|
|
|
|
aGameVars[i].val.plValues=NULL;
|
|
|
|
}
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[i].dwFlags |= GAMEVAR_RESET;
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2008-08-10 13:07:07 +00:00
|
|
|
if (i >= MAXGAMEARRAYS)
|
|
|
|
continue;
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2012-12-13 02:33:53 +00:00
|
|
|
if ((aGameArrays[i].dwFlags & GAMEARRAY_NORMAL) && aGameArrays[i].plValues)
|
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
Bfree(aGameArrays[i].plValues);
|
2012-12-13 02:33:53 +00:00
|
|
|
aGameArrays[i].plValues=NULL;
|
|
|
|
}
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2012-12-13 02:33:53 +00:00
|
|
|
aGameArrays[i].dwFlags |= GAMEARRAY_RESET;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2013-01-20 21:17:10 +00:00
|
|
|
|
|
|
|
g_gameVarCount = g_gameArrayCount = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
hash_init(&h_gamevars);
|
|
|
|
hash_init(&h_arrays);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
static void Gv_Clear(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
// only call this function ONCE...
|
2013-01-20 21:17:10 +00:00
|
|
|
int32_t i;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2013-01-20 21:17:10 +00:00
|
|
|
Gv_Free();
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2013-01-20 21:17:10 +00:00
|
|
|
// Now, only do work that Gv_Free() hasn't done.
|
|
|
|
for (i=MAXGAMEVARS-1; i>=0; i--)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2013-01-20 21:17:10 +00:00
|
|
|
Bfree(aGameVars[i].szLabel);
|
2008-06-09 23:41:54 +00:00
|
|
|
aGameVars[i].szLabel=NULL;
|
|
|
|
|
2009-01-21 22:43:44 +00:00
|
|
|
aGameVars[i].val.lValue=0;
|
2013-01-20 21:17:10 +00:00
|
|
|
|
2008-08-10 13:07:07 +00:00
|
|
|
if (i >= MAXGAMEARRAYS)
|
|
|
|
continue;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2013-01-20 21:17:10 +00:00
|
|
|
Bfree(aGameArrays[i].szLabel);
|
|
|
|
aGameArrays[i].szLabel=NULL;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, j;
|
2008-07-16 21:21:18 +00:00
|
|
|
char savedstate[MAXVOLUMES*MAXLEVELS];
|
2010-01-24 23:33:17 +00:00
|
|
|
char tbuf[12];
|
|
|
|
|
|
|
|
if (newbehav)
|
|
|
|
{
|
|
|
|
if (kread(fil, tbuf, 12)!=12) goto corrupt;
|
|
|
|
if (Bmemcmp(tbuf, "BEG: EDuke32", 12)) { OSD_Printf("BEG ERR\n"); return 2; }
|
|
|
|
}
|
2008-07-16 21:21:18 +00:00
|
|
|
|
|
|
|
Bmemset(&savedstate,0,sizeof(savedstate));
|
2008-06-09 23:41:54 +00:00
|
|
|
|
|
|
|
// AddLog("Reading gamevars from savegame");
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_Free(); // nuke 'em from orbit, it's the only way to be sure...
|
2008-12-15 13:56:30 +00:00
|
|
|
|
2008-06-09 23:41:54 +00:00
|
|
|
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);
|
|
|
|
// AddLog(g_szBuf);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_gameVarCount,sizeof(g_gameVarCount),1,fil) != 1) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_gameVarCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
|
|
|
if (kdfread(&(aGameVars[i]),sizeof(gamevar_t),1,fil) != 1) goto corrupt;
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil) != 1) goto corrupt;
|
2010-08-02 08:13:51 +00:00
|
|
|
hash_add(&h_gamevars, aGameVars[i].szLabel,i, 1);
|
2008-12-15 08:38:16 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameVars[i].val.plValues = (intptr_t*)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
|
2008-12-21 22:46:55 +00:00
|
|
|
if (kdfread(aGameVars[i].val.plValues,sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameVars[i].val.plValues = (intptr_t*)Bcalloc(MAXSPRITES,sizeof(intptr_t));
|
2008-12-21 22:46:55 +00:00
|
|
|
if (kdfread(&aGameVars[i].val.plValues[0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);
|
|
|
|
// AddLog(g_szBuf);
|
|
|
|
|
|
|
|
Gv_InitWeaponPointers();
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-12-14 22:11:07 +00:00
|
|
|
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);
|
|
|
|
// AddLog(g_szBuf);
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_RefreshPointers();
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil) != 1) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_gameArrayCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2012-12-15 11:28:56 +00:00
|
|
|
if (aGameArrays[i].dwFlags&GAMEARRAY_READONLY)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// read for .size and .dwFlags (the rest are pointers):
|
|
|
|
if (kdfread(&aGameArrays[i],sizeof(gamearray_t),1,fil) != 1) goto corrupt;
|
|
|
|
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameArrays[i].szLabel = (char *)Bcalloc(MAXARRAYLABEL,sizeof(uint8_t));
|
2009-01-09 09:29:17 +00:00
|
|
|
if (kdfread(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, fil) != 1) goto corrupt;
|
2010-08-02 08:13:51 +00:00
|
|
|
hash_add(&h_arrays, aGameArrays[i].szLabel, i, 1);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameArrays[i].plValues = (intptr_t *)Bcalloc(aGameArrays[i].size, GAR_ELTSZ);
|
2012-05-25 15:23:48 +00:00
|
|
|
if (kdfread(aGameArrays[i].plValues, GAR_ELTSZ * aGameArrays[i].size, 1, fil) < 1) goto corrupt;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);
|
|
|
|
// AddLog(g_szBuf);
|
|
|
|
if (kdfread(apScriptGameEvent,sizeof(apScriptGameEvent),1,fil) != 1) goto corrupt;
|
2011-07-29 22:07:49 +00:00
|
|
|
G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_BACK_NON0);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
|
|
|
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);
|
|
|
|
// AddLog(g_szBuf);
|
2008-07-16 21:21:18 +00:00
|
|
|
|
|
|
|
if (kdfread(&savedstate[0],sizeof(savedstate),1,fil) != 1) goto corrupt;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
|
2008-07-16 21:21:18 +00:00
|
|
|
{
|
|
|
|
if (savedstate[i])
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (MapInfo[i].savedstate == NULL)
|
2012-11-15 14:28:29 +00:00
|
|
|
MapInfo[i].savedstate = (mapstate_t *)Bcalloc(1,sizeof(mapstate_t));
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(MapInfo[i].savedstate,sizeof(mapstate_t),1,fil) != sizeof(mapstate_t)) goto corrupt;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=0; j<g_gameVarCount; j++)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue;
|
|
|
|
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2009-07-05 03:15:35 +00:00
|
|
|
// if (!MapInfo[i].savedstate->vars[j])
|
2012-11-15 14:28:29 +00:00
|
|
|
MapInfo[i].savedstate->vars[j] = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2009-07-05 03:15:35 +00:00
|
|
|
// if (!MapInfo[i].savedstate->vars[j])
|
2012-11-15 14:28:29 +00:00
|
|
|
MapInfo[i].savedstate->vars[j] = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
|
2008-11-20 14:06:36 +00:00
|
|
|
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
|
|
|
}
|
2008-07-16 21:21:18 +00:00
|
|
|
}
|
2013-05-19 19:29:23 +00:00
|
|
|
else
|
2008-07-16 21:21:18 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
G_FreeMapState(i);
|
2008-07-16 21:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
if (!newbehav)
|
|
|
|
{
|
2011-12-21 18:40:47 +00:00
|
|
|
intptr_t l;
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
if (kdfread(&l,sizeof(l),1,fil) != 1) goto corrupt;
|
|
|
|
if (kdfread(g_szBuf,l,1,fil) != 1) goto corrupt;
|
|
|
|
g_szBuf[l]=0;
|
|
|
|
OSD_Printf("%s\n",g_szBuf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (kread(fil, tbuf, 12)!=12) goto corrupt;
|
|
|
|
if (Bmemcmp(tbuf, "EOF: EDuke32", 12)) { OSD_Printf("EOF ERR\n"); return 2; }
|
|
|
|
}
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2013-02-07 21:00:48 +00:00
|
|
|
# if 0
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
AddLog("Dumping Vars...");
|
|
|
|
fp=fopen("xxx.txt","w");
|
|
|
|
if (fp)
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_DumpValues(fp);
|
2008-06-09 23:41:54 +00:00
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
AddLog("Done Dumping...");
|
|
|
|
}
|
2013-02-07 21:00:48 +00:00
|
|
|
# endif
|
2008-06-09 23:41:54 +00:00
|
|
|
return(0);
|
2006-12-10 06:49:01 +00:00
|
|
|
corrupt:
|
2008-06-09 23:41:54 +00:00
|
|
|
return(1);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
void Gv_WriteSave(FILE *fil, int32_t newbehav)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, j;
|
2008-07-16 21:21:18 +00:00
|
|
|
char savedstate[MAXVOLUMES*MAXLEVELS];
|
|
|
|
|
|
|
|
Bmemset(&savedstate,0,sizeof(savedstate));
|
2008-06-09 23:41:54 +00:00
|
|
|
|
|
|
|
// AddLog("Saving Game Vars to File");
|
2010-01-24 23:33:17 +00:00
|
|
|
if (newbehav)
|
|
|
|
fwrite("BEG: EDuke32", 12, 1, fil);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_gameVarCount,sizeof(g_gameVarCount),1,fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_gameVarCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
|
|
|
dfwrite(&(aGameVars[i]),sizeof(gamevar_t),1,fil);
|
2009-01-09 09:29:17 +00:00
|
|
|
dfwrite(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
//Bsprintf(g_szBuf,"Writing value array for %s (%d)",aGameVars[i].szLabel,sizeof(int32_t) * MAXPLAYERS);
|
2008-06-09 23:41:54 +00:00
|
|
|
//AddLog(g_szBuf);
|
2008-12-21 22:46:55 +00:00
|
|
|
dfwrite(aGameVars[i].val.plValues,sizeof(intptr_t) * MAXPLAYERS, 1, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
//Bsprintf(g_szBuf,"Writing value array for %s (%d)",aGameVars[i].szLabel,sizeof(int32_t) * MAXSPRITES);
|
2008-06-09 23:41:54 +00:00
|
|
|
//AddLog(g_szBuf);
|
2008-12-21 22:46:55 +00:00
|
|
|
dfwrite(&aGameVars[i].val.plValues[0],sizeof(intptr_t), MAXSPRITES, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_gameArrayCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2012-12-15 11:28:56 +00:00
|
|
|
if (aGameArrays[i].dwFlags&GAMEARRAY_READONLY)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// write for .size and .dwFlags (the rest are pointers):
|
|
|
|
dfwrite(&aGameArrays[i],sizeof(gamearray_t),1,fil);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
dfwrite(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, fil);
|
2012-05-25 15:23:48 +00:00
|
|
|
dfwrite(aGameArrays[i].plValues, GAR_ELTSZ * aGameArrays[i].size, 1, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2011-07-29 22:07:49 +00:00
|
|
|
G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_FWD_NON0);
|
2008-06-09 23:41:54 +00:00
|
|
|
dfwrite(apScriptGameEvent,sizeof(apScriptGameEvent),1,fil);
|
2011-07-29 22:07:49 +00:00
|
|
|
G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_BACK_NON0);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (MapInfo[i].savedstate != NULL)
|
2008-07-16 21:21:18 +00:00
|
|
|
savedstate[i] = 1;
|
|
|
|
|
|
|
|
dfwrite(&savedstate[0],sizeof(savedstate),1,fil);
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (MapInfo[i].savedstate)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(MapInfo[i].savedstate,sizeof(mapstate_t),1,fil);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=0; j<g_gameVarCount; j++)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue;
|
|
|
|
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
dfwrite(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil);
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2009-11-14 02:30:47 +00:00
|
|
|
dfwrite(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil);
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-07-16 21:21:18 +00:00
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
if (!newbehav)
|
|
|
|
{
|
2011-12-21 18:40:47 +00:00
|
|
|
intptr_t l;
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
Bsprintf(g_szBuf,"EOF: EDuke32");
|
|
|
|
l=Bstrlen(g_szBuf);
|
|
|
|
dfwrite(&l,sizeof(l),1,fil);
|
|
|
|
dfwrite(g_szBuf,l,1,fil);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fwrite("EOF: EDuke32", 12, 1, fil);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2009-02-02 01:49:14 +00:00
|
|
|
void Gv_DumpValues(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2008-12-28 23:27:24 +00:00
|
|
|
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf("// Current Game Definitions\n\n");
|
2008-12-28 23:27:24 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<g_gameVarCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_SECRET))
|
2008-06-09 23:41:54 +00:00
|
|
|
continue; // do nothing...
|
2008-12-28 23:27:24 +00:00
|
|
|
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
|
2008-12-28 23:27:24 +00:00
|
|
|
|
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR))
|
2010-08-02 08:13:51 +00:00
|
|
|
OSD_Printf("%d",*((int32_t *)aGameVars[i].val.lValue));
|
2008-12-28 23:27:24 +00:00
|
|
|
else if (aGameVars[i].dwFlags & (GAMEVAR_SHORTPTR))
|
2010-08-02 08:13:51 +00:00
|
|
|
OSD_Printf("%d",*((int16_t *)aGameVars[i].val.lValue));
|
2008-12-28 23:27:24 +00:00
|
|
|
else if (aGameVars[i].dwFlags & (GAMEVAR_CHARPTR))
|
2010-08-02 08:13:51 +00:00
|
|
|
OSD_Printf("%d",*((char *)aGameVars[i].val.lValue));
|
2008-06-09 23:41:54 +00:00
|
|
|
else
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf("%" PRIdPTR "",aGameVars[i].val.lValue);
|
|
|
|
|
2008-12-28 23:27:24 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_PERPLAYER))
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf(" GAMEVAR_PERPLAYER");
|
2008-12-28 23:27:24 +00:00
|
|
|
else if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR))
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf(" GAMEVAR_PERACTOR");
|
2008-12-28 23:27:24 +00:00
|
|
|
else
|
2014-02-10 11:00:07 +00:00
|
|
|
OSD_Printf(" %" PRIdPTR,aGameVars[i].dwFlags/* & (GAMEVAR_USER_MASK)*/);
|
2009-02-02 01:49:14 +00:00
|
|
|
|
|
|
|
OSD_Printf(" // ");
|
2008-12-28 23:27:24 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM))
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf(" (system)");
|
2011-04-07 01:16:29 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_PTR_MASK))
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf(" (pointer)");
|
2008-12-28 23:27:24 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_READONLY))
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf(" (read only)");
|
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_SPECIAL))
|
|
|
|
OSD_Printf(" (special)");
|
|
|
|
OSD_Printf("\n");
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2009-02-02 01:49:14 +00:00
|
|
|
OSD_Printf("\n// end of game definitions\n");
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2012-01-03 19:55:38 +00:00
|
|
|
// XXX: This function is very strange.
|
2008-12-13 07:23:13 +00:00
|
|
|
void Gv_ResetVars(void) /* this is called during a new game and nowhere else */
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_Free();
|
2008-08-23 15:37:30 +00:00
|
|
|
OSD_errors=0;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXGAMEVARS; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2010-07-03 08:53:57 +00:00
|
|
|
if (aGameVars[i].szLabel != NULL)
|
|
|
|
Gv_NewVar(aGameVars[i].szLabel,
|
2010-08-02 08:13:51 +00:00
|
|
|
aGameVars[i].dwFlags & GAMEVAR_NODEFAULT ? aGameVars[i].val.lValue : aGameVars[i].lDefault,
|
|
|
|
aGameVars[i].dwFlags);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXGAMEARRAYS; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2012-12-13 02:33:53 +00:00
|
|
|
if (aGameArrays[i].szLabel != NULL && (aGameArrays[i].dwFlags & GAMEARRAY_RESET))
|
|
|
|
Gv_NewArray(aGameArrays[i].szLabel,aGameArrays[i].plValues,aGameArrays[i].size,aGameArrays[i].dwFlags);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-04-01 02:50:44 +00:00
|
|
|
}
|
|
|
|
|
2012-12-13 02:33:53 +00:00
|
|
|
int32_t Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32_t dwFlags)
|
2008-04-01 02:50:44 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
if (g_gameArrayCount >= MAXGAMEARRAYS)
|
|
|
|
{
|
|
|
|
g_numCompilerErrors++;
|
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("%s:%d: error: too many arrays!\n",g_szScriptFileName,g_lineNumber);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-09 23:41:54 +00:00
|
|
|
if (Bstrlen(pszLabel) > (MAXARRAYLABEL-1))
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
g_numCompilerErrors++;
|
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("%s:%d: error: array name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXARRAYLABEL);
|
2008-06-09 23:41:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
i = hash_find(&h_arrays,pszLabel);
|
2012-12-13 02:33:53 +00:00
|
|
|
if (i >=0 && !(aGameArrays[i].dwFlags & GAMEARRAY_RESET))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-08-25 00:49:12 +00:00
|
|
|
// found it it's a duplicate in error
|
2012-12-13 02:33:53 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
g_numCompilerWarnings++;
|
2012-12-13 02:33:53 +00:00
|
|
|
|
|
|
|
if (aGameArrays[i].dwFlags&GAMEARRAY_TYPE_MASK)
|
|
|
|
{
|
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("ignored redefining system array `%s'.", pszLabel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
C_ReportError(WARNING_DUPLICATEDEFINITION);
|
|
|
|
|
2008-08-25 00:49:12 +00:00
|
|
|
return 0;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
i = g_gameArrayCount;
|
2008-12-13 07:23:13 +00:00
|
|
|
|
|
|
|
if (aGameArrays[i].szLabel == NULL)
|
2011-08-12 15:40:28 +00:00
|
|
|
aGameArrays[i].szLabel=(char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
|
2008-12-13 07:23:13 +00:00
|
|
|
if (aGameArrays[i].szLabel != pszLabel)
|
|
|
|
Bstrcpy(aGameArrays[i].szLabel,pszLabel);
|
2012-12-13 02:33:53 +00:00
|
|
|
|
|
|
|
if (!(dwFlags & GAMEARRAY_TYPE_MASK))
|
|
|
|
aGameArrays[i].plValues=(intptr_t *)Bcalloc(asize,GAR_ELTSZ);
|
|
|
|
else
|
|
|
|
aGameArrays[i].plValues=(intptr_t *)arrayptr;
|
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
aGameArrays[i].size=asize;
|
2012-12-13 02:33:53 +00:00
|
|
|
aGameArrays[i].dwFlags = dwFlags & ~GAMEARRAY_RESET;
|
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
g_gameArrayCount++;
|
2010-08-02 08:13:51 +00:00
|
|
|
hash_add(&h_arrays, aGameArrays[i].szLabel, i, 1);
|
2013-01-01 15:24:18 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
return 1;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2011-09-04 23:06:12 +00:00
|
|
|
int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, j;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
//Bsprintf(g_szBuf,"Gv_NewVar(%s, %d, %X)",pszLabel, lValue, dwFlags);
|
2008-06-09 23:41:54 +00:00
|
|
|
//AddLog(g_szBuf);
|
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
if (g_gameVarCount >= MAXGAMEVARS)
|
|
|
|
{
|
|
|
|
g_numCompilerErrors++;
|
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("%s:%d: error: too many gamevars!\n",g_szScriptFileName,g_lineNumber);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-09 23:41:54 +00:00
|
|
|
if (Bstrlen(pszLabel) > (MAXVARLABEL-1))
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
g_numCompilerErrors++;
|
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,pszLabel, MAXVARLABEL);
|
2008-06-09 23:41:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
i = hash_find(&h_gamevars,pszLabel);
|
2008-08-26 08:39:45 +00:00
|
|
|
|
2008-12-21 22:46:55 +00:00
|
|
|
if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-08-26 08:39:45 +00:00
|
|
|
// found it...
|
2011-04-07 01:16:29 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_PTR_MASK))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
|
2008-08-26 08:39:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2013-01-20 21:17:15 +00:00
|
|
|
else if (!(aGameVars[i].dwFlags & GAMEVAR_SYSTEM))
|
2008-08-26 08:39:45 +00:00
|
|
|
{
|
|
|
|
// it's a duplicate in error
|
2008-11-20 14:06:36 +00:00
|
|
|
g_numCompilerWarnings++;
|
|
|
|
C_ReportError(WARNING_DUPLICATEDEFINITION);
|
2008-08-26 08:39:45 +00:00
|
|
|
return 0;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2008-08-26 08:39:45 +00:00
|
|
|
if (i == -1)
|
2008-11-20 14:06:36 +00:00
|
|
|
i = g_gameVarCount;
|
2008-08-26 08:39:45 +00:00
|
|
|
|
2013-01-20 21:17:10 +00:00
|
|
|
// If it's a user gamevar...
|
2008-11-20 14:06:36 +00:00
|
|
|
if ((aGameVars[i].dwFlags & GAMEVAR_SYSTEM) == 0)
|
2008-08-26 09:05:32 +00:00
|
|
|
{
|
2013-01-20 21:17:10 +00:00
|
|
|
// Allocate and set its label
|
2008-08-26 09:05:32 +00:00
|
|
|
if (aGameVars[i].szLabel == NULL)
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
|
2008-08-26 09:05:32 +00:00
|
|
|
if (aGameVars[i].szLabel != pszLabel)
|
|
|
|
Bstrcpy(aGameVars[i].szLabel,pszLabel);
|
2013-01-20 21:17:10 +00:00
|
|
|
|
|
|
|
// and the flags
|
2008-08-26 09:05:32 +00:00
|
|
|
aGameVars[i].dwFlags=dwFlags;
|
|
|
|
|
2008-12-28 23:27:24 +00:00
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_USER_MASK)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2013-01-20 21:17:10 +00:00
|
|
|
// only free if per-{actor,player}
|
|
|
|
Bfree(aGameVars[i].val.plValues);
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[i].val.plValues=NULL;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-26 09:05:32 +00:00
|
|
|
|
|
|
|
// if existing is system, they only get to change default value....
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[i].lDefault = lValue;
|
|
|
|
aGameVars[i].dwFlags &= ~GAMEVAR_RESET;
|
2008-08-26 09:05:32 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
if (i == g_gameVarCount)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-08-26 09:05:32 +00:00
|
|
|
// we're adding a new one.
|
2010-08-02 08:13:51 +00:00
|
|
|
hash_add(&h_gamevars, aGameVars[i].szLabel, g_gameVarCount++, 0);
|
2008-08-26 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2013-01-20 21:17:10 +00:00
|
|
|
// Set initial values. (Or, override values for system gamevars.)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
|
2008-08-26 09:05:32 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
if (!aGameVars[i].val.plValues)
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameVars[i].val.plValues = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=MAXPLAYERS-1; j>=0; j--)
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[i].val.plValues[j]=lValue;
|
2008-08-26 09:05:32 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
|
2008-08-26 09:05:32 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
if (!aGameVars[i].val.plValues)
|
2012-11-15 14:28:29 +00:00
|
|
|
aGameVars[i].val.plValues = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=MAXSPRITES-1; j>=0; j--)
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[i].val.plValues[j]=lValue;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
else aGameVars[i].val.lValue = lValue;
|
|
|
|
|
2008-08-26 09:05:32 +00:00
|
|
|
return 1;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
void __fastcall A_ResetVars(register int32_t iActor)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
register int32_t i=(MAXGAMEVARS-1);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((aGameVars[i].dwFlags & (GAMEVAR_PERACTOR|GAMEVAR_NODEFAULT)) == GAMEVAR_PERACTOR)
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[i].val.plValues[iActor]=aGameVars[i].lDefault;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
while (i--);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static int32_t Gv_GetVarIndex(const char *szGameLabel)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t i = hash_find(&h_gamevars,szGameLabel);
|
2008-12-15 13:56:30 +00:00
|
|
|
if (i == -1)
|
|
|
|
{
|
2012-12-29 15:21:24 +00:00
|
|
|
OSD_Printf(OSD_ERROR "Gv_GetVarIndex(): INTERNAL ERROR: couldn't find gamevar %s!\n",szGameLabel);
|
2008-12-15 13:56:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return i;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, register int32_t iPlayer)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
if (id == g_iThisActorID)
|
|
|
|
return iActor;
|
2008-06-06 17:18:07 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (id == MAXGAMEVARS)
|
|
|
|
return(*insptr++);
|
|
|
|
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
register intptr_t negateResult = id&(MAXGAMEVARS<<1);
|
2008-08-10 13:07:07 +00:00
|
|
|
|
2009-06-27 08:20:09 +00:00
|
|
|
if (id >= g_gameVarCount)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-12-13 07:23:13 +00:00
|
|
|
if (id&(MAXGAMEVARS<<2)) // array
|
2008-08-10 13:07:07 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
register int32_t index=Gv_GetVar(*insptr++,iActor,iPlayer);
|
2008-08-10 13:07:07 +00:00
|
|
|
|
2009-01-16 06:11:25 +00:00
|
|
|
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2011-04-07 01:16:29 +00:00
|
|
|
if ((unsigned)index >= (unsigned)aGameArrays[id].size)
|
2008-08-10 13:07:07 +00:00
|
|
|
{
|
2011-04-07 01:16:29 +00:00
|
|
|
iActor = index;
|
|
|
|
goto badindex;
|
2008-08-10 13:07:07 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
|
|
|
|
return ((aGameArrays[id].plValues[index] ^ -negateResult) + negateResult);
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
|
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
register int32_t index=Gv_GetVar(*insptr++, iActor, iPlayer);
|
2009-01-16 06:11:25 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
switch ((id&(MAXGAMEVARS-1)) - g_iSpriteVarID)
|
2009-01-16 06:11:25 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
case 0: //if (id == g_iSpriteVarID)
|
2009-01-07 14:05:13 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t parm2 = 0, label = *insptr++;
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2009-01-16 07:24:15 +00:00
|
|
|
/*OSD_Printf("%d %d %d\n",__LINE__,index,label);*/
|
2009-01-07 14:05:13 +00:00
|
|
|
if (ActorLabels[label].flags & LABEL_HASPARM2)
|
|
|
|
parm2 = Gv_GetVar(*insptr++, iActor, iPlayer);
|
|
|
|
|
2011-09-12 06:25:50 +00:00
|
|
|
if ((unsigned)index >= MAXSPRITES)
|
|
|
|
{
|
|
|
|
iPlayer = index;
|
|
|
|
goto badsprite;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessSpriteX(index, label, parm2) ^ -negateResult) + negateResult);
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
case 3: //else if (id == g_iPlayerVarID)
|
2009-01-07 14:05:13 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t parm2 = 0, label = *insptr++;
|
2009-01-07 14:05:13 +00:00
|
|
|
|
|
|
|
if (PlayerLabels[label].flags & LABEL_HASPARM2)
|
|
|
|
parm2 = Gv_GetVar(*insptr++, iActor, iPlayer);
|
|
|
|
|
|
|
|
if (index == vm.g_i) index = vm.g_p;
|
2011-09-12 06:25:50 +00:00
|
|
|
|
|
|
|
if ((unsigned)index >= MAXPLAYERS)
|
|
|
|
{
|
|
|
|
iPlayer = index;
|
|
|
|
goto badplayer;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessPlayerX(index, label, parm2) ^ -negateResult) + negateResult);
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
case 4: //else if (id == g_iActorVarID)
|
|
|
|
return ((Gv_GetVar(*insptr++, index, iPlayer) ^ -negateResult) + negateResult);
|
|
|
|
case 1: //else if (id == g_iSectorVarID)
|
2009-01-07 14:05:13 +00:00
|
|
|
if (index == vm.g_i) index = sprite[vm.g_i].sectnum;
|
2012-02-24 19:51:54 +00:00
|
|
|
if ((unsigned)index >= MAXSECTORS)
|
|
|
|
{
|
|
|
|
iPlayer = index;
|
|
|
|
insptr++;
|
|
|
|
goto badsector;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessSectorX(index, *insptr++) ^ -negateResult) + negateResult);
|
2009-06-24 08:20:10 +00:00
|
|
|
case 2: //else if (id == g_iWallVarID)
|
2012-02-24 19:51:54 +00:00
|
|
|
if ((unsigned)index >= MAXWALLS)
|
|
|
|
{
|
|
|
|
iPlayer = index;
|
|
|
|
insptr++;
|
|
|
|
goto badwall;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
|
2009-06-24 08:20:10 +00:00
|
|
|
default:
|
2011-04-07 01:16:29 +00:00
|
|
|
goto wtf;
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
2008-08-10 13:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
id &= (MAXGAMEVARS-1);
|
|
|
|
|
|
|
|
if (!negateResult)
|
2011-04-07 01:16:29 +00:00
|
|
|
goto badvarid;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
switch (aGameVars[id].dwFlags &
|
2011-04-07 01:16:29 +00:00
|
|
|
(GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
default:
|
2009-06-24 08:20:10 +00:00
|
|
|
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_PERPLAYER:
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)iPlayer >= MAXPLAYERS) goto bad_id;
|
2009-06-24 08:20:10 +00:00
|
|
|
return ((aGameVars[id].val.plValues[iPlayer] ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_PERACTOR:
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)iActor >= MAXSPRITES) goto bad_id;
|
2009-06-24 08:20:10 +00:00
|
|
|
return ((aGameVars[id].val.plValues[iActor] ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_INTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
return (((*((int32_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_SHORTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
return (((*((int16_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_CHARPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
return (((*((char *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2011-04-07 01:16:29 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
bad_id:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid sprite/player ID %d/%d\n", iActor,iPlayer);
|
2009-06-24 08:20:10 +00:00
|
|
|
return -1;
|
2011-04-07 01:16:29 +00:00
|
|
|
|
|
|
|
badvarid:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid gamevar ID (%d)\n", id);
|
2011-04-07 01:16:29 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badindex:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid array index (%s[%d])\n", aGameArrays[id].szLabel,iActor);
|
2011-04-07 01:16:29 +00:00
|
|
|
return -1;
|
|
|
|
|
2011-09-12 06:25:50 +00:00
|
|
|
badplayer:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid player ID %d\n", iPlayer);
|
2011-09-12 06:25:50 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badsprite:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid sprite ID %d\n", iPlayer);
|
2011-09-12 06:25:50 +00:00
|
|
|
return -1;
|
|
|
|
|
2012-02-24 19:51:54 +00:00
|
|
|
badsector:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid sector ID %d\n", iPlayer);
|
2012-02-24 19:51:54 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badwall:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): invalid wall ID %d\n", iPlayer);
|
2012-02-24 19:51:54 +00:00
|
|
|
return -1;
|
|
|
|
|
2011-04-07 01:16:29 +00:00
|
|
|
wtf:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVar(): WTF?\n");
|
2011-04-07 01:16:29 +00:00
|
|
|
return -1;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register int32_t iActor, register int32_t iPlayer)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2011-04-07 01:16:29 +00:00
|
|
|
if ((unsigned)id >= (unsigned)g_gameVarCount) goto badvarid;
|
2009-06-24 08:20:10 +00:00
|
|
|
|
2012-03-26 05:05:57 +00:00
|
|
|
//Bsprintf(g_szBuf,"SGVI: %d (\"%s\") to %d for %d %d",id,aGameVars[id].szLabel,lValue,iActor,iPlayer);
|
2008-06-09 23:41:54 +00:00
|
|
|
//AddLog(g_szBuf);
|
2008-12-21 22:46:55 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
default:
|
|
|
|
aGameVars[id].val.lValue=lValue;
|
|
|
|
return;
|
|
|
|
case GAMEVAR_PERPLAYER:
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)iPlayer > MAXPLAYERS-1) goto badindex;
|
2008-06-09 23:41:54 +00:00
|
|
|
// for the current player
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[id].val.plValues[iPlayer]=lValue;
|
2008-06-09 23:41:54 +00:00
|
|
|
return;
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_PERACTOR:
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)iActor > MAXSPRITES-1) goto badindex;
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[id].val.plValues[iActor]=lValue;
|
2008-06-09 23:41:54 +00:00
|
|
|
return;
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_INTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
*((int32_t *)aGameVars[id].val.lValue)=(int32_t)lValue;
|
2008-11-20 14:06:36 +00:00
|
|
|
return;
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_SHORTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
*((int16_t *)aGameVars[id].val.lValue)=(int16_t)lValue;
|
2008-12-21 22:46:55 +00:00
|
|
|
return;
|
|
|
|
case GAMEVAR_CHARPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
*((uint8_t *)aGameVars[id].val.lValue)=(uint8_t)lValue;
|
2008-06-09 23:41:54 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
|
|
|
|
badvarid:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_SetVar(): invalid gamevar (%d) from sprite %d (%d), player %d\n",
|
2012-11-26 08:26:04 +00:00
|
|
|
id,vm.g_i,TrackerCast(sprite[vm.g_i].picnum),vm.g_p);
|
2009-06-24 08:20:10 +00:00
|
|
|
return;
|
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
badindex:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_SetVar(): invalid index (%d) for gamevar %s from sprite %d, player %d\n",
|
2011-03-04 08:50:58 +00:00
|
|
|
aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? iActor : iPlayer,
|
|
|
|
aGameVars[id].szLabel,vm.g_i,vm.g_p);
|
2009-06-24 08:20:10 +00:00
|
|
|
return;
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t __fastcall Gv_GetVarX(register int32_t id)
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
|
|
|
if (id == g_iThisActorID)
|
2009-01-07 14:05:13 +00:00
|
|
|
return vm.g_i;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (id == MAXGAMEVARS)
|
|
|
|
return(*insptr++);
|
|
|
|
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
register intptr_t negateResult = id&(MAXGAMEVARS<<1);
|
2008-12-21 22:46:55 +00:00
|
|
|
|
2009-06-27 08:20:09 +00:00
|
|
|
if (id >= g_gameVarCount)
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
|
|
|
if (id&(MAXGAMEVARS<<2)) // array
|
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
register int32_t index=Gv_GetVarX(*insptr++);
|
2012-12-13 02:33:53 +00:00
|
|
|
int32_t siz;
|
2008-12-21 22:46:55 +00:00
|
|
|
|
2009-01-16 06:11:25 +00:00
|
|
|
id &= (MAXGAMEVARS-1);// ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
|
2008-12-21 22:46:55 +00:00
|
|
|
|
2012-12-13 02:33:53 +00:00
|
|
|
if (aGameArrays[id].dwFlags & GAMEARRAY_VARSIZE)
|
|
|
|
siz = Gv_GetVarX(aGameArrays[id].size);
|
|
|
|
else
|
|
|
|
siz = aGameArrays[id].size;
|
|
|
|
|
|
|
|
if (index < 0 || index >= siz)
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
2011-04-07 01:16:29 +00:00
|
|
|
negateResult = index;
|
|
|
|
goto badindex;
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
2011-04-07 01:16:29 +00:00
|
|
|
|
2012-12-13 02:33:53 +00:00
|
|
|
switch (aGameArrays[id].dwFlags & GAMEARRAY_TYPE_MASK)
|
|
|
|
{
|
|
|
|
case 0:
|
2013-03-03 16:06:18 +00:00
|
|
|
return ((aGameArrays[id].plValues)[index] ^ -negateResult) + negateResult;
|
2012-12-13 02:33:53 +00:00
|
|
|
case GAMEARRAY_OFINT:
|
|
|
|
return (((int32_t *)aGameArrays[id].plValues)[index] ^ -negateResult) + negateResult;
|
|
|
|
case GAMEARRAY_OFSHORT:
|
|
|
|
return (((int16_t *)aGameArrays[id].plValues)[index] ^ -negateResult) + negateResult;
|
|
|
|
case GAMEARRAY_OFCHAR:
|
|
|
|
return (((uint8_t *)aGameArrays[id].plValues)[index] ^ -negateResult) + negateResult;
|
|
|
|
default:
|
|
|
|
goto arraywtf;
|
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
|
|
|
|
{
|
2009-09-28 00:01:06 +00:00
|
|
|
int32_t index=Gv_GetVarX(*insptr++);
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
switch ((id&(MAXGAMEVARS-1)) - g_iSpriteVarID)
|
2009-01-16 06:11:25 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
case 0: //if (id == g_iSpriteVarID)
|
2009-01-07 14:05:13 +00:00
|
|
|
{
|
2009-09-28 00:01:06 +00:00
|
|
|
register int32_t parm2 = 0, label = *insptr++;
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2009-01-16 07:24:15 +00:00
|
|
|
/*OSD_Printf("%d %d %d\n",__LINE__,index,label);*/
|
2009-01-07 14:05:13 +00:00
|
|
|
if (ActorLabels[label].flags & LABEL_HASPARM2)
|
|
|
|
parm2 = Gv_GetVarX(*insptr++);
|
2009-06-24 08:20:10 +00:00
|
|
|
|
2011-09-12 06:25:50 +00:00
|
|
|
if ((unsigned)index >= MAXSPRITES)
|
|
|
|
{
|
|
|
|
id = index;
|
|
|
|
goto badsprite;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessSpriteX(index, label, parm2) ^ -negateResult) + negateResult);
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
case 3: //else if (id == g_iPlayerVarID)
|
2009-01-07 14:05:13 +00:00
|
|
|
{
|
2009-09-28 00:01:06 +00:00
|
|
|
register int32_t parm2 = 0, label = *insptr++;
|
2009-01-07 14:05:13 +00:00
|
|
|
|
|
|
|
if (PlayerLabels[label].flags & LABEL_HASPARM2)
|
|
|
|
parm2 = Gv_GetVarX(*insptr++);
|
|
|
|
|
|
|
|
if (index == vm.g_i) index = vm.g_p;
|
2011-09-12 06:25:50 +00:00
|
|
|
|
|
|
|
if ((unsigned)index >= MAXPLAYERS)
|
|
|
|
{
|
|
|
|
id = index;
|
|
|
|
goto badplayer;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessPlayerX(index, label, parm2) ^ -negateResult) + negateResult);
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
case 4: //else if (id == g_iActorVarID)
|
|
|
|
return ((Gv_GetVar(*insptr++, index, vm.g_p) ^ -negateResult) + negateResult);
|
|
|
|
case 1: //else if (id == g_iSectorVarID)
|
2009-01-07 14:05:13 +00:00
|
|
|
if (index == vm.g_i) index = sprite[vm.g_i].sectnum;
|
2012-02-24 19:51:54 +00:00
|
|
|
if ((unsigned)index >= MAXSECTORS)
|
|
|
|
{
|
|
|
|
id = index;
|
|
|
|
insptr++;
|
|
|
|
goto badsector;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessSectorX(index, *insptr++) ^ -negateResult) + negateResult);
|
2009-06-24 08:20:10 +00:00
|
|
|
case 2: //else if (id == g_iWallVarID)
|
2012-02-24 19:51:54 +00:00
|
|
|
if ((unsigned)index >= MAXWALLS)
|
|
|
|
{
|
|
|
|
id = index;
|
|
|
|
insptr++;
|
|
|
|
goto badwall;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
return ((VM_AccessWallX(index, *insptr++) ^ -negateResult) + negateResult);
|
2009-06-24 08:20:10 +00:00
|
|
|
default:
|
2011-04-07 01:16:29 +00:00
|
|
|
goto wtf;
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
id &= (MAXGAMEVARS-1);
|
|
|
|
|
|
|
|
if (!negateResult)
|
2011-04-07 01:16:29 +00:00
|
|
|
goto badvarid;
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
|
|
|
default:
|
2009-06-24 08:20:10 +00:00
|
|
|
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_PERPLAYER:
|
2011-11-01 22:03:09 +00:00
|
|
|
if ((unsigned)vm.g_p >= MAXPLAYERS)
|
|
|
|
{
|
|
|
|
id = vm.g_p;
|
|
|
|
goto badplayer;
|
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
return ((aGameVars[id].val.plValues[vm.g_p] ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_PERACTOR:
|
2009-06-24 08:20:10 +00:00
|
|
|
return ((aGameVars[id].val.plValues[vm.g_i] ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_INTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
return (((*((int32_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_SHORTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
return (((*((int16_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
case GAMEVAR_CHARPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
return (((*((uint8_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
2011-04-07 01:16:29 +00:00
|
|
|
|
|
|
|
badindex:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): invalid array index (%s[%d])\n", aGameArrays[id].szLabel, (int32_t)negateResult);
|
2011-04-07 01:16:29 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badvarid:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): invalid gamevar ID (%d)\n", id);
|
2011-04-07 01:16:29 +00:00
|
|
|
return -1;
|
|
|
|
|
2011-09-12 06:25:50 +00:00
|
|
|
badplayer:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): invalid player ID %d\n", id);
|
2011-09-12 06:25:50 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badsprite:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): invalid sprite ID %d\n", id);
|
2012-02-24 19:51:54 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badsector:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): invalid sector ID %d\n", id);
|
2012-02-24 19:51:54 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
badwall:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): invalid wall ID %d\n", id);
|
2011-09-12 06:25:50 +00:00
|
|
|
return -1;
|
|
|
|
|
2012-12-13 02:33:53 +00:00
|
|
|
arraywtf:
|
|
|
|
CON_ERRPRINTF("Gv_GetVarX() (array): WTF?\n");
|
|
|
|
return -1;
|
|
|
|
|
2011-04-07 01:16:29 +00:00
|
|
|
wtf:
|
2012-12-13 02:33:53 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarX(): WTF?\n");
|
2011-04-07 01:16:29 +00:00
|
|
|
return -1;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
default:
|
|
|
|
aGameVars[id].val.lValue=lValue;
|
|
|
|
return;
|
|
|
|
case GAMEVAR_PERPLAYER:
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)vm.g_p > MAXPLAYERS-1) goto badindex;
|
2009-01-07 14:05:13 +00:00
|
|
|
aGameVars[id].val.plValues[vm.g_p]=lValue;
|
2008-12-21 22:46:55 +00:00
|
|
|
return;
|
|
|
|
case GAMEVAR_PERACTOR:
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)vm.g_i > MAXSPRITES-1) goto badindex;
|
2009-01-07 14:05:13 +00:00
|
|
|
aGameVars[id].val.plValues[vm.g_i]=lValue;
|
2008-12-21 22:46:55 +00:00
|
|
|
return;
|
|
|
|
case GAMEVAR_INTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
*((int32_t *)aGameVars[id].val.lValue)=(int32_t)lValue;
|
2008-12-21 22:46:55 +00:00
|
|
|
return;
|
|
|
|
case GAMEVAR_SHORTPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
*((int16_t *)aGameVars[id].val.lValue)=(int16_t)lValue;
|
2008-12-21 22:46:55 +00:00
|
|
|
return;
|
|
|
|
case GAMEVAR_CHARPTR:
|
2010-08-02 08:13:51 +00:00
|
|
|
*((uint8_t *)aGameVars[id].val.lValue)=(uint8_t)lValue;
|
2008-06-09 23:41:54 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
badindex:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_SetVar(): invalid index (%d) for gamevar %s\n",
|
2011-03-04 08:50:58 +00:00
|
|
|
aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? vm.g_i : vm.g_p,
|
|
|
|
aGameVars[id].szLabel);
|
2010-06-07 09:03:16 +00:00
|
|
|
return;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iActor, int32_t iPlayer)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t i = hash_find(&h_gamevars,szGameLabel);
|
2008-12-13 07:23:13 +00:00
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
return lDefault;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
return Gv_GetVar(i, iActor, iPlayer);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t i = hash_find(&h_gamevars,szGameLabel);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2008-12-13 07:23:13 +00:00
|
|
|
if (i < 0)
|
|
|
|
return NULL;
|
2008-08-25 00:49:12 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_PERPLAYER))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
if (!aGameVars[i].val.plValues)
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetVarDataPtr(): INTERNAL ERROR: NULL array !!!\n");
|
2008-12-21 22:46:55 +00:00
|
|
|
return aGameVars[i].val.plValues;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2008-12-21 22:46:55 +00:00
|
|
|
return &(aGameVars[i].val.lValue);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
2013-05-19 19:29:18 +00:00
|
|
|
#endif // !defined LUNATIC
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2012-12-29 15:21:24 +00:00
|
|
|
static void G_InitProjectileData(void)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
for (i=MAXTILES-1; i>=0; i--)
|
|
|
|
Bmemcpy(&ProjectileData[i], &g_tile[i].defproj, sizeof(projectile_t));
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void Gv_ResetSystemDefaults(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
// call many times...
|
2012-12-28 17:18:16 +00:00
|
|
|
#if !defined LUNATIC
|
2013-02-07 21:00:48 +00:00
|
|
|
int32_t i;
|
2012-12-28 17:18:16 +00:00
|
|
|
int32_t j;
|
2008-06-09 23:41:54 +00:00
|
|
|
char aszBuf[64];
|
|
|
|
|
|
|
|
//AddLog("ResetWeaponDefaults");
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=MAXPLAYERS-1; j>=0; j--)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=MAX_WEAPONS-1; i>=0; i--)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
|
|
|
Bsprintf(aszBuf,"WEAPON%d_CLIP",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponClip[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_RELOAD",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponReload[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponFireDelay[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponTotalTime[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponHoldDelay[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FLAGS",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponFlags[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponShoots[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2012-01-19 21:58:23 +00:00
|
|
|
if ((unsigned)aplWeaponShoots[i][j] >= MAXTILES)
|
|
|
|
aplWeaponShoots[i][j] = 0;
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSpawnTime[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SPAWN",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSpawn[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponShotsPerBurst[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponWorksLike[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponInitialSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponFireSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSound2Time[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSound2Sound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponReloadSound1[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponReloadSound2[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i);
|
|
|
|
aplWeaponSelectSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2009-04-13 06:01:50 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i);
|
|
|
|
aplWeaponFlashColor[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-20 21:17:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
g_iReturnVarID=Gv_GetVarIndex("RETURN");
|
|
|
|
g_iWeaponVarID=Gv_GetVarIndex("WEAPON");
|
|
|
|
g_iWorksLikeVarID=Gv_GetVarIndex("WORKSLIKE");
|
|
|
|
g_iZRangeVarID=Gv_GetVarIndex("ZRANGE");
|
|
|
|
g_iAngRangeVarID=Gv_GetVarIndex("ANGRANGE");
|
|
|
|
g_iAimAngleVarID=Gv_GetVarIndex("AUTOAIMANGLE");
|
|
|
|
g_iLoTagID=Gv_GetVarIndex("LOTAG");
|
|
|
|
g_iHiTagID=Gv_GetVarIndex("HITAG");
|
|
|
|
g_iTextureID=Gv_GetVarIndex("TEXTURE");
|
|
|
|
g_iThisActorID=Gv_GetVarIndex("THISACTOR");
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
g_iSpriteVarID=Gv_GetVarIndex("sprite");
|
|
|
|
g_iSectorVarID=Gv_GetVarIndex("sector");
|
|
|
|
g_iWallVarID=Gv_GetVarIndex("wall");
|
|
|
|
g_iPlayerVarID=Gv_GetVarIndex("player");
|
|
|
|
g_iActorVarID=Gv_GetVarIndex("actorvar");
|
2012-12-29 15:21:24 +00:00
|
|
|
#endif
|
|
|
|
G_InitProjectileData();
|
2008-06-09 23:41:54 +00:00
|
|
|
|
|
|
|
//AddLog("EOF:ResetWeaponDefaults");
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2013-06-02 14:07:56 +00:00
|
|
|
// Will set members that were overridden at CON translation time to 1.
|
|
|
|
// For example, if
|
|
|
|
// gamevar WEAPON1_SHOOTS 2200 GAMEVAR_PERPLAYER
|
|
|
|
// was specified at file scope, g_weaponOverridden[1].Shoots will be 1.
|
|
|
|
weapondata_t g_weaponOverridden[MAX_WEAPONS];
|
|
|
|
|
2012-12-28 17:18:12 +00:00
|
|
|
static weapondata_t weapondefaults[MAX_WEAPONS] = {
|
|
|
|
/*
|
|
|
|
WorksLike, Clip, Reload, FireDelay, TotalTime, HoldDelay,
|
|
|
|
Flags,
|
|
|
|
Shoots, SpawnTime, Spawn, ShotsPerBurst, InitialSound, FireSound, Sound2Time, Sound2Sound,
|
|
|
|
ReloadSound1, ReloadSound2, SelectSound, FlashColor
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
|
|
|
KNEE_WEAPON, 0, 0, 7, 14, 0,
|
|
|
|
WEAPON_NOVISIBLE | WEAPON_RANDOMRESTART | WEAPON_AUTOMATIC,
|
|
|
|
KNEE__STATIC, 0, 0, 0, 0, 0, 0,
|
2013-06-01 06:55:30 +00:00
|
|
|
0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, 0, 0
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
PISTOL_WEAPON, /*NAM?20:*/12, /*NAM?50:*/27, 2, 5, 0,
|
2013-01-05 13:09:31 +00:00
|
|
|
/*(NAM?WEAPON_HOLSTER_CLEARS_CLIP:0) |*/ WEAPON_RELOAD_TIMING,
|
2013-06-01 06:55:30 +00:00
|
|
|
SHOTSPARK1__STATIC, 2, SHELL__STATIC, 0, 0, PISTOL_FIRE__STATIC, 0, 0,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, INSERT_CLIP__STATIC, 255+(95<<8)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
SHOTGUN_WEAPON, 0, 13, 4, 30, 0,
|
|
|
|
WEAPON_CHECKATRELOAD,
|
2013-06-01 06:55:30 +00:00
|
|
|
SHOTGUN__STATIC, 24, SHOTGUNSHELL__STATIC, 7, 0, SHOTGUN_FIRE__STATIC, 15, SHOTGUN_COCK__STATIC,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SHOTGUN_COCK__STATIC, 255+(95<<8)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
CHAINGUN_WEAPON, 0, 0, 3, 12, 3,
|
|
|
|
WEAPON_AUTOMATIC | WEAPON_FIREEVERYTHIRD | WEAPON_AMMOPERSHOT | WEAPON_SPAWNTYPE3 | WEAPON_RESET,
|
2013-06-01 06:55:30 +00:00
|
|
|
CHAINGUN__STATIC, 1, SHELL__STATIC, 0, 0, CHAINGUN_FIRE__STATIC, 0, 0,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 255+(95<<8)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
RPG_WEAPON, 0, 0, 4, 20, 0,
|
|
|
|
0,
|
|
|
|
RPG__STATIC, 0, 0, 0, 0, 0, 0, 0,
|
2013-06-01 06:55:30 +00:00
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 255+(95<<8)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
HANDBOMB_WEAPON, 0, 30, 6, 19, 12,
|
|
|
|
WEAPON_THROWIT,
|
|
|
|
HEAVYHBOMB__STATIC, 0, 0, 0, 0, 0, 0,
|
2013-06-01 06:55:30 +00:00
|
|
|
0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, 0, 0
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
SHRINKER_WEAPON, 0, 0, 10, /*NAM?30:*/12, 0,
|
|
|
|
WEAPON_GLOWS,
|
2013-06-01 06:55:30 +00:00
|
|
|
SHRINKER__STATIC, 0, 0, 0, SHRINKER_FIRE__STATIC, 0, 0, 0,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 128+(255<<8)+(128<<16)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
DEVISTATOR_WEAPON, 0, 0, 3, 6, 5,
|
|
|
|
WEAPON_FIREEVERYOTHER | WEAPON_AMMOPERSHOT,
|
2013-06-01 06:55:30 +00:00
|
|
|
RPG__STATIC, 0, 0, 2, CAT_FIRE__STATIC, 0, 0, 0,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 255+(95<<8)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
TRIPBOMB_WEAPON, 0, 16, 3, 16, 7,
|
|
|
|
WEAPON_NOVISIBLE | WEAPON_STANDSTILL | WEAPON_CHECKATRELOAD,
|
|
|
|
HANDHOLDINGLASER__STATIC, 0, 0, 0, 0, 0, 0,
|
2013-06-01 06:55:30 +00:00
|
|
|
0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, 0, 0
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
FREEZE_WEAPON, 0, 0, 3, 5, 0,
|
|
|
|
WEAPON_RESET,
|
2013-06-01 06:55:30 +00:00
|
|
|
FREEZEBLAST__STATIC, 0, 0, 0, CAT_FIRE__STATIC, CAT_FIRE__STATIC, 0, 0,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 128+(128<<8)+(255<<16)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
HANDREMOTE_WEAPON, 0, 10, 2, 10, 0,
|
|
|
|
WEAPON_BOMB_TRIGGER | WEAPON_NOVISIBLE,
|
|
|
|
0, 0, 0, 0, 0, 0, 0,
|
2013-06-01 06:55:30 +00:00
|
|
|
0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, 0, 0
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
GROW_WEAPON, 0, 0, 3, /*NAM?30:*/5, 0,
|
|
|
|
WEAPON_GLOWS,
|
2013-06-01 06:55:30 +00:00
|
|
|
GROWSPARK__STATIC, /*NAM?2:*/0, /*NAM?SHELL:*/0, 0, 0, /*NAM?0:*/EXPANDERSHOOT__STATIC, 0, 0,
|
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 255+(95<<8)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
// KEEPINSYNC with what is contained above
|
|
|
|
// XXX: ugly
|
|
|
|
static int32_t G_StaticToDynamicTile(int32_t tile)
|
|
|
|
{
|
|
|
|
switch (tile)
|
|
|
|
{
|
|
|
|
case CHAINGUN__STATIC: return CHAINGUN;
|
|
|
|
case FREEZEBLAST__STATIC: return FREEZEBLAST;
|
|
|
|
case GROWSPARK__STATIC: return GROWSPARK;
|
|
|
|
case HANDHOLDINGLASER__STATIC: return HANDHOLDINGLASER;
|
|
|
|
case HEAVYHBOMB__STATIC: return HEAVYHBOMB;
|
|
|
|
case KNEE__STATIC: return KNEE;
|
|
|
|
case RPG__STATIC: return RPG;
|
|
|
|
case SHELL__STATIC: return SHELL;
|
|
|
|
case SHOTGUNSHELL__STATIC: return SHOTGUNSHELL;
|
|
|
|
case SHOTGUN__STATIC: return SHOTGUN;
|
|
|
|
case SHOTSPARK1__STATIC: return SHOTSPARK1;
|
|
|
|
case SHRINKER__STATIC: return SHRINKER;
|
|
|
|
default: return tile;
|
|
|
|
}
|
|
|
|
}
|
2013-06-01 06:55:30 +00:00
|
|
|
static int32_t G_StaticToDynamicSound(int32_t sound)
|
|
|
|
{
|
|
|
|
switch (sound)
|
|
|
|
{
|
|
|
|
case CAT_FIRE__STATIC: return CAT_FIRE;
|
|
|
|
case CHAINGUN_FIRE__STATIC: return CHAINGUN_FIRE;
|
|
|
|
case EJECT_CLIP__STATIC: return EJECT_CLIP;
|
|
|
|
case EXPANDERSHOOT__STATIC: return EXPANDERSHOOT;
|
|
|
|
case INSERT_CLIP__STATIC: return INSERT_CLIP;
|
|
|
|
case PISTOL_FIRE__STATIC: return PISTOL_FIRE;
|
|
|
|
case SELECT_WEAPON__STATIC: return SELECT_WEAPON;
|
|
|
|
case SHOTGUN_FIRE__STATIC: return SHOTGUN_FIRE;
|
|
|
|
case SHOTGUN_COCK__STATIC: return SHOTGUN_COCK;
|
|
|
|
case SHRINKER_FIRE__STATIC: return SHRINKER_FIRE;
|
|
|
|
default: return sound;
|
|
|
|
}
|
|
|
|
}
|
2012-12-28 17:18:12 +00:00
|
|
|
|
2013-06-02 14:07:56 +00:00
|
|
|
// Initialize WEAPONx_* gamevars. Since for Lunatic, they reside on the C side,
|
|
|
|
// they're set directly. In C-CON, a new CON variable is defined together with
|
|
|
|
// its initial value.
|
2012-12-28 17:18:16 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
# define ADDWEAPONVAR(Weapidx, Membname) do { \
|
|
|
|
int32_t j; \
|
|
|
|
for (j=0; j<MAXPLAYERS; j++) \
|
|
|
|
g_playerWeapon[j][Weapidx].Membname = weapondefaults[Weapidx].Membname; \
|
|
|
|
} while (0)
|
|
|
|
#else
|
|
|
|
# define ADDWEAPONVAR(Weapidx, Membname) do { \
|
2012-12-28 17:18:12 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_" #Membname, Weapidx); \
|
|
|
|
Bstrupr(aszBuf); \
|
|
|
|
Gv_NewVar(aszBuf, weapondefaults[Weapidx].Membname, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); \
|
|
|
|
} while (0)
|
2012-12-28 17:18:16 +00:00
|
|
|
#endif
|
2012-12-28 17:18:12 +00:00
|
|
|
|
2013-06-02 14:07:56 +00:00
|
|
|
// After CON translation, get not-overridden members from weapondefaults[] back
|
|
|
|
// into the live arrays! (That is, g_playerWeapon[][] for Lunatic, WEAPONx_*
|
|
|
|
// gamevars on the CON side in C-CON.)
|
|
|
|
#ifdef LUNATIC
|
|
|
|
# define POSTADDWEAPONVAR(Weapidx, Membname) ADDWEAPONVAR(Weapidx, Membname)
|
|
|
|
#else
|
|
|
|
// NYI
|
|
|
|
# define POSTADDWEAPONVAR(Weapidx, Membname) do {} while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Finish a default weapon member after CON translation. If it was not
|
|
|
|
// overridden from CON itself (see example at g_weaponOverridden[]), we set
|
|
|
|
// both the weapondefaults[] entry (probably dead by now) and the live value.
|
|
|
|
#define FINISH_WEAPON_DEFAULT_X(What, i, Membname) do { \
|
|
|
|
if (!g_weaponOverridden[i].Membname) \
|
|
|
|
{ \
|
|
|
|
weapondefaults[i].Membname = G_StaticToDynamic##What(weapondefaults[i].Membname); \
|
|
|
|
POSTADDWEAPONVAR(i, Membname); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define FINISH_WEAPON_DEFAULT_TILE(i, Membname) FINISH_WEAPON_DEFAULT_X(Tile, i, Membname)
|
|
|
|
#define FINISH_WEAPON_DEFAULT_SOUND(i, Membname) FINISH_WEAPON_DEFAULT_X(Sound, i, Membname)
|
|
|
|
|
|
|
|
// Process the dynamic {tile,sound} mappings after CON has been translated.
|
|
|
|
// We cannot do this before, because the dynamic maps are not yet set up then.
|
|
|
|
void Gv_FinalizeWeaponDefaults(void)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (i=0; i<MAX_WEAPONS; i++)
|
|
|
|
{
|
|
|
|
FINISH_WEAPON_DEFAULT_TILE(i, Shoots);
|
|
|
|
FINISH_WEAPON_DEFAULT_TILE(i, Spawn);
|
|
|
|
|
|
|
|
FINISH_WEAPON_DEFAULT_SOUND(i, InitialSound);
|
|
|
|
FINISH_WEAPON_DEFAULT_SOUND(i, FireSound);
|
|
|
|
FINISH_WEAPON_DEFAULT_SOUND(i, ReloadSound1);
|
|
|
|
FINISH_WEAPON_DEFAULT_SOUND(i, Sound2Sound);
|
|
|
|
FINISH_WEAPON_DEFAULT_SOUND(i, ReloadSound2);
|
|
|
|
FINISH_WEAPON_DEFAULT_SOUND(i, SelectSound);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#undef FINISH_WEAPON_DEFAULT_SOUND
|
|
|
|
#undef FINISH_WEAPON_DEFAULT_TILE
|
|
|
|
#undef FINISH_WEAPON_DEFAULT_X
|
|
|
|
#undef POSTADDWEAPONVAR
|
|
|
|
|
2013-07-18 18:08:13 +00:00
|
|
|
#if !defined LUNATIC
|
|
|
|
static int32_t lastvisinc;
|
|
|
|
#endif
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
static void Gv_AddSystemVars(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
// only call ONCE
|
2012-12-28 17:18:16 +00:00
|
|
|
#if !defined LUNATIC
|
2008-06-09 23:41:54 +00:00
|
|
|
char aszBuf[64];
|
2012-12-28 17:18:16 +00:00
|
|
|
#endif
|
2012-12-28 17:18:12 +00:00
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
if (NAM)
|
|
|
|
{
|
|
|
|
weapondefaults[PISTOL_WEAPON].Clip = 20;
|
|
|
|
weapondefaults[PISTOL_WEAPON].Reload = 50;
|
2013-01-04 17:27:43 +00:00
|
|
|
weapondefaults[PISTOL_WEAPON].Flags |= WEAPON_HOLSTER_CLEARS_CLIP;
|
2012-12-28 17:18:12 +00:00
|
|
|
|
|
|
|
weapondefaults[SHRINKER_WEAPON].TotalTime = 30;
|
|
|
|
|
|
|
|
weapondefaults[GROW_WEAPON].TotalTime = 30;
|
|
|
|
weapondefaults[GROW_WEAPON].SpawnTime = 2;
|
|
|
|
weapondefaults[GROW_WEAPON].Spawn = SHELL;
|
|
|
|
weapondefaults[GROW_WEAPON].FireSound = 0;
|
|
|
|
}
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2012-12-28 17:18:12 +00:00
|
|
|
for (i=0; i<MAX_WEAPONS; i++)
|
|
|
|
{
|
|
|
|
ADDWEAPONVAR(i, WorksLike);
|
|
|
|
ADDWEAPONVAR(i, Clip);
|
|
|
|
ADDWEAPONVAR(i, Reload);
|
|
|
|
ADDWEAPONVAR(i, FireDelay);
|
|
|
|
ADDWEAPONVAR(i, TotalTime);
|
|
|
|
ADDWEAPONVAR(i, HoldDelay);
|
|
|
|
ADDWEAPONVAR(i, Flags);
|
|
|
|
ADDWEAPONVAR(i, Shoots);
|
|
|
|
ADDWEAPONVAR(i, SpawnTime);
|
|
|
|
ADDWEAPONVAR(i, Spawn);
|
|
|
|
ADDWEAPONVAR(i, ShotsPerBurst);
|
|
|
|
ADDWEAPONVAR(i, InitialSound);
|
|
|
|
ADDWEAPONVAR(i, FireSound);
|
|
|
|
ADDWEAPONVAR(i, Sound2Time);
|
|
|
|
ADDWEAPONVAR(i, Sound2Sound);
|
|
|
|
ADDWEAPONVAR(i, ReloadSound1);
|
|
|
|
ADDWEAPONVAR(i, ReloadSound2);
|
|
|
|
ADDWEAPONVAR(i, SelectSound);
|
|
|
|
ADDWEAPONVAR(i, FlashColor);
|
|
|
|
}
|
2013-01-19 18:28:55 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
for (i=0; i<MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
DukePlayer_t *ps = g_player[i].ps;
|
|
|
|
|
|
|
|
ps->pipebombControl = NAM ? PIPEBOMB_TIMER : PIPEBOMB_REMOTE;
|
|
|
|
ps->pipebombLifetime = NAM_GRENADE_LIFETIME;
|
|
|
|
ps->pipebombLifetimeVar = NAM_GRENADE_LIFETIME_VAR;
|
|
|
|
|
|
|
|
ps->tripbombControl = TRIPBOMB_TRIPWIRE;
|
|
|
|
ps->tripbombLifetime = NAM_GRENADE_LIFETIME;
|
|
|
|
ps->tripbombLifetimeVar = NAM_GRENADE_LIFETIME_VAR;
|
|
|
|
}
|
|
|
|
#else
|
2008-12-13 07:23:13 +00:00
|
|
|
Gv_NewVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
|
|
|
|
Gv_NewVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
|
|
|
|
Gv_NewVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("PIPEBOMB_CONTROL", NAM?PIPEBOMB_TIMER:PIPEBOMB_REMOTE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
|
|
|
|
Gv_NewVar("RESPAWN_MONSTERS", (intptr_t)&ud.respawn_monsters,GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("RESPAWN_ITEMS",(intptr_t)&ud.respawn_items, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("RESPAWN_INVENTORY",(intptr_t)&ud.respawn_inventory, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("MONSTERS_OFF",(intptr_t)&ud.monsters_off, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("MARKER",(intptr_t)&ud.marker, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("FFIRE",(intptr_t)&ud.ffire, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("LEVEL",(intptr_t)&ud.level_number, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("VOLUME",(intptr_t)&ud.volume_number, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
|
|
|
|
|
|
|
Gv_NewVar("COOP",(intptr_t)&ud.coop, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("MULTIMODE",(intptr_t)&ud.multimode, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
|
|
|
|
Gv_NewVar("WEAPON", 0, GAMEVAR_PERPLAYER | GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("WORKSLIKE", 0, GAMEVAR_PERPLAYER | GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("RETURN", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("ZRANGE", 4, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("ANGRANGE", 18, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("AUTOAIMANGLE", 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("LOTAG", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("HITAG", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("TEXTURE", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("THISACTOR", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
2009-01-07 14:05:13 +00:00
|
|
|
|
|
|
|
// special vars for struct access
|
2009-02-02 01:49:14 +00:00
|
|
|
Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("sector", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("wall", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
2013-01-19 18:28:48 +00:00
|
|
|
Gv_NewVar("currentweapon",(intptr_t)&hudweap.cur, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("gs",(intptr_t)&hudweap.shade, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("looking_arc",(intptr_t)&hudweap.lookhoriz, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("gun_pos",(intptr_t)&hudweap.gunposy, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("weapon_xoffset",(intptr_t)&hudweap.gunposx, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("weaponcount",(intptr_t)&hudweap.count, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("looking_angSR1",(intptr_t)&hudweap.lookhalfang, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowx2",(intptr_t)&windowx2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowy1",(intptr_t)&windowy1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowy2",(intptr_t)&windowy2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
2008-12-13 07:23:13 +00:00
|
|
|
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
|
|
|
|
|
|
|
Gv_NewVar("current_menu",(intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
2008-12-13 07:23:13 +00:00
|
|
|
Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("gametype_flags",(intptr_t)&GametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
2008-12-13 07:23:13 +00:00
|
|
|
Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
|
|
|
|
2013-01-19 18:28:32 +00:00
|
|
|
Gv_NewVar("camerax",(intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("cameray",(intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("cameraz",(intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
|
|
|
|
Gv_NewVar("myx",(intptr_t)&my.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("myy",(intptr_t)&my.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("myz",(intptr_t)&my.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("omyx",(intptr_t)&omy.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("omyy",(intptr_t)&omy.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("omyz",(intptr_t)&omy.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("myvelx",(intptr_t)&myvel.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("myvely",(intptr_t)&myvel.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
Gv_NewVar("myvelz",(intptr_t)&myvel.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
|
|
|
|
Gv_NewVar("myhoriz",(intptr_t)&myhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("myhorizoff",(intptr_t)&myhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("omyhoriz",(intptr_t)&omyhoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("omyhorizoff",(intptr_t)&omyhorizoff, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("myang",(intptr_t)&myang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("omyang",(intptr_t)&omyang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("mycursectnum",(intptr_t)&mycursectnum, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
Gv_NewVar("myjumpingcounter",(intptr_t)&myjumpingcounter, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
|
|
|
|
|
|
|
Gv_NewVar("myjumpingtoggle",(intptr_t)&myjumpingtoggle, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
|
|
|
Gv_NewVar("myonground",(intptr_t)&myonground, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
|
|
|
Gv_NewVar("myhardlanding",(intptr_t)&myhardlanding, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
|
|
|
Gv_NewVar("myreturntocenter",(intptr_t)&myreturntocenter, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
|
|
|
|
|
|
|
Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
2008-12-13 07:23:13 +00:00
|
|
|
Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
|
|
|
|
|
|
|
Gv_NewVar("NUMWALLS",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
2012-03-14 22:32:04 +00:00
|
|
|
Gv_NewVar("Numsprites",(intptr_t)&Numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
2012-12-29 15:21:24 +00:00
|
|
|
# ifdef USE_OPENGL
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
2012-12-29 15:21:24 +00:00
|
|
|
# else
|
2011-04-07 01:16:29 +00:00
|
|
|
Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
2012-12-29 15:21:24 +00:00
|
|
|
# endif
|
2012-12-13 02:33:53 +00:00
|
|
|
|
2013-12-06 18:56:39 +00:00
|
|
|
// SYSTEM_GAMEARRAY
|
2012-12-13 02:33:53 +00:00
|
|
|
Gv_NewArray("tilesizx", (void *)tilesizx, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
|
|
|
|
Gv_NewArray("tilesizy", (void *)tilesizy, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
|
2012-12-29 15:21:24 +00:00
|
|
|
#endif
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2013-06-02 14:07:56 +00:00
|
|
|
#undef ADDWEAPONVAR
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void Gv_Init(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
// only call ONCE
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2011-07-22 22:00:53 +00:00
|
|
|
// (... not true anymore)
|
|
|
|
static int32_t inited=0;
|
|
|
|
if (inited)
|
|
|
|
return;
|
|
|
|
inited = 1;
|
|
|
|
|
2013-06-01 20:09:46 +00:00
|
|
|
#if !defined LUNATIC
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_Clear();
|
2013-06-01 20:09:46 +00:00
|
|
|
#endif
|
|
|
|
// Set up weapon defaults, g_playerWeapon[][].
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_AddSystemVars();
|
2013-06-01 20:09:46 +00:00
|
|
|
#if !defined LUNATIC
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_InitWeaponPointers();
|
2012-12-29 15:21:24 +00:00
|
|
|
#endif
|
2013-02-07 21:00:48 +00:00
|
|
|
Gv_ResetSystemDefaults();
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:18 +00:00
|
|
|
#if !defined LUNATIC
|
2008-11-20 14:06:36 +00:00
|
|
|
void Gv_InitWeaponPointers(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2008-06-09 23:41:54 +00:00
|
|
|
char aszBuf[64];
|
|
|
|
// called from game Init AND when level is loaded...
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
//AddLog("Gv_InitWeaponPointers");
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=(MAX_WEAPONS-1); i>=0; i--)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
|
|
|
Bsprintf(aszBuf,"WEAPON%d_CLIP",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponClip[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
if (!aplWeaponClip[i])
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
initprintf("ERROR: NULL weapon! WTF?!\n");
|
|
|
|
// exit(0);
|
|
|
|
G_Shutdown();
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
Bsprintf(aszBuf,"WEAPON%d_RELOAD",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponReload[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponFireDelay[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponTotalTime[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponHoldDelay[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FLAGS",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponFlags[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponShoots[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSpawnTime[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SPAWN",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSpawn[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponShotsPerBurst[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponWorksLike[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponInitialSound[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponFireSound[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSound2Time[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponSound2Sound[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponReloadSound1[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",i);
|
2008-11-20 14:06:36 +00:00
|
|
|
aplWeaponReloadSound2[i]=Gv_GetVarDataPtr(aszBuf);
|
|
|
|
Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i);
|
|
|
|
aplWeaponSelectSound[i]=Gv_GetVarDataPtr(aszBuf);
|
2009-04-13 06:01:50 +00:00
|
|
|
Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i);
|
|
|
|
aplWeaponFlashColor[i]=Gv_GetVarDataPtr(aszBuf);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void Gv_RefreshPointers(void)
|
2007-04-17 05:54:12 +00:00
|
|
|
{
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("RESPAWN_MONSTERS")].val.lValue = (intptr_t)&ud.respawn_monsters;
|
|
|
|
aGameVars[Gv_GetVarIndex("RESPAWN_ITEMS")].val.lValue = (intptr_t)&ud.respawn_items;
|
|
|
|
aGameVars[Gv_GetVarIndex("RESPAWN_INVENTORY")].val.lValue = (intptr_t)&ud.respawn_inventory;
|
|
|
|
aGameVars[Gv_GetVarIndex("MONSTERS_OFF")].val.lValue = (intptr_t)&ud.monsters_off;
|
|
|
|
aGameVars[Gv_GetVarIndex("MARKER")].val.lValue = (intptr_t)&ud.marker;
|
|
|
|
aGameVars[Gv_GetVarIndex("FFIRE")].val.lValue = (intptr_t)&ud.ffire;
|
|
|
|
aGameVars[Gv_GetVarIndex("LEVEL")].val.lValue = (intptr_t)&ud.level_number;
|
|
|
|
aGameVars[Gv_GetVarIndex("VOLUME")].val.lValue = (intptr_t)&ud.volume_number;
|
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("COOP")].val.lValue = (intptr_t)&ud.coop;
|
|
|
|
aGameVars[Gv_GetVarIndex("MULTIMODE")].val.lValue = (intptr_t)&ud.multimode;
|
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("myconnectindex")].val.lValue = (intptr_t)&myconnectindex;
|
|
|
|
aGameVars[Gv_GetVarIndex("screenpeek")].val.lValue = (intptr_t)&screenpeek;
|
2013-01-19 18:28:48 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("currentweapon")].val.lValue = (intptr_t)&hudweap.cur;
|
|
|
|
aGameVars[Gv_GetVarIndex("gs")].val.lValue = (intptr_t)&hudweap.shade;
|
|
|
|
aGameVars[Gv_GetVarIndex("looking_arc")].val.lValue = (intptr_t)&hudweap.lookhoriz;
|
|
|
|
aGameVars[Gv_GetVarIndex("gun_pos")].val.lValue = (intptr_t)&hudweap.gunposy;
|
|
|
|
aGameVars[Gv_GetVarIndex("weapon_xoffset")].val.lValue = (intptr_t)&hudweap.gunposx;
|
|
|
|
aGameVars[Gv_GetVarIndex("weaponcount")].val.lValue = (intptr_t)&hudweap.count;
|
|
|
|
aGameVars[Gv_GetVarIndex("looking_angSR1")].val.lValue = (intptr_t)&hudweap.lookhalfang;
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("xdim")].val.lValue = (intptr_t)&xdim;
|
|
|
|
aGameVars[Gv_GetVarIndex("ydim")].val.lValue = (intptr_t)&ydim;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowx1")].val.lValue = (intptr_t)&windowx1;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowx2")].val.lValue = (intptr_t)&windowx2;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowy1")].val.lValue = (intptr_t)&windowy1;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowy2")].val.lValue = (intptr_t)&windowy2;
|
|
|
|
aGameVars[Gv_GetVarIndex("totalclock")].val.lValue = (intptr_t)&totalclock;
|
|
|
|
aGameVars[Gv_GetVarIndex("lastvisinc")].val.lValue = (intptr_t)&lastvisinc;
|
|
|
|
aGameVars[Gv_GetVarIndex("numsectors")].val.lValue = (intptr_t)&numsectors;
|
|
|
|
aGameVars[Gv_GetVarIndex("numplayers")].val.lValue = (intptr_t)&numplayers;
|
|
|
|
aGameVars[Gv_GetVarIndex("current_menu")].val.lValue = (intptr_t)&g_currentMenu;
|
|
|
|
aGameVars[Gv_GetVarIndex("viewingrange")].val.lValue = (intptr_t)&viewingrange;
|
|
|
|
aGameVars[Gv_GetVarIndex("yxaspect")].val.lValue = (intptr_t)&yxaspect;
|
|
|
|
aGameVars[Gv_GetVarIndex("gravitationalconstant")].val.lValue = (intptr_t)&g_spriteGravity;
|
|
|
|
aGameVars[Gv_GetVarIndex("gametype_flags")].val.lValue = (intptr_t)&GametypeFlags[ud.coop];
|
|
|
|
aGameVars[Gv_GetVarIndex("framerate")].val.lValue = (intptr_t)&g_currentFrameRate;
|
|
|
|
|
2013-01-19 18:28:32 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("camerax")].val.lValue = (intptr_t)&ud.camerapos.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameray")].val.lValue = (intptr_t)&ud.camerapos.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameraz")].val.lValue = (intptr_t)&ud.camerapos.z;
|
2008-12-21 22:46:55 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("cameraang")].val.lValue = (intptr_t)&ud.cameraang;
|
|
|
|
aGameVars[Gv_GetVarIndex("camerahoriz")].val.lValue = (intptr_t)&ud.camerahoriz;
|
|
|
|
aGameVars[Gv_GetVarIndex("camerasect")].val.lValue = (intptr_t)&ud.camerasect;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameradist")].val.lValue = (intptr_t)&g_cameraDistance;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameraclock")].val.lValue = (intptr_t)&g_cameraClock;
|
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("myx")].val.lValue = (intptr_t)&my.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("myy")].val.lValue = (intptr_t)&my.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("myz")].val.lValue = (intptr_t)&my.z;
|
|
|
|
aGameVars[Gv_GetVarIndex("omyx")].val.lValue = (intptr_t)&omy.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("omyy")].val.lValue = (intptr_t)&omy.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("omyz")].val.lValue = (intptr_t)&omy.z;
|
|
|
|
aGameVars[Gv_GetVarIndex("myvelx")].val.lValue = (intptr_t)&myvel.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("myvely")].val.lValue = (intptr_t)&myvel.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("myvelz")].val.lValue = (intptr_t)&myvel.z;
|
2008-12-21 22:46:55 +00:00
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("myhoriz")].val.lValue = (intptr_t)&myhoriz;
|
|
|
|
aGameVars[Gv_GetVarIndex("myhorizoff")].val.lValue = (intptr_t)&myhorizoff;
|
|
|
|
aGameVars[Gv_GetVarIndex("omyhoriz")].val.lValue = (intptr_t)&omyhoriz;
|
|
|
|
aGameVars[Gv_GetVarIndex("omyhorizoff")].val.lValue = (intptr_t)&omyhorizoff;
|
|
|
|
aGameVars[Gv_GetVarIndex("myang")].val.lValue = (intptr_t)&myang;
|
|
|
|
aGameVars[Gv_GetVarIndex("omyang")].val.lValue = (intptr_t)&omyang;
|
|
|
|
aGameVars[Gv_GetVarIndex("mycursectnum")].val.lValue = (intptr_t)&mycursectnum;
|
|
|
|
aGameVars[Gv_GetVarIndex("myjumpingcounter")].val.lValue = (intptr_t)&myjumpingcounter;
|
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("myjumpingtoggle")].val.lValue = (intptr_t)&myjumpingtoggle;
|
|
|
|
aGameVars[Gv_GetVarIndex("myonground")].val.lValue = (intptr_t)&myonground;
|
|
|
|
aGameVars[Gv_GetVarIndex("myhardlanding")].val.lValue = (intptr_t)&myhardlanding;
|
|
|
|
aGameVars[Gv_GetVarIndex("myreturntocenter")].val.lValue = (intptr_t)&myreturntocenter;
|
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("display_mirror")].val.lValue = (intptr_t)&display_mirror;
|
|
|
|
aGameVars[Gv_GetVarIndex("randomseed")].val.lValue = (intptr_t)&randomseed;
|
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("NUMWALLS")].val.lValue = (intptr_t)&numwalls;
|
|
|
|
aGameVars[Gv_GetVarIndex("NUMSECTORS")].val.lValue = (intptr_t)&numsectors;
|
2012-03-14 22:32:04 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("Numsprites")].val.lValue = (intptr_t)&Numsprites;
|
2008-12-21 22:46:55 +00:00
|
|
|
|
|
|
|
aGameVars[Gv_GetVarIndex("lastsavepos")].val.lValue = (intptr_t)&g_lastSaveSlot;
|
2012-12-29 15:21:24 +00:00
|
|
|
# ifdef USE_OPENGL
|
2009-05-07 18:50:53 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("rendmode")].val.lValue = (intptr_t)&rendmode;
|
2012-12-29 15:21:24 +00:00
|
|
|
# endif
|
2007-04-17 05:54:12 +00:00
|
|
|
}
|
2013-01-01 15:24:18 +00:00
|
|
|
#endif
|