1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00
oot/include/ichain.h
fig02 a3b4dcf388
File Select (z_file_choose) OK (#1012)
* matching split

* migrate progress

* split done and rodata migrated

* all data migrated to c

* start init

* progress

* progress

* progress

* progress

* progress

* progress

* copy done

* progress

* erase and settings done

* progress

* progress

* progress

* start keyboard

* progress

* progress

* progress

* progress

* Minor progress

* fix z_magic_dark issue

* func_80806F34 decomp'd

* verified equivalence

* one fix

* format

* merge petries work

* reorganizing

* lots of reorganizing and wraning fixing

* rename file

* remove language enum

* unwanted changes

* some symbol replacement, organization, and some names

* all symbols replaced, some organization

* some more cleanup

* continue docs

* Match the remaining functions in file_choose

* merge master

* select mode documented, all functions in file_choose.c named

* nameset functions named, some other cleaning

* some more general cleanup

* stub comments for cm, name a few things

* fix data and sizeof

* copy/erase functions and modes named

* rename assets, format

* change some struct members

* fixes

* review1

* fix maching error

* extract VTX data

* re add werror to ZAPD

* review 2

* fix

* remove file boundary padding

* remove zeroes

* review3

* change skybox stuff

* changes to  vs  etc

Co-authored-by: KrimtonZ <krimtonz@gmail.com>
Co-authored-by: Thar0 <17233964+Thar0@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
Co-authored-by: Louis <louist103@gmail.com>
2021-11-15 22:33:44 +01:00

56 lines
2.4 KiB
C

#ifndef ICHAIN_H
#define ICHAIN_H
typedef struct {
u32 cont: 1;
u32 type: 4;
u32 offset: 11;
s32 value: 16;
} InitChainEntry;
typedef enum {
/* 0x0 */ ICHAINTYPE_U8, // sets byte
/* 0x1 */ ICHAINTYPE_S8,
/* 0x2 */ ICHAINTYPE_U16, // sets short
/* 0x3 */ ICHAINTYPE_S16,
/* 0x4 */ ICHAINTYPE_U32, // sets word
/* 0x5 */ ICHAINTYPE_S32,
/* 0x6 */ ICHAINTYPE_F32, // sets float
/* 0x7 */ ICHAINTYPE_F32_DIV1000, // sets float divided by 1000
/* 0x8 */ ICHAINTYPE_VEC3F, // sets Vec3f members
/* 0x9 */ ICHAINTYPE_VEC3F_DIV1000, // sets Vec3f members divided by 1000
/* 0xA */ ICHAINTYPE_VEC3S // sets Vec3s members
} InitChainType;
/**
* ICHAIN macros generate an init chain entry of the following form:
* * (e >> 31) & 0x0001 == Continue Parsing after this entry
* * (e >> 27) & 0x000F == Type
* * (e >> 16) & 0x07FF == Offset from start of instance to write initial value
* * e & 0xFFFF == Initial Value
*
* Arguments:
* * type ----- value from enum `InitChainType`
* * member --- name of member inside `Actor` structure to use as the offset
* * value ---- s16 value to use
* * cont ----- ICHAIN_CONTINUE (or ICHAIN_STOP) to continue (or stop) parsing
*/
#define ICHAIN(type, member, value, cont) \
{ cont, type, OFFSETOF(Actor, member), value }
#define ICHAIN_U8(member, val, cont) ICHAIN(ICHAINTYPE_U8, member, val, cont)
#define ICHAIN_S8(member, val, cont) ICHAIN(ICHAINTYPE_S8, member, val, cont)
#define ICHAIN_U16(member, val, cont) ICHAIN(ICHAINTYPE_U16, member, val, cont)
#define ICHAIN_S16(member, val, cont) ICHAIN(ICHAINTYPE_S16, member, val, cont)
#define ICHAIN_U32(member, val, cont) ICHAIN(ICHAINTYPE_U32, member, val, cont)
#define ICHAIN_S32(member, val, cont) ICHAIN(ICHAINTYPE_S32, member, val, cont)
#define ICHAIN_F32(member, val, cont) ICHAIN(ICHAINTYPE_F32, member, val, cont)
#define ICHAIN_F32_DIV1000(member, val, cont) ICHAIN(ICHAINTYPE_F32_DIV1000, member, val, cont)
#define ICHAIN_VEC3F(member, val, cont) ICHAIN(ICHAINTYPE_VEC3F, member, val, cont)
#define ICHAIN_VEC3F_DIV1000(member, val, cont) ICHAIN(ICHAINTYPE_VEC3F_DIV1000, member, val, cont)
#define ICHAIN_VEC3S(member, val, cont) ICHAIN(ICHAINTYPE_VEC3S, member, val, cont)
#define ICHAIN_CONTINUE 1
#define ICHAIN_STOP 0
#endif