2ship2harkinian/include/ichain.h
Anghelo Carvajal b08880f7a7
z_sram_NES with 2 NON_MATCHINGs and 1 NON_EQUIVALENTs (#531)
* Rename Sram_InitDebugSave

* Sram_InitDebugSave

* err

* Sram_IncrementDay

* non_matchings

* func_80146F5C and protos

* func_80146EE8

* func_80145698

* func_80143A54

* Split SaveContext

* problems with bss

* Fix bss

* more

* a small bunch

* Fix warnings

* almost everything

* two attempts

* at least compiles

* import data

* bss

* format

* stuff?

* Progress?

* More progress

* clean up data a little

* More progress

* disaster

* re split data

* A bit less of a disaster

* Fix renamed stuff

* data stuff

* fix conflicts

* format

* CycleSceneFlags

* some enums

* cleanup

* Fix merge issues

* format

* some changes

* format

* Lots of progress on z_sram_NES, but no matches yet

* SaveContent Documentation

* Oops

* Oops2

* Document more SaveContext

* Oops, don't need that anymore

* add small comment

* Another comment

* dekuPlaygroundPlayerName

* Fix merge issues

* format

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* remove magic number

* format

* fix merge issues

* bss

* format

* macro cleanup

* review

* merge issues

* review

* cleanup

* UNK_TYPE1

* Fix

* Remove comment

* small change

* conflicts

* review

* fix

* fixes

* format

* Update actorCtx renames part

* Match func_80143B0C thanks to Petrie and Anon

* minor cleaning pass

* format

* cleanup

* more minor cleanups

* Macros for accessing gSaveContext.save.stolenItems

* Introduce STOLEN_ITEM_NONE and remove CLEAR_STOLEN_ITEM_

* format

* Update include/macros.h

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Update src/code/z_sram_NES.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* @hensldm review

* Update include/functions.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update include/functions.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Rename QUEST_SONG_NEW_WAVE

* Add scene name comments to D_801C5FC0

* rename horseData.yaw

* Update include/functions.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sram_NES.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* // = CUR_UPG_VALUE(UPG_WALLET);

* run actorfixer and format

* fix bss

* Fix merge problems and run format

* Some improvements to func_801457CC by anon

* bss

* format

* run actorfixer

* actorfixer, bss and format

* Use original names for the RESPAWN_MODE enum because the current ones are bad

* QUEST_SONG_BOSSA_NOVA

* some minor fixes on the SaveContext struct according to the debug rom

* Merge Inventory.items and Inventory.masks

* a

* simplify saveBuf accesses

* A few func renames

* actorfixer

* bss

* fixes

* bss

* actorfixer

* actorfixer and format

* actorfixer

* whoops

* whops

* bss

Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
2022-03-27 12:37:02 -03:00

59 lines
2.4 KiB
C

#ifndef ICHAIN_H
#define ICHAIN_H
#include "libc/stddef.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