Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Last active Apr 30, 2019
Embed
What would you like to do?
BotW nxargs param data 010 template
typedef uchar u8;
typedef ushort u16;
typedef uint u32;
typedef ulong u64;
struct Vec3 {
float x, y, z;
};
enum<u8> BotwType { // non standard syntax, ugh
// Do nothing.
BotwType_None = 0,
// Spawn all actors whose spawn conditions are satisfied.
BotwType_CreateActors = 1,
// Any other type is ignored.
};
struct BotwHeader {
char magic[4]; // must be "BotW"
u16 x4; // unused
u8 x6; // unused
BotwType type;
u32 padding;
u8 num_actor_entries; // only used for type-1 data
u8 padding2[3];
};
enum<u8> BotwActorEntryFlag {
// Add the "DropActor" actor parameter to the spawned actor.
// The value is determined using ActorInfoData and drop_actor_name_hash.
// This is used to set treasure chest drops.
BotwActorEntryFlag_HasDropActor = 1,
// Treat the velocity Vec3 as a relative velocity.
BotwActorEntryFlag_RelativeVelocity = 2,
};
enum<u8> BotwFlagDataType {
BotwFlagDataType_Bool = 1,
BotwFlagDataType_S32 = 2,
BotwFlagDataType_F32 = 3,
};
enum<u8> BotwActorEntryConditionOp {
BotwActorEntryConditionOp_None = 0,
BotwActorEntryConditionOp_Eq = 1,
BotwActorEntryConditionOp_NotEq = 2,
BotwActorEntryConditionOp_Gt = 3,
BotwActorEntryConditionOp_Gte = 4,
BotwActorEntryConditionOp_Lt = 5,
BotwActorEntryConditionOp_Lte = 6,
};
struct BotwActorEntryCondition {
u32 flag_name_hash;
u32 rhs_value;
BotwFlagDataType flag_data_type;
BotwActorEntryConditionOp op;
u8 padding[2];
};
struct BotwActorEntry {
u32 actor_name_hash;
u32 drop_actor_name_hash; // only used if flag & 1
Vec3 position_offset;
Vec3 rotate;
Vec3 velocity;
BotwActorEntryFlag flag;
u8 num_conditions;
u8 padding[2];
// Each condition must be satisfied for the actor to be spawned.
// satisfied means: (GetFlagValue(flag_name_hash) <op> rhs_value) is true)
BotwActorEntryCondition conditions[num_conditions];
};
BotwHeader header;
if (header.type == BotwType_CreateActors)
BotwActorEntry actor_entries[header.num_actor_entries] <optimize=false>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment