Skip to content

Commit f048cfe

Browse files
committed
Fix defaults so game doesn't immediately crash when json is corrupted
1 parent 0f5c0d4 commit f048cfe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

TheForceEngine/TFE_ExternalData/weaponExternal.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <TFE_System/cJSON.h>
44
#include <TFE_System/system.h>
55
#include <TFE_FileSystem/filestream.h>
6-
#include <TFE_DarkForces/player.h>
76
#include <TFE_DarkForces/projectile.h>
87
#include <TFE_DarkForces/weapon.h>
98
#include "weaponExternal.h"

TheForceEngine/TFE_ExternalData/weaponExternal.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include <TFE_System/types.h>
3+
#include <TFE_DarkForces/player.h>
34

45
///////////////////////////////////////////
56
// TFE Externalised Weapon data
@@ -72,21 +73,21 @@ namespace TFE_ExternalData
7273
struct ExternalWeapon
7374
{
7475
const char* name = nullptr;
75-
s32 frameCount = 0;
76-
const char* textures[WEAPON_NUM_TEXTURES] = {};
76+
s32 frameCount = 1;
77+
const char* textures[WEAPON_NUM_TEXTURES] = { "default.bm" };
7778
s32 xPos[WEAPON_NUM_TEXTURES] = { 0 };
7879
s32 yPos[WEAPON_NUM_TEXTURES] = { 0 };
79-
s32* ammo = nullptr;
80+
s32* ammo = &TFE_DarkForces::s_playerInfo.ammoEnergy;
8081
s32* secondaryAmmo = nullptr;
8182
s32 wakeupRange = 0;
8283
s32 variation = 0;
8384

8485
s32 primaryFireConsumption = 1;
8586
s32 secondaryFireConsumption = 1;
8687

87-
s32 numAnimFrames = 0;
88+
s32 numAnimFrames = 1;
8889
WeaponAnimFrame animFrames[WEAPON_NUM_ANIMFRAMES];
89-
s32 numSecondaryAnimFrames = 0;
90+
s32 numSecondaryAnimFrames = 1;
9091
WeaponAnimFrame animFramesSecondary[WEAPON_NUM_ANIMFRAMES];
9192
};
9293

0 commit comments

Comments
 (0)