2006-12-10 06:49:01 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2016-02-07 02:38:03 +00:00
|
|
|
Copyright (C) 2016 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
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-12-10 06:49:01 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2019-09-21 18:59:54 +00:00
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2006-12-10 06:49:01 +00:00
|
|
|
#include "duke3d.h"
|
2014-05-31 12:26:41 +00:00
|
|
|
#include "menus.h"
|
2017-12-18 11:24:53 +00:00
|
|
|
#include "savegame.h"
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
#include "vfs.h"
|
|
|
|
|
2014-11-22 12:32:56 +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;
|
2016-08-27 01:40:35 +00:00
|
|
|
LUNATIC_CB void (*A_ResetVars)(int32_t spriteNum);
|
2014-01-31 21:13:03 +00:00
|
|
|
#else
|
2015-01-11 04:56:10 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
gamevar_t aGameVars[MAXGAMEVARS];
|
2015-01-11 04:56:10 +00:00
|
|
|
gamearray_t aGameArrays[MAXGAMEARRAYS];
|
2016-08-27 01:40:35 +00:00
|
|
|
int32_t g_gameVarCount = 0;
|
|
|
|
int32_t g_gameArrayCount = 0;
|
2015-01-11 04:56:10 +00:00
|
|
|
|
|
|
|
// pointers to weapon gamevar data
|
2016-08-27 01:40:35 +00:00
|
|
|
intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine
|
2015-01-11 04:56:10 +00:00
|
|
|
intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire
|
2018-11-18 18:11:27 +00:00
|
|
|
intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
|
2016-08-27 01:40:35 +00:00
|
|
|
intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon
|
2018-11-18 18:11:27 +00:00
|
|
|
intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color
|
|
|
|
intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none)
|
2015-01-11 04:56:10 +00:00
|
|
|
intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when weapon starts firing. zero for no sound
|
2018-11-18 18:11:27 +00:00
|
|
|
intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire)
|
2016-08-27 01:40:35 +00:00
|
|
|
intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed
|
|
|
|
intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
|
|
|
|
intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound of weapon being selected
|
2018-11-18 18:11:27 +00:00
|
|
|
intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots
|
|
|
|
intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst')
|
|
|
|
intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
|
|
|
|
intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
|
|
|
|
intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
|
|
|
|
intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item
|
|
|
|
intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire.
|
|
|
|
intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
|
2015-01-11 04:56:10 +00:00
|
|
|
|
2017-02-01 10:20:54 +00:00
|
|
|
# include "gamestructures.cpp"
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2014-12-26 17:29:56 +00:00
|
|
|
// Frees the memory for the *values* of game variables and arrays. Resets their
|
|
|
|
// counts to zero. Call this function as many times as needed.
|
|
|
|
//
|
|
|
|
// Returns: old g_gameVarCount | (g_gameArrayCount<<16).
|
2017-10-16 21:17:47 +00:00
|
|
|
int Gv_Free(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2018-11-18 18:11:27 +00:00
|
|
|
for (auto &gameVar : aGameVars)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2018-11-18 18:11:27 +00:00
|
|
|
if (gameVar.flags & GAMEVAR_USER_MASK)
|
|
|
|
ALIGNED_FREE_AND_NULL(gameVar.pValues);
|
|
|
|
gameVar.flags |= GAMEVAR_RESET;
|
2014-12-26 17:29:56 +00:00
|
|
|
}
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2018-11-18 18:11:27 +00:00
|
|
|
for (auto & gameArray : aGameArrays)
|
2014-12-26 17:29:56 +00:00
|
|
|
{
|
2018-11-18 18:11:27 +00:00
|
|
|
if (gameArray.flags & GAMEARRAY_ALLOCATED)
|
|
|
|
ALIGNED_FREE_AND_NULL(gameArray.pValues);
|
|
|
|
gameArray.flags |= GAMEARRAY_RESET;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2013-01-20 21:17:10 +00:00
|
|
|
|
2014-12-26 17:29:56 +00:00
|
|
|
EDUKE32_STATIC_ASSERT(MAXGAMEVARS < 32768);
|
2016-08-27 01:40:35 +00:00
|
|
|
int const varCount = g_gameVarCount | (g_gameArrayCount << 16);
|
2013-01-20 21:17:10 +00:00
|
|
|
g_gameVarCount = g_gameArrayCount = 0;
|
2014-12-26 17:29:56 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
hash_init(&h_gamevars);
|
|
|
|
hash_init(&h_arrays);
|
2014-12-26 17:29:56 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
return varCount;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2014-12-26 17:29:56 +00:00
|
|
|
// Calls Gv_Free() and in addition frees the labels of all game variables and
|
|
|
|
// arrays.
|
2018-11-18 18:14:26 +00:00
|
|
|
// Only call this function at exit
|
2017-10-16 21:17:47 +00:00
|
|
|
void Gv_Clear(void)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2018-11-18 18:11:27 +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.
|
2018-11-18 18:11:27 +00:00
|
|
|
for (auto & gameVar : aGameVars)
|
|
|
|
DO_FREE_AND_NULL(gameVar.szLabel);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2018-11-18 18:11:27 +00:00
|
|
|
for (auto & gameArray : aGameArrays)
|
|
|
|
DO_FREE_AND_NULL(gameArray.szLabel);
|
2018-11-18 18:14:26 +00:00
|
|
|
|
2018-12-15 01:39:51 +00:00
|
|
|
for (auto i : struct_tables)
|
2018-11-18 18:14:26 +00:00
|
|
|
hash_free(i);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
int Gv_ReadSave(buildvfs_kfd kFile)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2010-01-24 23:33:17 +00:00
|
|
|
char tbuf[12];
|
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (kread(kFile, 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
|
|
|
|
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
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(&g_gameVarCount,sizeof(g_gameVarCount),1,kFile) != 1) goto corrupt;
|
2016-08-27 01:41:21 +00:00
|
|
|
for (bssize_t i=0; i<g_gameVarCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2014-12-26 17:29:56 +00:00
|
|
|
char *const olabel = aGameVars[i].szLabel;
|
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(&aGameVars[i], sizeof(gamevar_t), 1, kFile) != 1)
|
2014-12-26 17:29:56 +00:00
|
|
|
goto corrupt;
|
|
|
|
|
2017-07-08 19:41:36 +00:00
|
|
|
aGameVars[i].szLabel = (char *)Xrealloc(olabel, MAXVARLABEL * sizeof(uint8_t));
|
2014-12-26 17:29:56 +00:00
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(aGameVars[i].szLabel, MAXVARLABEL, 1, kFile) != 1)
|
2014-12-26 17:29:56 +00:00
|
|
|
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
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & GAMEVAR_PERPLAYER)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2016-08-27 01:40:06 +00:00
|
|
|
aGameVars[i].pValues = (intptr_t*)Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t));
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(aGameVars[i].pValues,sizeof(intptr_t) * MAXPLAYERS, 1, kFile) != 1) goto corrupt;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2016-08-27 01:40:35 +00:00
|
|
|
else if (aGameVars[i].flags & GAMEVAR_PERACTOR)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2016-08-27 01:40:06 +00:00
|
|
|
aGameVars[i].pValues = (intptr_t*)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t));
|
2018-10-16 06:09:32 +00:00
|
|
|
if (kdfread_LZ4(aGameVars[i].pValues,sizeof(intptr_t) * MAXSPRITES, 1, kFile) != 1) goto corrupt;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
|
|
|
|
Gv_InitWeaponPointers();
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(&g_gameArrayCount,sizeof(g_gameArrayCount),1,kFile) != 1) goto corrupt;
|
2016-08-27 01:41:21 +00:00
|
|
|
for (bssize_t i=0; i<g_gameArrayCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2014-12-26 17:29:56 +00:00
|
|
|
char *const olabel = aGameArrays[i].szLabel;
|
|
|
|
|
2012-12-15 11:28:56 +00:00
|
|
|
// read for .size and .dwFlags (the rest are pointers):
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(&aGameArrays[i], sizeof(gamearray_t), 1, kFile) != 1)
|
2014-12-26 17:29:56 +00:00
|
|
|
goto corrupt;
|
|
|
|
|
2017-07-08 19:41:36 +00:00
|
|
|
aGameArrays[i].szLabel = (char *) Xrealloc(olabel, MAXARRAYLABEL * sizeof(uint8_t));
|
2012-12-15 11:28:56 +00:00
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, kFile) != 1)
|
2014-12-26 17:29:56 +00:00
|
|
|
goto corrupt;
|
2017-07-18 20:53:22 +00:00
|
|
|
|
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
|
|
|
|
2015-09-24 06:31:55 +00:00
|
|
|
intptr_t const asize = aGameArrays[i].size;
|
2017-07-11 04:03:01 +00:00
|
|
|
|
2017-07-20 08:57:50 +00:00
|
|
|
if (asize != 0 && !(aGameArrays[i].flags & GAMEARRAY_SYSTEM))
|
2015-09-24 06:31:55 +00:00
|
|
|
{
|
2017-10-31 02:09:25 +00:00
|
|
|
aGameArrays[i].pValues = (intptr_t *)Xaligned_alloc(ARRAY_ALIGNMENT, Gv_GetArrayAllocSize(i));
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(aGameArrays[i].pValues, Gv_GetArrayAllocSize(i), 1, kFile) < 1) goto corrupt;
|
2015-09-24 06:31:55 +00:00
|
|
|
}
|
|
|
|
else
|
2016-08-27 01:40:06 +00:00
|
|
|
aGameArrays[i].pValues = NULL;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-20 08:57:50 +00:00
|
|
|
Gv_RefreshPointers();
|
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
uint8_t savedstate[MAXVOLUMES*MAXLEVELS];
|
|
|
|
Bmemset(savedstate, 0, sizeof(savedstate));
|
2008-07-16 21:21:18 +00:00
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(savedstate, sizeof(savedstate), 1, kFile) != 1) goto corrupt;
|
2008-07-16 21:21:18 +00:00
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
for (bssize_t i = 0; i < (MAXVOLUMES * MAXLEVELS); i++)
|
2008-07-16 21:21:18 +00:00
|
|
|
{
|
2017-10-31 02:09:25 +00:00
|
|
|
G_FreeMapState(i);
|
|
|
|
|
|
|
|
if (!savedstate[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
g_mapInfo[i].savedstate = (mapstate_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, sizeof(mapstate_t));
|
2018-10-16 06:09:32 +00:00
|
|
|
if (kdfread_LZ4(g_mapInfo[i].savedstate, sizeof(mapstate_t), 1, kFile) != 1) return -8;
|
2017-10-31 02:09:25 +00:00
|
|
|
|
|
|
|
mapstate_t &sv = *g_mapInfo[i].savedstate;
|
|
|
|
|
|
|
|
for (bssize_t j = 0; j < g_gameVarCount; j++)
|
2008-07-16 21:21:18 +00:00
|
|
|
{
|
2017-10-31 02:09:25 +00:00
|
|
|
if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
|
|
|
|
if (aGameVars[j].flags & GAMEVAR_PERPLAYER)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2017-10-31 02:09:25 +00:00
|
|
|
sv.vars[j] = (intptr_t *) Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t));
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(sv.vars[j], sizeof(intptr_t) * MAXPLAYERS, 1, kFile) != 1) return -9;
|
2017-10-31 02:09:25 +00:00
|
|
|
}
|
|
|
|
else if (aGameVars[j].flags & GAMEVAR_PERACTOR)
|
|
|
|
{
|
|
|
|
sv.vars[j] = (intptr_t *) Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t));
|
2018-10-16 06:09:32 +00:00
|
|
|
if (kdfread_LZ4(sv.vars[j], sizeof(intptr_t) * MAXSPRITES, 1, kFile) != 1) return -10;
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2008-07-16 21:21:18 +00:00
|
|
|
}
|
2017-10-31 02:09:25 +00:00
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(sv.arraysiz, sizeof(sv.arraysiz), 1, kFile) < 1)
|
2017-10-31 02:09:25 +00:00
|
|
|
return -11;
|
|
|
|
|
|
|
|
for (bssize_t j = 0; j < g_gameArrayCount; j++)
|
|
|
|
if (aGameArrays[j].flags & GAMEARRAY_RESTORE)
|
|
|
|
{
|
|
|
|
size_t const siz = Gv_GetArrayAllocSizeForCount(j, sv.arraysiz[j]);
|
|
|
|
sv.arrays[j] = (intptr_t *) Xaligned_alloc(ARRAY_ALIGNMENT, siz);
|
2018-03-23 21:41:02 +00:00
|
|
|
if (kdfread_LZ4(sv.arrays[j], siz, 1, kFile) < 1) return -12;
|
2017-10-31 02:09:25 +00:00
|
|
|
}
|
2008-07-16 21:21:18 +00:00
|
|
|
}
|
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
if (kread(kFile, tbuf, 12) != 12) return -13;
|
2016-08-27 01:40:35 +00:00
|
|
|
if (Bmemcmp(tbuf, "EOF: EDuke32", 12)) { OSD_Printf("EOF ERR\n"); return 2; }
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2016-06-21 00:34:41 +00:00
|
|
|
return 0;
|
2017-10-31 02:09:25 +00:00
|
|
|
|
2006-12-10 06:49:01 +00:00
|
|
|
corrupt:
|
2017-10-31 02:09:25 +00:00
|
|
|
return -7;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
void Gv_WriteSave(buildvfs_FILE fil)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2008-06-09 23:41:54 +00:00
|
|
|
// AddLog("Saving Game Vars to File");
|
2019-03-01 08:51:50 +00:00
|
|
|
buildvfs_fwrite("BEG: EDuke32", 12, 1, fil);
|
2010-01-24 23:33:17 +00:00
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(&g_gameVarCount,sizeof(g_gameVarCount),1,fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
for (bssize_t i = 0; i < g_gameVarCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(&(aGameVars[i]), sizeof(gamevar_t), 1, fil);
|
|
|
|
dfwrite_LZ4(aGameVars[i].szLabel, sizeof(uint8_t) * MAXVARLABEL, 1, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & GAMEVAR_PERPLAYER)
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(aGameVars[i].pValues, sizeof(intptr_t) * MAXPLAYERS, 1, fil);
|
2016-08-27 01:40:35 +00:00
|
|
|
else if (aGameVars[i].flags & GAMEVAR_PERACTOR)
|
2018-10-16 06:09:32 +00:00
|
|
|
dfwrite_LZ4(aGameVars[i].pValues, sizeof(intptr_t) * MAXSPRITES, 1, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
for (bssize_t i = 0; i < g_gameArrayCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2012-12-15 11:28:56 +00:00
|
|
|
// write for .size and .dwFlags (the rest are pointers):
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(&aGameArrays[i], sizeof(gamearray_t), 1, fil);
|
|
|
|
dfwrite_LZ4(aGameArrays[i].szLabel, sizeof(uint8_t) * MAXARRAYLABEL, 1, fil);
|
2017-07-20 08:57:50 +00:00
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
if ((aGameArrays[i].flags & GAMEARRAY_SYSTEM) != GAMEARRAY_SYSTEM)
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(aGameArrays[i].pValues, Gv_GetArrayAllocSize(i), 1, fil);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
uint8_t savedstate[MAXVOLUMES * MAXLEVELS];
|
|
|
|
Bmemset(savedstate, 0, sizeof(savedstate));
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
for (bssize_t i = 0; i < (MAXVOLUMES * MAXLEVELS); i++)
|
2016-08-27 01:42:01 +00:00
|
|
|
if (g_mapInfo[i].savedstate != NULL)
|
2008-07-16 21:21:18 +00:00
|
|
|
savedstate[i] = 1;
|
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(savedstate, sizeof(savedstate), 1, fil);
|
2017-10-31 02:09:25 +00:00
|
|
|
|
|
|
|
for (bssize_t i = 0; i < (MAXVOLUMES * MAXLEVELS); i++)
|
|
|
|
{
|
|
|
|
if (!savedstate[i]) continue;
|
|
|
|
|
|
|
|
mapstate_t &sv = *g_mapInfo[i].savedstate;
|
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(g_mapInfo[i].savedstate, sizeof(mapstate_t), 1, fil);
|
2008-07-16 21:21:18 +00:00
|
|
|
|
2017-10-31 02:09:25 +00:00
|
|
|
for (bssize_t j = 0; j < g_gameVarCount; j++)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2017-10-31 02:09:25 +00:00
|
|
|
if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
|
|
|
|
if (aGameVars[j].flags & GAMEVAR_PERPLAYER)
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(sv.vars[j], sizeof(intptr_t) * MAXPLAYERS, 1, fil);
|
2017-10-31 02:09:25 +00:00
|
|
|
else if (aGameVars[j].flags & GAMEVAR_PERACTOR)
|
2018-10-16 06:09:32 +00:00
|
|
|
dfwrite_LZ4(sv.vars[j], sizeof(intptr_t) * MAXSPRITES, 1, fil);
|
2017-10-31 02:09:25 +00:00
|
|
|
}
|
|
|
|
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(sv.arraysiz, sizeof(sv.arraysiz), 1, fil);
|
2017-10-31 02:09:25 +00:00
|
|
|
|
|
|
|
for (bssize_t j = 0; j < g_gameArrayCount; j++)
|
|
|
|
if (aGameArrays[j].flags & GAMEARRAY_RESTORE)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2018-03-23 21:41:02 +00:00
|
|
|
dfwrite_LZ4(sv.arrays[j], Gv_GetArrayAllocSizeForCount(j, sv.arraysiz[j]), 1, fil);
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2017-10-31 02:09:25 +00:00
|
|
|
}
|
2008-07-16 21:21:18 +00:00
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
buildvfs_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
|
|
|
{
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint("// Current Game Definitions\n\n");
|
2008-12-28 23:27:24 +00:00
|
|
|
|
2016-08-27 01:41:21 +00:00
|
|
|
for (bssize_t i=0; i<g_gameVarCount; i++)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint("gamevar ", aGameVars[i].szLabel, " ");
|
2008-12-28 23:27:24 +00:00
|
|
|
|
Syntax changes for gamevar and gamearray declarations:
Gamevar: default value and flags are now optional. A var declared without a value will default to 0 and a var declared without flags will default to global. Multiple flags can now be stacked one after another in a var declaration, and the most useful ones (GAMEVAR_PERPLAYER, GAMEVAR_PERACTOR, GAMEVAR_NODEFAULT, and GAMEVAR_NORESET) are now pre-defined tokens for easy use.
Gamearray: flags field now allows stacking of multiple flags as described above. Arrays can now be defined with specific data types, including int16_t, uint8_t, and a new bit-packed boolean data type. The tokens GAMEARRAY_RESTORE, GAMEARRAY_INT16, GAMEARRAY_UINT8, and GAMEARRAY_BOOLEAN are pre-defined for use of this feature.
This is all still pretty experimental.
git-svn-id: https://svn.eduke32.com/eduke32@6356 1a8010ca-5511-0410-912e-c29ae57300e0
2017-07-11 04:02:52 +00:00
|
|
|
if (aGameVars[i].flags & (GAMEVAR_INT32PTR))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(*(int32_t *)aGameVars[i].global);
|
Syntax changes for gamevar and gamearray declarations:
Gamevar: default value and flags are now optional. A var declared without a value will default to 0 and a var declared without flags will default to global. Multiple flags can now be stacked one after another in a var declaration, and the most useful ones (GAMEVAR_PERPLAYER, GAMEVAR_PERACTOR, GAMEVAR_NODEFAULT, and GAMEVAR_NORESET) are now pre-defined tokens for easy use.
Gamearray: flags field now allows stacking of multiple flags as described above. Arrays can now be defined with specific data types, including int16_t, uint8_t, and a new bit-packed boolean data type. The tokens GAMEARRAY_RESTORE, GAMEARRAY_INT16, GAMEARRAY_UINT8, and GAMEARRAY_BOOLEAN are pre-defined for use of this feature.
This is all still pretty experimental.
git-svn-id: https://svn.eduke32.com/eduke32@6356 1a8010ca-5511-0410-912e-c29ae57300e0
2017-07-11 04:02:52 +00:00
|
|
|
else if (aGameVars[i].flags & (GAMEVAR_INT16PTR))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(*(int16_t *)aGameVars[i].global);
|
2008-06-09 23:41:54 +00:00
|
|
|
else
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(aGameVars[i].global);
|
2009-02-02 01:49:14 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & (GAMEVAR_PERPLAYER))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" GAMEVAR_PERPLAYER");
|
2016-08-27 01:40:35 +00:00
|
|
|
else if (aGameVars[i].flags & (GAMEVAR_PERACTOR))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" GAMEVAR_PERACTOR");
|
2008-12-28 23:27:24 +00:00
|
|
|
else
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" ", aGameVars[i].flags/* & (GAMEVAR_USER_MASK)*/);
|
2009-02-02 01:49:14 +00:00
|
|
|
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" // ");
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & (GAMEVAR_SYSTEM))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" (system)");
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & (GAMEVAR_PTR_MASK))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" (pointer)");
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & (GAMEVAR_READONLY))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" (read only)");
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[i].flags & (GAMEVAR_SPECIAL))
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint(" (special)");
|
|
|
|
buildprint("\n");
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2017-06-05 10:05:12 +00:00
|
|
|
buildprint("\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
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_Free();
|
2014-07-06 00:12:25 +00:00
|
|
|
|
|
|
|
osd->log.errors = 0;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2018-10-25 23:33:40 +00:00
|
|
|
for (auto &aGameVar : aGameVars)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2018-10-25 23:33:40 +00:00
|
|
|
if (aGameVar.szLabel != NULL)
|
|
|
|
Gv_NewVar(aGameVar.szLabel, (aGameVar.flags & GAMEVAR_NODEFAULT) ? aGameVar.global : aGameVar.defaultValue, aGameVar.flags);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
|
2018-10-25 23:33:40 +00:00
|
|
|
for (auto &aGameArray : aGameArrays)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2018-10-25 23:33:40 +00:00
|
|
|
if (aGameArray.szLabel != NULL && aGameArray.flags & GAMEARRAY_RESET)
|
|
|
|
Gv_NewArray(aGameArray.szLabel, aGameArray.pValues, aGameArray.size, aGameArray.flags);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-04-01 02:50:44 +00:00
|
|
|
}
|
|
|
|
|
2017-07-27 10:08:52 +00:00
|
|
|
unsigned __fastcall Gv_GetArrayElementSize(int const arrayIdx)
|
2017-07-18 20:53:22 +00:00
|
|
|
{
|
|
|
|
int typeSize = 0;
|
|
|
|
|
2017-07-28 08:27:31 +00:00
|
|
|
switch (aGameArrays[arrayIdx].flags & GAMEARRAY_SIZE_MASK)
|
2017-07-18 20:53:22 +00:00
|
|
|
{
|
2017-07-20 08:57:50 +00:00
|
|
|
case 0: typeSize = sizeof(uintptr_t); break;
|
2017-07-28 08:27:31 +00:00
|
|
|
case GAMEARRAY_INT8: typeSize = sizeof(uint8_t); break;
|
|
|
|
case GAMEARRAY_INT16: typeSize = sizeof(uint16_t); break;
|
2017-07-18 20:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return typeSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32_t dwFlags)
|
2008-04-01 02:50:44 +00:00
|
|
|
{
|
2018-05-23 05:58:12 +00:00
|
|
|
Bassert(asize >= 0);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(g_gameArrayCount >= MAXGAMEARRAYS))
|
2008-12-13 07:23:13 +00:00
|
|
|
{
|
2016-08-27 01:42:01 +00:00
|
|
|
g_errorCnt++;
|
2008-12-13 07:23:13 +00:00
|
|
|
C_ReportError(-1);
|
2016-08-27 01:42:01 +00:00
|
|
|
initprintf("%s:%d: error: too many arrays!\n",g_scriptFileName,g_lineNumber);
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
2008-12-13 07:23:13 +00:00
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(Bstrlen(pszLabel) > (MAXARRAYLABEL-1)))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2016-08-27 01:42:01 +00:00
|
|
|
g_errorCnt++;
|
2008-11-20 14:06:36 +00:00
|
|
|
C_ReportError(-1);
|
2016-08-27 01:42:01 +00:00
|
|
|
initprintf("%s:%d: error: array name `%s' exceeds limit of %d characters.\n",g_scriptFileName,g_lineNumber,pszLabel, MAXARRAYLABEL);
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2017-07-08 05:18:43 +00:00
|
|
|
|
|
|
|
int32_t i = hash_find(&h_arrays,pszLabel);
|
2014-10-25 03:36:34 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(i >=0 && !(aGameArrays[i].flags & 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
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
g_warningCnt++;
|
2012-12-13 02:33:53 +00:00
|
|
|
|
2017-07-08 19:41:43 +00:00
|
|
|
if (aGameArrays[i].flags & GAMEARRAY_SYSTEM)
|
2012-12-13 02:33:53 +00:00
|
|
|
{
|
|
|
|
C_ReportError(-1);
|
|
|
|
initprintf("ignored redefining system array `%s'.", pszLabel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
C_ReportError(WARNING_DUPLICATEDEFINITION);
|
|
|
|
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
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)
|
2017-07-08 19:41:43 +00:00
|
|
|
aGameArrays[i].szLabel = (char *)Xcalloc(MAXVARLABEL, sizeof(uint8_t));
|
2014-10-29 17:05:29 +00:00
|
|
|
|
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
|
|
|
|
2017-07-20 08:57:50 +00:00
|
|
|
aGameArrays[i].flags = dwFlags & ~GAMEARRAY_RESET;
|
|
|
|
aGameArrays[i].size = asize;
|
|
|
|
|
2017-07-18 20:53:22 +00:00
|
|
|
if (arrayptr)
|
|
|
|
aGameArrays[i].pValues = (intptr_t *)arrayptr;
|
2017-07-20 08:57:50 +00:00
|
|
|
else if (!(aGameArrays[i].flags & GAMEARRAY_SYSTEM))
|
2014-10-29 17:05:29 +00:00
|
|
|
{
|
2017-07-08 05:18:43 +00:00
|
|
|
if (aGameArrays[i].flags & GAMEARRAY_ALLOCATED)
|
2017-07-20 08:57:50 +00:00
|
|
|
ALIGNED_FREE_AND_NULL(aGameArrays[i].pValues);
|
2017-07-08 05:18:43 +00:00
|
|
|
|
2017-07-20 08:57:50 +00:00
|
|
|
int const allocSize = Gv_GetArrayAllocSize(i);
|
2017-07-08 19:41:43 +00:00
|
|
|
|
2017-07-18 20:53:22 +00:00
|
|
|
aGameArrays[i].flags |= GAMEARRAY_ALLOCATED;
|
2018-05-23 05:58:12 +00:00
|
|
|
if (allocSize > 0)
|
|
|
|
{
|
|
|
|
aGameArrays[i].pValues = (intptr_t *) Xaligned_alloc(ARRAY_ALIGNMENT, allocSize);
|
|
|
|
Bmemset(aGameArrays[i].pValues, 0, allocSize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aGameArrays[i].pValues = nullptr;
|
|
|
|
}
|
2014-10-29 17:05:29 +00:00
|
|
|
}
|
2012-12-13 02:33:53 +00:00
|
|
|
|
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);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2017-07-18 20:53:22 +00:00
|
|
|
void Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(g_gameVarCount >= MAXGAMEVARS))
|
2008-12-13 07:23:13 +00:00
|
|
|
{
|
2016-08-27 01:42:01 +00:00
|
|
|
g_errorCnt++;
|
2008-12-13 07:23:13 +00:00
|
|
|
C_ReportError(-1);
|
2016-08-27 01:42:01 +00:00
|
|
|
initprintf("%s:%d: error: too many gamevars!\n",g_scriptFileName,g_lineNumber);
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
2008-12-13 07:23:13 +00:00
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(Bstrlen(pszLabel) > (MAXVARLABEL-1)))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2016-08-27 01:42:01 +00:00
|
|
|
g_errorCnt++;
|
2008-11-20 14:06:36 +00:00
|
|
|
C_ReportError(-1);
|
2016-08-27 01:42:01 +00:00
|
|
|
initprintf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_scriptFileName,g_lineNumber,pszLabel, MAXVARLABEL);
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
int gV = hash_find(&h_gamevars,pszLabel);
|
2008-08-26 08:39:45 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (gV >= 0 && !(aGameVars[gV].flags & GAMEVAR_RESET))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-08-26 08:39:45 +00:00
|
|
|
// found it...
|
2016-08-27 01:40:35 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(aGameVars[gV].flags & (GAMEVAR_PTR_MASK)))
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
C_ReportError(-1);
|
2016-08-27 01:42:01 +00:00
|
|
|
initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_scriptFileName,g_lineNumber,label+(g_labelCnt<<6));
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
2008-08-26 08:39:45 +00:00
|
|
|
}
|
2016-08-27 01:40:35 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE(!(aGameVars[gV].flags & GAMEVAR_SYSTEM)))
|
2008-08-26 08:39:45 +00:00
|
|
|
{
|
|
|
|
// it's a duplicate in error
|
2016-08-27 01:42:01 +00:00
|
|
|
g_warningCnt++;
|
2008-11-20 14:06:36 +00:00
|
|
|
C_ReportError(WARNING_DUPLICATEDEFINITION);
|
2017-07-18 20:53:22 +00:00
|
|
|
return;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (gV == -1)
|
|
|
|
gV = g_gameVarCount;
|
2008-08-26 08:39:45 +00:00
|
|
|
|
2013-01-20 21:17:10 +00:00
|
|
|
// If it's a user gamevar...
|
2016-08-27 01:40:35 +00:00
|
|
|
if ((aGameVars[gV].flags & GAMEVAR_SYSTEM) == 0)
|
2008-08-26 09:05:32 +00:00
|
|
|
{
|
2013-01-20 21:17:10 +00:00
|
|
|
// Allocate and set its label
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[gV].szLabel == NULL)
|
|
|
|
aGameVars[gV].szLabel = (char *)Xcalloc(MAXVARLABEL,sizeof(uint8_t));
|
2014-10-29 17:05:29 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[gV].szLabel != pszLabel)
|
|
|
|
Bstrcpy(aGameVars[gV].szLabel,pszLabel);
|
2013-01-20 21:17:10 +00:00
|
|
|
|
|
|
|
// and the flags
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[gV].flags=dwFlags;
|
2008-08-26 09:05:32 +00:00
|
|
|
|
2014-10-29 17:05:29 +00:00
|
|
|
// only free if per-{actor,player}
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[gV].flags & GAMEVAR_USER_MASK)
|
|
|
|
ALIGNED_FREE_AND_NULL(aGameVars[gV].pValues);
|
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....
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[gV].defaultValue = lValue;
|
|
|
|
aGameVars[gV].flags &= ~GAMEVAR_RESET;
|
2008-08-26 09:05:32 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
if (gV == g_gameVarCount)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2008-08-26 09:05:32 +00:00
|
|
|
// we're adding a new one.
|
2016-08-27 01:40:35 +00:00
|
|
|
hash_add(&h_gamevars, aGameVars[gV].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.)
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[gV].flags & GAMEVAR_PERPLAYER)
|
2008-08-26 09:05:32 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
if (!aGameVars[gV].pValues)
|
2014-10-29 17:05:29 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[gV].pValues = (intptr_t *) Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t));
|
|
|
|
Bmemset(aGameVars[gV].pValues, 0, MAXPLAYERS * sizeof(intptr_t));
|
2014-10-29 17:05:29 +00:00
|
|
|
}
|
2016-08-27 01:41:21 +00:00
|
|
|
for (bssize_t j=MAXPLAYERS-1; j>=0; --j)
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[gV].pValues[j]=lValue;
|
2008-08-26 09:05:32 +00:00
|
|
|
}
|
2016-08-27 01:40:35 +00:00
|
|
|
else if (aGameVars[gV].flags & GAMEVAR_PERACTOR)
|
2008-08-26 09:05:32 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
if (!aGameVars[gV].pValues)
|
2014-10-29 17:05:29 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[gV].pValues = (intptr_t *) Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t));
|
|
|
|
Bmemset(aGameVars[gV].pValues, 0, MAXSPRITES * sizeof(intptr_t));
|
2014-10-29 17:05:29 +00:00
|
|
|
}
|
2016-08-27 01:41:21 +00:00
|
|
|
for (bssize_t j=MAXSPRITES-1; j>=0; --j)
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[gV].pValues[j]=lValue;
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2016-08-27 01:40:35 +00:00
|
|
|
else aGameVars[gV].global = lValue;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
static int Gv_GetVarIndex(const char *szGameLabel)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2016-10-09 00:15:18 +00:00
|
|
|
int const gameVar = hash_find(&h_gamevars,szGameLabel);
|
2014-10-25 03:36:34 +00:00
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)gameVar >= MAXGAMEVARS))
|
2008-12-15 13:56:30 +00:00
|
|
|
{
|
2019-05-19 03:56:20 +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;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
return gameVar;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2017-07-20 08:57:50 +00:00
|
|
|
static int Gv_GetArrayIndex(const char *szArrayLabel)
|
|
|
|
{
|
|
|
|
int const arrayIdx = hash_find(&h_arrays, szArrayLabel);
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)arrayIdx >= MAXGAMEARRAYS))
|
2017-07-20 08:57:50 +00:00
|
|
|
{
|
|
|
|
OSD_Printf(OSD_ERROR "Gv_GetArrayIndex(): INTERNAL ERROR: couldn't find array %s!\n", szArrayLabel);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return arrayIdx;
|
|
|
|
}
|
|
|
|
|
2017-07-28 08:27:35 +00:00
|
|
|
size_t __fastcall Gv_GetArrayAllocSizeForCount(int const arrayIdx, size_t const count)
|
2017-07-11 04:03:01 +00:00
|
|
|
{
|
|
|
|
if (aGameArrays[arrayIdx].flags & GAMEARRAY_BITMAP)
|
2017-07-28 08:27:35 +00:00
|
|
|
return (count + 7) >> 3;
|
2017-07-11 04:03:01 +00:00
|
|
|
|
2017-07-28 08:27:35 +00:00
|
|
|
return count * Gv_GetArrayElementSize(arrayIdx);
|
|
|
|
}
|
|
|
|
|
2019-05-19 03:54:44 +00:00
|
|
|
size_t __fastcall Gv_GetArrayCountForAllocSize(int const arrayIdx, size_t const filelength)
|
2017-07-28 08:27:35 +00:00
|
|
|
{
|
|
|
|
if (aGameArrays[arrayIdx].flags & GAMEARRAY_BITMAP)
|
|
|
|
return filelength << 3;
|
|
|
|
|
|
|
|
size_t const elementSize = Gv_GetArrayElementSize(arrayIdx);
|
|
|
|
size_t const denominator = min(elementSize, sizeof(uint32_t));
|
2018-11-18 18:06:33 +00:00
|
|
|
|
|
|
|
Bassert(denominator);
|
|
|
|
|
|
|
|
return tabledivide64(filelength + denominator - 1, denominator);
|
2017-07-11 04:03:01 +00:00
|
|
|
}
|
|
|
|
|
2016-10-09 00:15:18 +00:00
|
|
|
int __fastcall Gv_GetArrayValue(int const id, int index)
|
2015-03-25 21:30:25 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameArrays[id].flags & GAMEARRAY_STRIDE2)
|
2015-03-25 21:30:25 +00:00
|
|
|
index <<= 1;
|
|
|
|
|
2018-11-18 18:11:27 +00:00
|
|
|
int returnValue = 0;
|
2016-08-27 01:40:06 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
switch (aGameArrays[id].flags & GAMEARRAY_TYPE_MASK)
|
2015-03-25 21:30:25 +00:00
|
|
|
{
|
2018-11-18 18:10:39 +00:00
|
|
|
case 0: returnValue = (aGameArrays[id].pValues)[index]; break;
|
2017-07-28 08:27:31 +00:00
|
|
|
|
2017-07-08 05:18:43 +00:00
|
|
|
case GAMEARRAY_INT16: returnValue = ((int16_t *)aGameArrays[id].pValues)[index]; break;
|
2018-11-18 18:10:39 +00:00
|
|
|
case GAMEARRAY_INT8: returnValue = ((int8_t *)aGameArrays[id].pValues)[index]; break;
|
2017-07-18 20:53:22 +00:00
|
|
|
|
2018-11-18 18:10:39 +00:00
|
|
|
case GAMEARRAY_UINT16: returnValue = ((uint16_t *)aGameArrays[id].pValues)[index]; break;
|
|
|
|
case GAMEARRAY_UINT8: returnValue = ((uint8_t *)aGameArrays[id].pValues)[index]; break;
|
2017-07-18 20:53:22 +00:00
|
|
|
|
2017-07-08 19:41:36 +00:00
|
|
|
case GAMEARRAY_BITMAP:returnValue = !!(((uint8_t *)aGameArrays[id].pValues)[index >> 3] & pow2char[index & 7]); break;
|
2015-03-25 21:30:25 +00:00
|
|
|
}
|
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
return returnValue;
|
2015-03-25 21:30:25 +00:00
|
|
|
}
|
|
|
|
|
2018-11-18 18:11:27 +00:00
|
|
|
#define CHECK_INDEX(range) \
|
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)arrayIndex >= (unsigned)range)) \
|
|
|
|
{ \
|
2019-05-19 03:56:20 +00:00
|
|
|
returnValue = arrayIndex; \
|
2018-11-18 18:11:27 +00:00
|
|
|
goto badindex; \
|
2017-07-18 20:53:22 +00:00
|
|
|
}
|
2017-06-23 03:59:00 +00:00
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
static int __fastcall Gv_GetArrayOrStruct(int const gameVar, int const spriteNum, int const playerNum)
|
2018-11-18 18:11:21 +00:00
|
|
|
{
|
2019-05-19 03:56:20 +00:00
|
|
|
int const gv = gameVar & (MAXGAMEVARS-1);
|
|
|
|
int returnValue = 0;
|
2018-11-18 18:11:21 +00:00
|
|
|
|
2018-11-18 18:11:32 +00:00
|
|
|
if (gameVar & GV_FLAG_STRUCT) // struct shortcut vars
|
2018-11-18 18:11:21 +00:00
|
|
|
{
|
|
|
|
int arrayIndexVar = *insptr++;
|
|
|
|
int arrayIndex = Gv_GetVar(arrayIndexVar, spriteNum, playerNum);
|
|
|
|
int const labelNum = *insptr++;
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
switch (gv - g_structVarIDs)
|
2018-11-18 18:11:21 +00:00
|
|
|
{
|
|
|
|
case STRUCT_SPRITE_INTERNAL__:
|
|
|
|
CHECK_INDEX(MAXSPRITES);
|
2019-05-19 03:56:20 +00:00
|
|
|
returnValue = VM_GetStruct(ActorLabels[labelNum].flags, (intptr_t *)((intptr_t)&sprite[arrayIndex] + ActorLabels[labelNum].offset));
|
2018-11-18 18:11:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STRUCT_ACTOR_INTERNAL__:
|
|
|
|
CHECK_INDEX(MAXSPRITES);
|
2019-05-19 03:56:20 +00:00
|
|
|
returnValue = VM_GetStruct(ActorLabels[labelNum].flags, (intptr_t *)((intptr_t)&actor[arrayIndex] + ActorLabels[labelNum].offset));
|
2018-11-18 18:11:21 +00:00
|
|
|
break;
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
// no THISACTOR check here because we convert those cases to setvarvar
|
|
|
|
case STRUCT_ACTORVAR: returnValue = Gv_GetVar(labelNum, arrayIndex, vm.playerNum); break;
|
|
|
|
case STRUCT_PLAYERVAR: returnValue = Gv_GetVar(labelNum, vm.spriteNum, arrayIndex); break;
|
2018-11-18 18:11:21 +00:00
|
|
|
|
|
|
|
case STRUCT_SECTOR:
|
|
|
|
if (arrayIndexVar == g_thisActorVarID)
|
|
|
|
arrayIndex = vm.pSprite->sectnum;
|
|
|
|
|
|
|
|
CHECK_INDEX(MAXSECTORS);
|
|
|
|
|
|
|
|
returnValue = (SectorLabels[labelNum].offset != -1 && (SectorLabels[labelNum].flags & LABEL_READFUNC) == 0)
|
2019-05-19 03:56:20 +00:00
|
|
|
? VM_GetStruct(SectorLabels[labelNum].flags, (intptr_t *)((intptr_t)§or[arrayIndex] + SectorLabels[labelNum].offset))
|
2018-11-18 18:11:21 +00:00
|
|
|
: VM_GetSector(arrayIndex, labelNum);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STRUCT_WALL:
|
|
|
|
CHECK_INDEX(MAXWALLS);
|
|
|
|
returnValue = (WallLabels[labelNum].offset != -1 && (WallLabels[labelNum].flags & LABEL_READFUNC) == 0)
|
2019-05-19 03:56:20 +00:00
|
|
|
? VM_GetStruct(WallLabels[labelNum].flags, (intptr_t *)((intptr_t)&wall[arrayIndex] + WallLabels[labelNum].offset))
|
2018-11-18 18:11:21 +00:00
|
|
|
: VM_GetWall(arrayIndex, labelNum);
|
|
|
|
break;
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
case STRUCT_SPRITE:
|
|
|
|
CHECK_INDEX(MAXSPRITES);
|
|
|
|
arrayIndexVar = (ActorLabels[labelNum].flags & LABEL_HASPARM2) ? Gv_GetVar(*insptr++, spriteNum, playerNum) : 0;
|
|
|
|
returnValue = VM_GetSprite(arrayIndex, labelNum, arrayIndexVar);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STRUCT_SPRITEEXT_INTERNAL__:
|
|
|
|
CHECK_INDEX(MAXSPRITES);
|
|
|
|
returnValue = VM_GetStruct(ActorLabels[labelNum].flags, (intptr_t *)((intptr_t)&spriteext[arrayIndex] + ActorLabels[labelNum].offset));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STRUCT_TSPR:
|
|
|
|
CHECK_INDEX(MAXSPRITES);
|
|
|
|
returnValue = VM_GetStruct(TsprLabels[labelNum].flags, (intptr_t *)((intptr_t)(spriteext[arrayIndex].tspr) + TsprLabels[labelNum].offset));
|
|
|
|
break;
|
|
|
|
|
2018-11-18 18:11:32 +00:00
|
|
|
case STRUCT_PLAYER:
|
|
|
|
if (arrayIndexVar == g_thisActorVarID)
|
|
|
|
arrayIndex = vm.playerNum;
|
|
|
|
CHECK_INDEX(MAXPLAYERS);
|
|
|
|
arrayIndexVar = (EDUKE32_PREDICT_FALSE(PlayerLabels[labelNum].flags & LABEL_HASPARM2)) ? Gv_GetVar(*insptr++, spriteNum, playerNum) : 0;
|
|
|
|
returnValue = VM_GetPlayer(arrayIndex, labelNum, arrayIndexVar);
|
2018-11-18 18:11:04 +00:00
|
|
|
break;
|
|
|
|
|
2015-03-25 06:27:57 +00:00
|
|
|
case STRUCT_THISPROJECTILE:
|
2018-11-18 18:11:32 +00:00
|
|
|
CHECK_INDEX(MAXSPRITES);
|
2016-08-27 01:42:01 +00:00
|
|
|
returnValue = VM_GetActiveProjectile(arrayIndex, labelNum);
|
2015-03-25 06:27:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STRUCT_PROJECTILE:
|
2018-11-18 18:11:32 +00:00
|
|
|
CHECK_INDEX(MAXTILES);
|
2016-08-27 01:42:01 +00:00
|
|
|
returnValue = VM_GetProjectile(arrayIndex, labelNum);
|
2015-03-25 06:27:57 +00:00
|
|
|
break;
|
2017-06-23 03:59:06 +00:00
|
|
|
|
2015-03-30 05:56:37 +00:00
|
|
|
case STRUCT_TILEDATA:
|
2017-07-10 13:43:57 +00:00
|
|
|
if (arrayIndexVar == g_thisActorVarID)
|
|
|
|
arrayIndex = vm.pSprite->picnum;
|
2018-11-18 18:11:32 +00:00
|
|
|
CHECK_INDEX(MAXTILES);
|
2016-08-27 01:42:01 +00:00
|
|
|
returnValue = VM_GetTileData(arrayIndex, labelNum);
|
2015-03-30 05:56:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case STRUCT_PALDATA:
|
2017-07-10 13:43:57 +00:00
|
|
|
if (arrayIndexVar == g_thisActorVarID)
|
|
|
|
arrayIndex = vm.pSprite->pal;
|
2018-11-18 18:11:32 +00:00
|
|
|
CHECK_INDEX(MAXPALOOKUPS);
|
2016-08-27 01:42:01 +00:00
|
|
|
returnValue = VM_GetPalData(arrayIndex, labelNum);
|
2015-03-30 05:56:37 +00:00
|
|
|
break;
|
2012-02-24 19:51:54 +00:00
|
|
|
|
2015-03-25 06:27:57 +00:00
|
|
|
case STRUCT_INPUT:
|
2016-08-27 01:42:01 +00:00
|
|
|
if (arrayIndexVar == g_thisActorVarID)
|
|
|
|
arrayIndex = vm.playerNum;
|
2018-11-18 18:11:32 +00:00
|
|
|
CHECK_INDEX(MAXPLAYERS);
|
2016-08-27 01:42:01 +00:00
|
|
|
returnValue = VM_GetPlayerInput(arrayIndex, labelNum);
|
2015-03-25 06:27:57 +00:00
|
|
|
break;
|
2015-03-24 00:40:12 +00:00
|
|
|
|
2015-03-25 06:27:57 +00:00
|
|
|
case STRUCT_USERDEF:
|
2019-05-19 03:54:35 +00:00
|
|
|
arrayIndexVar = (EDUKE32_PREDICT_FALSE(UserdefsLabels[labelNum].flags & LABEL_HASPARM2)) ? Gv_GetVar(*insptr++) : 0;
|
2018-11-18 18:11:32 +00:00
|
|
|
returnValue = VM_GetUserdef(labelNum, arrayIndexVar);
|
2015-03-25 06:27:57 +00:00
|
|
|
break;
|
2014-09-30 04:16:21 +00:00
|
|
|
}
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2019-05-19 03:56:20 +00:00
|
|
|
else // if (gameVar & GV_FLAG_ARRAY)
|
2018-11-18 18:11:32 +00:00
|
|
|
{
|
|
|
|
int const arrayIndex = Gv_GetVar(*insptr++, spriteNum, playerNum);
|
2019-05-19 03:56:20 +00:00
|
|
|
|
|
|
|
CHECK_INDEX(aGameArrays[gv].size);
|
|
|
|
returnValue = Gv_GetArrayValue(gv, arrayIndex);
|
2018-11-18 18:11:32 +00:00
|
|
|
}
|
2014-09-30 04:16:21 +00:00
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
return returnValue;
|
2016-10-09 00:15:18 +00:00
|
|
|
|
|
|
|
badindex:
|
2019-05-19 03:56:20 +00:00
|
|
|
CON_ERRPRINTF("Gv_GetArrayOrStruct(): invalid index %d for \"%s\"\n", returnValue,
|
|
|
|
(gameVar & GV_FLAG_ARRAY) ? aGameArrays[gv].szLabel : aGameVars[gv].szLabel);
|
2016-10-09 00:15:18 +00:00
|
|
|
return -1;
|
2015-03-24 00:40:55 +00:00
|
|
|
}
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
static FORCE_INLINE int __fastcall getvar__(int const gameVar, int const spriteNum, int const playerNum)
|
2015-03-24 00:40:55 +00:00
|
|
|
{
|
2019-05-19 03:56:20 +00:00
|
|
|
if (gameVar & (GV_FLAG_STRUCT|GV_FLAG_ARRAY))
|
|
|
|
return Gv_GetArrayOrStruct(gameVar, spriteNum, playerNum);
|
|
|
|
else if (gameVar == g_thisActorVarID)
|
|
|
|
return spriteNum;
|
2018-11-18 18:11:32 +00:00
|
|
|
else if (gameVar == GV_FLAG_CONSTANT)
|
2019-05-19 03:56:20 +00:00
|
|
|
return *insptr++;
|
2015-03-24 00:40:55 +00:00
|
|
|
else
|
|
|
|
{
|
2019-05-19 03:56:20 +00:00
|
|
|
auto const &var = aGameVars[gameVar & (MAXGAMEVARS-1)];
|
|
|
|
|
|
|
|
int returnValue = 0;
|
|
|
|
int const varFlags = var.flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
|
2018-11-18 18:11:32 +00:00
|
|
|
int const invertResult = !!(gameVar & GV_FLAG_NEGATIVE);
|
2015-03-24 00:40:55 +00:00
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
if (!varFlags) returnValue = var.global;
|
|
|
|
else if (varFlags == GAMEVAR_PERACTOR)
|
|
|
|
returnValue = var.pValues[spriteNum & (MAXSPRITES-1)];
|
2016-08-27 01:42:01 +00:00
|
|
|
else if (varFlags == GAMEVAR_PERPLAYER)
|
2019-05-19 03:56:20 +00:00
|
|
|
returnValue = var.pValues[playerNum & (MAXPLAYERS-1)];
|
2018-11-18 18:14:43 +00:00
|
|
|
else switch (varFlags & GAMEVAR_PTR_MASK)
|
2015-03-24 00:40:55 +00:00
|
|
|
{
|
2019-05-19 03:55:31 +00:00
|
|
|
case GAMEVAR_RAWQ16PTR:
|
2018-11-18 18:11:32 +00:00
|
|
|
case GAMEVAR_INT32PTR: returnValue = *(int32_t *)var.global; break;
|
|
|
|
case GAMEVAR_INT16PTR: returnValue = *(int16_t *)var.global; break;
|
2019-05-19 03:56:20 +00:00
|
|
|
case GAMEVAR_Q16PTR: returnValue = fix16_to_int(*(fix16_t *)var.global); break;
|
2015-03-24 00:40:55 +00:00
|
|
|
}
|
|
|
|
|
2018-11-18 18:11:32 +00:00
|
|
|
return (returnValue ^ -invertResult) + invertResult;
|
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
}
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2018-11-18 18:11:32 +00:00
|
|
|
#undef CHECK_INDEX
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
int __fastcall Gv_GetVar(int const gameVar, int const spriteNum, int const playerNum) { return getvar__(gameVar, spriteNum, playerNum); }
|
|
|
|
int __fastcall Gv_GetVar(int const gameVar) { return getvar__(gameVar, vm.spriteNum, vm.playerNum); }
|
2018-11-18 18:11:32 +00:00
|
|
|
|
2017-06-23 03:59:06 +00:00
|
|
|
void __fastcall Gv_GetManyVars(int const numVars, int32_t * const outBuf)
|
2015-03-24 00:40:55 +00:00
|
|
|
{
|
2018-04-06 01:43:17 +00:00
|
|
|
for (native_t j = 0; j < numVars; ++j)
|
2019-05-19 03:56:20 +00:00
|
|
|
outBuf[j] = getvar__(*insptr++, vm.spriteNum, vm.playerNum);
|
2015-03-24 00:40:55 +00:00
|
|
|
}
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
static FORCE_INLINE void __fastcall setvar__(int const gameVar, int const newValue, int const spriteNum, int const playerNum)
|
2008-12-21 22:46:55 +00:00
|
|
|
{
|
2018-11-18 18:11:21 +00:00
|
|
|
gamevar_t &var = aGameVars[gameVar];
|
2018-04-23 06:36:02 +00:00
|
|
|
int const varFlags = var.flags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK);
|
2015-01-11 04:53:44 +00:00
|
|
|
|
2018-11-18 18:11:32 +00:00
|
|
|
if (!varFlags) var.global=newValue;
|
|
|
|
else if (varFlags == GAMEVAR_PERACTOR)
|
2019-05-19 03:56:20 +00:00
|
|
|
var.pValues[spriteNum & (MAXSPRITES-1)] = newValue;
|
2018-11-18 18:11:32 +00:00
|
|
|
else if (varFlags == GAMEVAR_PERPLAYER)
|
2019-05-19 03:56:20 +00:00
|
|
|
var.pValues[playerNum & (MAXPLAYERS-1)] = newValue;
|
2018-11-18 18:14:43 +00:00
|
|
|
else switch (varFlags & GAMEVAR_PTR_MASK)
|
2015-01-11 04:53:44 +00:00
|
|
|
{
|
2019-05-19 03:55:31 +00:00
|
|
|
case GAMEVAR_RAWQ16PTR:
|
2018-11-18 18:11:32 +00:00
|
|
|
case GAMEVAR_INT32PTR: *((int32_t *)var.global) = (int32_t)newValue; break;
|
|
|
|
case GAMEVAR_INT16PTR: *((int16_t *)var.global) = (int16_t)newValue; break;
|
2019-05-19 03:56:20 +00:00
|
|
|
case GAMEVAR_Q16PTR: *(fix16_t *)var.global = fix16_from_int((int16_t)newValue); break;
|
2015-01-11 04:53:44 +00:00
|
|
|
}
|
|
|
|
return;
|
2018-11-18 18:11:32 +00:00
|
|
|
}
|
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
void __fastcall Gv_SetVar(int const gameVar, int const newValue) { setvar__(gameVar, newValue, vm.spriteNum, vm.playerNum); }
|
2018-11-18 18:11:32 +00:00
|
|
|
void __fastcall Gv_SetVar(int const gameVar, int const newValue, int const spriteNum, int const playerNum)
|
|
|
|
{
|
2019-05-19 03:56:20 +00:00
|
|
|
setvar__(gameVar, newValue, spriteNum, playerNum);
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
int Gv_GetVarByLabel(const char *szGameLabel, int const defaultValue, int const spriteNum, int const playerNum)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
int const gameVar = hash_find(&h_gamevars, szGameLabel);
|
2019-05-19 03:56:20 +00:00
|
|
|
return EDUKE32_PREDICT_TRUE(gameVar >= 0) ? Gv_GetVar(gameVar, spriteNum, playerNum) : defaultValue;
|
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
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
int const gameVar = hash_find(&h_gamevars, szGameLabel);
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)gameVar >= MAXGAMEVARS))
|
2008-12-13 07:23:13 +00:00
|
|
|
return NULL;
|
2008-08-25 00:49:12 +00:00
|
|
|
|
2018-11-18 18:11:21 +00:00
|
|
|
gamevar_t &var = aGameVars[gameVar];
|
2018-04-23 06:36:02 +00:00
|
|
|
|
2019-05-19 03:56:20 +00:00
|
|
|
if (var.flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK))
|
2018-04-23 06:36:02 +00:00
|
|
|
return var.pValues;
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2018-04-23 06:36:02 +00:00
|
|
|
return &(var.global);
|
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
|
|
|
|
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
|
2008-06-09 23:41:54 +00:00
|
|
|
char aszBuf[64];
|
|
|
|
|
|
|
|
//AddLog("ResetWeaponDefaults");
|
|
|
|
|
2016-08-29 19:11:47 +00:00
|
|
|
for (int weaponNum = 0; weaponNum < MAX_WEAPONS; ++weaponNum)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2018-11-18 18:11:27 +00:00
|
|
|
for (int playerNum = 0; playerNum < MAXPLAYERS; ++playerNum)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_CLIP", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponClip[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_RELOAD", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponReload[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FIREDELAY", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponFireDelay[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_TOTALTIME", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponTotalTime[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_HOLDDELAY", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponHoldDelay[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FLAGS", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponFlags[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SHOOTS", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponShoots[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
|
|
|
if ((unsigned)aplWeaponShoots[weaponNum][playerNum] >= MAXTILES)
|
|
|
|
aplWeaponShoots[weaponNum][playerNum] = 0;
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SPAWNTIME", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponSpawnTime[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SPAWN", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponSpawn[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SHOTSPERBURST", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponShotsPerBurst[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_WORKSLIKE", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponWorksLike[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_INITIALSOUND", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponInitialSound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FIRESOUND", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponFireSound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SOUND2TIME", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponSound2Time[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SOUND2SOUND", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponSound2Sound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_RELOADSOUND1", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponReloadSound1[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_RELOADSOUND2", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponReloadSound2[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SELECTSOUND", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponSelectSound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FLASHCOLOR", weaponNum);
|
2016-08-27 01:40:35 +00:00
|
|
|
aplWeaponFlashColor[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
|
|
|
}
|
2013-01-20 21:17:06 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
g_aimAngleVarID = Gv_GetVarIndex("AUTOAIMANGLE");
|
2018-11-18 18:11:27 +00:00
|
|
|
g_angRangeVarID = Gv_GetVarIndex("ANGRANGE");
|
2016-10-09 00:15:18 +00:00
|
|
|
g_hitagVarID = Gv_GetVarIndex("HITAG");
|
2018-11-18 18:11:27 +00:00
|
|
|
g_lotagVarID = Gv_GetVarIndex("LOTAG");
|
|
|
|
g_returnVarID = Gv_GetVarIndex("RETURN");
|
|
|
|
g_structVarIDs = Gv_GetVarIndex("sprite");
|
2016-10-09 00:15:18 +00:00
|
|
|
g_textureVarID = Gv_GetVarIndex("TEXTURE");
|
|
|
|
g_thisActorVarID = Gv_GetVarIndex("THISACTOR");
|
2018-11-18 18:11:27 +00:00
|
|
|
g_weaponVarID = Gv_GetVarIndex("WEAPON");
|
|
|
|
g_worksLikeVarID = Gv_GetVarIndex("WORKSLIKE");
|
|
|
|
g_zRangeVarID = Gv_GetVarIndex("ZRANGE");
|
2012-12-29 15:21:24 +00:00
|
|
|
#endif
|
2015-01-11 04:53:44 +00:00
|
|
|
|
2018-10-25 23:33:40 +00:00
|
|
|
for (auto & tile : g_tile)
|
|
|
|
if (tile.defproj)
|
|
|
|
*tile.proj = *tile.defproj;
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2019-09-17 03:20:16 +00:00
|
|
|
static int constexpr statnumList[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_MISC, STAT_ZOMBIEACTOR, STAT_FALLER, STAT_PLAYER };
|
|
|
|
|
|
|
|
Bmemset(g_radiusDmgStatnums, 0, sizeof(g_radiusDmgStatnums));
|
|
|
|
|
|
|
|
for (int i = 0; i < ARRAY_SSIZE(statnumList); ++i)
|
|
|
|
bitmap_set(g_radiusDmgStatnums, statnumList[i]);
|
|
|
|
|
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
|
|
|
|
*/
|
2019-05-19 03:55:36 +00:00
|
|
|
#ifndef EDUKE32_STANDALONE
|
2012-12-28 17:18:12 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2016-08-27 01:41:21 +00:00
|
|
|
PISTOL_WEAPON, 12, 27, 2, 5, 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
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2016-08-27 01:41:21 +00:00
|
|
|
SHRINKER_WEAPON, 0, 0, 10, 12, 0,
|
2012-12-28 17:18:12 +00:00
|
|
|
WEAPON_GLOWS,
|
2013-06-01 06:55:30 +00:00
|
|
|
SHRINKER__STATIC, 0, 0, 0, SHRINKER_FIRE__STATIC, 0, 0, 0,
|
2015-12-23 04:05:31 +00:00
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 176+(252<<8)+(120<<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,
|
2015-12-23 04:05:31 +00:00
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 72+(88<<8)+(140<<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
|
|
|
},
|
|
|
|
|
|
|
|
{
|
2016-08-27 01:41:21 +00:00
|
|
|
GROW_WEAPON, 0, 0, 3, 5, 0,
|
2012-12-28 17:18:12 +00:00
|
|
|
WEAPON_GLOWS,
|
2016-08-27 01:41:21 +00:00
|
|
|
GROWSPARK__STATIC, 0, 0, 0, 0, EXPANDERSHOOT__STATIC, 0, 0,
|
2015-12-23 04:05:31 +00:00
|
|
|
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 216+(52<<8)+(20<<16)
|
2012-12-28 17:18:12 +00:00
|
|
|
},
|
2019-05-19 03:55:36 +00:00
|
|
|
#endif
|
2012-12-28 17:18:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// KEEPINSYNC with what is contained above
|
|
|
|
// XXX: ugly
|
2015-03-24 00:40:12 +00:00
|
|
|
static int32_t G_StaticToDynamicTile(int32_t const tile)
|
2012-12-28 17:18:12 +00:00
|
|
|
{
|
|
|
|
switch (tile)
|
|
|
|
{
|
2019-05-19 03:55:36 +00:00
|
|
|
#ifndef EDUKE32_STANDALONE
|
2012-12-28 17:18:12 +00:00
|
|
|
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;
|
2019-05-19 03:55:36 +00:00
|
|
|
#endif
|
2012-12-28 17:18:12 +00:00
|
|
|
default: return tile;
|
|
|
|
}
|
|
|
|
}
|
2015-01-11 04:53:44 +00:00
|
|
|
|
2015-03-24 00:40:12 +00:00
|
|
|
static int32_t G_StaticToDynamicSound(int32_t const sound)
|
2013-06-01 06:55:30 +00:00
|
|
|
{
|
|
|
|
switch (sound)
|
|
|
|
{
|
2019-05-19 03:55:36 +00:00
|
|
|
#ifndef EDUKE32_STANDALONE
|
2013-06-01 06:55:30 +00:00
|
|
|
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;
|
2019-05-19 03:55:36 +00:00
|
|
|
#endif
|
2013-06-01 06:55:30 +00:00
|
|
|
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 { \
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_" #Membname, Weapidx); \
|
2012-12-28 17:18:12 +00:00
|
|
|
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)
|
|
|
|
{
|
2018-11-18 18:11:21 +00:00
|
|
|
for (int i=0; i<MAX_WEAPONS; i++)
|
2013-06-02 14:07:56 +00:00
|
|
|
{
|
|
|
|
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
|
2018-11-18 18:11:14 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
#if !defined LUNATIC
|
2018-11-18 18:11:14 +00:00
|
|
|
// special vars for struct access
|
|
|
|
// KEEPINSYNC gamedef.h: enum QuickStructureAccess_t (including order)
|
2018-11-18 18:11:27 +00:00
|
|
|
Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("__sprite__", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("__actor__", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("__spriteext__", -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);
|
|
|
|
Gv_NewVar("playervar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("tspr", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("projectile", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
2018-11-18 18:11:14 +00:00
|
|
|
Gv_NewVar("thisprojectile", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
2018-11-18 18:11:27 +00:00
|
|
|
Gv_NewVar("userdef", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("input", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("tiledata", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
|
|
|
Gv_NewVar("paldata", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
2012-12-28 17:18:16 +00:00
|
|
|
#endif
|
2012-12-28 17:18:12 +00:00
|
|
|
|
2019-05-19 03:55:36 +00:00
|
|
|
#ifndef EDUKE32_STANDALONE
|
2015-11-25 12:08:24 +00:00
|
|
|
if (NAM_WW2GI)
|
2012-12-28 17:18:12 +00:00
|
|
|
{
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[PISTOL_WEAPON].Clip = 20;
|
2012-12-28 17:18:12 +00:00
|
|
|
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;
|
2018-05-02 07:12:52 +00:00
|
|
|
|
|
|
|
if (NAM)
|
|
|
|
{
|
|
|
|
weapondefaults[GROW_WEAPON].SpawnTime = 2;
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[GROW_WEAPON].Spawn = SHELL;
|
2018-05-02 07:12:52 +00:00
|
|
|
weapondefaults[GROW_WEAPON].FireSound = 0;
|
|
|
|
}
|
|
|
|
else if (WW2GI)
|
|
|
|
{
|
|
|
|
weapondefaults[KNEE_WEAPON].HoldDelay = 14;
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[KNEE_WEAPON].Reload = 30;
|
2018-05-02 07:12:52 +00:00
|
|
|
|
|
|
|
weapondefaults[PISTOL_WEAPON].Flags |= WEAPON_AUTOMATIC;
|
|
|
|
|
|
|
|
weapondefaults[SHOTGUN_WEAPON].TotalTime = 31;
|
|
|
|
|
|
|
|
weapondefaults[CHAINGUN_WEAPON].FireDelay = 1;
|
|
|
|
weapondefaults[CHAINGUN_WEAPON].HoldDelay = 10;
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[CHAINGUN_WEAPON].Reload = 30;
|
2018-05-02 07:12:52 +00:00
|
|
|
weapondefaults[CHAINGUN_WEAPON].SpawnTime = 0;
|
|
|
|
|
|
|
|
weapondefaults[RPG_WEAPON].Reload = 30;
|
|
|
|
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[DEVISTATOR_WEAPON].FireDelay = 2;
|
|
|
|
weapondefaults[DEVISTATOR_WEAPON].Flags = WEAPON_FIREEVERYOTHER;
|
|
|
|
weapondefaults[DEVISTATOR_WEAPON].Reload = 30;
|
2018-05-02 07:12:52 +00:00
|
|
|
weapondefaults[DEVISTATOR_WEAPON].ShotsPerBurst = 0;
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[DEVISTATOR_WEAPON].TotalTime = 5;
|
2018-05-02 07:12:52 +00:00
|
|
|
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[TRIPBOMB_WEAPON].Flags = WEAPON_STANDSTILL;
|
2018-05-02 07:12:52 +00:00
|
|
|
weapondefaults[TRIPBOMB_WEAPON].HoldDelay = 0;
|
2018-11-18 18:11:14 +00:00
|
|
|
weapondefaults[TRIPBOMB_WEAPON].Reload = 30;
|
2018-05-02 07:12:52 +00:00
|
|
|
|
|
|
|
weapondefaults[FREEZE_WEAPON].Flags = WEAPON_FIREEVERYOTHER;
|
|
|
|
|
|
|
|
weapondefaults[HANDREMOTE_WEAPON].Reload = 30;
|
|
|
|
|
|
|
|
weapondefaults[GROW_WEAPON].InitialSound = EXPANDERSHOOT;
|
|
|
|
}
|
2012-12-28 17:18:12 +00:00
|
|
|
}
|
2019-05-19 03:55:36 +00:00
|
|
|
#endif
|
2008-06-09 23:41:54 +00:00
|
|
|
|
2018-11-18 18:11:14 +00:00
|
|
|
char aszBuf[64];
|
|
|
|
|
2016-08-29 19:11:47 +00:00
|
|
|
for (int i=0; i<MAX_WEAPONS; i++)
|
2012-12-28 17:18:12 +00:00
|
|
|
{
|
|
|
|
ADDWEAPONVAR(i, Clip);
|
|
|
|
ADDWEAPONVAR(i, FireDelay);
|
2018-11-18 18:11:27 +00:00
|
|
|
ADDWEAPONVAR(i, FireSound);
|
2012-12-28 17:18:12 +00:00
|
|
|
ADDWEAPONVAR(i, Flags);
|
2018-11-18 18:11:27 +00:00
|
|
|
ADDWEAPONVAR(i, FlashColor);
|
|
|
|
ADDWEAPONVAR(i, HoldDelay);
|
2012-12-28 17:18:12 +00:00
|
|
|
ADDWEAPONVAR(i, InitialSound);
|
2018-11-18 18:11:27 +00:00
|
|
|
ADDWEAPONVAR(i, Reload);
|
2012-12-28 17:18:12 +00:00
|
|
|
ADDWEAPONVAR(i, ReloadSound1);
|
|
|
|
ADDWEAPONVAR(i, ReloadSound2);
|
|
|
|
ADDWEAPONVAR(i, SelectSound);
|
2018-11-18 18:11:27 +00:00
|
|
|
ADDWEAPONVAR(i, Shoots);
|
|
|
|
ADDWEAPONVAR(i, ShotsPerBurst);
|
|
|
|
ADDWEAPONVAR(i, Sound2Sound);
|
|
|
|
ADDWEAPONVAR(i, Sound2Time);
|
|
|
|
ADDWEAPONVAR(i, Spawn);
|
|
|
|
ADDWEAPONVAR(i, SpawnTime);
|
|
|
|
ADDWEAPONVAR(i, TotalTime);
|
|
|
|
ADDWEAPONVAR(i, WorksLike);
|
2012-12-28 17:18:12 +00:00
|
|
|
}
|
2018-11-18 18:11:14 +00:00
|
|
|
|
2013-01-19 18:28:55 +00:00
|
|
|
#ifdef LUNATIC
|
2016-08-29 19:11:47 +00:00
|
|
|
for (int i=0; i<MAXPLAYERS; i++)
|
2013-01-19 18:28:55 +00:00
|
|
|
{
|
2019-07-08 00:41:25 +00:00
|
|
|
auto ps = g_player[i].ps;
|
2013-01-19 18:28:55 +00:00
|
|
|
|
2015-11-25 12:08:24 +00:00
|
|
|
ps->pipebombControl = NAM_WW2GI ? PIPEBOMB_TIMER : PIPEBOMB_REMOTE;
|
2013-01-19 18:28:55 +00:00
|
|
|
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
|
2019-05-19 03:55:36 +00:00
|
|
|
|
|
|
|
#ifndef EDUKE32_STANDALONE
|
|
|
|
Gv_NewVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("PIPEBOMB_CONTROL", NAM_WW2GI ? PIPEBOMB_TIMER : PIPEBOMB_REMOTE, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
#endif
|
|
|
|
|
2018-11-18 18:11:14 +00:00
|
|
|
Gv_NewVar("ANGRANGE", 18, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("AUTOAIMANGLE", 0, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
Gv_NewVar("COOP", (intptr_t)&ud.coop, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("FFIRE", (intptr_t)&ud.ffire, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("HITAG", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("LEVEL", (intptr_t)&ud.level_number, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("LOTAG", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("MARKER", (intptr_t)&ud.marker, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("MONSTERS_OFF", (intptr_t)&ud.monsters_off, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("MULTIMODE", (intptr_t)&ud.multimode, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("NUMSECTORS", (intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("NUMWALLS", (intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("Numsprites", (intptr_t)&Numsprites, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("RESPAWN_INVENTORY", (intptr_t)&ud.respawn_inventory, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("RESPAWN_ITEMS", (intptr_t)&ud.respawn_items, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("RESPAWN_MONSTERS", (intptr_t)&ud.respawn_monsters, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("RETURN", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("TEXTURE", 0, GAMEVAR_SYSTEM);
|
|
|
|
Gv_NewVar("THISACTOR", 0, GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("VOLUME", (intptr_t)&ud.volume_number, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("WEAPON", 0, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("WORKSLIKE", 0, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("ZRANGE", 4, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER);
|
|
|
|
|
2019-08-01 06:50:56 +00:00
|
|
|
Gv_NewVar("automapping", (intptr_t)&automapping, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
2018-11-18 18:11:14 +00:00
|
|
|
Gv_NewVar("cameraang", (intptr_t)&ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR);
|
|
|
|
Gv_NewVar("cameraclock", (intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("cameradist", (intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("camerahoriz", (intptr_t)&ud.cameraq16horiz, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR);
|
2019-05-19 03:55:31 +00:00
|
|
|
Gv_NewVar("cameraq16ang", (intptr_t)&ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_RAWQ16PTR);
|
|
|
|
Gv_NewVar("cameraq16horiz", (intptr_t)&ud.cameraq16horiz, GAMEVAR_SYSTEM | GAMEVAR_RAWQ16PTR);
|
2018-11-18 18:11:14 +00:00
|
|
|
Gv_NewVar("camerasect", (intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
|
|
|
|
Gv_NewVar("camerax", (intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("cameray", (intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("cameraz", (intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("current_menu", (intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("currentweapon", (intptr_t)&hudweap.cur, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
2019-05-19 03:55:19 +00:00
|
|
|
Gv_NewVar("display_mirror", (intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
2018-11-18 18:11:14 +00:00
|
|
|
Gv_NewVar("framerate", (intptr_t)&g_frameRate, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("gametype_flags", (intptr_t)&g_gametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("gravitationalconstant", (intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("gs", (intptr_t)&hudweap.shade, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("gun_pos", (intptr_t)&hudweap.gunposy, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("lastsavepos", (intptr_t)&g_lastAutoSaveArbitraryID, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("lastvisinc", (intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("looking_angSR1", (intptr_t)&hudweap.lookhalfang, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("looking_arc", (intptr_t)&hudweap.lookhoriz, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("numplayers", (intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("numsectors", (intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("randomseed", (intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("totalclock", (intptr_t)&totalclock, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("viewingrange", (intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("weapon_xoffset", (intptr_t)&hudweap.gunposx, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("weaponcount", (intptr_t)&hudweap.count, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
|
|
|
Gv_NewVar("windowx1", (intptr_t)&windowxy1.x, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowx2", (intptr_t)&windowxy2.x, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowy1", (intptr_t)&windowxy1.y, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("windowy2", (intptr_t)&windowxy2.y, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("xdim", (intptr_t)&xdim, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("ydim", (intptr_t)&ydim, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
|
|
|
Gv_NewVar("yxaspect", (intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
2017-07-08 19:42:11 +00:00
|
|
|
|
2012-12-29 15:21:24 +00:00
|
|
|
# ifdef USE_OPENGL
|
2018-11-18 18:11:14 +00:00
|
|
|
Gv_NewVar("rendmode", (intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
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
|
2019-09-17 03:20:16 +00:00
|
|
|
Gv_NewArray("gotpic", (void *)&gotpic[0], MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP);
|
|
|
|
Gv_NewArray("radiusdmgstatnums", (void *)&g_radiusDmgStatnums[0], MAXSTATUS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP);
|
|
|
|
Gv_NewArray("show2dsector", (void *)&show2dsector[0], MAXSECTORS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP);
|
|
|
|
Gv_NewArray("tilesizx", (void *)&tilesiz[0].x, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_STRIDE2 | GAMEARRAY_READONLY | GAMEARRAY_INT16);
|
|
|
|
Gv_NewArray("tilesizy", (void *)&tilesiz[0].y, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_STRIDE2 | GAMEARRAY_READONLY | GAMEARRAY_INT16);
|
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
|
|
|
{
|
2015-01-19 00:11:25 +00:00
|
|
|
#if !defined LUNATIC
|
2015-01-11 04:53:44 +00:00
|
|
|
// already initialized
|
2016-08-27 01:40:35 +00:00
|
|
|
if (aGameVars[0].flags)
|
2011-07-22 22:00:53 +00:00
|
|
|
return;
|
2015-01-19 00:11:25 +00:00
|
|
|
#else
|
|
|
|
static int32_t inited=0;
|
|
|
|
if (inited)
|
|
|
|
return;
|
|
|
|
inited = 1;
|
2013-06-01 20:09:46 +00:00
|
|
|
#endif
|
2015-01-19 00:11:25 +00:00
|
|
|
|
2013-06-01 20:09:46 +00:00
|
|
|
// 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
|
|
|
{
|
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
|
|
|
|
2016-08-29 19:11:47 +00:00
|
|
|
for (int i=(MAX_WEAPONS-1); i>=0; i--)
|
2008-06-09 23:41:54 +00:00
|
|
|
{
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_CLIP", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponClip[i] = Gv_GetVarDataPtr(aszBuf);
|
|
|
|
|
2008-06-09 23:41:54 +00:00
|
|
|
if (!aplWeaponClip[i])
|
|
|
|
{
|
2016-08-27 01:41:33 +00:00
|
|
|
initprintf("ERROR: NULL weapon! WTF?! %s\n", aszBuf);
|
2014-06-13 09:02:37 +00:00
|
|
|
// Bexit(0);
|
2008-11-20 14:06:36 +00:00
|
|
|
G_Shutdown();
|
2008-06-09 23:41:54 +00:00
|
|
|
}
|
2016-08-27 01:41:33 +00:00
|
|
|
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_RELOAD", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponReload[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FIREDELAY", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponFireDelay[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_TOTALTIME", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponTotalTime[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_HOLDDELAY", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponHoldDelay[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FLAGS", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponFlags[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SHOOTS", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponShoots[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SPAWNTIME", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponSpawnTime[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SPAWN", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponSpawn[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SHOTSPERBURST", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponShotsPerBurst[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_WORKSLIKE", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponWorksLike[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_INITIALSOUND", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponInitialSound[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FIRESOUND", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponFireSound[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SOUND2TIME", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponSound2Time[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SOUND2SOUND", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponSound2Sound[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_RELOADSOUND1", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponReloadSound1[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_RELOADSOUND2", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponReloadSound2[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_SELECTSOUND", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
aplWeaponSelectSound[i] = Gv_GetVarDataPtr(aszBuf);
|
2016-08-29 19:11:47 +00:00
|
|
|
Bsprintf(aszBuf, "WEAPON%d_FLASHCOLOR", i);
|
2016-08-27 01:41:33 +00:00
|
|
|
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
|
|
|
{
|
2018-11-18 18:11:14 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("COOP")].global = (intptr_t)&ud.coop;
|
2016-08-27 01:41:33 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("FFIRE")].global = (intptr_t)&ud.ffire;
|
|
|
|
aGameVars[Gv_GetVarIndex("LEVEL")].global = (intptr_t)&ud.level_number;
|
2018-11-18 18:11:14 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("MARKER")].global = (intptr_t)&ud.marker;
|
|
|
|
aGameVars[Gv_GetVarIndex("MONSTERS_OFF")].global = (intptr_t)&ud.monsters_off;
|
|
|
|
aGameVars[Gv_GetVarIndex("MULTIMODE")].global = (intptr_t)&ud.multimode;
|
|
|
|
aGameVars[Gv_GetVarIndex("NUMSECTORS")].global = (intptr_t)&numsectors;
|
|
|
|
aGameVars[Gv_GetVarIndex("NUMWALLS")].global = (intptr_t)&numwalls;
|
|
|
|
aGameVars[Gv_GetVarIndex("Numsprites")].global = (intptr_t)&Numsprites;
|
|
|
|
aGameVars[Gv_GetVarIndex("RESPAWN_INVENTORY")].global = (intptr_t)&ud.respawn_inventory;
|
|
|
|
aGameVars[Gv_GetVarIndex("RESPAWN_ITEMS")].global = (intptr_t)&ud.respawn_items;
|
|
|
|
aGameVars[Gv_GetVarIndex("RESPAWN_MONSTERS")].global = (intptr_t)&ud.respawn_monsters;
|
2016-08-27 01:41:33 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("VOLUME")].global = (intptr_t)&ud.volume_number;
|
2016-08-27 01:40:35 +00:00
|
|
|
|
2019-08-12 03:15:25 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("automapping")].global = (intptr_t)&automapping;
|
2018-11-18 18:11:14 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("cameraang")].global = (intptr_t)&ud.cameraq16ang; // XXX FIXME
|
|
|
|
aGameVars[Gv_GetVarIndex("cameraclock")].global = (intptr_t)&g_cameraClock;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameradist")].global = (intptr_t)&g_cameraDistance;
|
|
|
|
aGameVars[Gv_GetVarIndex("camerahoriz")].global = (intptr_t)&ud.cameraq16horiz; // XXX FIXME
|
|
|
|
aGameVars[Gv_GetVarIndex("cameraq16ang")].global = (intptr_t)&ud.cameraq16ang; // XXX FIXME
|
|
|
|
aGameVars[Gv_GetVarIndex("cameraq16horiz")].global = (intptr_t)&ud.cameraq16horiz; // XXX FIXME
|
|
|
|
aGameVars[Gv_GetVarIndex("camerasect")].global = (intptr_t)&ud.camerasect;
|
|
|
|
aGameVars[Gv_GetVarIndex("camerax")].global = (intptr_t)&ud.camerapos.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameray")].global = (intptr_t)&ud.camerapos.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("cameraz")].global = (intptr_t)&ud.camerapos.z;
|
|
|
|
aGameVars[Gv_GetVarIndex("current_menu")].global = (intptr_t)&g_currentMenu;
|
|
|
|
aGameVars[Gv_GetVarIndex("currentweapon")].global = (intptr_t)&hudweap.cur;
|
|
|
|
aGameVars[Gv_GetVarIndex("display_mirror")].global = (intptr_t)&display_mirror;
|
|
|
|
aGameVars[Gv_GetVarIndex("framerate")].global = (intptr_t)&g_frameRate;
|
|
|
|
aGameVars[Gv_GetVarIndex("gametype_flags")].global = (intptr_t)&g_gametypeFlags[ud.coop];
|
|
|
|
aGameVars[Gv_GetVarIndex("gravitationalconstant")].global =
|
|
|
|
(intptr_t)&g_spriteGravity;
|
|
|
|
aGameVars[Gv_GetVarIndex("gs")].global = (intptr_t)&hudweap.shade;
|
|
|
|
aGameVars[Gv_GetVarIndex("gun_pos")].global = (intptr_t)&hudweap.gunposy;
|
|
|
|
aGameVars[Gv_GetVarIndex("lastsavepos")].global = (intptr_t)&g_lastAutoSaveArbitraryID;
|
|
|
|
aGameVars[Gv_GetVarIndex("lastvisinc")].global = (intptr_t)&lastvisinc;
|
|
|
|
aGameVars[Gv_GetVarIndex("looking_angSR1")].global = (intptr_t)&hudweap.lookhalfang;
|
|
|
|
aGameVars[Gv_GetVarIndex("looking_arc")].global = (intptr_t)&hudweap.lookhoriz;
|
|
|
|
aGameVars[Gv_GetVarIndex("myconnectindex")].global = (intptr_t)&myconnectindex;
|
|
|
|
aGameVars[Gv_GetVarIndex("numplayers")].global = (intptr_t)&numplayers;
|
|
|
|
aGameVars[Gv_GetVarIndex("numsectors")].global = (intptr_t)&numsectors;
|
|
|
|
aGameVars[Gv_GetVarIndex("randomseed")].global = (intptr_t)&randomseed;
|
|
|
|
aGameVars[Gv_GetVarIndex("screenpeek")].global = (intptr_t)&screenpeek;
|
|
|
|
aGameVars[Gv_GetVarIndex("totalclock")].global = (intptr_t)&totalclock;
|
|
|
|
aGameVars[Gv_GetVarIndex("viewingrange")].global = (intptr_t)&viewingrange;
|
|
|
|
aGameVars[Gv_GetVarIndex("weapon_xoffset")].global = (intptr_t)&hudweap.gunposx;
|
|
|
|
aGameVars[Gv_GetVarIndex("weaponcount")].global = (intptr_t)&hudweap.count;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowx1")].global = (intptr_t)&windowxy1.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowx2")].global = (intptr_t)&windowxy2.x;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowy1")].global = (intptr_t)&windowxy1.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("windowy2")].global = (intptr_t)&windowxy2.y;
|
|
|
|
aGameVars[Gv_GetVarIndex("xdim")].global = (intptr_t)&xdim;
|
|
|
|
aGameVars[Gv_GetVarIndex("ydim")].global = (intptr_t)&ydim;
|
|
|
|
aGameVars[Gv_GetVarIndex("yxaspect")].global = (intptr_t)&yxaspect;
|
|
|
|
|
2012-12-29 15:21:24 +00:00
|
|
|
# ifdef USE_OPENGL
|
2016-08-27 01:40:35 +00:00
|
|
|
aGameVars[Gv_GetVarIndex("rendmode")].global = (intptr_t)&rendmode;
|
2012-12-29 15:21:24 +00:00
|
|
|
# endif
|
2017-07-20 08:57:50 +00:00
|
|
|
|
|
|
|
aGameArrays[Gv_GetArrayIndex("gotpic")].pValues = (intptr_t *)&gotpic[0];
|
|
|
|
aGameArrays[Gv_GetArrayIndex("tilesizx")].pValues = (intptr_t *)&tilesiz[0].x;
|
|
|
|
aGameArrays[Gv_GetArrayIndex("tilesizy")].pValues = (intptr_t *)&tilesiz[0].y;
|
2007-04-17 05:54:12 +00:00
|
|
|
}
|
2013-01-01 15:24:18 +00:00
|
|
|
#endif
|