exported gGameOptions.

This commit is contained in:
Christoph Oelckers 2023-10-04 19:30:21 +02:00
parent 8e5f2cceda
commit 79ae66d5ec
3 changed files with 47 additions and 13 deletions

View file

@ -24,6 +24,26 @@ See the GNU General Public License for more details.
#include "blood.h"
BEGIN_BLD_NS
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nGameType)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nDifficulty)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nMonsterSettings)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, uGameFlags)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, uNetGameFlags)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nWeaponSettings)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nItemSettings)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nRespawnSettings)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nTeamSettings)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nMonsterRespawnTime)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nWeaponRespawnTime)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nItemRespawnTime)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, nSpecialRespawnTime)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, weaponsV10x)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, bFriendlyFire)
DEFINE_FIELD_X(GAMEOPTIONS, GAMEOPTIONS, bKeepKeysOnRespawn)
DEFINE_GLOBAL_UNSIZED(gGameOptions)
DEFINE_ACTION_FUNCTION(_Blood, OriginalLoadScreen)
{
static int bLoadScreenCrcMatch = -1;
@ -87,16 +107,6 @@ DEFINE_ACTION_FUNCTION(_Blood, GetViewPlayer)
ACTION_RETURN_POINTER(getPlayer(gViewIndex));
}
static int blood_gameMode()
{
return gGameOptions.nGameType;
}
DEFINE_ACTION_FUNCTION_NATIVE(_Blood, gameType, blood_gameMode)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(gGameOptions.nGameType);
}
DEFINE_ACTION_FUNCTION(_BloodPlayer, GetHealth)
{
PARAM_SELF_STRUCT_PROLOGUE(DBloodPlayer);

View file

@ -225,11 +225,11 @@ class BloodActor : CoreActor native
spawned.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
spawned.shade = spawned.defshade;
if (itemtype is 'BloodKeyBase' && Blood.GameType() == kSingleplayer)
if (itemtype is 'BloodKeyBase' && gGameOptions.nGameType == kSingleplayer)
{
spawned.xspr.respawn = 3;
}
if (itemtype is 'BloodFlagBase' && Blood.GameType() == kTeamplay)
if (itemtype is 'BloodFlagBase' && gGameOptions.nGameType == kTeamplay)
{
spawned.evPostActorCallback(1800, kCallbackReturnFlag);
}

View file

@ -49,7 +49,6 @@ struct Blood native
native static void sndStartSampleNamed(String sname, int volume, int channel);
native static TextureID PowerupIcon(int pwup);
native static BloodPlayer GetViewPlayer();
native static int gameType();
// These are just dummies to make the MP statusbar code compile.
@ -64,6 +63,31 @@ struct Blood native
}
}
struct GAMEOPTIONS native
{
native readonly uint8 nGameType;
native readonly uint8 nDifficulty;
native readonly uint8 nMonsterSettings;
native readonly int uGameFlags;
native readonly int uNetGameFlags;
native readonly uint8 nWeaponSettings;
native readonly uint8 nItemSettings;
native readonly uint8 nRespawnSettings;
native readonly uint8 nTeamSettings;
native readonly int nMonsterRespawnTime;
native readonly int nWeaponRespawnTime;
native readonly int nItemRespawnTime;
native readonly int nSpecialRespawnTime;
native readonly int weaponsV10x;
native readonly bool bFriendlyFire;
native readonly bool bKeepKeysOnRespawn;
}
extend struct _
{
native readonly @GAMEOPTIONS gGameOptions;
}
struct PACKINFO // not native!
{
bool isActive;