Add stub for array funcs

This commit is contained in:
Vasilii Rogin 2023-04-15 22:07:32 +03:00
parent c6612d2170
commit 7e3d188aac
3 changed files with 36 additions and 9 deletions

View File

@ -63,13 +63,6 @@ typedef struct STRU_519DBC {
int field_8; // early what?
} STRU_519DBC;
typedef struct STRUCT_519DA8 {
Object* object;
Script* script;
int* vars;
struct STRUCT_519DA8* next;
} STRUCT_519DA8;
static int partyMemberGetDescription(Object* object, PartyMemberDescription** partyMemberDescriptionPtr);
static void partyMemberDescriptionInit(PartyMemberDescription* partyMemberDescription);
static int _partyMemberPrepLoadInstance(STRUCT_519DA8* a1);
@ -95,12 +88,12 @@ static STRUCT_519DA8* _itemSaveListHead = NULL;
// List of party members, it's length is [gPartyMemberDescriptionsLength] + 20.
//
// 0x519DA8
static STRUCT_519DA8* gPartyMembers = NULL;
STRUCT_519DA8* gPartyMembers = NULL;
// Number of critters added to party.
//
// 0x519DAC
static int gPartyMembersLength = 0;
int gPartyMembersLength = 0;
// 0x519DB0
static int _partyMemberItemCount = 20000;

View File

@ -3,12 +3,23 @@
#include "db.h"
#include "obj_types.h"
#include "scripts.h"
namespace fallout {
extern int gPartyMemberDescriptionsLength;
extern int* gPartyMemberPids;
typedef struct STRUCT_519DA8 {
Object* object;
Script* script;
int* vars;
struct STRUCT_519DA8* next;
} STRUCT_519DA8;
extern int gPartyMembersLength;
extern STRUCT_519DA8* gPartyMembers;
int partyMembersInit();
void partyMembersReset();
void partyMembersExit();

View File

@ -10,6 +10,7 @@
#include "message.h"
#include "mouse.h"
#include "object.h"
#include "party_member.h"
#include "sfall_global_vars.h"
#include "sfall_lists.h"
#include "stat.h"
@ -286,6 +287,26 @@ static void opGetMessage(Program* program)
programStackPushString(program, text);
}
// get_array_key
static void opGetArrayKey(Program* program)
{
auto index = programStackPopInteger(program);
auto arrayId = programStackPopInteger(program);
programStackPushInteger(program, 33);
}
// get_array
static void opGetArray(Program* program)
{
auto key = programStackPopInteger(program);
auto arrayId = programStackPopInteger(program);
printf("opGetArray %i %i\n", key, arrayId);
programStackPushPointer(program, (void*)44);
}
// len_array
static void opLenArray(Program* program)
{
@ -344,9 +365,11 @@ void sfallOpcodesInit()
interpreterRegisterOpcode(0x821D, opGetMouseY);
interpreterRegisterOpcode(0x8220, opGetScreenWidth);
interpreterRegisterOpcode(0x8221, opGetScreenHeight);
interpreterRegisterOpcode(0x822F, opGetArray);
interpreterRegisterOpcode(0x8231, opLenArray);
interpreterRegisterOpcode(0x8237, opParseInt);
interpreterRegisterOpcode(0x824F, opGetStringLength);
interpreterRegisterOpcode(0x8256, opGetArrayKey);
interpreterRegisterOpcode(0x826B, opGetMessage);
interpreterRegisterOpcode(0x8267, opRound);
interpreterRegisterOpcode(0x8271, opPartyMemberList);