Add function to get all party members for sFall

This commit is contained in:
Vasilii Rogin 2023-04-20 01:49:39 +03:00
parent 3e1f04ca74
commit a764634457
2 changed files with 24 additions and 11 deletions

View File

@ -63,6 +63,13 @@ typedef struct STRU_519DBC {
int field_8; // early what?
} STRU_519DBC;
typedef struct PartyMemberListItem {
Object* object;
Script* script;
int* vars;
struct PartyMemberListItem* next;
} PartyMemberListItem;
static int partyMemberGetDescription(Object* object, PartyMemberDescription** partyMemberDescriptionPtr);
static void partyMemberDescriptionInit(PartyMemberDescription* partyMemberDescription);
static int _partyMemberPrepLoadInstance(PartyMemberListItem* a1);
@ -93,7 +100,7 @@ PartyMemberListItem* gPartyMembers = NULL;
// Number of critters added to party.
//
// 0x519DAC
int gPartyMembersLength = 0;
static int gPartyMembersLength = 0;
// 0x519DB0
static int _partyMemberItemCount = 20000;
@ -904,6 +911,20 @@ int _getPartyMemberCount()
return count;
}
std::vector<Object*> get_all_party_members_objects(bool include_hidden)
{
std::vector<Object*> value;
for (int index = 0; index < gPartyMembersLength; index++) {
auto p_object = gPartyMembers[index].object;
if (include_hidden) {
value.push_back(p_object);
} else if (PID_TYPE(p_object->pid) == OBJ_TYPE_CRITTER && !critterIsDead(p_object) && !((p_object->flags & OBJECT_HIDDEN) != 0)) {
value.push_back(p_object);
}
}
return value;
}
// 0x495070
static int _partyMemberNewObjID()
{

View File

@ -4,22 +4,13 @@
#include "db.h"
#include "obj_types.h"
#include "scripts.h"
#include <vector>
namespace fallout {
extern int gPartyMemberDescriptionsLength;
extern int* gPartyMemberPids;
typedef struct PartyMemberListItem {
Object* object;
Script* script;
int* vars;
struct PartyMemberListItem* next;
} PartyMemberListItem;
extern int gPartyMembersLength;
extern PartyMemberListItem* gPartyMembers;
int partyMembersInit();
void partyMembersReset();
void partyMembersExit();
@ -53,6 +44,7 @@ bool partyMemberSupportsChemUse(Object* object, int chemUse);
int _partyMemberIncLevels();
bool partyIsAnyoneCanBeHealedByRest();
int partyGetMaxWoundToHealByRest();
std::vector<Object*> get_all_party_members_objects(bool include_hidden);
} // namespace fallout