Format extracted params: ObjSwitch (#2722)

* ObjSwitch params macros

* format extracted ObjSwitch params
This commit is contained in:
Dragorn421
2026-04-24 22:31:44 +02:00
committed by GitHub
parent 189baf8e79
commit 55cdfccdd9
3 changed files with 57 additions and 9 deletions
@@ -26,13 +26,6 @@
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
#define OBJSWITCH_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 3)
#define OBJSWITCH_SUBTYPE(thisx) PARAMS_GET_U((thisx)->params, 4, 3)
#define OBJSWITCH_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 8, 6)
#define OBJSWITCH_FROZEN(thisx) PARAMS_GET_U((thisx)->params, 7, 1)
#define OBJSWITCH_FROZEN_FLAG (1 << 7)
void ObjSwitch_Init(Actor* thisx, PlayState* play);
void ObjSwitch_Destroy(Actor* thisx, PlayState* play);
void ObjSwitch_Update(Actor* thisx, PlayState* play);
@@ -4,6 +4,18 @@
#include "ultra64.h"
#include "actor.h"
#define OBJSWITCH_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 3)
#define OBJSWITCH_SUBTYPE(thisx) PARAMS_GET_U((thisx)->params, 4, 3)
#define OBJSWITCH_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 8, 6)
#define OBJSWITCH_FROZEN(thisx) PARAMS_GET_U((thisx)->params, 7, 1)
#define OBJSWITCH_FROZEN_FLAG (1 << 7)
#define OBJSWITCH_PARAMS(type, subType, switchFlag) ((type) | ((subType) << 4) | ((switchFlag) << 8))
// Same as OBJSWITCH_PARAMS but also sets two unused bits
#define OBJSWITCH_PARAMS_ALT(type, subType, switchFlag) (OBJSWITCH_PARAMS(type, subType, switchFlag) | (0xC000))
#define OBJSWITCH_PARAMS_EYE(subType, switchFlag, isFrozen) (OBJSWITCH_PARAMS(OBJSWITCH_TYPE_EYE, subType, switchFlag) | ((isFrozen) ? OBJSWITCH_FROZEN_FLAG : 0))
struct ObjSwitch;
typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, struct PlayState*);