Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Last active April 30, 2019 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoetlino/da5eeea19ad628642240bf8d2701dc51 to your computer and use it in GitHub Desktop.
Save leoetlino/da5eeea19ad628642240bf8d2701dc51 to your computer and use it in GitHub Desktop.
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