Rename STRUCT_519DA8 -> PartyMemberListItem

This commit is contained in:
Vasilii Rogin 2023-04-15 22:09:37 +03:00
parent 7e3d188aac
commit a8058acfd0
2 changed files with 32 additions and 32 deletions

View File

@ -65,13 +65,13 @@ typedef struct STRU_519DBC {
static int partyMemberGetDescription(Object* object, PartyMemberDescription** partyMemberDescriptionPtr);
static void partyMemberDescriptionInit(PartyMemberDescription* partyMemberDescription);
static int _partyMemberPrepLoadInstance(STRUCT_519DA8* a1);
static int _partyMemberRecoverLoadInstance(STRUCT_519DA8* a1);
static int _partyMemberPrepLoadInstance(PartyMemberListItem* a1);
static int _partyMemberRecoverLoadInstance(PartyMemberListItem* a1);
static int _partyMemberNewObjID();
static int _partyMemberNewObjIDRecurseFind(Object* object, int objectId);
static int _partyMemberPrepItemSave(Object* object);
static int _partyMemberItemSave(Object* object);
static int _partyMemberItemRecover(STRUCT_519DA8* a1);
static int _partyMemberItemRecover(PartyMemberListItem* a1);
static int _partyMemberClearItemList();
static int _partyFixMultipleMembers();
static int _partyMemberCopyLevelInfo(Object* object, int a2);
@ -83,12 +83,12 @@ int gPartyMemberDescriptionsLength = 0;
int* gPartyMemberPids = NULL;
//
static STRUCT_519DA8* _itemSaveListHead = NULL;
static PartyMemberListItem* _itemSaveListHead = NULL;
// List of party members, it's length is [gPartyMemberDescriptionsLength] + 20.
//
// 0x519DA8
STRUCT_519DA8* gPartyMembers = NULL;
PartyMemberListItem* gPartyMembers = NULL;
// Number of critters added to party.
//
@ -142,7 +142,7 @@ int partyMembersInit()
memset(gPartyMemberPids, 0, sizeof(*gPartyMemberPids) * gPartyMemberDescriptionsLength);
gPartyMembers = (STRUCT_519DA8*)internal_malloc(sizeof(*gPartyMembers) * (gPartyMemberDescriptionsLength + 20));
gPartyMembers = (PartyMemberListItem*)internal_malloc(sizeof(*gPartyMembers) * (gPartyMemberDescriptionsLength + 20));
if (gPartyMembers == NULL) {
goto err;
}
@ -371,7 +371,7 @@ int partyMemberAdd(Object* object)
}
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
if (partyMember->object == object || partyMember->object->pid == object->pid) {
return 0;
}
@ -382,7 +382,7 @@ int partyMemberAdd(Object* object)
return -1;
}
STRUCT_519DA8* partyMember = &(gPartyMembers[gPartyMembersLength]);
PartyMemberListItem* partyMember = &(gPartyMembers[gPartyMembersLength]);
partyMember->object = object;
partyMember->script = NULL;
partyMember->vars = NULL;
@ -427,7 +427,7 @@ int partyMemberRemove(Object* object)
int index;
for (index = 1; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
if (partyMember->object == object) {
break;
}
@ -472,7 +472,7 @@ int _partyMemberPrepSave()
_partyStatePrepped = 1;
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* ptr = &(gPartyMembers[index]);
PartyMemberListItem* ptr = &(gPartyMembers[index]);
if (index > 0) {
ptr->object->flags &= ~(OBJECT_NO_REMOVE | OBJECT_NO_SAVE);
@ -491,7 +491,7 @@ int _partyMemberPrepSave()
int _partyMemberUnPrepSave()
{
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* ptr = &(gPartyMembers[index]);
PartyMemberListItem* ptr = &(gPartyMembers[index]);
if (index > 0) {
ptr->object->flags |= (OBJECT_NO_REMOVE | OBJECT_NO_SAVE);
@ -515,7 +515,7 @@ int partyMembersSave(File* stream)
if (fileWriteInt32(stream, _partyMemberItemCount) == -1) return -1;
for (int index = 1; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
if (fileWriteInt32(stream, partyMember->object->id) == -1) return -1;
}
@ -539,7 +539,7 @@ int _partyMemberPrepLoad()
_partyStatePrepped = 1;
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* ptr_519DA8 = &(gPartyMembers[index]);
PartyMemberListItem* ptr_519DA8 = &(gPartyMembers[index]);
if (_partyMemberPrepLoadInstance(ptr_519DA8) != 0) {
return -1;
}
@ -550,7 +550,7 @@ int _partyMemberPrepLoad()
// partyMemberPrepLoadInstance
// 0x49480C
static int _partyMemberPrepLoadInstance(STRUCT_519DA8* a1)
static int _partyMemberPrepLoadInstance(PartyMemberListItem* a1)
{
Object* obj = a1->object;
@ -635,7 +635,7 @@ int _partyMemberRecoverLoad()
debugPrint("[Party Member %d]: %s\n", index, critterGetName(gPartyMembers[index].object));
}
STRUCT_519DA8* v6 = _itemSaveListHead;
PartyMemberListItem* v6 = _itemSaveListHead;
while (v6 != NULL) {
_itemSaveListHead = v6->next;
@ -656,7 +656,7 @@ int _partyMemberRecoverLoad()
// partyMemberRecoverLoadInstance
// 0x494A88
static int _partyMemberRecoverLoadInstance(STRUCT_519DA8* a1)
static int _partyMemberRecoverLoadInstance(PartyMemberListItem* a1)
{
if (a1->script == NULL) {
showMesageBox("\n Error!: partyMemberRecoverLoadInstance: No script!");
@ -793,7 +793,7 @@ int _partyMemberSyncPosition()
int n = 0;
int distance = 2;
for (int index = 1; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
Object* partyMemberObj = partyMember->object;
if ((partyMemberObj->flags & OBJECT_HIDDEN) == 0 && PID_TYPE(partyMemberObj->pid) == OBJ_TYPE_CRITTER) {
int rotation;
@ -825,7 +825,7 @@ int _partyMemberRestingHeal(int a1)
}
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
if (PID_TYPE(partyMember->object->pid) == OBJ_TYPE_CRITTER) {
int healingRate = critterGetStat(partyMember->object, STAT_HEALING_RATE);
critterAdjustHitPoints(partyMember->object, v1 * healingRate);
@ -852,7 +852,7 @@ Object* partyMemberFindByPid(int pid)
bool _isPotentialPartyMember(Object* object)
{
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
if (partyMember->object->pid == gPartyMemberPids[index]) {
return true;
}
@ -968,7 +968,7 @@ static int _partyMemberNewObjIDRecurseFind(Object* obj, int objectId)
int _partyMemberPrepItemSaveAll()
{
for (int partyMemberIndex = 0; partyMemberIndex < gPartyMembersLength; partyMemberIndex++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[partyMemberIndex]);
PartyMemberListItem* partyMember = &(gPartyMembers[partyMemberIndex]);
Inventory* inventory = &(partyMember->object->data.inventory);
for (int inventoryItemIndex = 0; inventoryItemIndex < inventory->length; inventoryItemIndex++) {
@ -1017,7 +1017,7 @@ static int _partyMemberItemSave(Object* object)
object->id = script->field_1C;
}
STRUCT_519DA8* node = (STRUCT_519DA8*)internal_malloc(sizeof(*node));
PartyMemberListItem* node = (PartyMemberListItem*)internal_malloc(sizeof(*node));
if (node == NULL) {
showMesageBox("\n Error!: partyMemberItemSave: Out of memory!");
exit(1);
@ -1045,7 +1045,7 @@ static int _partyMemberItemSave(Object* object)
node->vars = NULL;
}
STRUCT_519DA8* temp = _itemSaveListHead;
PartyMemberListItem* temp = _itemSaveListHead;
_itemSaveListHead = node;
node->next = temp;
}
@ -1061,7 +1061,7 @@ static int _partyMemberItemSave(Object* object)
// partyMemberItemRecover
// 0x495388
static int _partyMemberItemRecover(STRUCT_519DA8* a1)
static int _partyMemberItemRecover(PartyMemberListItem* a1)
{
int sid = -1;
if (scriptAdd(&sid, SCRIPT_TYPE_ITEM) == -1) {
@ -1100,7 +1100,7 @@ static int _partyMemberItemRecover(STRUCT_519DA8* a1)
static int _partyMemberClearItemList()
{
while (_itemSaveListHead != NULL) {
STRUCT_519DA8* node = _itemSaveListHead;
PartyMemberListItem* node = _itemSaveListHead;
_itemSaveListHead = _itemSaveListHead->next;
if (node->script != NULL) {
@ -1265,7 +1265,7 @@ static int _partyFixMultipleMembers()
}
for (int index = 0; index < gPartyMembersLength; index++) {
STRUCT_519DA8* partyMember = &(gPartyMembers[index]);
PartyMemberListItem* partyMember = &(gPartyMembers[index]);
Script* script;
if (scriptGetScript(partyMember->object->sid, &script) != -1) {
@ -1457,7 +1457,7 @@ bool partyMemberSupportsChemUse(Object* object, int chemUse)
int _partyMemberIncLevels()
{
int i;
STRUCT_519DA8* ptr;
PartyMemberListItem* ptr;
Object* obj;
PartyMemberDescription* party_member;
const char* name;
@ -1625,7 +1625,7 @@ static int _partyMemberCopyLevelInfo(Object* critter, int a2)
bool partyIsAnyoneCanBeHealedByRest()
{
for (int index = 1; index < gPartyMembersLength; index++) {
STRUCT_519DA8* ptr = &(gPartyMembers[index]);
PartyMemberListItem* ptr = &(gPartyMembers[index]);
Object* object = ptr->object;
if (PID_TYPE(object->pid) != OBJ_TYPE_CRITTER) continue;
@ -1652,7 +1652,7 @@ int partyGetMaxWoundToHealByRest()
int maxWound = 0;
for (int index = 1; index < gPartyMembersLength; index++) {
STRUCT_519DA8* ptr = &(gPartyMembers[index]);
PartyMemberListItem* ptr = &(gPartyMembers[index]);
Object* object = ptr->object;
if (PID_TYPE(object->pid) != OBJ_TYPE_CRITTER) continue;

View File

@ -10,15 +10,15 @@ namespace fallout {
extern int gPartyMemberDescriptionsLength;
extern int* gPartyMemberPids;
typedef struct STRUCT_519DA8 {
typedef struct PartyMemberListItem {
Object* object;
Script* script;
int* vars;
struct STRUCT_519DA8* next;
} STRUCT_519DA8;
struct PartyMemberListItem* next;
} PartyMemberListItem;
extern int gPartyMembersLength;
extern STRUCT_519DA8* gPartyMembers;
extern PartyMemberListItem* gPartyMembers;
int partyMembersInit();
void partyMembersReset();